Graphics Reference
In-Depth Information
It is interesting to note that the computed rotation matrix is guaranteed to be an
orthonormal matrix. Recall that an orthonormal matrix has normalized row and
column vectors that are perpendicular to each other. As discussed in Section B.4,
an orthonormal matrix defines the orientation of an object. Our experience from
Tutorials 16.3 and 16.4 verify that modifications to the rotation parameters do
indeed only change the orientation without changing the position or the size of
the tiger. In this section, we examine how to compute and control the rotation
matrix to achieve specific orientations for objects.
Tutorial 16.5.
Project Name:
D3D _ Orientation
Library Support:
UWB _ MFC _ Lib1
UWB _ D3D _ Lib17
Tutorial 16.5. Using and Computing the Rotation Matrix
Goal. Demonstrate how to use the rotation matrix in maneuvering objects
and understand that we can compute rotation matrices to create custom ori-
entation of objects.
Approach. Implement moving forward, aiming, and homing-in function-
ality based on using and computing the rotation matrix.
Figure 16.8 is a screenshot of running Tutorial 16.5. The interesting computations
here are moving forward, aiming, and homing in.
Figure 16.8.
Tutorial
16.5.
Moving forward. Before we begin, notice that by default the tiger's head is
facing toward the negative z -axis (blue arrow) direction. Now, in preparation
for controlling the navigation of the tiger, select the tiger node and click on the
“Rotation” radio button in the XformInfo control panel. Enable the movement of
Transforming directions.
Given a transformation matrix
M and a direction vector V ,
to transform the vector by the
matrix, we must compute
V ( M 1
the tiger by clicking on the “Move Tiger” checkbox. Observe that the tiger moves
forward in the direction of its head. We can control the forward direction of the
tiger by adjusting the y rotation ( y slider bar). The x rotation allows the tiger to
move higher or lower from its current level.
To implement this forward-moving functionality, we must first compute the
current forward direction V f of the tiger and then change the tiger position P t in
the V f direction. From the orthonormal basis defined in the tiger's object coor-
dinate (OC) space, we can see that the tiger's head is facing the negative z -axis.
This observation says that, in the tiger's OC space, the forward direction V oc
f
T
)
.
In this case, R is an orthonor-
mal rotation matrix where
R 1
T
(
)
=
R
.
is
For this reason, we can com-
pute the transformation of V i
by
= 00
1 .
V oc
f
simply
multiplying
with
the matrix R .
The current forward direction (in WC space) is controlled by the user's rotation
settings R such that
V wc
V oc
=
.
R
f
f
Search WWH ::




Custom Search