Graphics Reference
In-Depth Information
7.3.4 Rotate and Translate a Point
There are two ways we can combine the rotate and translate transforms into a single
transform. The first method starts by translating a point
P(x,y)
using
T
(t
x
,t
y
)
to an
intermediate point, which is then rotated using
R
β
. The problem with this strategy
is that the radius of rotation becomes large and subjects the point to a large circular
motion. The normal way is to first subject the point to a rotation about the origin
and then translate it:
P
=
T
t
x
,t
y
R
β
P
⎡
⎤
⎡
⎤
⎡
⎤
⎡
⎤
x
y
1
10
t
x
01
t
y
00 1
cos
β
−
sin
β
0
x
y
1
⎣
⎦
=
⎣
⎦
⎣
⎦
⎣
⎦
sin
β
cos
β
0
0
0
1
⎡
⎣
⎤
⎦
=
⎡
⎣
⎤
⎦
⎡
⎣
⎤
⎦
.
x
y
1
−
cos
β
sin
β
x
x
y
1
sin
β
cos
β
y
0
0
1
For example, consider rotating the point
P(
1
,
0
)
, 90° and then translating it by
(
1
,
0
)
. The rotation moves
P
to
(
0
,
1
)
and the translation moves it to
(
1
,
1
)
.Thisis
confirmed by the above transform:
⎡
⎤
⎡
⎤
⎡
⎤
1
1
1
0
11
100
001
−
1
0
1
⎣
⎦
=
⎣
⎦
⎣
⎦
.
7.3.5 Composite Rotations
It is worth confirming that if we rotate a point
β
about the origin, and follow this
by a rotation of
θ
, this is equivalent to a single rotation of
θ
+
β
,so
R
θ
R
β
=
R
θ
+
β
.
Let's start with the transforms
R
β
and
R
θ
:
⎡
⎤
cos
β
−
sin
β
0
⎣
⎦
R
β
=
sin
β
cos
β
0
0
0
1
⎡
⎤
cos
θ
−
sin
θ
0
⎣
⎦
.
R
θ
=
sin
θ
cos
θ
0
0
0
1
We can represent the double rotation by the product
R
θ
R
β
:
⎡
⎤
⎡
⎤
⎦
cos
θ
−
sin
θ
0
cos
β
−
sin
β
0
⎣
⎦
⎣
R
θ
R
β
=
sin
θ
cos
θ
0
sin
β
cos
β
0
0
0
1
0
0
1