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

## Recommended Posts

I'd post this thread on D3D forum,but no answer. {CODE} float LengthSq(D3DXQUATERNION &q) { return q.x * q.x + q.y * q.y + q.z * q.z + q.w * q.w; } void SquadSetup(D3DXQUATERNION& outA,D3DXQUATERNION& outB,D3DXQUATERNION& outC,const D3DXQUATERNION& q0,const D3DXQUATERNION& q1,const D3DXQUATERNION& q2,const D3DXQUATERNION& q3) { D3DXQUATERNION m1 = q0 + q1; D3DXQUATERNION m2 = q0 - q1; D3DXQUATERNION qt0 = ((LengthSq(m1) < LengthSq(m2)) ? -q0 : q0); m1 = q1 + q2; m2 = q1 - q2; D3DXQUATERNION qt2 = ((LengthSq(m1) < LengthSq(m2)) ? -q2 : q2); m1 = q2 + q3; m2 = q2 - q3; D3DXQUATERNION qt3 = ((LengthSq(m1) < LengthSq(m2)) ? -q3 : q3); D3DXQUATERNION qt1 = q1; D3DXQUATERNION expQt1;D3DXQuaternionExp(&expQt1,&qt1); D3DXQUATERNION expQt2;D3DXQuaternionExp(&expQt2,&qt2); D3DXQUATERNION expQt1Qt2 = expQt1 * qt2; D3DXQUATERNION expQt1Qt0 = expQt1 * qt0; D3DXQUATERNION expQt2Qt3 = expQt2 * qt3; D3DXQUATERNION expQt2Qt1 = expQt2 * qt1; D3DXQUATERNION logExpQt1Qt2;D3DXQuaternionLn(&logExpQt1Qt2,&expQt1Qt2); D3DXQUATERNION logExpQt1Qt0;D3DXQuaternionLn(&logExpQt1Qt0,&expQt1Qt0); D3DXQUATERNION logExpQt2Qt3;D3DXQuaternionLn(&logExpQt2Qt3,&expQt2Qt3); D3DXQUATERNION logExpQt2Qt1;D3DXQuaternionLn(&logExpQt2Qt1,&expQt2Qt1); D3DXQUATERNION t1 = -0.25 * (logExpQt1Qt2 + logExpQt1Qt0); D3DXQUATERNION t2 = -0.25 * (logExpQt2Qt3 + logExpQt2Qt1); D3DXQUATERNION t1Exp;D3DXQuaternionExp(&t1Exp,&t1); D3DXQUATERNION t2Exp;D3DXQuaternionExp(&t2Exp,&t2); outA = qt1 * t1Exp; outB = qt2 * t2Exp; outC = qt2; } {/CODE} but it doesn't work as D3D API D3DXQuaternionSquadSetup,any errors in the code? thank u.

1. 1
2. 2
3. 3
Rutin
19
4. 4
5. 5

• 14
• 12
• 9
• 12
• 37
• ### Forum Statistics

• Total Topics
631424
• Total Posts
3000008
×