Graphics Reference
In-Depth Information
The above algebraic approach to derive the rotation transform is relatively easy.
However, it is also possible to use matrices to derive composite transforms, such as
a reflection relative to an arbitrary line or scaling and rotation relative to an arbitrary
point. All of these linear transforms are called affine transforms, as parallel lines
remain parallel after being transformed. Furthermore, the word 'affine' is used to
imply that there is a strong geometric affinity between the original and transformed
shape. One cannot always guarantee that angles and lengths are preserved, as these
can change when different scaling factors are used. For completeness, let's derive
the above transform using matrices.
A transform for rotating a point β about the origin is given by
cos β
sin β
0
R β =
sin β
cos β
0
0
0
1
and a transform for translating a point (t x ,t y ) relative to the origin is given by
10 t x
01 t y
00 1
.
T t x ,t y =
We can use R β and T t x ,t y to develop a composite transform for rotating a point about
an arbitrary point (t x ,t y ) as follows:
x
y
1
x
y
1
=
T t x ,t y R β T t x , t y
(7.2)
where
t y creates a temporary origin
R β rotates β about the origin
T t x ,t y returns to the original position .
Note that the transform sequence starts on the right next to the original coordinates,
working leftwards.
Equation ( 7.2 ) expands to
T
t x ,
x
y 1
10 t x
01 t y
00 1
cos β
sin β
0
10
t x
x
y
1
=
.
sin β
cos β
0
01
t y
0
0
1
00
1
Next, we multiply these matrices together to form a single matrix. Let's begin by
multiplying the R β and T t x , t y
matrices, which produces
x
y
1
10 t x
01 t y
00 1
cos β
sin β
t x cos β
+
t y sin β
x
y
1
=
sin β
cos β
t x sin β
t y cos β
0
0
1
and finally we obtain
x
y 1
cos β
sin β x ( 1
cos β) + t y sin β
x
y
1
=
sin β
cos β y ( 1
cos β) t x sin β
0
0
1
which is the same as the previous transform ( 7.1 ).
Search WWH ::




Custom Search