Graphics Programs Reference
In-Depth Information
Exercise 3.8:
Show why point (0
,
1
/
4) is not located on
P
∗
(
t
).
Transforming and projecting
. This example illustrates the advantage of the
projection matrix
T
p
of Equation (3.4). Given an object, we might want to transform
it before we project its points. In such a case, all we have to do is prepare the individual
4
4 transformation matrices, multiply them together in the order of the transforma-
tions, and multiply the result by
T
p
. Assume that we want to apply the following
transformations to our object: (1) Rotate it about the
x
axis by 90
◦
from the direction
of positive
y
to the direction of positive
z
(Figure 3.25a). (2) Translate it by 3 units in
the positive
z
direction. (3) Scale it by a factor of 1/2 (i.e., shrink it to half its size) in
the
y
dimension. The three transformation matrices are
×
⎡
⎤
⎡
⎤
⎡
⎤
1000
0010
0
−
100
0001
1000
0100
0010
0031
1000
01
/
200
0010
0001
⎣
⎦
⎣
⎦
⎣
⎦
T
R
=
,
T
T
=
,
T
S
=
and their product with
T
p
(we assume
k
=1,so
r
= 1) produces
⎡
⎤
⎡
⎤
1000
0100
0001
0001
1000
0001
0
⎣
⎦
⎣
⎦
T
=
T
R
T
T
T
S
=
.
(3.5)
1
/
200
0004
−
y
y
z
z
x
x
(a)
(b)
Figure 3.25: Rotation about the
x
Axis.
We can now pick any point on the object, write it as a 4-tuple in homogeneous
coordinates, and multiply it by
T
to obtain its projection after applying the three
transformations to it. Notice that a point cannot be scaled, but the effect of scaling is
to move points such that the scaled object will shrink to half its size in the
y
dimension.
As an example, multiplying point (0
,
1
,
4
,
1) by
T
results in (0
,
2
,
0
,
5),which,after
dividing by the fourth coordinate, produces the two-dimensional point (0
,
2
/
5).
−
Exercise 3.9:
Multiply point (0
,
1
,
−
4
,
1) by the product
T
R
T
T
T
S
and explain the
result.
Search WWH ::
Custom Search