Graphics Programs Reference
In-Depth Information
x
B
x
B
x
x
D
k
z
z
D
z
z
(a)
(b)
(c)
(d)
Figure 3.32: Transforming the Viewer-Screen Unit.
screen. We simply use the coordinates ( a, b, c )ofpoint B and the components ( d, e, f )
of vector D to derive the three transformation matrices T 1 (translation), T 2 (rotation),
and T 3 (second translation) and multiply T = T 1 T 2 T 3 T p .Anypoint P on the object
is then transformed and projected in a single step by the multiplication P = PT .
This approach is developed here for the general case but is first illustrated by two
examples where the coordinates of B and the components of D are known numbers.
Example 1 . The viewer is located at B =(1 , 1 , 1) and is looking in direction
D =(1 , 0 , 1) (i.e., midway between the directions of positive x and positive z ). Matrix
T 1 below translates from (1 , 1 , 1) to the origin. Matrix T 2 rotates by 45 from the
positive x to the positive z direction. Matrix T 3 translates fr o m the origin to point
(0 , 0 ,
k ). The result is (we denote s = cos 45 =sin45 =1 / 2)
T = T 1 T 2 T 3 T p
1000
0100
0010
s 0 s 0
0 100
1000
0100
0010
00
1000
0100
000 r
0001
=
s 0 s 0
0 001
1
1
11
k
1
s
0
s
0
1000
0100
000 r
0001
01
0 0
=
s
0
s
0
0
1
2 s
k
1
s
00
sr
010
0
=
s
00
sr
0
101
kr
2 rs
s 00 sr
0100
−s
=
.
(3.8)
00 sr
0
10 2 rs
(Recall that k =1 /r .)
The projection of any point P =( x, y, z ) is calculated by
 
Search WWH ::




Custom Search