3
\$\begingroup\$

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?

\$\endgroup\$
2
  • \$\begingroup\$ conventionally, it is a rotation about the Z, followed by a rotation about [new] x-axis, followed by the [new] Z; ZXZ, not XYZ \$\endgroup\$
    – Ken
    Commented Oct 18, 2012 at 19:19
  • \$\begingroup\$ But XYZ should work too. There are 12 possible sequences. And now I wonder if the above matrix is for XYZ or ZYX. \$\endgroup\$
    – xenon
    Commented Oct 18, 2012 at 19:26

2 Answers 2

3
\$\begingroup\$

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

\$\endgroup\$
0
\$\begingroup\$

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.

\$\endgroup\$
1
  • \$\begingroup\$ 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? \$\endgroup\$
    – xenon
    Commented Oct 18, 2012 at 19:04

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .