D3DXQUATERNIONSQUADSETUP function
Establish a control point for spherical quadrangular interpolation.
definition:
Void WinAPI D3DXQUATERNISQUADSETUP (
D3DXQUATERNION * PAOUT,
D3DXQUATERNION * PBOUT,
D3DXQUATERNION * PCOUT,
Const d3dxquaternion * pq0,
Const d3dxquaternion * pq1,
Const d3dxquaternion * pq2,
Const d3dxquaternion * pq3
);
parameter:
PAOUT
[OUT] Points to AOUT.
Pbout
[OUT] points to BOUT.
PCOUT
[OUT] points to COUT.
PQ0
[in] points to the input control point Q0.
PQ1
[in] points to the input control point Q1.
PQ2
[in] points to the input control point Q2.
PQ3
[in] points to the input control point Q3.
return value:
No.
Description:
The four control points PQ0, PQ1, PQ2, and PQ3 are provided in this function. The function will change these values along the curve to find the shortest path. Q0, Q2 and Q3 values are calculated as follows:
Q0 = | Q0 Q1 | <| q0 - q1 |? -Q0: Q0
Q2 = | Q1 Q2 | <| Q1 - Q2 |? -q2: Q2
Q3 = | Q2 Q3 | <| Q2 - q3 |? -Q3: Q3
If Q is calculated, the value of AOUT, BOUT and COUT uses the following formula:
AOUT = Q1 * E [-0.25 * (ln [eXP (q1) * q2] ln [eXP (q1) * q0])]
Bout = Q2 * E [-0.25 * (ln [eXP (Q2) * q3] ln [eXP (q2) * q1])]
Cout = Q2
Note that the LN is the API function D3DxQuaternionln and Exp are the API function D3DXQUATERNIONEXP.
E.g:
An example is a bit (q0, q1, q2, q3) to calculate the points (A, B, C) of the inner epitaxial surface. It is assumed here that the positive cutting value is continuous through this curve.
A b
Q0 Q1 Q2 Q3
Hereinafter, the interpolation between Q1 and Q2 is described below:
/ / About Z axis rotation
D3DXQUATERNION Q0 = D3DXQUATERNION (0, 0, 0.707F, -.707F);
D3DXQUATERNION Q1 = D3DXQUATERNION (0, 0, 0.000F, 1.000F);
D3DXQUATERNION Q2 = D3DXQUATERNION (0, 0, 0.707F, 0.707F);
D3DXQUATERNION Q3 = D3DXQUATERNION (0, 0, 1.000F, 0.000F);
D3DXQUATERNION A, B, C, QT;
Float Time = 0.5F;
D3DXQUATERNIONSQUADSETUP (& A, & B, & C, & Q0, & Q1, & Q2, & Q3);
D3DXQUATERNISQUAD (& QT, & Q1, & A, & B, & C, Time);
note:
· C is the /- Q2 positive and negative sign mainly looks at the return value of the function.
· QT is the function return value.
Here the results are rotated about 45 degrees around the Z axis every 0.5.
Function information:
HEADER
D3DX9Math.h
Import libraryd3dx9.lib
Minimum operation systems
WINDOWS 98
related functions:
D3DXQUATERNISISQUAD