Spherical linear interpolation
≈ 4 min read
Names in other languages
No names in other languages are held for this entry yet.
Article bodies are English and are not machine-translated. A name in another language is not a translation of the article.
In geometry, spherical linear interpolation, commonly abbreviated slerp, is a function which interpolates between two points on a sphere, such that spherical distance from the starting point varies uniformly with the interpolation parameter. In computer graphics, it was popularized by Ken Shoemake for animating three-dimensional rotations, represented as quaternions on an abstract 3-sphere. When the interpolation parameter represents time, spherical linear interpolation results in a constant-speed motion along a great circle arc between the endpoints or a smooth and uniform variation between two three-dimensional rotations.
In geometry, spherical linear interpolation, commonly abbreviated slerp, is a function which interpolates between two points on a sphere, such that spherical distance from the starting point varies uniformly with the interpolation parameter. In computer graphics, it was popularized by Ken Shoemake for animating three-dimensional rotations, represented as quaternions on an abstract 3-sphere. When the interpolation parameter represents time, spherical linear interpolation results in a constant-speed motion along a great circle arc between the endpoints or a smooth and uniform variation between two three-dimensional rotations. \operatorname{slerp}(p_0,p_1; t) = \frac{\sin {[(1-t)\Omega}]}{\sin \Omega} p_0 + \frac{\sin [t\Omega]}{\sin \Omega} p_1. The symmetry lies in the fact that . In the limit as , this formula reduces to the corresponding symmetric formula for linear interpolation, \operatorname{slerp}(p_0,p_1; t) = (1-t) p_0 + t p_1. 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 . Letting , and applying the trigonometric identity , this becomes the slerp formula. The factor of in the general formula is a normalization, since a vector p 1 at an angle of Ω to p 0 projects onto the perpendicular ⊥p 0 with a length of only . 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 p 0 and p 1 , respectively; and bisection, evaluation at , simplifies to , normalized. Another special case, common in animation, is evaluation with fixed ends and equal parametric steps. If p k−1 and p k are two consecutive values, and if c is twice their dot product (constant for all steps), then the next value, p k+1 , is the reflection . e^q = 1 + q + \frac{q^2}{2} + \frac{q^3}{6} + \cdots + \frac{q^n}{n!} + \cdots . Writing a unit quaternion q in versor form, , with v a unit 3-vector, and noting that the quaternion square v 2 equals −1 (implying a quaternion version of Euler's formula), we have , and . The identification of interest is , so that the real part of q is , the same as the geometric dot product used above. Here are four equivalent quaternion expressions for slerp. \begin{align} \operatorname{slerp}(q_0, q_1, t) & = q_0 (q_0^{-1} q_1)^t \\[6pt] & = q_1 (q_1^{-1} q_0)^{1-t} \\[6pt] & = (q_0 q_1^{-1})^{1-t} q_1 \\[6pt] & = (q_1 q_0^{-1})^t q_0 \end{align} The derivative of with respect to t, assuming the ends are fixed, is log(q 1 q 0 −1 ) times the function value, where the quaternion natural logarithm in this case yields half the 3D angular velocity vector. The initial tangent vector is parallel transported to each tangent along the curve; thus the curve is, indeed, a geodesic. In the tangent space at any point on a quaternion slerp curve, the inverse of the exponential 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 the de Casteljau algorithm for Bézier curves. Since the sphere is not an affine 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, but the extension loses the fixed execution-time of the slerp algorithm.
Text derived from https://en.wikipedia.org/w/index.php?oldid=1377792005 under CC BY-SA 4.0; modifications have been made.