So we have a 2D rotation matrix for counterclockwise (positive) angle "$a$":
$\begin{pmatrix} \cos(a) & -\sin(a) \\ \sin(a) & \cos(a) \end{pmatrix}$.

For clockwise (negative) angle: $\begin{pmatrix} \cos(a) & \sin(a) \\ -\sin(a) & \cos(a) \end{pmatrix}$.

When converting euler angles to 3d rotation matrix we extend rotation matrices of yaw ($z$), pitch ($y$) and roll ($x$) angles and multiply them. The same convention is used for all angles: counterclockwise direction, right-handed system.

$R_x = \begin{pmatrix} 1 & 0 & 0 \\ 0 & \cos(x) & -\sin(x) \\ 0 & \sin(x) & \cos(x) \end{pmatrix}$, $R_y = \begin{pmatrix} \cos(y) & 0 & \sin(y) \\ 0 & 1 & 0 \\ -\sin(y) & 0 & \cos(y) \end{pmatrix}$, $R_z = \begin{pmatrix} \cos(z) & -\sin(z) & 0 \\ \sin(z) & \cos(z) & 0 \\ 0 & 0 & 1 \end{pmatrix}$.

Why is the direction of rotation for the pitch angle (sign of sin elements) different from yaw and roll angles? Thanks.

  • $\begingroup$ $R_z$: $\sin(x), \cos(x)$ or $\sin(z), \cos(z)$? $\endgroup$ – Oleg567 Jul 11 '13 at 8:30
  • $\begingroup$ Thanks, Oleg567, changed x to z in Rz matrix $\endgroup$ – Andrey Grachev Jul 11 '13 at 9:35

Matrix rows or columns are traditionally listed under $(x,y,z)$ order.

Cyclically change the pairs under consideration i.e $(x,y)\to(y,z)\to(z,x)$. The pairs $(x,y)$ and $(y,z)$ show up in the same order in the matrix but the $(z,x)$ shows up in reverse in the matrix. That is the cause of apparent discrepancy but really there is no discrepancy.

For example write

$x'=x\cos \alpha - y \sin \alpha$

$y'=x\sin \alpha + y \cos \alpha$

now change $(x,y)\to(y,z)\to(z,x)$ and $\alpha\to \beta \to \gamma$ and write the three matrices to see how $(z,x)$ part gets flipped.


If you want them to look alike then give up the matrix notation and instead write

$y'=y\cos \beta - z \sin \beta$

$z'=y\sin \beta + z \cos \beta$


$z'=z\cos \gamma - x \sin \gamma$

$x'=z\sin \gamma + x \cos \gamma$

In each instance if you try to write $\left[ \matrix{ x' \cr y' \cr z'}\right]$ in terms of $\left[ \matrix{ x \cr y \cr z}\right]$ you will see that the mystery goes away.

  • $\begingroup$ Maesumi, thank you for the answer. But $\endgroup$ – Andrey Grachev Jul 11 '13 at 10:48
  • $\begingroup$ But then if Ry was |sin(y) 0 cos(y)| |0 1 0 | |cos(y) 0 -sin(y)|, it would be easier to avoid confusion. $\endgroup$ – Andrey Grachev Jul 11 '13 at 11:01
  • $\begingroup$ Then it would not be counterclockwise like the others! $\endgroup$ – Maesumi Jul 11 '13 at 12:05
  • $\begingroup$ got that, thanks. $\endgroup$ – Andrey Grachev Jul 11 '13 at 12:21

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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