This article includes a list ofgeneral references, butit lacks sufficient correspondinginline citations. Please help toimprove this article byintroducing more precise citations.(April 2021) (Learn how and when to remove this message) |
Incomputer graphics,slerp is shorthand forspherical linear interpolation, introduced by Ken Shoemake[1] in the context ofquaternioninterpolation for the purpose ofanimating 3Drotation. It refers to constant-speed motion along a unit-radiusgreat circle arc, given the ends and an interpolation parameter between 0 and 1.
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 alinear combination of the ends. Letp0 andp1 be the first and last points of the arc, and lett be the parameter,0 ≤t ≤ 1. Compute Ω as the anglesubtended by the arc, so thatcos Ω =p0 ⋅p1, then-dimensionaldot product of the unit vectors from the origin to the ends. The geometric formula is then
The symmetry lies in the fact thatslerp(p0,p1;t)= slerp(p1,p0; 1 −t). In the limit asΩ → 0, this formula reduces to the corresponding symmetric formula forlinear 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 sphericalgeodesic.

More familiar than the general slerp formula is the case when the end vectors are perpendicular, in which case the formula isp0cosθ +p1sinθ. Lettingθ =tπ/2, and applying the trigonometric identitycosθ = sin(π/2 −θ), this becomes the slerp formula. The factor of1/sin Ω in the general formula is a normalization, since a vectorp1 at an angle of Ω top0 projects onto the perpendicular ⊥p0 with a length of onlysin Ω.
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 ofBresenham'scircle algorithm. Evaluation at the special parameter values 0 and 1 trivially yieldsp0 andp1, respectively; and bisection, evaluation at 1/2, simplifies to(p0 +p1)/2, normalized. Another special case, common in animation, is evaluation with fixed ends and equal parametric steps. Ifpk−1 andpk are two consecutive values, and ifc is twice their dot product (constant for all steps), then the next value,pk+1, is the reflectionpk+1 =cpk −pk−1.
When slerp is applied to unitquaternions, the quaternion path maps to a path through 3D rotations in astandard way. The effect is a rotation with uniformangular velocity around a fixedrotation axis. When the initial end point is the identity quaternion, slerp gives a segment of aone-parameter subgroup of both theLie group of 3D rotations,SO(3), and itsuniversal covering group of unit quaternions,S3. Slerp gives a straightest and shortest path between its quaternion end points, and maps to a rotation through an angle of 2Ω. However, because the covering is double (q and −q map to the same rotation), the rotation path may turn either the "short way" (less than 180°) or the "long way" (more than 180°). Long paths can be prevented by negating one end if the dot product,cos Ω, is negative, thus ensuring that−90° ≤ Ω ≤ 90°.
Slerp also has expressions in terms of quaternion algebra, all usingexponentiation.Real powers of a quaternion are defined in terms of the quaternionexponential function, written aseq and given by thepower series equally familiar from calculus, complex analysis and matrix algebra:
Writing a unit quaternionq inversor form,cos Ω +v sin Ω, withv a unit 3-vector, and noting that the quaternion squarev2 equals −1 (implying a quaternion version ofEuler's formula), we havee vΩ =q, andqt = costΩ +v sintΩ. The identification of interest isq =q1q0−1, so that the real part ofq iscos Ω, the same as the geometric dot product used above. Here are four equivalent quaternion expressions for slerp.
Thederivative ofslerp(q0,q1;t) with respect tot, assuming the ends are fixed, is log(q1q0−1) times the function value, where the quaternionnatural logarithm in this case yields half the 3Dangular velocity vector. The initial tangent vector isparallel transported to each tangent along the curve; thus the curve is, indeed, a geodesic.
In thetangent space at any point on a quaternion slerp curve, the inverse of theexponential map transforms the curve into a line segment. Slerp curves not extending through a point fail to transform into lines in that point's tangent space.
Quaternion slerps are commonly used to construct smooth animation curves by mimicking affine constructions like thede Casteljau algorithm forBézier curves. Since the sphere is not anaffine space, familiar properties of affine constructions may fail, though the constructed curves may otherwise be entirely satisfactory. For example, the de Casteljau algorithm may be used to split a curve in affine space; this does not work on a sphere.
The two-valued slerp can be extended to interpolate among many unit quaternions,[2] but the extension loses thefixed execution-time of the slerp algorithm.