Re: [Algorithms] Rotation Matrices
Brought to you by:
vexxed72
From: Steve B. <st...@li...> - 2000-08-02 19:55:29
|
On Wed, 2 Aug 2000 Nik...@ao... wrote: > Why isn't the multiplication of rotational matrices commutative? Well, look at the top-left corner element and see how it's computed: dst[0][0] = m2[0][0] * m1[0][0] + m2[0][1] * m1[1][0] + m2[0][2] * m1[2][0] + m2[0][3] * m1[3][0] ; Clearly, in general: m2[0][1]*m1[1][0] != m1[0][1]*m2[1][0] ...and so on, so from the definition of how you multiply them, it's clearly not commutative. > For example > if I have one rotation matrix which rotates 20 degrees around the Z axis, and > another which rotates 50 degrees around the X axis, depending on the order in > which I multiply them, I get different results. Why is this? Because that's how rotation works in the real world. > When rotating > an object there is no visible difference when it is first rotated on one axis > and then on another, is there? Yes there is - you need a concrete example! Do this - *really* do it - I MEAN NOW! 1) Fold yourself a paper airplane. ...OK - finished? Now do this: [ Roll ==Rotation about Z axis, Pitch==Rotation about X axis ... for the sake of this example ] 2) Hold the paper plane level, right side up with it's nose pointing away from you. 3) Roll it 90 degrees so the left wing is pointing at the floor and the right wing is pointing up towards the ceiling. 4) Now pitch the plane 90 degrees so the nose is pointing at the floor and the left wing is pointing towards your chest and the right wing is pointing away from you. 5) Remember how it looks. That was 90 roll followed by 90 pitch. Now let's do the reverse: 2) Hold the paper plane level, right side up with it's nose pointing away from you. 3) Pitch it 90 degrees so the nose is pointing at the floor and the tail is pointing up towards the ceiling. 4) Now roll the plane 90 degrees so the nose is pointing to your right and the tail to your left. 5) Notice that your paper plane is in a different position now. So, you can clearly see that rotations in the real world are definitely *not* commutative. > I first looked in an elementary linear > algebra book for the answer; however it stated that the multiplication of > rotation matrices is commutative (although it was only covering 2D rotation > matrices). Any help would be appreciated. Well, that's only true for 2x2 *rotation* matrices - if you do something like: Take a square. Rotate 90 degrees. (Still a square) Scale by 0.5 in the X direction. (Now a tall, thin rectangle) ...you get something different than: Take a square Scale by 0.5 in the X direction. (Now a tall, thin rectangle) Rotate 90 degrees. (Now a short, fat rectangle) ...so arbitary 2x2 matrix multiplication *certainly* isn't commutative. The math book was strictly correct - hopefully it didn't imply that arbitary 2x2's could be multiplied commutatively. The deal is that 2D rotations always happen about the same axis (there IS only one after all) - so multiplication of rotation matrices is just like adding the angles - and addition is commutative. If you do multiple 3D rotations that are all about the same axis then they commute too. The problem is when you have a pair of rotations about DIFFERENT axes - that can't happen in 2D so the non-commutative nature of arbitary axis rotations doesn't show up. Steve Baker (817)619-2657 (Vox/Vox-Mail) L3Com/Link Simulation & Training (817)619-2466 (Fax) Work: sj...@li... http://www.link.com Home: sjb...@ai... http://web2.airmail.net/sjbaker1 |