Game Development Reference
In-Depth Information
θ
1
(
()
)
cos
qq
t
1
t
1
(
()
)
()
Figure 4.8. Graph of
cos
qq , where
t
q
t
is the normalized linear interpolation
1
function given by Equation (4.62).
Now we have a function that traces out the arc between q and q , shown in Fig-
ure 4.7 as a two-dimensional cross-section of what is actually occurring on the
surface of the four-dimensional unit hypersphere.
Although linear interpolation is efficient, it has the drawback that the func-
()
tion
q
t
given by Equation (4.62) does not trace out the arc between q and
q at
1
(
()
)
a constant rate. The graph of
qq shown in Figure 4.8 demonstrates
that the rate at which the angle between
cos
t
1
()
q
t
and q changes is relatively slow at
the endpoints where
=
and
=
1
, and is the fastest where
=
.
t
0
t
t
1
2
()
q that interpolates the quaternions q and
q , preserves unit length, and sweeps through the angle between q and q at a
constant rate. If q and q are separated by an angle θ , then such a function would
generate quaternions forming the angle θt between
We would like to find a function
()
q
t
and q as t varies from 0
to 1.
()
Figure 4.9 shows the quaternion
q
t
lying on the arc connecting q and
q ,
(
)
forming the angle θt with q , and forming the angle
1 θ t
with
q . We can
()
write
q
t
as
()
()
()
q
t
=
at
q
+
bt
q
(4.63)
1
2
()
()
()
by letting
at and
b t represent the lengths of the components of
t
lying
q
along the directions q and
q . As shown in Figure 4.9(a), we can determine the
()
length
at by constructing similar triangles. The perpendicular distance from q
to the line segment connecting the origin to q is equal to
q
1 sin θ
. The perpen-