# D3DXVec3CatmullRom 函数 (D3DX10Math.h)

D3DX10 实用工具库已弃用。 建议改用 DirectXMath

## 语法

``````D3DXVECTOR3* D3DXVec3CatmullRom(
_Inout_       D3DXVECTOR3 *pOut,
_In_    const D3DXVECTOR3 *pV0,
_In_    const D3DXVECTOR3 *pV1,
_In_    const D3DXVECTOR3 *pV2,
_In_    const D3DXVECTOR3 *pV3,
_In_          FLOAT       s
);
``````

pOut [in， out]

pV0 [in]

pV1 [in]

pV2 [in]

pV3 [in]

s [in]

## 注解

``````Q(s) is a cubic function.
Q(s) interpolates between p2 and p3 as s ranges from 0 to 1.
Q(s) is parallel to the line joining p1 to p3 when s is 0.
Q(s) is parallel to the line joining p2 to p4 when s is 1.
``````

Catmull-Rom样条可以通过设置从 Hermite 样条派生：

``````v1 = p2
v2 = p3
t1 = (p3 - p1) / 2
t2 = (p4 - p2) / 2
``````

v1 是 pV0 的内容。

v2 是 pV1 的内容。

p3 是 pV2 的内容。

p4 是 pV3 的内容。

``````Q(s) = (2s3 - 3s2 + 1)v1 + (-2s3 + 3s2)v2 + (s3 - 2s2 + s)t1 + (s3 - s2)t2
``````

``````Q(s) = (2s3 - 3s2 + 1)p2 + (-2s3 + 3s2)p3 + (s3 - 2s2 + s)(p3 - p1) / 2 + (s3 - s2)(p4 - p2) / 2
``````

``````Q(s) = [(-s3 + 2s2 - s)p1 + (3s3 - 5s2 + 2)p2 + (-3s3 + 4s2 + s)p3 + (s3 - s2)p4] / 2
``````

D3DX10Math.h