XMVectorCatmullRom

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

Syntax

XMVECTOR XMVectorCatmullRom(
         XMVECTOR Position0,
         XMVECTOR Position1,
         XMVECTOR Position2,
         GXMVECTOR Position3,
         float t
)  

Parameters

Position0
Type: XMVECTOR 

First position.

Position1
Type: XMVECTOR 

Second position.

Position2
Type: XMVECTOR 

Third position.

Position3
Type: GXMVECTOR 

Fourth position.

t
Type: float 

Interpolating control factor.

Return value

Type: XMVECTOR 

Returns the results of the Catmull-Rom interpolation.

Remarks

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;  

Requirements

Header: Declared in directxmath.h.