Interpolates between two unit quaternions, using spherical linear interpolation.
XMVECTOR XMQuaternionSlerp(
XMVECTOR Q0,
XMVECTOR Q1,
float t
)
Q0
Type: XMVECTOR
Unit quaternion to interpolate from.
Q1
Type: XMVECTOR
Unit quaternion to interpolate to.
t
Type: float
Interpolation control factor.
Type: XMVECTOR
Returns the interpolated quaternion. If Q0 and Q1 are not unit quaternions, the resulting interpolation is undefined.
The DirectXMath quaternion functions use an XMVECTOR 4-vector to represent quaternions, where the X, Y, and Z components are the vector part and the W component is the scalar part.
When t is 0.0f, the function returns Q0. When t is 1.0f, the function returns Q1.
In most use-cases, slerp (spherical linear interpolation) is unnecessary and can be easily and efficiently approximated by nlerp (normalized linear interpolation). nlerp is implemented as follows:
XMQuaternionNormalize( XMVectorLerp( Q0, Q1, t ) );
See XMVectorLerp and XMQuaternionNormalize. For more information, see Understanding Slerp, Then Not Using It.
Header: Declared in directxmath.h.