Slerp

Slerp

In computer graphics, Slerp is shorthand for spherical linear interpolation, introduced by Ken Shoemake in the context of quaternion interpolation for the purpose of animating 3D rotation. It refers to constant speed motion along a unit radius great circle arc, given the ends and an interpolation parameter between 0 and 1.

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 "p"0 and "p"1 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 Ω = "p"0 ∙ "p"1, the "n"-dimensional dot product of the unit vectors from the origin to the ends. The geometric formula is then

: mathrm{Slerp}(p_0,p_1; t) = frac{sin {(1-t)Omega{sin Omega} p_0 + frac{sin tOmega}{sin Omega} p_1.

The symmetry can be seen in the fact that Slerp("p"0,"p"1;"t") = Slerp("p"1,"p"0;1−"t"). In the limit Ω → 0, this formula reduces to the corresponding symmetric formula for linear interpolation,

: mathrm{Lerp}(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 "p"0 cos θ + "p"1 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 "p"1 at an angle of Ω to "p"0 projects onto the perpendicular ⊥"p"0 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 "p"0 and "p"1, respectively; and bisection, evaluation at ½, simplifies to ("p"0+"p"1)/2, 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 "p""k"+1 = c"p""k" −"p""k"−1.

Quaternion Slerp

When Slerp is applied to unit quaternions, the quaternion path maps to a path through 3D rotations in a standard way. The effect is a rotation with uniform angular velocity around a fixed rotation axis. When the initial end point is the identity quaternion, Slerp gives a segment of a one-parameter subgroup of both the Lie group of 3D rotations, SO(3), and its universal 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 using exponentiation. For a quaternion "q" and a real number "t", the exponential "q" "t" is defined in terms of the exponential "e" "q", itself given by the power series familiar from complex analysis,

: 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, cos Ω + v sin Ω, with v a unit 3-vector, and noting that the quaternion square v2 equals −1 (implying a quaternion version of Euler's formula), we have "e"vΩ = "q", and "q" "t" = cos "t"Ω + v sin "t"Ω. The identification of interest is "q" = "q"1"q"0−1, so that the real part of "q" is cos Ω, the same as the geometric dot product used above. Here are four equivalent quaternion expressions for Slerp.

:

The derivative of Slerp("q"0,"q"1;"t") 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.

External links

* Ken Shoemake. [http://doi.acm.org/10.1145/325334.325242 Animating rotation with quaternion curves] .
* Erik B. Dam, Martin Koch, Martin Lillholm. [http://www.diku.dk/publikationer/tekniske.rapporter/1998/98-5.ps.gz Quaternions, Interpolation and Animation. (gzipped ps)]
* [http://number-none.com/product/Understanding%20Slerp,%20Then%20Not%20Using%20It/ Understanding Slerp, Then Not Using It]
* [http://www.theory.org/software/qfa/writeup/node12.html Brian Martin on quaternion animation]


Wikimedia Foundation. 2010.

Игры ⚽ Поможем написать курсовую

Look at other dictionaries:

  • Quaternions and spatial rotation — Unit quaternions provide a convenient mathematical notation for representing orientations and rotations of objects in three dimensions. Compared to Euler angles they are simpler to compose and avoid the problem of gimbal lock. Compared to… …   Wikipedia

  • Quaternion — Quaternions, in mathematics, are a non commutative extension of complex numbers. They were first described by the Irish mathematician Sir William Rowan Hamilton in 1843 and applied to mechanics in three dimensional space. They find uses in both… …   Wikipedia

  • Euler angles — The Euler angles were developed by Leonhard Euler to describe the orientation of a rigid body (a body in which the relative position of all its points is constant) in 3 dimensional Euclidean space. To give an object a specific orientation it may… …   Wikipedia

  • List of numerical analysis topics — This is a list of numerical analysis topics, by Wikipedia page. Contents 1 General 2 Error 3 Elementary and special functions 4 Numerical linear algebra …   Wikipedia

  • List of mathematics articles (S) — NOTOC S S duality S matrix S plane S transform S unit S.O.S. Mathematics SA subgroup Saccheri quadrilateral Sacks spiral Sacred geometry Saddle node bifurcation Saddle point Saddle surface Sadleirian Professor of Pure Mathematics Safe prime Safe… …   Wikipedia

  • Generalized quaternion interpolation — is an interpolation method used by the slerp algorithm. It is closed form and fixed time, but it cannot be applied to the more general problem of interpolating more than two unit quaternions.Definition of unconstrained interpolationGeneral… …   Wikipedia

  • Computer-Animation — Eine einfache computergenerierte Animation Computeranimation bezeichnet die computergestützte Erzeugung von Animationen. Sie verwendet die Mittel der Computergrafik und ergänzt sie um zusätzliche Techniken. Manchmal wird zwischen… …   Deutsch Wikipedia

  • Computeranimation — Eine einfache computergenerierte Animation einer archimedischen Schraube Computeranimation bezeichnet die computergestützte Erzeugung von Animationen. Sie verwendet die Mittel der Computergrafik und ergänzt sie um zusätzliche Techniken. Manchmal… …   Deutsch Wikipedia

  • Computeranimationsfilm — Eine einfache computergenerierte Animation Computeranimation bezeichnet die computergestützte Erzeugung von Animationen. Sie verwendet die Mittel der Computergrafik und ergänzt sie um zusätzliche Techniken. Manchmal wird zwischen… …   Deutsch Wikipedia

  • Computeranimierter Film — Eine einfache computergenerierte Animation Computeranimation bezeichnet die computergestützte Erzeugung von Animationen. Sie verwendet die Mittel der Computergrafik und ergänzt sie um zusätzliche Techniken. Manchmal wird zwischen… …   Deutsch Wikipedia

Share the article and excerpts

Direct link
Do a right-click on the link above
and select “Copy Link”