From: Richard Fabian <algorithms@th...>  20021127 15:18:33

> So why can't we just > adopt math's convention of using predominantly righthanded > operations and > live saner lives where we never have to have a thread like this again? > </rant> hear hear! i x j should be equal to k. y rotated pi/2 about x should be z. 
From: Joseph, William <WJ<oseph@eu...>  20021122 17:55:24

If I understand matrix stuff correctly, a rotationonly matrix is always righthanded  even when working in a lefthanded coordinate system. If your rotation matrix is lefthanded, transforming a space by it will cause that space to switch handedness. For example.. object space A is lefthanded and object>world rotation matrix B is lefthanded. Applying B to A will result in the object appearing righthanded in worldspace... I think. To construct the rotation matrix correctly, you have to do it in the correct space. I'm not familiar with tangentspace transforms.. but you may be able to do this by converting the lefthanded basis to righthanded, extracting the rotation, then converting back to lefthanded. I suggest experimenting.. Will Original Message From: Joe Ante [mailto:joeante@...] Sent: 22 November 2002 16:23 To: gdalgorithmslist@... 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 magicsoftware) Is there any way to represent a lefthanded matrix as a quaternion? What do I have to do to convert my lefthanded orthonormal matrix into a quaternion? Joe Ante  This sf.net email is sponsored by:ThinkGeek Welcome to geek heaven. http://thinkgeek.com/sf _______________________________________________ GDAlgorithmslist mailing list GDAlgorithmslist@... https://lists.sourceforge.net/lists/listinfo/gdalgorithmslist Archives: http://sourceforge.net/mailarchive/forum.php?forum_id=6188 
From: Michael Pohoreski <MP<ohoreski@cy...>  20021122 19:20:39
Attachments:
Message as HTML

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:twjensen@...]=20 Sent: Friday, November 22, 2002 1:41 PM To: gdalgorithmslist@... Subject: RE: [Algorithms] Quaternion handedness Huh? We wrote an entire game in lefthanded coordinates and we never noticed any "magic" preference for righthandedness 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 handedness 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 lefthanded world and use lefthanded transforms your stuff will remain lefthanded. I recommend a constant matrix that can be applied to convert a matrix from lefthanded to righthanded and another one that goes in reverse. I'd recommend doing all your quaternion stuff in (pick a hand) space. If a matrix is (otherhanded) then convert the matrix to the (correcthanded) space, convert to quaternion, do whatever, convert back, and then convert the (correcthanded) matrix back into an (otherhanded) matrix. Trying to maintain lefthanded quaternions and righthanded quaternions is just compounding the problem of having both lefthanded coordinate spaces and right handed coordinate spaces. Original Message From: gdalgorithmslistadmin@... [mailto:gdalgorithmslistadmin@...] On Behalf Of Joseph, William Sent: Friday, November 22, 2002 9:55 AM To: 'gdalgorithmslist@...' Subject: RE: [Algorithms] Quaternion handedness If I understand matrix stuff correctly, a rotationonly matrix is always righthanded  even when working in a lefthanded coordinate system. If your rotation matrix is lefthanded, transforming a space by it will cause that space to switch handedness. For example.. object space A is lefthanded and object>world rotation matrix B is lefthanded. Applying B to A will result in the object appearing righthanded in worldspace... I think. To construct the rotation matrix correctly, you have to do it in the correct space. I'm not familiar with tangentspace transforms.. but you may be able to do this by converting the lefthanded basis to righthanded, extracting the rotation, then converting back to lefthanded. I suggest experimenting.. Will Original Message From: Joe Ante [mailto:joeante@...] Sent: 22 November 2002 16:23 To: gdalgorithmslist@... 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 magicsoftware) Is there any way to represent a lefthanded matrix as a quaternion? What do I have to do to convert my lefthanded orthonormal matrix into a quaternion? Joe Ante 
From: Nick Pelling <NP<elling@cl...>  20021126 10:51:52

A unit quaternion is no more and no less than than a rotation around an axis  handedness (relative to the coordinate frame) is explicit, because the signs of each of the sine and cosine components are included in the quaternion. Also: in normal rotation matrices, the resulting matrix is composited out of a sequences of rotation matrices, and is both ordersensitive and handednesssensitive. However, for a rotation angle 3tuple, the handedness is implicit, as are its axis association and order. So: when linking between rotation angle 3tuples and quaternions, you need to get all the implicit stuff right, or you'll get a load of nonsense. Unsurprisingly, "This Often Happens". :/ I could put a load of quaternion maths in here to demonstrate this basic point, but it really shouldn't be necessary. :) Cheers, .....Nick Pelling..... Original Message From: Peter Lipson [mailto:peter@...] Sent: 25 November 2002 18:16 To: gdalgorithmslist@... Subject: RE: [Algorithms] Quaternion handedness This whole discussion seems to be lacking any answer based on the theoretical basis for using quaternions to hold the rotations. I know quaternions used for rotation are constructed by using the axis and sin/cos of the angle, but I have a less firm grasp of the theoretical underpinnings that guarantee this 'works'. I'd love to see Ron's (or some other mathematician's) explanation of how handedness is incorporated into this representation. I have my own explanation, but I'm not a mathematician myself! 
From: Tyson Jensen <twjensen@sa...>  20021126 17:44:19

Actually, technically a quaternion multiply (unit or otherwise) represents a screw transform. The typical way quaternions are applied, ie qvq* where q is a unit quaternion, insures that the translational element is removed leaving a pure rotation. Since we game programmers haven't really gotten into screw theory, all of our quaternions represent rotations. As with many mathematical constructions, our plans for how we are going to use them make a big difference in what they represent. For example, a matrix can do all kinds of things besides rotate and translate but the only thing we typically do outside of those is a perspective transform. Original Message From: gdalgorithmslistadmin@... [mailto:gdalgorithmslistadmin@...] On Behalf Of Nick Pelling Sent: Tuesday, November 26, 2002 2:52 AM To: 'gdalgorithmslist@...' Subject: RE: [Algorithms] Quaternion handedness A unit quaternion is no more and no less than than a rotation around an axis  handedness (relative to the coordinate frame) is explicit, because the signs of each of the sine and cosine components are included in the quaternion. Also: in normal rotation matrices, the resulting matrix is composited out of a sequences of rotation matrices, and is both ordersensitive and handednesssensitive. However, for a rotation angle 3tuple, the handedness is implicit, as are its axis association and order. So: when linking between rotation angle 3tuples and quaternions, you need to get all the implicit stuff right, or you'll get a load of nonsense. Unsurprisingly, "This Often Happens". :/ I could put a load of quaternion maths in here to demonstrate this basic point, but it really shouldn't be necessary. :) Cheers, .....Nick Pelling..... Original Message From: Peter Lipson [mailto:peter@...] Sent: 25 November 2002 18:16 To: gdalgorithmslist@... Subject: RE: [Algorithms] Quaternion handedness This whole discussion seems to be lacking any answer based on the theoretical basis for using quaternions to hold the rotations. I know quaternions used for rotation are constructed by using the axis and sin/cos of the angle, but I have a less firm grasp of the theoretical underpinnings that guarantee this 'works'. I'd love to see Ron's (or some other mathematician's) explanation of how handedness is incorporated into this representation. I have my own explanation, but I'm not a mathematician myself!  This SF.net email is sponsored by: Get the new Palm Tungsten T handheld. Power & Color in a compact size! http://ads.sourceforge.net/cgibin/redirect.pl?palm0002en _______________________________________________ GDAlgorithmslist mailing list GDAlgorithmslist@... https://lists.sourceforge.net/lists/listinfo/gdalgorithmslist Archives: http://sourceforge.net/mailarchive/forum.php?forum_id=6188 
From: Casey Muratori <gda@fu...>  20021126 22:00:41

> A unit quaternion is no more and no less than than a rotation around an > axis  handedness (relative to the coordinate frame) is explicit, > because the signs of each of the sine and cosine components are included > in the quaternion. OK I think this thread is starting to get out of control, so here we go: Quaternions have no handedness. I'm not sure how the initial concept that a quaternion has a handedness got started, but to quote Marsellus Wallace, "it don't". Just like vectors, there is only a handedness to your _operations_. You wouldn't call your vectors lefthanded or righthanded, would you? But you _would_ (or I certainly hope you would!) call your crossproduct lefthanded or righthanded, correct? The same situation applies to quaternions. When you wrote your quaternion multiply, you used a cross product (or, as is apparently more likely, if you cut and pasted somebody else's code, THEY used a cross product). If your/their cross product is righthanded, then your/their quaternions are going to multiply righthanded. If it's left, they'll multiply left. It's really that simple. Or, if you prefer, "it's really that complicated". And so forth. Now as for this this: > I'd love to see Ron's (or some other mathematician's) explanation of how > handedness is incorporated into this representation. I have my own > explanation, but I'm not a mathematician myself! Thankfully, the explanation is simple and doesn't require a mathematician. As everyone has seen many times, quaternion operations are all defined by setting up multiplication rules for the imaginary components i, j, and k. Well, if you had been ignoring those derivations previously, now's your chance to stop ignoring them. Go back and look, and you'll see that the "handedness" is baked into those initial definitions. If you change the initial multiplication rules to be lefthanded, then all the operations will come out lefthanded. Right handed systems have: i^2 = j^2 = k^2 = ijk = 1 i = jk = kj j = ki = ik k = ij = ji and left handed systems have: i^2 = j^2 = k^2 = ijk = 1 i = jk = kj j = ki = ik k = ij = ji And that's all there is to it. k is the "zaxis". If you want to invert your z axis, you just define the fact that i (xaxis) and j (yaxis) multiply together to get negative k. Obviously, you don't have to restrict yourself to making k negative, you could've negated something else instead. For some reason, Shoemake never presented the lefthanded version (as far as I'm aware), so I guess nobody ever thought about it? Not sure. Anyhow, go ahead and do the quaternion multiplication (w + xi + yj + zk) (d + ai + bj + ck) with each rule set and see what you get. You'll find that you get a righthanded cross product when you use the righthanded rules, and a left handed cross product when you use the lefthanded rules, and otherwise the two will be identical. <rant> Now I would simply like to say hey, if I had to hazard a guess as to why everyone thinks quaternions are inherently righthanded, and the lefthanded definition doesn't ever show up, I'd say it's because that's the way most math is written by default: righthanded. So when you go and read something in a math book, it's probably righthanded. So why do some people still insist on using these lefthanded coordinate frames? For the love of god, people, stop using lefthanded coordinate systems so we can put an end to all this useless conversion confusion. There's no advantage to one or the other  they're the same in every way. So why can't we just adopt math's convention of using predominantly righthanded operations and live saner lives where we never have to have a thread like this again? </rant>  Casey 
From: Richard Fabian <algorithms@th...>  20021127 15:18:33

> So why can't we just > adopt math's convention of using predominantly righthanded > operations and > live saner lives where we never have to have a thread like this again? > </rant> hear hear! i x j should be equal to k. y rotated pi/2 about x should be z. 
From: Jon Watte <hplus@mi...>  20021127 18:54:59

> y rotated pi/2 about x should be z. This is the case in both lefthanded and righthanded coordinate systems. Cheers, / h+ 
From: Thatcher Ulrich <tu@tu...>  20021127 21:26:00

> > So why can't we just adopt math's convention of using > > predominantly righthanded operations and live saner lives where > > we never have to have a thread like this again? </rant> The least significant byte should have the lowest address! <duck>  Thatcher Ulrich http://tulrich.com 
From: Tyson Jensen <twjensen@sa...>  20021122 18:41:04

Huh? We wrote an entire game in lefthanded coordinates and we never noticed any "magic" preference for righthandedness 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 handedness assumptions. I'd bet money that lhA * lhB = right handed space is a result of a bias in code, not in the math. If you have a lefthanded world and use lefthanded transforms your stuff will remain lefthanded. I recommend a constant matrix that can be applied to convert a matrix from lefthanded to righthanded and another one that goes in reverse. I'd recommend doing all your quaternion stuff in (pick a hand) space. If a matrix is (otherhanded) then convert the matrix to the (correcthanded) space, convert to quaternion, do whatever, convert back, and then convert the (correcthanded) matrix back into an (otherhanded) matrix. Trying to maintain lefthanded quaternions and righthanded quaternions is just compounding the problem of having both lefthanded coordinate spaces and right handed coordinate spaces. Original Message From: gdalgorithmslistadmin@... [mailto:gdalgorithmslistadmin@...] On Behalf Of Joseph, William Sent: Friday, November 22, 2002 9:55 AM To: 'gdalgorithmslist@...' Subject: RE: [Algorithms] Quaternion handedness If I understand matrix stuff correctly, a rotationonly matrix is always righthanded  even when working in a lefthanded coordinate system. If your rotation matrix is lefthanded, transforming a space by it will cause that space to switch handedness. For example.. object space A is lefthanded and object>world rotation matrix B is lefthanded. Applying B to A will result in the object appearing righthanded in worldspace... I think. To construct the rotation matrix correctly, you have to do it in the correct space. I'm not familiar with tangentspace transforms.. but you may be able to do this by converting the lefthanded basis to righthanded, extracting the rotation, then converting back to lefthanded. I suggest experimenting.. Will Original Message From: Joe Ante [mailto:joeante@...] Sent: 22 November 2002 16:23 To: gdalgorithmslist@... 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 magicsoftware) Is there any way to represent a lefthanded matrix as a quaternion? What do I have to do to convert my lefthanded orthonormal matrix into a quaternion? Joe Ante  This sf.net email is sponsored by:ThinkGeek Welcome to geek heaven. http://thinkgeek.com/sf _______________________________________________ GDAlgorithmslist mailing list GDAlgorithmslist@... https://lists.sourceforge.net/lists/listinfo/gdalgorithmslist Archives: http://sourceforge.net/mailarchive/forum.php?forum_id=6188  This sf.net email is sponsored by:ThinkGeek Welcome to geek heaven. http://thinkgeek.com/sf _______________________________________________ GDAlgorithmslist mailing list GDAlgorithmslist@... https://lists.sourceforge.net/lists/listinfo/gdalgorithmslist Archives: http://sourceforge.net/mailarchive/forum.php?forum_id=6188 