Graphics Programs Reference
In-Depth Information
Using the ratio
k
, we can write a similarity (ignoring the translation part) as the
product
⎛
⎞
⎛
⎞
⎛
⎞
ac
0
−
k
00
0
k
0
001
a/k
c/k
0
⎝
⎠
⎝
⎠
⎝
⎠
,
ca
0
001
−
c/k
a/k
0
0
0
1
which shows that a similarity is a combination of a scaling/reflection (by a factor
k
)
and a rotation. (The definition of
k
implies that (
a/k
)
2
+(
c/k
)
2
= 1, so we can consider
c/k
and
a/k
the sine and cosine of the rotation angle, respectively.)
1.2.6 A 180
◦
Rotation
Another interesting example of combining transformations is a 180
◦
rotation about a
fixed point
P
=(
P
x
,P
y
). This combination is called a
halfturn
. It is performed, as
usual, by translating
P
to the origin, rotating about the origin, and translating back.
The transformation matrix is (notice that cos(180
◦
)=
−
1)
⎛
⎞
⎛
⎞
⎛
⎞
⎛
⎞
1
0
0
−
100
0
100
010
P
x
−
100
0
⎝
⎠
⎝
⎠
⎝
⎠
=
⎝
⎠
.
T
=
0
1
0
10
001
−
−
10
−
P
x
−
P
y
1
P
y
1
2
P
x
2
P
y
1
A general point (
x, y
) is therefore transformed by a halfturn to
⎛
⎞
−
100
0
⎝
⎠
=(
(
x, y,
1)
−
10
−
x
+2
P
x
,
−
y
+2
P
y
,
1)
(1.19)
2
P
x
2
P
y
1
(Figure 1.14a), but it's more interesting to explore the effect of two consecutive halfturns,
about points
P
and
Q
. The second halfturn transforms point (
−
x
+2
P
x
,
−
y
+2
P
y
,
1)
to
⎛
⎞
−
100
0
⎝
⎠
=(
x
(
−
x
+2
P
x
,
−
y
+2
P
y
,
1)
−
10
−
2
P
x
+2
Q
x
,y
−
2
P
y
+2
Q
y
,
1)
.
(1.20)
2
Q
x
2
Q
y
1
If
P
=
Q
, then the result of the second halfturn is (
x, y
), showing how two identical
180
◦
rotations return a point to its original location. If
P
and
Q
are different, the result
is a
translation
of the original point (
x, y
)byfactors
−
2
P
x
+2
Q
x
and
−
2
P
y
+2
Q
y
(Figure 1.14b).
Exercise 1.32:
What is the result of three consecutive halfturns about the distinct
points
P
,
Q
,and
R
?
Things turn out best for the people who make the best out of the
way things turn out.
—Art Linkletter
Search WWH ::
Custom Search