RE: [Algorithms] Quaternion handedness
Brought to you by:
vexxed72
From: Michael P. <MPo...@cy...> - 2002-11-22 19:20:39
|
Be aware that different books will use or not use a transposed quat->matrix. i.e. "3D Game Engine Design", Page 17, Section 2.3.5, Eqn 2.13 and "Rotating Objects Using Quaterions" (Corrected matrix) Game Developer, Feb 98, Nick Bobick RHCS? 2 2 =20 [ 1 - 2y - 2z 2xy + 2wz 2xz - 2wy ] [ 2 2 ] [ 2xy - 2wz 1 - 2x - 2z 2yz + 2wx ] [ 2 2 ] [ 2xz + 2wy 2yz - 2wx 1 - 2x - 2y ] Used by Watt&Watt, Parameetrization of orientation, Page 362 LHCS? 2 2 =20 [ 1 - 2y - 2z 2xy - 2wz 2xz + 2wy ] [ 2 2 ] [ 2xy + 2wz 1 - 2x - 2z 2yz - 2wx ] [ 2 2 ] [ 2xz - 2wy 2yz + 2wx 1 - 2x - 2y ] Cheers -----Original Message----- From: Tyson Jensen [mailto:twj...@sa...]=20 Sent: Friday, November 22, 2002 1:41 PM To: gda...@li... Subject: RE: [Algorithms] Quaternion handedness Huh? We wrote an entire game in left-handed coordinates and we never noticed any "magic" preference for right-handedness in matrices. I am unclear as to why arithmetic would care what hand humans tend to prefer. What happens is that care must be taken when copying algorithms out of books that might be making handed-ness assumptions. I'd bet money that lhA * lhB =3D right handed space is a result of a bias in code, not in = the math. If you have a left-handed world and use left-handed transforms your stuff will remain left-handed. I recommend a constant matrix that can be applied to convert a matrix from left-handed to right-handed and another one that goes in reverse. I'd recommend doing all your quaternion stuff in (pick a hand) space. If a matrix is (other-handed) then convert the matrix to the (correct-handed) space, convert to quaternion, do whatever, convert back, and then convert the (correct-handed) matrix back into an (other-handed) matrix. Trying to maintain left-handed quaternions and right-handed quaternions is just compounding the problem of having both left-handed coordinate spaces and right handed coordinate spaces. -----Original Message----- From: gda...@li... [mailto:gda...@li...] On Behalf Of Joseph, William Sent: Friday, November 22, 2002 9:55 AM To: 'gda...@li...' Subject: RE: [Algorithms] Quaternion handedness If I understand matrix stuff correctly, a rotation-only matrix is always right-handed - even when working in a left-handed coordinate system. If your rotation matrix is left-handed, transforming a space by it will cause that space to switch handedness. For example.. object space A is left-handed and object->world rotation matrix B is left-handed. Applying B to A will result in the object appearing right-handed in world-space... I think. To construct the rotation matrix correctly, you have to do it in the correct space. I'm not familiar with tangent-space transforms.. but you may be able to do this by converting the left-handed basis to right-handed, extracting the rotation, then converting back to left-handed. I suggest experimenting.. -Will -----Original Message----- From: Joe Ante [mailto:jo...@li...] Sent: 22 November 2002 16:23 To: gda...@li... Subject: [Algorithms] Quaternion handedness Hi, I am trying to convert tangent space 3x3 matrices for dot3 product bumpmapping to quaternions. I want to convert these 3x3 matrices into quaternions to do the objectspace- tangentspace transformation, because I need to slerp my tangentspace transform when doing geomorphing on my chunk lod mesh. The tangentspace orthonormal bases are sometimes right handed, sometimes left handed. Unfortunately my matrix to quaternion algorithm seems not to work on left handed matrices. (I am using the algorithm availible at magic-software) Is there any way to represent a left-handed matrix as a quaternion? What do I have to do to convert my left-handed orthonormal matrix into a quaternion? Joe Ante |