Graphics Programs Reference
In-Depth Information
artificially set them to zero. Matrix T g becomes
1000
0
10 0
000 −r
ab
T g =
.
(3.14)
0
cr
This is a matrix that transforms a point P =( x, y, z, 1) to point
P =
z ) r , 0 .
x + a
z ) r ,
y + b
( c
( c
Following are two quick tests of this matrix. They were performed with the following
Mathematica code:
(* code to check matrix T_g for the case 1 +f=0*)
r = 1/k; {a, b, c} = {0, 0, -k};
T = {{-1, 0, 0, 0}, {0, -1, 0, 0}, {0, 0, 0, -r}, {a, b, 0, c r}};
{x, y, z, 1}.T
k ), matrix T g of
Equation (3.14) transforms an arbitrary point P =( x, y, z )tothepoint
P =
1. When the viewer B is located at the standard location (0 , 0 ,
( k + z ) r , 0 =
1+ z/k , 0 ,
x
( k + z ) r ,
y
x
1+ z/k ,
y
which is the familiar Equation (3.1).
2. When the viewer B is located at (1 , 1 , 1), point ( x, y, z )=(1 , 1 ,
1) is trans-
formed to
1
(1 + 1) r , 0 =(0 , 0 , 0) .
1
(1 + 1) r ,
1
1
The reader should visualize this situation with the help of a diagram to see why the
result is correct.
The Top Vector . This section's approach to general perspective moves the viewer
from an arbitrary location B to the standard position while rotating his line of sight
from an arbitrary direction D to the positive z direction. This is done in the following
three steps: (1) a translation from B to the origin, (2) a rotation, and (3) a translation
to point (0 , 0 ,
k ). However, Figures 3.27 and Ans.8b illustrate why another rotation
is sometimes needed after step 3 in order to correct the orientation of the screen. Fig-
ure 3.35 shows a viewer moved from a general location to the standard position and how
the extra rotation serves to align the top of the screen with the y axis in a new step 4.
The software normally has no idea how the screen is oriented initially and how
it should be oriented when the viewer is brought to the standard position. If this
orientation is important, the user should specify the direction Q of the top of the
screen, and step 4 should be added to rotate the viewer-screen unit about the z axis
until Q is aligned with the x or y axis or any other desired direction.
Search WWH ::




Custom Search