Game Development Reference
In-Depth Information
Thus, the equation for slerp is given by
Quaternion slerp in
theory
−1 ) t q 0 .
slerp( q 0 , q 1 ,t) = ( q 1 q 0
This algebraic form is how slerp is computed in theory. In practice, we
use a formulation that is mathematically equivalent, but computationally
more e cient. To derive this alternative formula, we start by interpreting
the quaternions as existing in a 4D Euclidian space. Since all of the quater-
nions of interest are unit quaternions, they “live” on the surface of a 4D
hypersphere. The basic idea is to interpolate around the arc that connects
the two quaternions, along the surface of the 4D hypersphere. (Hence the
name spherical linear interpolation.)
We can visualize this in the plane (see Figure 8.11). Imagine two 2D
vectors v 0 and v 1 , both of unit length. We wish to compute the value of v t ,
which is the result of smoothly interpolating around the arc by a fraction
t of the distance from v 0 to v 1 . If we let ω 13 be the angle intercepted by
the arc from v 0 to v 1 , then v t is the result of rotating v 0 around this arc
by an angle of tω.
Figure 8.11
Interpolating a rotation
We can express v t as a linear combination of v 0 and v 1 . In other words,
there exist nonnegative constants k 0 and k 1 such that v t = k 0 v 0 + k 1 v 1 .
We can use elementary geometry to determine the values of k 0 and k 1 .
Figure 8.12 shows how this can be done.
13 This is the Greek letter omega, pronounced “oh-MAY-guh.”
Search WWH ::




Custom Search