Funzione D3DXVec3CatmullRom (D3dx9math.h)

Nota

La libreria di utilità D3DX è deprecata. È consigliabile usare invece DirectXMath .

Esegue un'interpolazione Catmull-Rom usando i vettori 3D specificati.

Sintassi

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

Parametri

pOut [in, out]

Tipo: D3DXVECTOR3*

Puntatore alla struttura D3DXVECTOR3 risultante dall'operazione.

pV0 [in]

Tipo: const D3DXVECTOR3*

Puntatore a una struttura D3DXVECTOR3 di origine, vettore di posizione.

pV1 [in]

Tipo: const D3DXVECTOR3*

Puntatore a una struttura D3DXVECTOR3 di origine, vettore di posizione.

pV2 [in]

Tipo: const D3DXVECTOR3*

Puntatore a una struttura D3DXVECTOR3 di origine, vettore di posizione.

pV3 [in]

Tipo: const D3DXVECTOR3*

Puntatore a una struttura D3DXVECTOR3 di origine, vettore di posizione.

s [in]

Tipo: FLOAT

Fattore di peso. Vedere la sezione Osservazioni.

Valore restituito

Tipo: D3DXVECTOR3*

Puntatore a una struttura D3DXVECTOR3 risultante dall'interpolazione Catmull-Rom.

Commenti

Dato quattro punti (p1, p2, p3, p4), trovare una funzione Q(s) in modo che:

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.

La Catmull-Rom spline può essere derivata dalla spline hermite impostando:

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

dove:

v1 è il contenuto di pV0.

v2 è il contenuto di pV1.

p3 è il contenuto di pV2.

p4 è il contenuto di pV3.

Uso dell'equazione spline di Hermite:

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

e sostituendo per v1, v2, t1, t2 restituisce:

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

Questo può essere riorganiato come:

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

Requisiti

Requisito Valore
Intestazione
D3dx9math.h
Libreria
D3dx9.lib

Vedi anche

Funzioni matematiche

D3DXVec2CatmullRom

D3DXVec4CatmullRom