Projection in computer graphics means the transformation of a three-dimensional (3D) area into a two-dimensional (2D) area. The plane in the area into which we transform (project) objects is called the 'Table'. The most frequently used projections are:
Parallel projection is the transformation of a three-dimension area into a plane. In this projection, all projection rays are parallel. It is determined by a table (plane) and by a projection direction (vector), which cannot be parallel with the table. In accordance with the projection direction, we can split parallel projection into the following types:
Most frequently used is the orthogonal projection where the projection trays are orthogonal to the table. The method of orthogonal projection neglects one of coordinates.
The orthogonal parallel projection into the plane xy neglects z-coordinate. To the point P=(x,y,z) corresponding to in the projection the point P' = (x, y). The matrix representation of this transformation is:| 1 0 0 0 | Tkxy = | 0 1 0 0 | | 0 0 0 0 | | 0 0 0 1 |
The projects obtained in this way (meaning what we receive on the table) represents the ground plan of a projected object. In the case of projecting into the plane xz , so then neglecting the y-coordinate of the given object we obtain the elevation of an object, and in the case of projecting in the plane yz it is the side elevation of an object.
We can express the oblique parallel projection of the point (x, y, z) to the plane xy as follows: :
x' = x + z. (a.cos(a)),
y' = y + z. (a.sin(a)),
where the parameter a
determines elongation for the axis z and the angle a
is deviation from the axis x.
If the parameter a=0 , then it is a case of an orthogonal projection
The oblique projection to the plane xy can be expressed in the following matrix
| 1 0 0 0 | Txy = | 0 1 0 0 | | a.cosa a.sina 0 0 | | 0 0 0 1 |
Central projection is given by a table and a center of projection. All projection rays start from one point called the center of projection. This type of projection creates an image similar to that seen by the human eye in the real world. An object standing farther away appears smaller. This type of projection does not maintain parallelism of abscissas. Projects of the parallel abscissas in the 3D area are skew abscissas, except the case where the abscissa lies in the plane parallel to the table.
Let's have a point in 3D with the coordinates (x, y, z), and we want to project it into 2D. We demonstrate this situation on an applet.
Where zvzdia is the distance
from the viewer's eye to the table. R is image of a 3D point in the 2D system. Points A and B
are auxiliary points. Inside the applet, there are two triangles, that are similar. They are: Eye A P and Eye B R.
Based on the similarity of those triangles, we can write transformation equations:
x x' y y' ---------- = --------- a ------------ = --------, (z+vzdial) vzdial (z+vzdial) vzdialFrom them, we obtain the basic transformation equations:
x' = vzdial * x / ( z+vzdial ) y' = vzdial * y / ( z+vzdial )
The variable vzdial is normally selected as 256 (the calculation vzdial * x
or y is made as SHL 8; meaning that it is shifted 8 bits left).
However, these equations assume that the viewer's eye is parallel to the axis z, and concurrently is lying on it. After adding the viewer's center, we receive:
x'= vzdial * (x + vzdial_x ) / (z + vzdial) + x_stred y'= - vzdial * (y + vzdial_y ) / (z + vzdial) + y_stred ,
where vzdial_x and vzdial_y are the viewer's coordinates [vzdial_x,vzdial_y,vzdial]. The variables x_stred and y_stred are defined so as to obtain a shift of the image z [0,0] into [x_stred,y_stred], which is mostly the center of a display box (table); (e.g., with a display box 320x200 it is 160x160).
where d = vzdial.| 1 0 0 0 | M = | 0 1 0 0 | | 0 0 1 1/d | | 0 0 0 1 |,
Let's consider a plane coordinate system SXY, where Sis the center of display box. For maximum simplicity in projecting the coordinate system Oxyz, let axes z and y be identical, and also the points O and Sare identical, too. Select the unit lengths with the center in the point O for each of the axes x, y, z and mark them as jx ,jy ,jz. The end points of these lengths are the points Px, Qy, Rz with the coordinates p1, p2 , or q1, q2 and r1, r2.
Take the point A with the coordinates: xa, ya, za in the system Oxyz. Projection of this point into the display box, meaning into the coordinate system SXY is determined by the pair of projection transformation equations:
Xp =
xa*p1 + ya*q1
Yp = xa*p2 + ya*q2 +
za*r2
The points Xp and Yp are the coordinates of the point A on the display box. This point is called the projection of point A. A display, of which the output is a plane of the point, we call the projection.
isometry
general axonometry
p1= -0.87 q1= 0.87
p1= -0.7 q1= 0.8
p2= -0.5 q2= -0.5 r2= 1 p2= -0.3 q2= -0.2 r2= 0.8
general axonometry 2
war axonometry
p1= -0.8 q1= 0.7
p1= -0.71 q1= 0.71
p2= -0.25 q2= -0.3 r2= 0.9 p2= -0.71 q2= -0.71 r2= 1
projection from the left
projection from the right
p1= -0.43 q1= 1
p1= - 1 q1= 0.43
p2=
- 0.25 q2=
0 r2= 1 p2= 0
q2= -0.25 r2= 1