| InterpolationHelperSquad Method (QuaternionD, QuaternionD, QuaternionD, QuaternionD, Double) |
Interpolates between quaternions using spherical quadrangle interpolation (double-precision).
Namespace: DigitalRune.Mathematics.InterpolationAssembly: DigitalRune.Mathematics (in DigitalRune.Mathematics.dll) Version: 1.14.0.0 (1.14.0.14427)
Syntax public static QuaternionD Squad(
QuaternionD q,
QuaternionD a,
QuaternionD b,
QuaternionD p,
double t
)
Public Shared Function Squad (
q As QuaternionD,
a As QuaternionD,
b As QuaternionD,
p As QuaternionD,
t As Double
) As QuaternionD
public:
static QuaternionD Squad(
QuaternionD q,
QuaternionD a,
QuaternionD b,
QuaternionD p,
double t
)
static member Squad :
q : QuaternionD *
a : QuaternionD *
b : QuaternionD *
p : QuaternionD *
t : float -> QuaternionD
Parameters
- q
- Type: DigitalRune.Mathematics.AlgebraQuaternionD
The source quaternion (qn). - a
- Type: DigitalRune.Mathematics.AlgebraQuaternionD
The first intermediate quaternion (an). - b
- Type: DigitalRune.Mathematics.AlgebraQuaternionD
The second intermediate quaternion (an+1). - p
- Type: DigitalRune.Mathematics.AlgebraQuaternionD
The target quaternion (qn+1). - t
- Type: SystemDouble
The interpolation parameter t.
Return Value
Type:
QuaternionDThe 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(QuaternionD, QuaternionD, QuaternionD, QuaternionD, Double):
QuaternionD q0, q1, q2, q3;
double t;
QuaternionD q, a, b, p;
QuaternionD.SquadSetup(q0, q1, q2, q3, out q, out a, out b, out p);
QuaternionD result = QuaternionF.Squad(q, a, b, p, t);
See Also