Jump to content
  • Advertisement
Sign in to follow this  
brekehan

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.

If you intended to correct an error in the post then please contact us.

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 this post


Link to post
Share on other sites
Advertisement
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 - 1
D3DXQuaternionSlerp(&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.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!