In 2 dimensions, order doesn't matter. But in 3 dimensions, order almost always matters. So make sure you have the order the way you want it. I would take some special cases, easy ones, and just do the rotation in your head to see if they come out right.
Incidentally, your computations in Post # 24 agree with mine. You have successfully computed
which would be (assuming you're always left-multiplying by the matrices) the z rotation followed by the x rotation.
Jan 28th 2011, 07:36 AM
im doing it in matlab, but wouldnt it be the other way around? x followed by z?
The order for euler angles and pitch,roll yaw are different. i dont see why, seeing as how they are the same thing..(are they?)
Jan 28th 2011, 08:00 AM
No, for 3D rotations, order is absolutely crucial. Think about it. Take a unit vector in the x direction. Rotate it about the z axis in a positive direction through 90 degrees. It's now pointed in the + y direction. Now rotate it about the x axis through 90 degrees, and it'll be pointed in the + z direction.
Now do it the other way: take your unit vector in the x direction. Rotate it about the x axis through 90 degrees. No change! (That's a hint right there that it's not going to be the same.) Now rotate it about the z axis through 90 degrees. It'll now be pointed in the + y direction. So, essentially, I've proven the following:
Therefore, it follows that
Indeed, this is matrix multiplication we're dealing with here, which is not, in general, commutative. So you shouldn't expect to be able to do things in any order you want.
Jan 28th 2011, 08:23 AM
Yes, that makes sense, i should have spotted that.
So should i go x*y*z for the pitch roll yaw method, or z*y*x for the euler angle method?
Jan 28th 2011, 08:45 AM
I don't think it matters. Just pick one and be consistent.