Graphics Reference
In-Depth Information
equals the identity matrix, R 1
β
and because R β R β
R β :
=
cos β
sin β
0
R 1
β
=
sin β
cos β
0
0
0
1
confirms that R β is orthogonal.
7.3.3 Rotate a Point About an Arbitrary Point
Now let's see how to rotate a point (x, y) about an arbitrary point (t x ,t y ) .The
strategy involves making the point of rotation a temporary origin, which is achieved
by subtracting (t x ,t y ) from the coordinates (x, y) respectively. Next, we perform a
rotation about the temporary origin, and finally, we add (t x ,t y ) back to the rotated
point to compensate for the original subtraction. Here are the steps:
1. Subtract (t x ,t y ) to create a new temporary origin:
x 1 = x t x
y 1 = y t y .
2. Rotate (x 1 ,y 1 ) about the temporary origin by β :
x 2 =
(x
t x ) cos β
(y
t y ) sin β
y 2 =
+
t y ) cos β.
3. Add (t x ,t y ) to the rotated point (x 2 ,y 2 ) to return to the original origin:
x =
(x
t x ) sin β
(y
x 2 +
t x
y =
y 2 +
t y
x =
(x
t x ) cos β
(y
t y ) sin β
+
t x
y =
(x
t x ) sin β
+
(y
t y ) cos β
+
t y .
Simplifying, we obtain
x =
x cos β
y sin β
+
t x ( 1
cos β)
+
t y sin β
y =
x sin β
+
y cos β
+
t y ( 1
cos β)
t x sin β
and in matrix form we have
x
y
1
cos β
sin β x ( 1
cos β)
+
t y sin β
x
y
1
=
.
sin β
cos β y ( 1
cos β)
t x sin β
(7.1)
0
0
1
For example, if we rotate the point ( 2 , 1 ) , 90° about the point ( 1 , 1 ) the transform
( 7.1 ) becomes
=
.
1
2
1
0
12
100
001
2
1
1
Search WWH ::




Custom Search