Take the 2-minute tour ×
Game Development Stack Exchange is a question and answer site for professional and independent game developers. It's 100% free, no registration required.

I am trying to learn more about Euler Angles so as to help myself in understanding how I can control my camera better in the game.

I came across the following formula that converts Euler Angles to rotation matrices: enter image description here

In the equation, I could see that the first matrix from the left is the rotation matrix about x-axis, the second is about y-axis and the third is about z-axis.

From my understanding about ordinary matrix transformations, the later transformation is always applied to the right hand side. And if I'm right about this, then the above equation should have a rotation order starting from rotating about z-axis, y-axis, then finally x-axis.

But, from the symbols enter image description here it seems that the rotation order start rotating about x-axis, then y-axis, then finally z-axis. What should the actual order of the rotation be?

Also, I am confuse about if the input vector, in this case, would be a row vector on the left, or a column vector on the right?

share|improve this question
    
conventionally, it is a rotation about the Z, followed by a rotation about [new] x-axis, followed by the [new] Z; ZXZ, not XYZ –  Ken Oct 18 '12 at 19:19
    
But XYZ should work too. There are 12 possible sequences. And now I wonder if the above matrix is for XYZ or ZYX. –  xenon Oct 18 '12 at 19:26
add comment

2 Answers 2

up vote 1 down vote accepted

It really depends on how you write your vector. DirectX uses row vectors, OpenGL uses column vectors. The matrices need to be transposed accordingly.

If you consider your vector a column vector, it goes to the right: R_x R_y R_z v. But if it's a row vector, it needs to go on the left: v R_x R_y R_z.

The order also changes depending on this definition, because the matrix "closest" to the vector is applied first. So for a column vector, the order would be z, y, x, but for a row vector it's x, y, z.

And then it also depends on how your Euler angles are defined. Wikipedia gives a bunch of different options with corresponding matrices: http://en.wikipedia.org/wiki/Euler_angles#Matrix_orientation

share|improve this answer
add comment

With matrix transformation, it always works right to left. The right most matrix is 'applied' first.

Also, input vector would be column on the right.

Rule of thumb: the matrix closest to the vector goes first.

share|improve this answer
    
This is how I understand about matrix transformation too. But according to what I have read, it doesn't seem so for Euler Angles. According to a notes I read, it says for Euler Angle using the sequence of XYZ, the equation in the question is used for converting from Euler Angles to rotation matrix. Also, it mentions that a row vector is used as input on the left side. That's why I am very confused and I'm not sure what is right. Is there any special cases for matrix transformations when it comes to Euler Angle? –  xenon Oct 18 '12 at 19:04
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.