# quaternion/euler angle rotation

Started by Sep 24 2001 01:41 PM

,
4 replies to this topic

###
#1
Members - Reputation: **122**

Posted 24 September 2001 - 01:41 PM

Where can I find a reference on how to do basic conversions from one position to another? I want to know how to do the "typical" 3D spaceship that can roll and yaw (bank) in a turn while simultaneously pitching up or down. I need to know how to go from one position to another. I realize Euler angles have the whole gimbal lock problem but I just don''t understand quaternions. Where is a good place to figure this stuff out?
Thanks.

###
#2
Members - Reputation: **118**

Posted 25 September 2001 - 02:10 PM

Most people say the best book on the subject is Jack Kuipers "Quaternions and Rotation Sequences". It describes this from the ground up. I highly recommend it.

But basically you can forgo the Quaternions and build a rotation matrix by tracking the current yall, pitch and, row for your ship. Then using these angles to build a rotation matrix by multiplying the yall rotation matrix (done about the up axis), by the pitch rotation matrix (done about the right axis) and, by the roll rotation matrix (done about the look axis). The order of the rotations does not matter.

Or you can keep track of the three current look, up, and right axises for the ship and rotate the current delta yall, pitch, roll rotations about these arbitrary axises.

For either of these methods I suggest keeping each of the rotation angles between -180 degrees (-PI) to 180 degrees (PI) where zero is no rotation. This will keep things simple.

Gimbal lock will not be a problem if you do it like this.

Hope this helps.

But basically you can forgo the Quaternions and build a rotation matrix by tracking the current yall, pitch and, row for your ship. Then using these angles to build a rotation matrix by multiplying the yall rotation matrix (done about the up axis), by the pitch rotation matrix (done about the right axis) and, by the roll rotation matrix (done about the look axis). The order of the rotations does not matter.

Or you can keep track of the three current look, up, and right axises for the ship and rotate the current delta yall, pitch, roll rotations about these arbitrary axises.

For either of these methods I suggest keeping each of the rotation angles between -180 degrees (-PI) to 180 degrees (PI) where zero is no rotation. This will keep things simple.

Gimbal lock will not be a problem if you do it like this.

Hope this helps.

###
#3
Members - Reputation: **122**

Posted 27 September 2001 - 08:44 AM

quote:

But basically you can forgo the Quaternions and build a rotation matrix by tracking the current yall, pitch and, row for your ship. Then using these angles to build a rotation matrix by multiplying the yall rotation matrix (done about the up axis), by the pitch rotation matrix (done about the right axis) and, by the roll rotation matrix (done about the look axis). The order of the rotations does not matter.

Hmm, is that true? From matrix algebra I remember that matrix multiplication is not....commutative? I mean, AB is in general not the same as BA, but is it in this case?

*/Mankind gave birth to God.*

###
#5
Members - Reputation: **118**

Posted 05 October 2001 - 10:03 AM

BeerHunter's hit it 100%.

Even though generally in matrix algebra AB != BA, the reason I say the order of the rotations don't matter is that for matrix rotations the order doesn't matter (At least for rotations on that anises that are orthogonal (perpendicular) -- like just on the X, Y, or Z axises. I'm not 100% sure if this is true for arbitrary rotations about any vector, but I think this property is true for those types of rotations also.) This is because of the unique properties of rotation matrixes. The proof for this is a bit much for me to go into here. but, the reason is explained quite well in that Quaternion book -- as it applies to Quaternions that is.

Mike

Edited by - blackbot20 on October 5, 2001 5:04:08 PM

Edited by - blackbot20 on October 5, 2001 5:04:59 PM

Even though generally in matrix algebra AB != BA, the reason I say the order of the rotations don't matter is that for matrix rotations the order doesn't matter (At least for rotations on that anises that are orthogonal (perpendicular) -- like just on the X, Y, or Z axises. I'm not 100% sure if this is true for arbitrary rotations about any vector, but I think this property is true for those types of rotations also.) This is because of the unique properties of rotation matrixes. The proof for this is a bit much for me to go into here. but, the reason is explained quite well in that Quaternion book -- as it applies to Quaternions that is.

Mike

Edited by - blackbot20 on October 5, 2001 5:04:08 PM

Edited by - blackbot20 on October 5, 2001 5:04:59 PM