Spherical linear interpolation, usually abbreviated slerp, is a method of interpolation between two points on a sphere that moves along a great-circle arc at constant angular speed. It is the spherical counterpart of straight-line interpolation in Euclidean space. Its best-known application is interpolating three-dimensional orientations represented by unit quaternions, where it produces a rotation about a fixed axis at constant angular velocity.
Definition
Let and be unit vectors in a real inner-product space, with angle
For a parameter , spherical linear interpolation is defined by
The parameter specifies the fraction of the arc traversed:
The result remains a unit vector. Although the expression is a linear combination of the endpoints, its coefficients depend nonlinearly on and generally do not sum to one. The word linear refers to the linear progression of angular distance, not to linearity in the surrounding vector space.
The same construction works on a sphere of radius centered at the origin by normalizing the endpoints, applying slerp, and multiplying the result by . For a sphere with another center, the center is first subtracted and later restored.
Geometric interpretation
Two distinct, non-antipodal unit vectors span a plane through the origin. Its intersection with the unit sphere is a great circle, and slerp follows the shorter arc between the endpoints. This arc is a geodesic of the sphere.
Define
Then and are orthogonal unit vectors, and the interpolation can be rewritten as
This form makes the circular motion explicit. Differentiating gives
so its norm is constant:
Consequently, the arc length traveled from to is on the unit sphere. If the motion lasts a physical time , its angular speed is .
The second derivative satisfies
Thus, the acceleration points radially inward and has no component tangent to the sphere. This is another characterization of constant-speed geodesic motion.
Example
For
the endpoint angle is , and
At , the result is
the midpoint of the quarter-circle arc.
Quaternion interpolation of rotations
A unit quaternion represents a three-dimensional rotation. In scalar–vector notation, a rotation through angle about a unit axis is represented by
Unit quaternions lie on the three-dimensional unit sphere in four-dimensional Euclidean space. Applying slerp to two such quaternions therefore preserves their unit length.
Double representation and the shortest rotation
The quaternions and represent the same physical rotation. This double representation is essential when selecting the interpolation path.
Given unit quaternions and , implementations commonly compute their four-dimensional dot product
If , is replaced by . This selects the nearer quaternion representative and ensures that the interpolated orientations follow a shortest rotational path.
After this sign choice,
lies between and . The corresponding physical rotation angle between the endpoint orientations is , because quaternion coordinates use half-angles.
When the relative physical rotation is exactly , there are two equally short rotational paths. The endpoints alone do not distinguish between them; an additional convention or continuity requirement is needed.
Relative-rotation form
Quaternion slerp can also be expressed as
with a consistent branch chosen for the quaternion power. Equivalently,
This formula expresses interpolation as taking a fraction of the relative rotation. Quaternion multiplication is not commutative, so the multiplication order must be preserved.
The construction is related to interpolation on a Lie group. For three-dimensional rotations, it corresponds to a constant-speed geodesic under the usual rotation-invariant metric. In matrix form, the analogous expression is
where the exponential is the matrix exponential and the logarithm must again be chosen consistently.
Degenerate cases and numerical implementation
Coincident endpoints
When , the displayed sine-weight formula has a removable singularity because . The natural definition is
For nearly coincident endpoints, directly evaluating the formula can involve division by a small number. A common implementation switches to normalized linear interpolation when the dot product is sufficiently close to one.
Another expression uses the function , extended continuously by :
Near zero, sinc can be evaluated using its Taylor series.
Antipodal endpoints
When , the endpoints do not specify a unique great-circle arc. On spheres of dimension at least two, infinitely many semicircular paths connect them. An additional direction is required to choose one.
If is a selected unit vector orthogonal to , a possible interpolation is
This ambiguity is geometric, not merely a numerical defect. Near-antipodal interpolation is also sensitive to small endpoint perturbations.
For rotations represented by quaternions, exactly antipodal quaternion endpoints represent the same orientation. Sign correction reduces that case to coincident endpoints rather than requiring a semicircular path.
Floating-point precautions
With floating-point arithmetic, an inner product of nominally unit vectors may fall slightly outside . Practical implementations normalize the inputs and clamp the computed dot product before applying .
An angle may alternatively be computed as
This can improve angle evaluation near coincident endpoints, although it does not remove the underlying ambiguity near antipodal endpoints. Numerical stability also depends on how normalization and the nearly parallel cases are handled.
Comparison with linear interpolation
Ordinary linear interpolation is
For distinct unit endpoints and , this follows the chord inside the sphere rather than its surface.
Normalized linear interpolation is
For non-antipodal endpoints, nlerp traces the same shorter great-circle arc as slerp, but generally at a nonconstant angular speed. It avoids trigonometric evaluation and closely approximates slerp for small endpoint angles. At antipodal endpoints, its denominator vanishes at .
Thus, the main distinction is not necessarily the geometric path but its parameterization: slerp advances uniformly in angle, whereas nlerp generally does not.
History, applications, and limitations
Ken Shoemake introduced quaternion slerp to computer graphics in the 1985 paper Animating Rotation with Quaternion Curves. It became a standard technique for orientation interpolation in animation, camera motion, robotics, and simulation.
Beyond quaternions, slerp interpolates unit directions and other normalized vectors in arbitrary finite dimensions. Its geometric meaning depends on the chosen inner product: it is not a general interpolation rule for every curved manifold.
A single slerp segment determines a fixed path and a constant speed, but joining several segments does not generally produce continuous velocity at their junctions. Smooth multi-keyframe animation therefore often uses higher-order spherical curves rather than independent slerp segments.
Likewise, constant angular speed may be unsuitable when a motion should accelerate or decelerate. Replacing with a nonlinear timing function preserves the arc but changes the speed. Endpoint orientations alone also do not encode extra complete revolutions; these require additional path information.