Microsoft DirectX 8.0 (Visual Basic) |
D3DXQuaternionExp( _ QOut As D3DQUATERNION, _ Q As D3DQUATERNION)
If the function fails, an error is raised and Err.Number can be set to one of the following values:
D3DERR_INVALIDCALL |
D3DERR_OUTOFVIDEOMEMORY |
For information on trapping errors, see the Microsoft® Visual Basic® Error Handling topic.
The D3DXQuaternionExp function works only with pure quaternions, where w == 0.
This function is implemented in the following manner.
q = (0, theta * v) Exp(q) = (Cos(theta), Sin(theta) * v)
The D3DXQuaternionExp and D3DXQuaternionLn functions are useful when using the D3DXQuaternionSquad function. Given a set of quaternion keys (q0, q1, q2, ..., qn), you can compute the inner quadrangle points (a1, a2, a3, ..., an-1) as shown in the following example, to insure that the tangents are continuous across adjacent segments.
a1 a2 a3 q0 q1 q2 q3 q4 a[i] = q[i] * Exp( -(ln(inv(q[i])*q[i+1]) + ln(inv(q[i])*q[i-1])) / 4 )
Once (a1, a2, a3, ...) are computed, you can use the results to interpolate along the curve.
qt = Squad(t, q[i], a[i], a[i+1], q[i+1])