Spherical linear interpolation, commonly abbreviated slerp, is a method of interpolation between two unit vectors that follows a great-circle arc at constant angular speed. Unlike ordinary linear interpolation, which follows a straight chord through the ambient space, slerp remains on the unit sphere. It is especially important for interpolating three-dimensional orientations represented by unit quaternions, with applications in animation, robotics, camera motion, and simulation.
Definition
Let and be unit vectors in a real inner-product space, and let their angular separation be
For , spherical linear interpolation is defined by
The parameter specifies the fraction of the angular journey completed. In particular,
The result has unit norm throughout the interpolation. Although the expression is a linear combination of the endpoints, its coefficients are trigonometric functions of , rather than the ordinary linear weights and . The word “linear” refers to the uniform progression of angle and arc length.
The definition applies in any finite-dimensional Euclidean space, not just three dimensions. Provided the endpoints are neither identical nor antipodal, their span determines a plane, and the interpolation follows the shorter arc of the unit circle in that plane.
Geometric interpretation and derivation
Define
Then and are orthogonal unit vectors, and
A point rotating uniformly from toward can therefore be written as
Substitution of the expression for , followed by a trigonometric identity, gives the standard slerp formula.
This representation establishes its principal properties:
- Unit length: .
- Constant speed: .
- Uniform angular progress: the angle from to is for .
- Shortest spherical path: for non-antipodal endpoints, the curve is the unique shortest geodesic segment on the unit sphere.
The derivative is
If , where denotes physical time and is the interpolation duration, the angular speed is .
Example
For
the separation is , so
At , the result is
the midpoint of the quarter-circle arc.
Quaternion rotation interpolation
A unit quaternion represents a three-dimensional rotation. With scalar-first notation, a rotation through angle about a unit axis is represented by
Unit quaternions form the unit sphere in four-dimensional Euclidean space. Slerp can therefore be applied directly to their four components.
The quaternion sign ambiguity
The quaternions and represent the same physical rotation. Consequently, the shorter arc between two particular quaternion representatives need not represent the shortest motion between their orientations.
For shortest-path rotation interpolation, implementations ordinarily compute the dot product
and replace by when . This selects representatives with nonnegative dot product, giving a quaternion separation no greater than . The corresponding physical rotation angle is
which lies between and .
Thus, constant angular speed on the quaternion sphere corresponds to constant physical angular speed, with a factor of two between the angles.
Sign selection is specific to rotation representation. For ordinary direction vectors, and generally represent different directions and cannot be interchanged.
Relative-rotation form
After choosing quaternion representatives and a consistent logarithm branch, slerp can also be expressed as
or
Here quaternion powers are defined using the quaternion exponential and logarithm. The formula applies a fixed relative rotation at a uniformly increasing angle.
This interpretation connects slerp to the geometry of Lie groups. Three-dimensional rotations form the group , while unit quaternions provide a two-to-one representation of that group.
A pair of endpoint orientations alone does not specify extra revolutions or an intended long rotation. Such motion requires additional information, such as intermediate orientations or an explicit rotation axis and accumulated angle.
Comparison with linear interpolation
Ordinary linear interpolation gives
For distinct unit endpoints, its interior points generally lie inside the sphere. Normalizing the result gives normalized linear interpolation, often called nlerp:
For non-antipodal endpoints, nlerp follows the same shorter great-circle arc as slerp, but generally at a nonconstant angular speed. It agrees with slerp at both endpoints and at the midpoint.
Nlerp avoids trigonometric evaluations and is often a useful approximation when the endpoints are close. Slerp is preferable when uniform angular timing is important. Neither method automatically supplies smooth acceleration at transitions between independently interpolated segments.
Degenerate cases and numerical evaluation
Identical or nearly identical endpoints
If , the natural interpolation is the constant path
The standard formula is formally undefined because , although the limiting path is well defined.
For small nonzero , direct evaluation can lose accuracy. Practical implementations often switch to normalized linear interpolation below a small angular threshold. Another formulation uses
to write
Evaluating sinc near zero with a suitable Taylor series avoids the removable singularity.
Antipodal endpoints
If , then , and the standard formula is undefined. On spheres of dimension at least two, infinitely many shortest semicircular paths connect the endpoints. The endpoints alone do not determine which one to choose.
Given an additional orthogonal unit vector , one possible path is
Near-antipodal interpolation is also sensitive to small endpoint changes because those changes can substantially alter the selected great-circle plane.
For quaternion rotations, antipodal quaternions represent the same orientation, so sign correction turns this case into a constant orientation path. By contrast, orientations separated by exactly admit two equally short rotational paths.
Floating-point considerations
Floating-point arithmetic can produce a dot product slightly outside , even when the input vectors are intended to have unit length. Implementations commonly normalize inputs, clamp the computed dot product before applying arccosine, handle small-angle cases separately, and renormalize the output when necessary. These measures address numerical stability without changing the underlying geometric definition.
Applications and limitations
Slerp is used for orientation changes in character animation, camera systems, robotic mechanisms, and spacecraft attitude trajectories. For ordinary unit vectors, it interpolates directions and points on a spherical model. Geographic great-circle interpolation assumes a spherical surface; it does not by itself solve geodesic problems on an ellipsoid.
The method became established in computer graphics through Ken Shoemake’s 1985 work on quaternion rotation curves.
A single slerp segment is smooth away from its degenerate cases. A sequence of segments passing through multiple key orientations, however, generally has discontinuous angular velocity at the joins. Higher-order quaternion curves, including spherical cubic constructions, use additional control information to improve continuity.
Replacing by an easing function preserves the arc but changes its timing. This permits acceleration and deceleration, while giving up constant angular speed with respect to the original parameter.
The same formulas can extrapolate beyond , continuing around the chosen great circle. Outside the interpolation interval, the traversed arc need not be the shortest path from the initial point. Slerp also interpolates only spherical data: translations, scales, and general transformations represented by a matrix require separate treatment.