3D projection

3D projection
Axonometric projection.svg
Part of a series on:
Graphical projection
v · d · e

3D projection is any method of mapping three-dimensional points to a two-dimensional plane. As most current methods for displaying graphical data are based on planar two-dimensional media, the use of this type of projection is widespread, especially in computer graphics, engineering and drafting.

Contents

Orthographic projection

When the human eye looks at a scene, objects in the distance appear smaller than objects close by. Orthographic projection ignores this effect to allow the creation of to-scale drawings for construction and engineering.

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 plane, cross-section, bird's-eye, and elevation.

If the normal of the viewing plane (the camera direction) is parallel to one of the primary axes (which is the x, y, or z axis), the mathematical transformation is as follows; To project the 3D point ax, ay, az onto the 2D point bx, by using an orthographic projection parallel to the y axis (profile view), the following equations can be used:

bx = sxax + cx
by = szaz + cz

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. Using matrix multiplication, the equations become:


 \begin{bmatrix}
   {b_x }  \\
   {b_y }  \\
\end{bmatrix} = \begin{bmatrix}
   {s_x } & 0 & 0 \\
   0 & 0 & {s_z }  \\
\end{bmatrix}\begin{bmatrix}
   {a_x }  \\
   {a_y }  \\
   {a_z }  \\
\end{bmatrix} + \begin{bmatrix}
   {c_x }  \\
   {c_z }  \\
\end{bmatrix}
.

While orthographically projected images represent the three dimensional nature of the object projected, they do not represent the object as it would be recorded photographically or perceived by a viewer observing it directly. In particular, parallel lengths at all points in an orthographically projected image are of the same scale regardless of whether they are far away or near to the virtual viewer. As a result, lengths near to the viewer are not foreshortened as they would be in a perspective projection.

Perspective projection

When the human eye looks at a scene, objects in the distance appear smaller than objects close by - this is known as perspective. While orthographic projection ignores this effect to allow accurate measurements, perspective definition shows distant objects as smaller to provide additional realism.

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 behavior of the projection transformation. The following variables are defined to describe this transformation:

  • \mathbf{a}_{x,y,z} - the 3D position of a point A that is to be projected.
  • \mathbf{c}_{x,y,z} - the 3D position of a point C representing the camera.
  • \mathbf{\theta}_{x,y,z} - The orientation of the camera (represented, for instance, by Tait–Bryan angles).
  • \mathbf{e}_{x,y,z} - the viewer's position relative to the display surface.[1]

Which results in:

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

When \mathbf{c}_{x,y,z}=\langle 0,0,0\rangle, and \mathbf{\theta}_{x,y,z} = \langle 0,0,0\rangle, the 3D vector \langle 1,2,0 \rangle is projected to the 2D vector \langle 1,2 \rangle.

Otherwise, to compute \mathbf{b}_{x,y} we first define a vector \mathbf{d}_{x,y,z} as the position of point A with respect to a coordinate system defined by the camera, with origin in C and rotated by \mathbf{\theta} with respect to the initial coordinate system. This is achieved by subtracting \mathbf{c} from \mathbf{a} and then applying a rotation by -\mathbf{\theta} to the result. This transformation is often called a camera transform, and can be expressed as follows, expressing the rotation in terms of rotations about the x, y, and z axes (these calculations assume that the axes are ordered as a left-handed system of axes): [2] [3]


\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)

This representation corresponds to rotating by three Euler angles (more properly, Tait–Bryan angles), using the xyz convention, which can be interpreted either as "rotate about the extrinsic axes (axes of the scene) in the order z, y, x (reading right-to-left)" or "rotate about the intrinsic axes (axes of the camera) in the order x, y, z) (reading left-to-right)". Note that if the camera is not rotated (\mathbf{\theta}_{x,y,z} = \langle 0,0,0\rangle), then the matrices drop out (as identities), and this reduces to simply a shift: \mathbf{d} = \mathbf{a} - \mathbf{c}.

Alternatively, without using matrices, (note that the signs of angles are inconsistent with matrix form):


\begin{array}{lcl}
	d_x &= &\cos \theta_y\cdot(\sin \theta_z\cdot(a_y-c_y)+\cos \theta_z\cdot(a_x-c_x))-\sin \theta_y\cdot(a_z-c_z) \\
	d_y &= &\sin \theta_x\cdot(\cos \theta_y\cdot(a_z-c_z)+\sin \theta_y\cdot(\sin \theta_z\cdot(a_y-c_y)+\cos \theta_z\cdot(a_x-c_x)))+\cos \theta_x\cdot(\cos \theta_z\cdot(a_y-c_y)-\sin \theta_z\cdot(a_x-c_x)) \\
	d_z &= &\cos \theta_x\cdot(\cos \theta_y\cdot(a_z-c_z)+\sin \theta_y\cdot(\sin \theta_z\cdot(a_y-c_y)+\cos \theta_z\cdot(a_x-c_x)))-\sin \theta_x\cdot(\cos \theta_z\cdot(a_y-c_y)-\sin \theta_z\cdot(a_x-c_x)) \\
\end{array}

This transformed point can then be projected onto the 2D plane using the formula (here, x/y is used as the projection plane; literature also may use x/z):[4]


\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, in matrix form using homogeneous coordinates, the system


\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}

in conjunction with an argument using similar triangles, leads to division by the homogeneous coordinate, giving


\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 viewer from the display surface, \mathbf{e}_z, directly relates to the field of view, where \alpha=2 \cdot \tan^{-1}(1/\mathbf{e}_z) is the viewed angle. (Note: This assumes that you map the points (-1,-1) and (1,1) to the corners of your viewing surface)

The above equations can also be rewritten as:


\begin{array}{lcl}
 \mathbf{b}_x= (\mathbf{d}_x \mathbf{s}_x ) / (\mathbf{d}_z \mathbf{r}_x) \mathbf{r}_z\\
 \mathbf{b}_y= (\mathbf{d}_y \mathbf{s}_y ) / (\mathbf{d}_z \mathbf{r}_y) \mathbf{r}_z\\
\end{array}.

In which \mathbf{s}_{x,y} is the display size, \mathbf{r}_{x,y} is the recording surface size (CCD or film), \mathbf{r}_z is the distance from the recording surface to the entrance pupil (camera center), and \mathbf{d}_z is the distance, from the 3D point being projected, to the entrance pupil.

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

Diagram

Perspective Transform Diagram.png

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

B_x = A_x \frac{B_z}{A_z}

where

Bx is the screen x coordinate
Ax is the model x coordinate
Bz is the focal length—the axial distance from the camera center to the image plane
Az is the subject distance.

Because the camera is in 3D, the same works for the screen y-coordinate, substituting y for x in the above diagram and equation.

See also

References

  1. ^ Ingrid Carlbom, Joseph Paciorek (1978). "Planar Geometric Projections and Viewing Transformations". ACM Computing Surveys 10 (4): 465–502. doi:10.1145/356744.356750. http://www.cs.uns.edu.ar/cg/clasespdf/p465carlbom.pdf .
  2. ^ Riley, K F (2006). Mathematical Methods for Physics and Engineering. Cambridge University Press. pp. 931, 942. doi:10.2277/0521679710. ISBN 0-521-67971-0. 
  3. ^ Goldstein, Herbert (1980). Classical Mechanics (2nd ed.). Reading, Mass.: Addison-Wesley Pub. Co.. pp. 146–148. ISBN 0-201-02918-9. 
  4. ^ Sonka, M; Hlavac, V; Boyle, R (1995). Image Processing, Analysis & Machine Vision (2nd ed.). Chapman and Hall. pp. 14. ISBN 0-412-45570-6 

External links

Further reading


Wikimedia Foundation. 2010.

Игры ⚽ Поможем написать курсовую

Look at other dictionaries:

  • projection — [ prɔʒɛksjɔ̃ ] n. f. • 1314; lat. projectio, de projectus, p. p. de projicere 1 ♦ Action de jeter, de lancer en avant (⇒ 1. jet; projeter, I ). Projection de liquide, de vapeur. Lancement, jet (de projectiles). Projection de pierres, d obus.… …   Encyclopédie Universelle

  • Projection conforme — Projection cartographique Le choix d une projection et la conversion d une projection à une autre comptent parmi les difficultés que les cartographes ont dû affronter. L informatique leur a beaucoup apporté de ce point de vue La projection… …   Wikipédia en Français

  • Projection (géométrie) — Pour les articles homonymes, voir Projection. En géométrie, une projection est une transformation de l espace, c est à dire une application linéaire qui projette l espace sur une sous partie. Par exemple pour faire de la 3D on projette l espace… …   Wikipédia en Français

  • Projection cinematographique — Projection cinématographique Cinéma …   Wikipédia en Français

  • Projection stéréographique — du pôle sud sur le plan équatorial …   Wikipédia en Français

  • Projection BandWidth — Projection Bänder sind ein in den 1990er Jahren von Mel Widner entwickeltes Verfahren zur Chartanalyse. Der Projection Band ist eine Art Umhüllungsindikator ähnlich den Bollinger Bändern oder Envelopes. Wie alle Instrumente der technischen… …   Deutsch Wikipedia

  • Projection Oscillator — Projection Bänder sind ein in den 1990er Jahren von Mel Widner entwickeltes Verfahren zur Chartanalyse. Der Projection Band ist eine Art Umhüllungsindikator ähnlich den Bollinger Bändern oder Envelopes. Wie alle Instrumente der technischen… …   Deutsch Wikipedia

  • Projection de Lambert — Projection conique conforme de Lambert Pour les articles homonymes, voir Lambert.  Ne doit pas être confondu avec Projection azimutale équivalente de Lambert. La projection conique conforme de Lambert, ou plus simplement, la projection de… …   Wikipédia en Français

  • Projection de lambert — Projection conique conforme de Lambert Pour les articles homonymes, voir Lambert.  Ne doit pas être confondu avec Projection azimutale équivalente de Lambert. La projection conique conforme de Lambert, ou plus simplement, la projection de… …   Wikipédia en Français

  • PROJECTION (psychanalyse) — Dans la doctrine psychanalytique, la projection est un mécanisme de défense inconscient par lequel le sujet projette sur autrui les craintes et les désirs qu’il ressent comme interdits et dont la représentation consciente serait chargée… …   Encyclopédie Universelle

  • Projection bands — sind ein in den 1990er Jahren von Mel Widner entwickeltes Verfahren zur Chartanalyse. Der Projection Band ist eine Art Umhüllungsindikator ähnlich den Bollinger Bändern oder Envelopes. Wie alle Instrumente der technischen Analyse ist seine… …   Deutsch Wikipedia

Share the article and excerpts

Direct link
Do a right-click on the link above
and select “Copy Link”