Graphics Reference
In-Depth Information
Similarly, this transform is used for reflections about an arbitrary
x
-axis,
y
=
a
y
:
x
=
x
y
=
−
(
y
−
a
y
)+
a
y
=
−
y
+2
a
y
(7.34)
or, in matrix form,
⎡
⎤
⎡
⎤
⎡
⎤
x
y
1
100
0
x
y
1
⎣
⎦
=
⎣
⎦
·
⎣
⎦
1
a
y
001
−
(7.35)
7.3.4 2D Shearing
A shape is sheared by leaning it over at an angle
β
. Figure 7.6 illustrates
the geometry, and we see that the
y
-coordinate remains unchanged but the
x
-coordinate is a function of
y
and tan(
β
).
x
=
x
+
y
tan(
β
)
y
=
y
(7.36)
or, in matrix form,
⎡
⎤
⎡
⎤
⎡
⎤
x
y
1
1
tan(
β
)0
x
y
1
⎣
⎦
=
⎣
⎦
·
⎣
⎦
0
1
0
(7.37)
0
0
1
Y
y tan
b
y
Original
Sheared
b
X
Fig. 7.6.
The original square shape is sheared to the right by an angle
β
, and the
horizontal shift is proportional to
ytan
(
β
).