Graphics Programs Reference
In-Depth Information
sin 45
sin 45
0
0
0
1
0
0
=
.
sin 45
sin 45
0
0
k +2 k sin 45
0
0
1
Any point P =( x, y, z, 1) on the object can be projected to a two-dimensional point P
on the screen by
a 00 a/k
010 0
P = PA 1 T p =( x, y, z, 1)
a 00 a/k
000 2 a
=( a ( x
z ) ,y, 0 ,a (2 k + x + z ) /k ) ,
resulting in
z )
2 k + x + z ,
k ( x
= yk
x =
a (2 k + x + z ) ,
where a =sin45 . A comparison of parts (c) and (f) in Figure 3.29 shows how the
viewer and the object end up in the same relative positions.
If transforming the viewer involves only translations and rotations (and no reflec-
tions), it is possible to transform the viewer from the standard position to any location
in space by means of (1) a translation to the origin, (2) a general rotation about the
origin, and (3) another translation from the origin to the final location. The two trans-
lations are easy to express, and Section 3.7 shows how to derive the transformation
matrix that will rotate the viewer so his line of sight becomes any given direction D .
The following example serves to illustrate this claim. Suppose that we want to
translate the viewer from the standard position (0 , 0 ,
k ) to an arbitrary location
B =( a, b, c ) and then rotate him about some axis that goes through the origin (or,
equivalently, first rotate him and then translate him to B ). A rotation about the origin
requires a temporary translation from B to the origin, a rotation, and a translation
back to B . Thus, we need the four transformation matrices
1000
0100
0010
abc + k
1000
0100
0010
T 1 =
,
T 2 =
,
1
a
b
c
1
. . . 0
. . . 0
. . . 0
0001
1000
0100
0010
abc 1
T 3 =
,
T 4 =
,
where the elements of the rotation matrix T 3 are irrelevant and are not shown. Direct
multiplication verifies that the product T 1 T 2 is a transformation matrix that translates
from the standard position (0 , 0 ,
k ) to the origin. Thus, instead of the four matrices
above, we need only three transformation matrices, a translation to the origin, a rotation
about the origin, and a translation to point B .
Search WWH ::




Custom Search