Graphics Programs Reference
In-Depth Information
where
I
is the identity matrix. The transpose
M
T
therefore equals the inverse,
M
−
1
,
of
M
, which shows that a rotation matrix
M
is orthogonal.
Example
. Consider a rotation about the
z
axis. The rotation axis is
u
=(0
,
0
,
1),
resulting in
⎛
⎞
⎛
⎞
⎛
⎞
000
000
001
0
10
100
000
−
cos
θ
−
sin
θ
0
⎝
⎠
and
U
=
⎝
⎠
,
and hence
M
=
⎝
⎠
,
uu
T
=
sin
θ
cos
θ
0
0
0
1
which is the familiar rotation matrix about the
z
axis. It is identical to the
z
-rotation
matrix of Equation (1.29), so we conclude that it rotates counterclockwise when viewed
from the direction of positive
z
.
The general rotation matrix of Equation (1.32) can also be constructed as the
product of five simple rotations about various coordinate axes. Given a unit vector
u
=(
u
x
,u
y
,u
z
), consider the following rotations.
1. Rotate
u
about the
z
axis into the
xz
plane, so its
y
coordinate becomes zero.
This is done by a rotation matrix of the form
⎡
⎤
cos
ψ
−
sin
ψ
0
⎣
⎦
,
A
=
sin
ψ
cos
ψ
0
0
0
1
and the angle
ψ
of rotation can be computed from the requirement that the
y
component
of vector
v
=
uA
b
e zero.
This com
ponent
is
−
u
x
sin
ψ
+
u
y
cos
ψ
, which implies
cos
ψ
=
u
x
/
u
x
+
u
y
and sin
ψ
=
u
y
/
u
x
+
u
y
. Notice that rotating
u
does not affect
its magnitude, so
v
is also a unit vector. In addition, since the rotation is about the
z
axis, the
z
component of
u
does not change, so
v
z
=
u
z
.
2. Rotate vector
v
about the
y
axis until it coincides with the
z
axis. This is
accomplished by the matrix
⎡
⎤
cos
φ
0 in
φ
⎣
⎦
.
B
=
0
1
0
−
sin
φ
0 os
φ
The angle
φ
of rotation i
s comp
uted from the dot product cos
φ
=
v
·
(0
,
0
,
1) =
v
z
=
u
z
,
implying that sin
φ
=
1
−
u
z
.Since
v
is a unit vector, it is rotated by
B
to vector
(0
,
0
,
1).
3. Rotate (0
,
0
,
1) about the
z
axis through an angle
θ
. Thisisdonebymatrix
⎡
⎤
cos
θ
−
sin
θ
0
⎣
⎦
.
C
=
sin
θ
cos
θ
0
0
0
1
This is a trivial rotation that does not change (0
,
0
,
1).
4. Rotate the result of step 3 by
B
−
1
(which equals
B
T
).
Search WWH ::
Custom Search