D3DXVEC2HERMite function

xiaoxiao2021-03-06  107

D3DXVEC2HERMite function

Perform the Hermite spike interpolation, here is 2D vector interpolation.

definition:

D3DXVECTOR2 * WINAPI D3DXVEC2HERMITE (

D3DXVECTOR2 * Pout,

Const d3dxvector2 * pv1,

Const d3dxvector2 * pt1,

Const d3dxvector2 * pv2,

Const d3dxvector2 * pt2,

Float S

);

parameter:

pout

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

PV1

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

PT1

[in] Points to the slice of D3DxVector2 structure.

PV2

[in] pointing to the source location vector of the D3DxVector2 structure.

PT2

[in] Points to the slice of D3DxVector2 structure.

s

[IN] Weight Coefficient, see instructions.

return value:

Point the Hermite spike interpolation of the D3DXVector2 structure.

Description:

The D3DxVec2hermite function is used by Hermite to Positiona, Tangenta, and the Hermite interpolation is interpolated polynomial and interpolation.

Because the splines are smoothly connected, it is smoothly connected. Slope is mainly determined by Q (s) attributes:

Q (s) = as3 bs2 cs d (and q '(s) = 3AS2 2BS C)

a) q (0) = V1, SO q '(0) = T1

b) q (1) = v2, so q '(1) = T2

V1 is PV1, V2 is PV2, T1 is PT1, T2 is PT2.

These parameters are used to solve A, B, C, D.

D = V1 (from a)

C = T1 (from a)

3A 2B = T2 - T-1 (Substitude for C)

A B = V2 - V1 - T1 (Substitude For C and D)

The Q (s) can be written from the above calculation of A, B, C, D.

A = 2V1 - 2V2 T2 T1

B = 3V2 - 3V1 - 2T1 - T2

C = T1

D = V1

Then it is:

Q (s) = (2V1 - 2V2 T2 T1) S3 (3V2 - 3V1 - 2T1 - T2) S2 T1S V1.

// After reorganizing:

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

Hermite interpolation is very useful in control animation because it passes each control point because those points are equivalent to each keyframe, and it is the location and tangent, so you can easily match the starting point and end of each grade. Create a C2 consecutive curve.

The function return value is the same as the POUT parameter. This allows functions D3DXVEC2HERMITE as a parameter of other functions.

Function information:

HEADER

D3DX9Math.h

Import Library

D3DX9.LIB

Minimum operation systems

WINDOWS 98

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

New Post(0)