Click or drag to resize
DigitalRuneInterpolationHelperSquad Method (QuaternionF, QuaternionF, QuaternionF, QuaternionF, Single)
Interpolates between quaternions using spherical quadrangle interpolation (single-precision).

Namespace: DigitalRune.Mathematics.Interpolation
Assembly: DigitalRune.Mathematics (in DigitalRune.Mathematics.dll) Version: 1.14.0.0 (1.14.0.14427)
Syntax
public static QuaternionF Squad(
	QuaternionF q,
	QuaternionF a,
	QuaternionF b,
	QuaternionF p,
	float t
)

Parameters

q
Type: DigitalRune.Mathematics.AlgebraQuaternionF
The source quaternion (qn).
a
Type: DigitalRune.Mathematics.AlgebraQuaternionF
The first intermediate quaternion (an).
b
Type: DigitalRune.Mathematics.AlgebraQuaternionF
The second intermediate quaternion (an+1).
p
Type: DigitalRune.Mathematics.AlgebraQuaternionF
The target quaternion (qn+1).
t
Type: SystemSingle
The interpolation parameter t.

Return Value

Type: QuaternionF
The interpolated quaternion.
Remarks

The spherical quadrangle interpolation (SQUAD) is a spline-based interpolation of rotations (unit quaternion). This operation is also known as spherical cubic interpolation.

If qn is a sequence of N quaternions (n = 0 to N-1), then the smooth interpolation is given by:

squad(qn, an, an+1, qn+1, t) = slerp(slerp(qn, qn+1, t), slerp(an, an+1, t), 2t(1-t)) where

  • qn, qn+1 represent start and destination rotation,
  • t is the interpolation parameter which lies in the interval [0, 1], and
  • an, an+1 are intermediate quaternions which can be determined with:

    an = qn e-(ln(qn-1qn-1) + ln(qn-1qn+1))/4

Examples
The following example demonstrates how to interpolate quaternions using Squad(QuaternionF, QuaternionF, QuaternionF, QuaternionF, Single):
// Given:
QuaternionF q0, q1, q2, q3;  // A sequence of quaternions
float t;                     // A interpolation parameter

// We want to interpolate between q1 and q2 by an interpolation factor t
QuaternionF q, a, b, p;
QuaternionF.SquadSetup(q0, q1, q2, q3, out q, out a, out b, out p);
QuaternionF result = QuaternionF.Squad(q, a, b, p, t);
See Also