Graphics Reference
In-Depth Information
⎡
⎣
⎤
⎦
cos
α
sin
α
00
−
sin
α
cos
α
00
R
−
1
α,z
=
0
0
1
0
0
0
0
1
⎡
⎣
⎤
⎦
cos
α
sin
α
0
−
t
x
cos
α
−
t
y
sin
α
−
sin
α
cos
α
0
−
t
y
cos
α
+
t
x
sin
α
R
−
1
α,z
T
−
1
t
x
,t
y
,
0
=
.
0
0
1
0
0
0
0
1
Let's test this transform by making
α
=
90°, and
t
x
=
t
y
=
1, as shown in
Fig.
10.4
(b):
⎡
⎣
⎤
⎦
010
−
1
−
100 1
0010
0001
R
−
1
90
°
,z
T
−
1
1
,
1
,
0
=
which, if used on the unit cube shown in Fig.
10.4
(c), produces
⎡
⎣
⎤
⎦
⎡
⎣
⎤
⎦
010
−
1
00001111
00110011
01010101
11111111
−
100 1
0010
0001
⎡
⎣
⎤
⎦
−
−
−
−
100
11110000
01010101
11111111
1
100
1
=
as confirmed by Fig.
10.4
(d).
Let's explore what happens if we swap the rotation and translation transforms to
T
−
1
t
x
,t
y
,
0
R
−
1
α,z
. This now implies that the frame of reference is rotated
α
about the
z
-
axis, and then translated
(t
x
,t
y
,
0
)
in the rotated frame's space, which is not what we
had planned. Here are the three transforms for rotating a frame of reference about
an off-set axis:
⎡
⎣
⎤
⎦
1
0
0
0
0
cos
α
sin
α
−
t
y
cos
α
−
t
z
sin
α
R
−
1
α,x
T
−
1
0
,t
y
,t
z
=
0
−
sin
α
cos
α
−
t
z
cos
α
+
t
y
sin
α
0
0
0
1
⎡
⎣
⎤
⎦
cos
α
0
−
sin
α
−
t
x
cos
α
+
t
z
sin
α
01 0
0
α,y
T
−
1
R
−
1
t
x
,
0
,t
z
=
−
−
sin
α
0
cos
α
t
z
cos
α
t
x
sin
α
00 0
1
⎡
⎣
⎤
⎦
−
−
cos
α
sin
α
0
t
x
cos
α
t
y
sin
α
−
sin
α
cos
α
0
−
t
y
cos
α
+
t
x
sin
α
α,z
T
−
1
R
−
1
t
x
,t
y
,
0
=
.
0
0
1
0
0
0
0
1