Graphics Reference
In-Depth Information
9
10
11
12
13
14
15
16
psi = Math.atan2(m[2,1], m[1,1]);
}
else
{
phi = atan2(-m[0,1], m[0,0]);
psi = atan2(-m[1,2], m[2,2]);
}
}
determined produce matrices
which, when multiplied together, really do produce the given rotation matrix M ,
but this is a straightforward computation.
It remains to verify that the values of
θ
,
φ
, and
ψ
Inline Exercise 11.3: Write a short program that creates a rotation matrix
from Rodrigues' formula (Equation 11.17 below) and computes from it the
three Euler angles. Then use Equation 11.14 to build a matrix from these three
angles, and confirm that it is, in fact, your original matrix. Use a random unit
direction vector and rotation amount in Rodrigues' formula.
Aside from the special case where cos
θ
= 0 in the code above, we have a
one-to-one mapping from rotations to (
θ
,
φ
,
ψ
) triples with
−π/
2
<θ≤ π/
2 and
−π<φ
. Thus, the set of rotations in 3-space is three-dimensional.
In general, you can imagine controlling the attitude of an object by speci-
fying a rotation using
,
ψ ≤ π
. If you change any one of them, the rotation
matrix changes a little, so you have a way of maneuvering around in SO ( 3 ) .The
cos
θ
,
φ
, and
ψ
θ
= 0 situation is tricky, though. If
θ
=
π/
2, for instance, we find that multiple
(
turns out to not produce inde-
pendent changes in the attitude of the object. This phenomenon, in various forms,
is called gimbal lock, and is one reason that Euler angles are not considered an
ideal way to characterize rotations.
φ
,
ψ
) pairs give the same result; varying
φ
and
ψ
11.2.3 Axis-Angle Description of a Rotation
One way to rotate 3-space is to pick a particular axis (i.e., a unit vector) and rotate
about that direction by some amount. The matrix R xy does this when the axis is
the z -axis, for instance. We show, in the web materials, that every rotation in 3-
space is rotation about some axis by some angle. Rodrigues [Rod16] discovered a
formula to build a rotation for any axis and angle of rotation, and thus to produce
any rotation matrix. We let
v x
v y
v z
=
(11.15)
v
denote the unit-vector axis of rotation and
θ
the amount of rotation about
(mea-
v
sured counterclockwise as viewed from the tip of
looking toward the origin).
To express the rotation we seek, we'll need to use cross products a good deal.
The function v
v
v is a linear transformation from R 3 to itself; the matrix for
v ×
this transformation is
0
v z
v y
.
J v =
v z
0
v x
(11.16)
v y
v x
0
 
 
 
Search WWH ::




Custom Search