Graphics Programs Reference
In-Depth Information
β 0 α 0
0 100
1000
0100
000 r
0001
=
α 0 β 0
0 001
β 00 αr
0100
=
.
(3.9)
α 00 βr
0001
It is easy to see that for θ =0(where α =0and β = 1), matrix (3.9) reduces to
matrix (3.4).
Exercise 3.20: Assuming a viewer positioned as in the example above, calculate the
projectionofpoint P =( βl, m,
αl ).
Exercise 3.21: Projection matrices (3.9) and (3.7) correspond to the same geometry,
so one would think that they should be identical. Why are they different?
We now develop this approach for the general case where a viewer is located at an
arbitrary point B =( a, b, c ) looking in an arbitrary direction D =( d, e, f ), where vector
D is assumed to be normalized (i.e., d 2 + e 2 + f 2 = 1). Translating the viewer to the
origin is done, as usual, by matrix T 1 :
1000
0100
0010
T 1 =
.
(3.10)
a
b
c
1
The main task is to rotate vector D so it coincides with the positive z direction. The
rotation should be about an axis that's perpendicular to both D and the z axis. A
general vector in this direction is obtained by the cross product
D
×
(0 , 0 , 1) = ( d, e, f )
×
(0 , 0 , 1) = ( e,
d, 0) .
Normalizing this vector yields
=
1 − f 2 , 0 .
( e,
d, 0)
e 2 + d 2
e
1 − f 2 ,
d
u =
Vector u is a unit vector in the direction of rotation. The rotation angle θ is the angle
between vectors D and z =(0 , 0 , 1). Since both are unit v ectors, we can employ the dot
product to obtain cos θ = D
cos 2 θ = 1
(0 , 0 , 1) = f and sin θ = 1
f 2 . Notice
that sin θ is nonnegative because the angle between vector D and the z axis is measured
between the direction of D and the positive z direction and is consequently always in
the interval [0 ].
Search WWH ::




Custom Search