Willem 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 unitlength quaternions that represent r. This can easily be seen by noticing that a unitlength 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 preimage 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 Eulerangle tuple.
