Graphics Reference
In-Depth Information
V b
WC
Shusui OC
Rotation: q a
y
z
x
q b = (V b , θ b )
θ b
wc
V f
oc
V p = (0, 0, -1)
wc
V p
(Direction from
Plane to Tiger)
(Front in OC)
(Front in WC)
Figure 16.10.
Describing plane rotation with a quaternion.
Equation (16.5) to assign the computed axis frame to the plane. When drawing
the plane with the R p rotation matrix, the plane aims toward the tiger with up in
the y -axis direction.
Aiming with quaternion rotations. Restart Tutorial 16.5, click on “Aim Plane
At Tiger,” and enable rotation with quaternion computation by selecting the “Ro-
tate With Quat” radio button. Now, select the tiger node and set the translation
of the tiger to
. First of all, verify that the plane is still aiming toward
the tiger. Now, concentrate on the plane and switch from “Rotate With Quat” to
“Rotate With Matrix” to notice the very different upward direction of the plane.
As we have seen in Listing 16.16, the matrix rotation computation ensures the
upward direction is along the y -axis. As we will see, quaternion computation
supports a simple rotation to re-orientate the plane.
Recall from Equation (16.4) that a quaternion q is represented by four floating-
point numbers:
(
10
,
10
,
10
)
V
q
=(
, θ )=(
v x ,
v y ,
v z , θ ) ,
V is the axis of rotation and
where
θ
is the angle to rotate.
As illustrated in
Figure 16.10, if we let
V p
=
plane forward direction
,
V f
=
direction from plane to tiger
,
Search WWH ::




Custom Search