Slerp

Last updated

In computer graphics, slerp is shorthand for spherical linear interpolation, introduced by Ken Shoemake [1] 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.

Contents

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 p0 and p1 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 Ω = p0p1, the n-dimensional dot product of the unit vectors from the origin to the ends. The geometric formula is then

The symmetry lies in the fact that slerp(p0, p1; t)= slerp(p1, p0; 1 − t). In the limit as Ω → 0, this formula reduces to the corresponding symmetric formula for linear interpolation,

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.

Oblique vector rectifies to slerp factor. Slerp factor explanation.png
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 p0cos θ + p1sin θ. 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 p1 at an angle of Ω to p0 projects onto the perpendicular ⊥p0 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 p0 and p1, respectively; and bisection, evaluation at 1/2, simplifies to (p0 + p1)/2, normalized. Another special case, common in animation, is evaluation with fixed ends and equal parametric steps. If pk−1 and pk are two consecutive values, and if c is twice their dot product (constant for all steps), then the next value, pk+1, is the reflection pk+1 = cpkpk−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. Real powers of a quaternion are defined in terms of the quaternion exponential function, written as eq and given by the power series equally familiar from calculus, complex analysis and matrix algebra:

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 evΩ = q, and qt = cos tΩ + v sin tΩ. The identification of interest is q = q1q0−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(q0, q1; t) with respect to t, assuming the ends are fixed, is log(q1q0−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, [2] but the extension loses the fixed execution-time of the slerp algorithm.

See also

Related Research Articles

<span class="mw-page-title-main">Centripetal force</span> Force directed to the center of rotation

A centripetal force is a force that makes a body follow a curved path. The direction of the centripetal force is always orthogonal to the motion of the body and towards the fixed point of the instantaneous center of curvature of the path. Isaac Newton described it as "a force by which bodies are drawn or impelled, or in any way tend, towards a point as to a centre". In the theory of Newtonian mechanics, gravity provides the centripetal force causing astronomical orbits.

<span class="mw-page-title-main">Polar coordinate system</span> Coordinates determined by distance and angle

In mathematics, the polar coordinate system is a two-dimensional coordinate system in which each point on a plane is determined by a distance from a reference point and an angle from a reference direction. The reference point is called the pole, and the ray from the pole in the reference direction is the polar axis. The distance from the pole is called the radial coordinate, radial distance or simply radius, and the angle is called the angular coordinate, polar angle, or azimuth. Angles in polar notation are generally expressed in either degrees or radians.

<span class="mw-page-title-main">3-sphere</span> Mathematical object

In mathematics, a 3-sphere, glome or hypersphere is a higher-dimensional analogue of a sphere. It may be embedded in 4-dimensional Euclidean space as the set of points equidistant from a fixed central point. Analogous to how the boundary of a ball in three dimensions is an ordinary sphere, the boundary of a ball in four dimensions is a 3-sphere. A 3-sphere is an example of a 3-manifold and an n-sphere.

Kinematics is a subfield of physics, developed in classical mechanics, that describes the motion of points, bodies (objects), and systems of bodies without considering the forces that cause them to move. Kinematics, as a field of study, is often referred to as the "geometry of motion" and is occasionally seen as a branch of mathematics. A kinematics problem begins by describing the geometry of the system and declaring the initial conditions of any known values of position, velocity and/or acceleration of points within the system. Then, using arguments from geometry, the position, velocity and acceleration of any unknown parts of the system can be determined. The study of how forces act on bodies falls within kinetics, not kinematics. For further details, see analytical dynamics.

<span class="mw-page-title-main">Hyperboloid</span> Unbounded quadric surface

In geometry, a hyperboloid of revolution, sometimes called a circular hyperboloid, is the surface generated by rotating a hyperbola around one of its principal axes. A hyperboloid is the surface obtained from a hyperboloid of revolution by deforming it by means of directional scalings, or more generally, of an affine transformation.

In mechanics and geometry, the 3D rotation group, often denoted SO(3), is the group of all rotations about the origin of three-dimensional Euclidean space under the operation of composition.

Unit quaternions, known as versors, provide a convenient mathematical notation for representing spatial orientations and rotations of elements in three dimensional space. Specifically, they encode information about an axis-angle rotation about an arbitrary axis. Rotation and orientation quaternions have applications in computer graphics, computer vision, robotics, navigation, molecular dynamics, flight dynamics, orbital mechanics of satellites, and crystallographic texture analysis.

In the mathematical field of differential geometry, a metric tensor is an additional structure on a manifold M that allows defining distances and angles, just as the inner product on a Euclidean space allows defining distances and angles there. More precisely, a metric tensor at a point p of M is a bilinear form defined on the tangent space at p, and a metric tensor on M consists of a metric tensor at each point p of M that varies smoothly with p.

<span class="mw-page-title-main">Rotation (mathematics)</span> Motion of a certain space that preserves at least one point

Rotation in mathematics is a concept originating in geometry. Any rotation is a motion of a certain space that preserves at least one point. It can describe, for example, the motion of a rigid body around a fixed point. Rotation can have a sign (as in the sign of an angle): a clockwise rotation is a negative magnitude so a counterclockwise turn has a positive magnitude. A rotation is different from other types of motions: translations, which have no fixed points, and (hyperplane) reflections, each of them having an entire (n − 1)-dimensional flat of fixed points in a n-dimensional space.

<span class="mw-page-title-main">Hopf fibration</span> Fiber bundle of the 3-sphere over the 2-sphere, with 1-spheres as fibers

In the mathematical field of differential topology, the Hopf fibration describes a 3-sphere in terms of circles and an ordinary sphere. Discovered by Heinz Hopf in 1931, it is an influential early example of a fiber bundle. Technically, Hopf found a many-to-one continuous function from the 3-sphere onto the 2-sphere such that each distinct point of the 2-sphere is mapped from a distinct great circle of the 3-sphere. Thus the 3-sphere is composed of fibers, where each fiber is a circle — one for each point of the 2-sphere.

In linear algebra, a rotation matrix is a transformation matrix that is used to perform a rotation in Euclidean space. For example, using the convention below, the matrix

In mathematics and physics, the Christoffel symbols are an array of numbers describing a metric connection. The metric connection is a specialization of the affine connection to surfaces or other manifolds endowed with a metric, allowing distances to be measured on that surface. In differential geometry, an affine connection can be defined without reference to a metric, and many additional concepts follow: parallel transport, covariant derivatives, geodesics, etc. also do not require the concept of a metric. However, when a metric is available, these concepts can be directly tied to the "shape" of the manifold itself; that shape is determined by how the tangent space is attached to the cotangent space by the metric tensor. Abstractly, one would say that the manifold has an associated (orthonormal) frame bundle, with each "frame" being a possible choice of a coordinate frame. An invariant metric implies that the structure group of the frame bundle is the orthogonal group O(p, q). As a result, such a manifold is necessarily a (pseudo-)Riemannian manifold. The Christoffel symbols provide a concrete representation of the connection of (pseudo-)Riemannian geometry in terms of coordinates on the manifold. Additional concepts, such as parallel transport, geodesics, etc. can then be expressed in terms of Christoffel symbols.

In mathematics, the group of rotations about a fixed point in four-dimensional Euclidean space is denoted SO(4). The name comes from the fact that it is the special orthogonal group of order 4.

<span class="mw-page-title-main">Spherical law of cosines</span> Mathematical relation in spherical triangles

In spherical trigonometry, the law of cosines is a theorem relating the sides and angles of spherical triangles, analogous to the ordinary law of cosines from plane trigonometry.

<span class="mw-page-title-main">Great-circle navigation</span> Flight or sailing route along the shortest path between two points on a globes surface

Great-circle navigation or orthodromic navigation is the practice of navigating a vessel along a great circle. Such routes yield the shortest distance between two points on the globe.

In geometry, various formalisms exist to express a rotation in three dimensions as a mathematical transformation. In physics, this concept is applied to classical mechanics where rotational kinematics is the science of quantitative description of a purely rotational motion. The orientation of an object at a given instant is described with the same tools, as it is defined as an imaginary rotation from a reference placement in space, rather than an actually observed rotation from a previous placement in space.

<span class="mw-page-title-main">Axis–angle representation</span> Parameterization of a rotation into a unit vector and angle

In mathematics, the axis–angle representation parameterizes a rotation in a three-dimensional Euclidean space by two quantities: a unit vector e indicating the direction (geometry) of an axis of rotation, and an angle of rotation θ describing the magnitude and sense of the rotation about the axis. Only two numbers, not three, are needed to define the direction of a unit vector e rooted at the origin because the magnitude of e is constrained. For example, the elevation and azimuth angles of e suffice to locate it in any particular Cartesian coordinate frame.

<span class="mw-page-title-main">Biarc</span>

A biarc is a smooth curve formed from two circular arcs. In order to make the biarc smooth, the two arcs should have the same tangent at the connecting point where they meet.

In the differential geometry of surfaces, a Darboux frame is a natural moving frame constructed on a surface. It is the analog of the Frenet–Serret frame as applied to surface geometry. A Darboux frame exists at any non-umbilic point of a surface embedded in Euclidean space. It is named after French mathematician Jean Gaston Darboux.

In mathematics, quaternionic analysis is the study of functions with quaternions as the domain and/or range. Such functions can be called functions of a quaternion variable just as functions of a real variable or a complex variable are called.

References

  1. "Ken Shoemake - Home".
  2. Pennec, Xavier (March 1998). Computing the Mean of Geometric Features Application to the Mean Rotation (report). INRIA. Retrieved 19 June 2020.