Graphics Reference
In-Depth Information
24
25
26
27
28
double t = 2 * Math.Sin(theta);
omega = Vector3D(x/t, y/t, z/t);
return;
}
}
A few observations are in order.
• For small
θ
, M is nearly the identity.
• For small
θ
, the coefficient of the last term is approximately
θ
, while the
2
2 ; thus, the middle term
is far smaller than the last term. So to first order, M
≈− θ
coefficient of the middle term is 1
cos(
θ
)
I +sin
θ
J
.
v
11.2.5 Body-Centered Euler Angles
Suppose we have a model of an airplane whose vertices are stored in an n
×
3
array V . We've rotated the model to some position that we like by multiplying all
the vertices by some rotation matrix M , that is, we've computed
W = MV .
(11.29)
We now decide that we'd like to have the airplane model pitch up a little more (as
if the pilot had pulled on the joystick). We could apply some Euler-angle rotations
to the rotated vertices, that is, we could compute
1
0
0
cos
θ
θ
01 0
0 sin
cos
φ −
sin
φ
0
W . (11.30)
0 cos
ψ −
sin
ψ
sin
φ
cos
φ
0
0 sin
ψ
cos
ψ
sin
θ
0 cos
θ
0
0
1
The problem is that this would take the already rotated vertices and rotate them
first about the world z -axis, which might point diagonally through the airplane,
and then about the world y -axis, and then about the world x -axis. It would be very
hard to choose
to have the effect we are seeking. Such a transformation
would be called a world-centered rotation, because the description of the rotation
is in terms of the axes of the world coordinate system. We could instead compute
ψ
,
θ
, and
φ
1
0
0
cos
θ
θ
01 0
0 sin
cos
φ −
sin
φ
0
V ,
M
0 cos
ψ −
sin
ψ
sin
φ
cos
φ
0
0 sin
ψ
cos
ψ
sin
θ
0 cos
θ
0
0
1
(11.31)
that is, apply some rotations to the object's vertices before applying the rotation
M to the object. Such an operation is called a body-centered rotation or object-
centered rotation. In this case, performing the rotation we seek is easy: We sim-
ply adjust the pitch angle
. Of course, if we then want to adjust it further, we
have to apply another body-centered rotation, and it appears that we're destined to
accumulate a huge sequence of matrices. One solution is to explicitly compute the
product so that we always have at most one matrix, plus three others temporarily
being adjusted until they too can be folded into the matrix. Another approach is
to represent matrices with quaternions, as we'll see below. In general, if M is the
current transformation applied to the vertex set V , and we alter it to M 1 = MA ,
then A is called a body-centered operation, while if we alter it to M 2 = CM , then
C is called a world-centered operation.
φ
 
 
 
Search WWH ::




Custom Search