Graphics Reference
In-Depth Information
x
-coordinate. And finally, we add 1 to the reflected coordinate to compensate
for the original subtraction. Algebraically, the three steps are
x
1
=
x
−
1
x
2
=
−
(
x
−
1)
x
=
−
(
x
−
1) + 1
which simplifies to
x
=
−
x
+2
y
=
y
(7.30)
or in matrix form,
⎡
⎤
⎡
⎤
⎡
⎤
x
y
1
−
102
010
001
x
y
1
⎣
⎦
=
⎣
⎦
·
⎣
⎦
(7.31)
Figure 7.5 illustrates this process.
In general, to reflect a shape about an arbitrary
y
-axis,
y
=
a
x
, the fol-
lowing transform is required:
x
=
−
(
x
−
a
x
)+
a
x
=
−
x
+2
a
x
y
=
y
(7.32)
or, in matrix form,
⎡
⎤
⎡
⎤
⎡
⎤
x
y
1
−
10
a
x
01 0
00 1
x
y
1
⎣
⎦
=
⎣
⎦
·
⎣
⎦
(7.33)
Y
X
−
2
−
1
0
1
2
3
4
Fig. 7.5.
The shape on the right is reflected about the
x
= 1 axis.