Game Development Reference
In-Depth Information
Figure 8.12
Interpolating a vector about an arc
Applying some trig to the right triangle with k 1 v 1 as the hypotenuse
(and recalling that v 1 is a unit vector), we see that
sinω = sintω
k 1
,
k 1 = sintω
sinω .
A similar technique to solve for k 0 yields the following result:
k 0 = sin(1 − t)ω
sinω
.
Thus, v t can be expressed as
v t = k 0 v 0 + k 1 v 1 = sin(1 − t)ω
sinω
v 0 + sintω
sinω v 1 .
The same basic idea can be extended into quaternion space, and we can
reformulate the slerp as
slerp( q 0 , q 1 ,t) = sin(1 − t)ω
sinω
q 0 + sintω
Quaternion slerp in
practice
sinω q 1 .
We just need a way to compute ω, the “angle” between the two quater-
nions. As it turns out, an analogy from 2D vector math can be carried into
quaternion space; we can think of the quaternion dot product as returning
cosω.
There are two slight complications. First, the two quaternions q and
q represent the same orientation, but may produce different results when
 
Search WWH ::




Custom Search