Microsoft DirectX 8.0 (C++) |
Calculates the natural logarithm.
D3DXQUATERNION* D3DXQuaternionLn( D3DXQUATERNION* pOut, CONST D3DXQUATERNION* pQ );
Pointer to a D3DXQUATERNION structure that is the natural logarithm.
The D3DXQuaternionLn function works only for unit quaternions.
This function is implemented in the following manner.
q = (cos(theta), sin(theta) * v) |v| = 1 ln(q) = (0, 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) 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])
The return value for this function is the same value returned in the pOut parameter. In this way, the D3DXQuaternionLn function can be used as a parameter for another function.
Header: Declared in D3dx8math.h.
Import Library: Use D3dx8.lib.