# D3DXQuaternionSlerp

This topic is 3801 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

## Recommended Posts

Quote:
 MSDN D3DXQuaternionSlerp Interpolates between two quaternions, using spherical linear interpolation. D3DXQUATERNION * D3DXQuaternionSlerp( D3DXQUATERNION * pOut, CONST D3DXQUATERNION * pQ1, CONST D3DXQUATERNION * pQ2, FLOAT t ); Parameters pOut [in, out] Pointer to the D3DXQUATERNION structure that is the result of the operation. pQ1 [in] Pointer to a source D3DXQUATERNION structure. pQ2 [in] Pointer to a source D3DXQUATERNION structure. t [in] Parameter that indicates how far to interpolate between the quaternions. Return Values Pointer to a D3DXQUATERNION structure that is the result of the interpolation. Remarks The return value for this function is the same value returned in the pOut parameter. In this way, the D3DXQuaternionSlerp function can be used as a parameter for another function. Use D3DXQuaternionNormalize for any quaternion input that is not already normalized. Requirements Header: Declared in D3dx9math.h.
Can anyone explain parameter t a bit better? How does t describe how far to interpolate? Is it 0 to 1? What units is it in? What are valid range of values? [Edited by - brekehan on July 14, 2008 10:52:05 PM]

##### Share on other sites
t is a unitless parameter, normally in the range 0 to 1.

For instance, in animation:

Given an object orientation at time t1 of pQ1, and a desired orientation at time t2 of pQ2, the orientation pQ at time t (assumed that t1 <= t <= t2) is:
float normalizedT = (t-t1)/(t2-t1); // put normalizedT in the range 0 - 1D3DXQuaternionSlerp(&pQ, &pQ1, &pQ2, normalizedT);

EDIT: For example, if an arm is at a lowered position with palm inward at t1 and the arm is fully raised with palm outward at t2, then you can determine the position at any time between t1 and t2 using the slerp function, smoothly raising the arm and rotating the hand.

1. 1
2. 2
3. 3
Rutin
15
4. 4
khawk
14
5. 5
frob
12

• 9
• 11
• 11
• 23
• 12
• ### Forum Statistics

• Total Topics
633662
• Total Posts
3013228
×