DirectX SDK |
The D3DXQuaternionLn function calculates the natural logarithm.
D3DXQUATERNION* D3DXQuaternionLn( D3DXQUATERNION* pOut, const D3DXQUATERNION* pQ );
A pointer to a D3DXQUATERNION structure that is the natural logarithm.
The D3DXQuaternionLn function only works 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), in order 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.
Windows NT/2000: Requires Windows 2000.
Windows 95/98: Requires Windows 95 or later. Available as a redistributable for Windows 95.
Windows CE: Unsupported.
Version: Requires DirectX 7.0.
Header: Declared in d3dxmath.h.
Library: Use d3dx.lib.