Geometric Slerp
Slerp has a geometric formula independent of quaternions, and independent of the dimension of the space in which the arc is embedded. This formula, a symmetric weighted sum credited to Glenn Davis, is based on the fact that any point on the curve must be a linear combination of the ends. Let p0 and p1 be the first and last points of the arc, and let t be the parameter, 0 ≤ t ≤ 1. Compute Ω as the angle subtended by the arc, so that cos Ω = p0 ∙ p1, the n-dimensional dot product of the unit vectors from the origin to the ends. The geometric formula is then
The symmetry can be seen in the fact that Slerp(p0, p1; t) = Slerp(p1, p0; 1 − t). In the limit as Ω → 0, this formula reduces to the corresponding symmetric formula for linear interpolation,
A Slerp path is, in fact, the spherical geometry equivalent of a path along a line segment in the plane; a great circle is a spherical geodesic.
More familiar than the general Slerp formula is the case when the end vectors are perpendicular, in which case the formula is p0 cos θ + p1 sin θ. Letting θ = t π/2, and applying the trigonometric identity cos θ = sin (π/2 − θ), this becomes the Slerp formula. The factor of 1/sin Ω in the general formula is a normalization, since a vector p1 at an angle of Ω to p0 projects onto the perpendicular ⊥p0 with a length of only sin Ω.
Some special cases of Slerp admit more efficient calculation. When a circular arc is to be drawn into a raster image, the preferred method is some variation of Bresenham's circle algorithm. Evaluation at the special parameter values 0 and 1 trivially yields p0 and p1, respectively; and bisection, evaluation at ½, simplifies to (p0 + p1)/2, normalized. Another special case, common in animation, is evaluation with fixed ends and equal parametric steps. If pk−1 and pk are two consecutive values, and if c is twice their dot product (constant for all steps), then the next value, pk+1, is the reflection pk+1 = c pk − pk−1.
Read more about this topic: Slerp
Famous quotes containing the word geometric:
“In mathematics he was greater
Than Tycho Brahe, or Erra Pater:
For he, by geometric scale,
Could take the size of pots of ale;
Resolve, by sines and tangents straight,
If bread and butter wanted weight;
And wisely tell what hour o th day
The clock doth strike, by algebra.”
—Samuel Butler (16121680)