|
|
(One intermediate revision by one other user not shown) |
Line 1: |
Line 1: |
| In [[computer graphics]], '''Slerp''' is shorthand for '''s'''pherical '''l'''inear int'''erp'''olation, introduced by Ken Shoemake in the context of [[quaternion]] [[interpolation]] for the purpose of [[animation|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.
| | Hello. Let me introduce the writer. Her title is Emilia Shroyer but it's not the most feminine name out there. Body developing is what my family and I appreciate. My family members life in Minnesota and my family loves it. Bookkeeping is her working day occupation now.<br><br>My website :: [http://Tinyurl.com/k7cuceb http://Tinyurl.com/k7cuceb] |
| | |
| ==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''<sub>0</sub> and ''p''<sub>1</sub> be the first and last points of the arc, and let ''t'' be the parameter, 0 ≤ ''t'' ≤ 1. Compute Ω as the angle [[Subtended angle|subtended]] by the arc, so that {{nowrap|cos Ω = ''p''<sub>0</sub> ∙ ''p''<sub>1</sub>}}, the ''n''-dimensional [[dot product]] of the unit vectors from the origin to the ends. The geometric formula is then
| |
| | |
| :<math> \mathrm{Slerp}(p_0,p_1; t) = \frac{\sin {[(1-t)\Omega}]}{\sin \Omega} p_0 + \frac{\sin [t\Omega]}{\sin \Omega} p_1.</math>
| |
| | |
| The symmetry can be seen in the fact that {{nowrap|Slerp(''p''<sub>0</sub>, ''p''<sub>1</sub>; ''t'')}} = {{nowrap|Slerp(''p''<sub>1</sub>, ''p''<sub>0</sub>; 1 − ''t'')}}. In the limit as Ω → 0, this formula reduces to the corresponding symmetric formula for [[linear interpolation]],
| |
| | |
| :<math> \mathrm{Slerp}(p_0,p_1; t) = (1-t) p_0 + t p_1.\,\!</math>
| |
| | |
| 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]].
| |
| | |
| [[Image:Slerp factor explanation.png|right|thumb|Oblique vector rectifies to Slerp factor.]]
| |
| More familiar than the general Slerp formula is the case when the end vectors are perpendicular, in which case the formula is {{nowrap|''p''<sub>0</sub> cos ''θ'' + ''p''<sub>1</sub> sin ''θ''}}. Letting {{nowrap|''θ'' = ''t'' π/2}}, and applying the trigonometric identity {{nowrap|cos ''θ'' = sin (π/2 − ''θ'')}}, this becomes the Slerp formula. The factor of {{nowrap|1/sin Ω}} in the general formula is a normalization, since a vector ''p''<sub>1</sub> at an angle of Ω to ''p''<sub>0</sub> projects onto the perpendicular ⊥''p''<sub>0</sub> with a length of only {{nowrap|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 [[Jack E. Bresenham|Bresenham's]] circle algorithm. Evaluation at the special parameter values 0 and 1 trivially yields ''p''<sub>0</sub> and ''p''<sub>1</sub>, respectively; and bisection, evaluation at ½, simplifies to {{nowrap|(''p''<sub>0</sub> + ''p''<sub>1</sub>)/2}}, normalized. Another special case, common in animation, is evaluation with fixed ends and equal parametric steps. If ''p''<sub>''k''−1</sub> and ''p''<sub>''k''</sub> are two consecutive values, and if ''c'' is twice their dot product (constant for all steps), then the next value, ''p''<sub>''k''+1</sub>, is the reflection {{nowrap|''p''<sub>''k''+1</sub> = ''c'' ''p''<sub>''k''</sub> − ''p''<sub>''k''−1</sub>}}.
| |
| | |
| ==Quaternion Slerp==
| |
| When Slerp is applied to unit [[quaternion]]s, the quaternion path maps to a path through 3D rotations in a [[quaternions and spatial rotation|standard way]]. The effect is a rotation with uniform [[angular velocity]] around a fixed [[axis of rotation|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 [[covering map|universal covering group]] of unit quaternions, [[3-sphere|S<sup>3</sup>]]. 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, {{nowrap|cos Ω}}, is negative, thus ensuring that −90° ≤ Ω ≤ 90°.
| |
| | |
| Slerp also has expressions in terms of quaternion algebra, all using [[exponentiation]]. [[real numbers|Real]] powers of a quaternion are defined in terms of the quaternion [[exponential function]], written as {{nowrap|''e''<sup> ''q''</sup>}} and given by the [[power series]] equally familiar from calculus, complex analysis and matrix algebra:
| |
| | |
| :<math> e^q = 1 + q + \frac{q^2}{2} + \frac{q^3}{6} + \cdots + \frac{q^n}{n!} + \cdots .</math> | |
| | |
| Writing a unit quaternion ''q'' in [[versor]] form, {{nowrap|cos Ω + '''v''' sin Ω}}, with '''v''' a unit 3-vector, and noting that the quaternion square '''v'''<sup>2</sup> equals −1 (implying a quaternion version of [[Euler's formula]]), we have {{nowrap|''e''<sup> '''v''' Ω</sup> = ''q''}}, and {{nowrap|''q''<sup> ''t''</sup> = cos ''t'' Ω + '''v''' sin ''t'' Ω}}. The identification of interest is {{nowrap|''q'' = ''q''<sub>1</sub> ''q''<sub>0</sub><sup>−1</sup>}}, so that the real part of ''q'' is {{nowrap|cos Ω}}, the same as the geometric dot product used above. Here are four equivalent quaternion expressions for Slerp.
| |
| | |
| : <math>
| |
| \begin{align}
| |
| \mathrm{Slerp}(q_0, q_1; t) & = q_0 (q_0^{-1} q_1)^t \\
| |
| & = q_1 (q_1^{-1} q_0)^{1-t} \\
| |
| & = (q_0 q_1^{-1})^{1-t} q_1 \\
| |
| & = (q_1 q_0^{-1})^t q_0
| |
| \end{align}
| |
| </math>
| |
| | |
| The [[derivative]] of {{nowrap|Slerp(''q''<sub>0</sub>, ''q''<sub>1</sub>; ''t'')}} with respect to ''t'', assuming the ends are fixed, is log(''q''<sub>1</sub>''q''<sub>0</sub><sup>−1</sup>) 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 transport]]ed 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's algorithm|de Casteljau algorithm]] for [[Bézier curve]]s. 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 [[Generalized quaternion interpolation|extended]] to interpolate among many unit quaternions, but the extension loses the [[time complexity|fixed execution-time]] of the Slerp algorithm.
| |
| | |
| ==External links==
| |
| * Ken Shoemake. [http://run.usc.edu/cs520-s12/assign2/p245-shoemake.pdf Animating rotation with quaternion curves].
| |
| * Erik B. Dam, Martin Koch, Martin Lillholm. [http://web.mit.edu/2.998/www/QuaternionReport1.pdf Quaternions, Interpolation and Animation]
| |
| * [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]
| |
| | |
| [[Category:Computer graphics algorithms]]
| |
| [[Category:Quaternions]]
| |
| [[Category:Interpolation]]
| |
| [[Category:Rotation in three dimensions]]
| |
Hello. Let me introduce the writer. Her title is Emilia Shroyer but it's not the most feminine name out there. Body developing is what my family and I appreciate. My family members life in Minnesota and my family loves it. Bookkeeping is her working day occupation now.
My website :: http://Tinyurl.com/k7cuceb