Question

How do I orthographically project a 3D set of points (x1,y1,z1...) to two dimensional space (x1,y1...) using a non-cardinal vector to represent the axis to be collapsed? I looked around and could find no satisfactory answer, and my linear mathematics handbook has only a projection to plane section, and not a projection to 2D space, and many answers that deal with projection are either perspective, or cardinal axis, the reason I need this is to calculate air-drag upon a falling body, with my vector being the body's velocity.

Was it helpful?

Solution

The trick is to use a cardinal vector, because it makes this trivial to do. The idea behind most 3d packages is that the camera is always oriented one way in a cardinal orientation (usually -z). And the world is transformed to match the camera.

How do you handle non cardinal directions then? You handle them the same way, except that you transform the world into your cameras cardinal space. So what you do is you form a matrix for the plane with normal in negative z. Y and x axis being arbitrary orthogonal unit vectors of each other and z. The body is then transformed by the inverse matrix to the cardinal space of of your camera space. End result is a 3d space that is aligned so that reading first 2 coordinates yields your answer, and in case of perspective you still need to divide the points with their w value.

A old video example I made, visualizing all the steps to perspective, can be found here (2.5M Quicktime movie)

In essence its just a question of choosing what you consider a good reference frame that's all. Its the same computation your just missing the non obvious part of having hierarchical transformation chains.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top