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

## 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.

1. 1
Rutin
44
2. 2
3. 3
4. 4
5. 5

• 10
• 27
• 20
• 9
• 20
• ### Forum Statistics

• Total Topics
633405
• Total Posts
3011680
• ### Who's Online (See full list)

There are no registered users currently online

×