Microsoft DirectX 8.0 (Visual Basic)

D3DXQuaternionLn

Calculates the natural logarithm.

D3DXQuaternionLn( _ 
    QOut As D3DQUATERNION, _ 
    Q As D3DQUATERNION)

Parameters

QOut
D3DQUATERNION type that is the result of the operation, the natural logarithm.
Q
The source D3DQUATERNION type.

Error Codes

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.

Remarks

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])

See Also

D3DXQuaternionExp, D3DXQuaternionSquad