[Math] (Graphics Gems IV, Shoemake) From matrix to euler angles explanation

3dgeometrymatricesrotations

I am trying to understand matrix to Euler angles conversion. So I read Graphics Gems IV, page 222 from Ken Shoemake. It states:

"Suppose we have code to convert a rotation matrix to XEDS angles, $R = R_z(c)R_y(b)R_x(a)$. If we are asked to extract XEDR, $R = R_z(a)R_y(b)R_x(c)$, we use our code as is, and swap $a$ and $c$ afterwards."
Restated (am I wrong??), it means that a $XYZ$ rotation of $(a, b, c)$ around static axes, is equivalent to a $XYZ$ rotation of $(c, b, a)$ around moving axes. This is exactly what they are doing in the source code.

In wikipedia, they state instead:
"For either Euler or Tait-Bryan angles, it is very simple to convert from an intrinsic (rotating axes) to an extrinsic (static axes) convention, and vice-versa: just swap the order of the operations. An $(a, b, c)$ rotation using $X-Y-Z$ intrinsic convention is equivalent to a $(c, b, a)$ rotation using $Z-Y-X$ extrinsic convention; this is true for all Euler or Tait-Bryan axis combinations."

Restated (am I wrong 2 ? ), it means that a $XYZ$ rotation of $(a, b, c)$ around static axes, is equivalent to a $ZYX$ rotation of $(c, b, a)$ around moving axes which I can understand if I derive the sequence of rotation in static frames starting from the sequence of rotation in moving frames.

If I take a simple example,with no rotation around $Y $nor $Z, R = Rx(a)$ in static frames, Shoemake states that $R = R_z(a)$ in moving frames while wikipedia states that $R = Rx(a)$ in moving frames.

Moreover, taking it source code, and converting the same Euler angles with one rotation only and different rotation orders results in different quaternions. Intuitively, I believe that if we are rotating around one axis only, then order does not matter and it should always return the same quaternion.

PROBLEM:

Everybody is using Shoemake algo for a long time so it HAS to be right and I HAVE to be wrong. Someone could please help to see what I am doing wrong please?

Best regards.

Best Answer

Actually Wikipedia is right. Of course you have to keep the axis-to-angle relation. If rotating with angle $\theta$ around the $z$-axis, you cannot suddenly use this angle to rotate around the $x$-axis. So it is true that an $XYZ$ moving-axis representation with angles $(\alpha,\beta,\gamma)$ (resulting in $R=R_x(\alpha)R_y(\beta)R_z(\gamma))$ is equivalent to a ZYX fixed-axis rotation with angles $(\gamma,\beta,\alpha)$ (again resulting in $R=R_x(\alpha)R_y(\beta)R_z(\gamma))$ and therefore the same rotation.

But I wouldn't think Shoemake to make such a dumb error and neither his code to be incorrect. But since I don't have any insight into this code or this book chapter, I would rather say that this paragraph is just poorly worded (like many statements about Euler angles suffer from notational inconsistencies).

Or you have just restated it incorrectly. Look at the quotation, no matter what transformations he means with XEDR and XEDS, his formulas still match his statements, since $R=R_z(\alpha)R_y(\beta)R_x(\gamma)$ is indeed the same as $R=R_z(\gamma)R_y(\beta)R_x(\alpha)$ with just $\alpha$ and $\gamma$ swapped. So with only seeing this quotation, he is perfectly right with his statements.