D3DXVEC3HERMite function

xiaoxiao2021-03-06  112

D3DXVEC3HERMite function

Perform the Hermite spline interpolation, here is a 3D vector interpolation.

definition:

D3DXVECTOR3 * WINAPI D3DXVEC3HERMITE (

D3DXVECTOR3 * Pout,

Const d3dxvector3 * pv1,

Const d3dxvector3 * pt1,

Const d3dxvector3 * pv2,

Const d3dxvector3 * pt2,

Float S

);

Parameters

pout

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

PV1

[in] Points to the location vector of the D3DxVector3 structure.

PT1

[in] Points the tangent to the D3DxVector3 structure.

PV2

[in] Points to the location vector of the D3DxVector3 structure.

PT2

[in] Points the tangent to the D3DxVector3 structure.

s

[IN] Weight Coefficient, see instructions.

return value:

Point the Hermite spline interpolation of the D3DxVector3 structure.

Description:

The D3DxVec3hermite function is used by Hermite to Positiona, Tangenta, and 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 D3DXVEC3Hermite to use parameters of other functions.

Function information:

HEADER

D3DX9Math.h

Import Library

D3DX9.LIB

Minimum operation systems

WINDOWS 98

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

New Post(0)