Function directx_math::XMVectorCatmullRom[][src]

pub fn XMVectorCatmullRom(
    Position0: FXMVECTOR,
    Position1: FXMVECTOR,
    Position2: FXMVECTOR,
    Position3: GXMVECTOR,
    t: f32
) -> XMVECTOR

Performs a Catmull-Rom interpolation, using the specified position vectors.

Parameters

Position0 First position.

Position1 Second position.

Position2 Third position.

Position3 Fourth position.

t Interpolating control factor.

Return value

Returns the results of the Catmull-Rom interpolation.

The following pseudocode demonstrates the operation of the function:

XMVECTOR Result;

float t2 = t * t;
float t3 = t2* t;

float P0 = -t3 + 2.0f * t2 - t;
float P1 = 3.0f * t3 - 5.0f * t2 + 2.0f;
float P2 = -3.0f * t3 + 4.0f * t2 + t;
float P3 = t3 - t2;

Result.x = (P0 * Position0.x + P1 * Position1.x + P2 * Position2.x + P3 * Position3.x) * 0.5f;
Result.y = (P0 * Position0.y + P1 * Position1.y + P2 * Position2.y + P3 * Position3.y) * 0.5f;
Result.z = (P0 * Position0.z + P1 * Position1.z + P2 * Position2.z + P3 * Position3.z) * 0.5f;
Result.w = (P0 * Position0.w + P1 * Position1.w + P2 * Position2.w + P3 * Position3.w) * 0.5f;

return Result;

Reference

https://docs.microsoft.com/en-us/windows/win32/api/directxmath/nf-directxmath-XMVectorCatmullRom