ArticleslgStudy

computer science

Spherical linear interpolation

Spherical linear interpolation is a computer science topic covered in the lgStudy science library. This page brings together a partial reference excerpt, illustrations, worked examples, real-world applications and a short study plan, so you can understand Spherical linear interpolation rather than just read about it. In short: 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.

Spherical linear interpolation — main illustration
Spherical linear interpolation — illustration

Key takeaways

  • Spherical linear interpolation belongs to computer science; place it in that map before memorising details.
  • Learn the definition first, then one example that makes the definition concrete.
  • Connect Spherical linear interpolation to a quantity you can measure, compute or draw — that is where exam questions come from.
  • Reproduce the core statement of Spherical linear interpolation from memory before moving on to harder problems.

Reference excerpt

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.

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

slerp⁡(p0,p1;t)=sin⁡[(1−t)Ω]sin⁡Ωp0+sin⁡[tΩ]sin⁡Ωp1. 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,

slerp⁡(p0,p1;t)=(1−t)p0+tp1. 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 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 = cpk − pk−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:

eq=1+q+q22+q36+⋯+qnn!+⋯. 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 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.

slerp⁡(q0,q1,t)=q0(q0−1q1)t=q1(q1−1q0)1−t=(q0q1−1)1−tq1=(q1q0−1)tq0 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, but the extension loses the fixed execution-time of the slerp algorithm.

See also Quaternions and spatial rotation Spherical mean (statistics)

References

External links

Worked examples

Example 1 — a first encounter with Spherical linear interpolation

Start with the simplest possible case. Write down what Spherical linear interpolation claims or describes in one sentence, then invent the smallest concrete situation in which that sentence is true. In computer science, the smallest case is usually a single object, a single equation or a single measurement. Check that every symbol or term in your sentence has a meaning in that case.

Example 2 — changing one variable

Take the situation from Example 1 and change exactly one quantity: double it, halve it, or set it to zero. Predict what should happen to Spherical linear interpolation before you calculate. Comparing your prediction with the result is the fastest way to find out whether you understand the idea or only the words.

Example 3 — an exam-style question

Typical questions about Spherical linear interpolation ask you to (a) state it precisely, (b) apply it to given data, and (c) explain a limitation. Practise writing all three answers in under five minutes; the third part is what separates a full-mark answer from an average one.

Applications of Spherical linear interpolation

In research
Spherical linear interpolation appears in computer science research whenever the underlying quantities have to be modelled precisely. Papers usually cite it as a starting assumption and then explore where it breaks down.
In technology and industry
Engineering practice reuses Spherical linear interpolation in design rules, simulations and safety margins. Knowing the idea lets you read a specification sheet and understand why the numbers look the way they do.
In the classroom
Spherical linear interpolation is common in secondary-school and first-year university syllabi. It links to neighbouring topics Computer graphics algorithms, Interpolation, Quaternions, so understanding it makes those chapters shorter.
In everyday life
Look for Spherical linear interpolation outside the textbook — in sport, cooking, traffic, electronics or the sky above you. An example you found yourself is remembered far longer than one you were given.
Ask Teacher Smith questions about this articleOpens your AI tutor with a question about “Spherical linear interpolation” →

How to study Spherical linear interpolation in 20 minutes

  1. Read the reference excerpt below once, without taking notes.
  2. Close the page and write down what Spherical linear interpolation means in your own words.
  3. Compare your version with the excerpt and mark what you missed.
  4. Work through the three examples above with pen and paper.
  5. Explain Spherical linear interpolation out loud to somebody else — or to Teacher Smith in the lgStudy chat.

Frequently asked questions

What is Spherical linear interpolation in simple terms?

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…

Why does Spherical linear interpolation matter?

Because it connects several computer science ideas at once: it gives you a definition you can apply, a quantity you can calculate, and a way to check whether a result is plausible.

How should I study Spherical linear interpolation?

Read the excerpt, restate it from memory, then work through the examples and applications listed on this page. The five-step study plan above takes about twenty minutes.

What does this page cover?

It gives you a compact reference excerpt plus original lgStudy explanations, examples, applications and study material on Spherical linear interpolation.

Tags

  • Computer graphics algorithms
  • Interpolation
  • Quaternions
  • Rotation in three dimensions
  • Spherical curves

Keep exploring