Game Development Reference
In-Depth Information
2
2
12
−−
y
2
z
2
xy
2
wz
2
xz
+
2
wy
2
2
R
=
22
xy
+
z
122
x z
22
z
x
.
(4.60)
q
2
2
22
xz
y
22
z
+
x
12 2
x y
4.6.3 Spherical Linear Interpolation
Because quaternions are represented by vectors, they are well suited for interpo-
lation. When an object is being animated, interpolation is useful for generating
intermediate orientations that fall between precalculated key frames.
The simplest type of interpolation is linear interpolation . For two unit qua-
ternions q and
()
q , the linearly interpolated quaternion
q
t
is given by
() (
)
q
t
=−
1
t
qq .
+
t
(4.61)
1
2
()
The function
q changes smoothly along the line segment connecting q and q
as t varies from 0 to 1. As shown in Figure 4.7,
()
q
t
does not maintain the unit
length of q and
q , but we can renormalize at each point by instead using the
function
(
)
1
1
−+
t
qq
t
()
1
2
q
t
=
qq .
(4.62)
(
)
−+
t
t
1
2
q
1
()
q
t
()
()
q
q
t
t
q
2
Figure 4.7. Linear interpolation of quaternions.