Not logged in, Join Here! or Log In Below:  
News Articles Search    

 Home / 3D Theory & Graphics / let's talk about quaternions Account Manager
Archive Notice: This thread is old and no longer active. It is here for reference purposes. This thread was created on an older version of the flipcode forums, before the site closed in 2005. Please keep that in mind as you view this thread, as many of the topics and opinions may be outdated.

April 23, 2005, 04:00 PM

so each orientation stored as 3 euler angles should have its own distinct quaternion, right? i mean, if my model is only rotated 80 degrees about the y-axis, the quaternion that represents that rotation is different from one that would represent a 100-degree rotation on the y-axis, right? and if i turn these quaternions back into euler angles, they should be different from each other?

Victor Widell

April 23, 2005, 08:19 PM


Now, of couse 2 distinct sets of eulers/quats can be different, but still represent exactly the same orientation. (360==0, 180==-180)


April 24, 2005, 06:45 AM

Depending on your conversion functions, things could be a bit worse.
Imagine 2 sets of euler angles and quaternions, (e1,q1) and (e2,q2), different from each other, but representing the same rotation.

Your conversion might be a bit ill-formed and convert e1 to q1, but q1 to e2,
both of which are perfectly valid conversions.

Thus converting back and forth might not result in the same euler angle/quaternion again.


April 25, 2005, 09:45 AM

Yes, let's talk about quaternions.

May I conclude from your post that you want to go from Euler angles to the quaternions? Then given any orientation in Euler angles, r=(e0,e1,e2) (with e0,e1,e2 real numbers) there exist two unit-length quaternions that represent r. This can easily be seen by noticing that a unit-length quaternion, q, and its additive inverse, -q, represent the same rotation (a rotation of a radians about an axis v is the same as a rotation of "-a" radians about the axis -v). It is up to you to choose which q you want.

More technical:
Things get worse (if not impossible) if you want to go from the quaternions to Euler angles, because you have a singularity (the infamous Gimbal lock issue). That is to say the map f: Eul -> SO(3), ie., the map from Euler angles to the group of rotations (and reflections) is not injective; there exists an element o of SO(3) such that the pre-image of o, f^-1(o), consists of infinitely many elements of Eul. From this it is also easily seen that, given the map h: Quat -> SO(3), and its restriction, h_r, to "half of Quat" such that h is invertible, the composition (h_r^-1 o f) is the map that will you your quaternion given an Euler-angle tuple.

This thread contains 4 messages.
Hosting by Solid Eight Studios, maker of PhotoTangler Collage Maker.