D3DXVEC2CATMULLLROM function

xiaoxiao2021-03-06  106

D3DXVEC2CATMULLLROM function

Perform CATMULL-ROM interpolation calculation. Here is 2-D vector interpolation.

definition:

D3DXVECTOR2 * WINAPI D3DXVEC2CATMULLROM

D3DXVECTOR2 * Pout,

Const d3dxvector2 * pv0,

Const d3dxvector2 * pv1,

Const d3dxvector2 * pv2,

Const d3dxvector2 * pv3,

Float S

);

parameter:

pout

[IN, OUT] points to the operation result of the D3DXVECTOR2 structure.

PV0

[in] points to the position vector of the D3DxVector2 structure.

PV1

[in] points to the position vector of the D3DxVector2 structure.

PV2

[in] points to the position vector of the D3DxVector2 structure.

PV3

[in] points to the position vector of the D3DxVector2 structure.

s

Weight factor. Review.

return value:

Point the CATMULL-ROM interpolation result of the D3DXVector2 structure.

Description:

If there are four points (P1, P2, P3, P4), find a function q (s) to satisfy the following conditions:

Q (s) is a three-function function equation.

When S ranges from 0 to 1, the Q (S) value is between P2 and P3.

When S is 0, Q (S) line is parallel to P1 and P3 straight lines.

When S is 1, Q (S) is straight in line parallel to the straight line of P2 and P4.

The CATMULL-ROM spline can also be obtained from the Hermite spline:

V1 = P2

V2 = P3

T1 = (p3 - p1) / 2

T2 = (p4 - p2) / 2

among them:

V1 is PV0.

V2 is PV1.

P3 is PV2.

P4 is PV3.

With Hermite formula:

Q (s) = (2S3 - 3S2 1) V1 (-2S3 3S2) V2 (S3 - 2S2 S) T1 (S3 - S2) T2

Switching with the above variable, the above formula is converted to:

Q (s) = (2S3 - 3S2 1) P2 (-2S3 3S2) P3 (S3 - 2S2 S) (P3 - P1) / 2 (S3 - S2) (P4 - P2) / 2

Retreating is:

Q (s) = [(-S3 2S2 - S) P1 (3S3 - 5S2 2) P2 (-3S3 4S2 S) P3 (S3 - S2) P4] / 2

Function information:

HEADER

D3DX9Math.h

Import Library

D3DX9.LIB

Minimum operation systems

WINDOWS 98

related functions:

D3DXVEC3CATMULLROM, D3DXVEC4CATMULLROM

转载请注明原文地址:https://www.9cbs.com/read-104273.html

New Post(0)