## Recommended Posts

Hello, i'd been trying to rotate whit quaternions but im still falling in gimbal lock, i have some questions abaut this...
1.-¿Quaternions work whit acumulative angles?
2.-¿Quaternions can rotate in 3 angles at the same time?
I dont really know the answer of this questions because id never seen an example showing any of those, i alredy know the math behind the quaternions but i guess im coding grong.
void vRotQuat( ... pd3dDevice, ... &matRot, float fRX, float fRY, float fRZ )
{
D3DXQUATERNION qRot;
D3DXQuaternionNormalize( &qRot, &qRot );
D3DXMatrixRotationQuaternion( &matRot, &qRot );

pd3dDevice->SetTransform( D3DTS_WORLD, &matTemp );
pd3dDevice->SetStreamSource( 0, lpLineList, sizeof( MYVERTEX ) );
pd3dDevice->DrawPrimitive( D3DPT_LINELIST, 0, 3 );
}


Anyone know an example doing the same as my questions? in case they can be done... ummm... [Edited by - Xhadow on October 11, 2008 11:39:08 AM]

##### Share on other sites
Quote:
 Original post by Xhadow1.-¿Quaternions work whit acumulative angles?2.-¿Quaternions can rotate in 3 angles at the same time?

A unit quaternion can be interpreted as a rotation around a single axis and by a single angle. Having a (more or less) arbitrary rotation axis at hand is by no means the same as "rotate in 3 angles at the same time".

Several unit quaternions can be combined to represent an overall rotation, similarly to several rotation matrices that are multiplied to yield in an overall rotation matrix. Hence, if you choose to combine 3 rotations, and furthur choose the rotation axes to be those of an Euler rotation, you actually do perform an Euler rotation. That you suffer from gimbal lock isn't a question of the way you _represent_ the rotations but how you combine them.

## Create an account

Register a new account

• ### Forum Statistics

• Total Topics
628316
• Total Posts
2982032

• 9
• 9
• 13
• 11
• 14