3D projection

Wikipedia, the free encyclopedia - Cite This Source

A 3D projection is a mathematical transformation used to project three dimensional points onto a two dimensional plane. As most current methods for displaying graphical data are based on two dimensional media, the use of 3D projection is widespread, especially in computer graphics, engineering and drafting. Several common projections are described below.

Orthographic projection

Orthographic projections are a small set of transforms often used to show profile, detail or precise measurements of a three dimensional object. Common names for orthographic projections include plan, cross-section, bird's-eye, and elevation.

The normal of the viewing plane (the camera direction) is always parallel to one of the 3D axes making the mathematical transformation very simple. To project the 3D point a_x, a_y, a_z onto the 2D point b_x, b_y using an Orthographic projection parallel to the y axis(Profile view), the following equation can be used:

b_x = s_x a_x + c_x
b_y = s_z a_z + c_z Where the vector s is an arbitrary scale factor, and c is an arbitrary offset. These constants are optional, and can be used to properly align the viewport. The projection can be shown using Matrix notation (introducing a temporary vector d for clarity)
begin{bmatrix} {d_x } {d_y } end{bmatrix} = begin{bmatrix}
  1 & 0 & 0  
  0 & 0 & 1  
end{bmatrix}begin{bmatrix} {a_x } {a_y } {a_z } end{bmatrix}
begin{bmatrix} {b_x } {b_y } end{bmatrix} = begin{bmatrix} {s_x } & 0 0 & {s_z } end{bmatrix}begin{bmatrix} {d_x } {d_y } end{bmatrix} + begin{bmatrix} {c_x } {c_z } end{bmatrix}

Perspective projection

See also Transformation matrix#Perspective projection
The perspective projection requires greater definition. A conceptual aid to understanding the mechanics of this projection involves treating the 2D projection as being viewed through a camera viewfinder. The camera's position, orientation, and field of view control the behaviour of the projection transformation. The following variables are defined to describe this transformation:

  • mathbf{a}_{x,y,z} - a point in 3D space.
  • mathbf{c}_{x,y,z} - the location of the camera.
  • mathbf{theta}_{x,y,z} - The rotation of the camera. When mathbf{c}_{x,y,z}=<0,0,0>, and mathbf{theta}_{x,y,z}=<0,0,0>, the 3D vector <1,2,0> is projected to the 2D vector <1,2>.
  • mathbf{e}_{x,y,z} - the viewer position in camera space.

Which results in:

  • mathbf{b}_{x,y} - the 2D projection of mathbf{a}.

First, we define a point mathbf{d}_{x,y,z} as a translation of point mathbf{a} into a coordinate system defined by mathbf{c}. This is achieved by subtracting mathbf{c} from mathbf{a} and then applying a vector rotation matrix using -mathbf{theta} to the result. This transformation is often called a camera transform:

begin{bmatrix} mathbf{d}_x mathbf{d}_y mathbf{d}_z end{bmatrix}=begin{bmatrix}
  1 & 0 & 0  
0 & {cos -mathbf{theta}_x } & {sin -mathbf{theta}_x } 0 & { - sin -mathbf{theta}_x } & {cos -mathbf{theta}_x } end{bmatrix}begin{bmatrix} {cos -mathbf{theta}_y } & 0 & { - sin -mathbf{theta}_y }
  0 & 1 & 0  
{sin -mathbf{theta}_y } & 0 & {cos -mathbf{theta}_y } end{bmatrix}begin{bmatrix} {cos -mathbf{theta}_z } & {sin -mathbf{theta}_z } & 0 { - sin -mathbf{theta}_z } & {cos -mathbf{theta}_z } & 0
  0 & 0 & 1  
end{bmatrix}left({begin{bmatrix} mathbf{a}_x mathbf{a}_y mathbf{a}_z end{bmatrix} - begin{bmatrix} mathbf{c}_x mathbf{c}_y mathbf{c}_z end{bmatrix}} right)

Or, for those less comfortable with matrix multiplication:

begin{array}{lcl} d_x &= &cos theta_ycdot(sin theta_zcdot(a_y-c_y)+cos theta_zcdot(a_x-c_x))-sin theta_ycdot(a_z-c_z) d_y &= &sin theta_xcdot(cos theta_ycdot(a_z-c_z)+sin theta_ycdot(sin theta_zcdot(a_y-c_y)+cos theta_zcdot(a_x-c_x)))+cos theta_xcdot(cos theta_zcdot(a_y-c_y)-sin theta_zcdot(a_x-c_x)) d_z &= &cos theta_xcdot(cos theta_ycdot(a_z-c_z)+sin theta_ycdot(sin theta_zcdot(a_y-c_y)+cos theta_zcdot(a_x-c_x)))-sin theta_xcdot(cos theta_zcdot(a_y-c_y)-sin theta_zcdot(a_x-c_x)) end{array} This transformed point can then projected onto the 2D plane using the formula (here, x/y is used as the projection plane, literature also may use x/z):
begin{array}{lcl} mathbf{b}_x &= &(mathbf{d}_x - mathbf{e}_x) (mathbf{e}_z / mathbf{d}_z) mathbf{b}_y &= &(mathbf{d}_y - mathbf{e}_y) (mathbf{e}_z / mathbf{d}_z) end{array}

Or again in matrix form:

begin{bmatrix} mathbf{f}_x mathbf{f}_y mathbf{f}_z mathbf{f}_w end{bmatrix}=begin{bmatrix} 1 & 0 & 0 & -mathbf{e}_x 0 & 1 & 0 & -mathbf{e}_y
  0 & 0 & 1 & 0 
0 & 0 & 1/mathbf{e}_z & 0 end{bmatrix}begin{bmatrix} mathbf{d}_x mathbf{d}_y mathbf{d}_z
  1 
end{bmatrix} and
begin{array}{lcl} mathbf{b}_x &= &mathbf{f}_x / mathbf{f}_w mathbf{b}_y &= &mathbf{f}_y / mathbf{f}_w end{array}

The distance of the camera plane to the viewer, mathbf{e}_z, directly relates to the field of view, where alpha=2 cdot tan^{-1}(1/mathbf{e}_z) is the viewed angle.

Subsequent clipping and scaling operations may be necessary to map the 2D plane onto any particular display media.

Diagram

To determine which screen x coordinate corresponds to a point at Ax,Az multiply the point coordinates by:

text{screen x coordinate}(Bx) = text{model x coordinate}(Ax) times frac{text{distance from eye to screen}(Bz)}{text{distance from eye to point}(Az)}

the same works for the screen y coordinate:

text{screen y coordinate}(By) = text{model y coordinate}(Ay) times frac{text{distance from eye to screen}(Bz)}{text{distance from eye to point}(Az)}

Other projections

Other common 3D projections include:

See also

References



Wikipedia, the free encyclopedia © 2001-2006 Wikipedia contributors (Disclaimer)
This article is licensed under the GNU Free Documentation License.
Last updated on Thursday March 13, 2008 at 09:39:53 PDT (GMT -0700)
View this article at Wikipedia.org - Edit this article at Wikipedia.org - Donate to the Wikimedia Foundation