All possible interpretations of a rotation matrix in euler angles

3danglematricesmatrix decomposition

I have searched as much as i could here, but I couldn't find the answer. Don't hesitate to let me know if i have overlooked some post covering this..

Given a rotation matrix of an object in 3d space, i'd like to find all possible euler-angle interpretations (given a rotation order xyz, and a 'max rotation' ceiling).
As suggested, adding a description of what i mean by 'euler angles' (albeit coming from me, this might be way more confusing than helpful):
Euler angles refer to three consecutive extrinsic rotations about three different, mutually orthogonal basis vectors.

Image to illustrate (euler angle descriptions, in degrees):
enter image description here

In the above image, the object in space (cube) is defined by the same rotational matrix, but is interpreted as two different euler rotations (using only two boxes is just to illustrate, there is of course more euler rotation combinations that could achieve the same result)

If i'd say to clip results to anything below any axis being 360deg, 720, etc, then i have to assume the number of euler interpretations is finite, hence I thought there surely exists a formula to get what i am after..

Please note that I am not as versed in math as much as many of you, but i'll do my best to understand whatever answers may come my way.

I'd be happy for any nudge in the correct direction.
(Also, not sure what tags to use, feel free to edit that part..)

Thank you!

Edit: aha, maybe what i actually need as a base, instead of one vector, is three vectors, or rather a rotation matrix? Apologies for the confusion, if my current assumption is right… The question still stands, though i am not sure if my edit to change 'vector' to 'three vectors or a rotation matrix' helped with any confusion…

Best Answer

If the rotation order is $XYZ$ then the resulting rotation matrix is

$ R = R_Z R_Y R_X $

and this is equal to

$ R = \begin{bmatrix} \cos(\theta_3) && - \sin(\theta_3) && 0 \\ \sin(\theta_3) && \cos(\theta_3) && 0 \\ 0 && 0 && 1 \end{bmatrix} \begin{bmatrix} \cos(\theta_2) && 0 && \sin(\theta_2 ) \\ 0 && 1 && 0 \\ -\sin(\theta_2) && 0 && \cos(\theta_2) \end{bmatrix} \begin{bmatrix} 1 && 0 && 0 \\ 0 && \cos(\theta_1) && - \sin(\theta_1) \\ 0 && \sin(\theta_1 ) && \cos(\theta_1) \end{bmatrix} $

Multiplying the above matrices gives

$ R = \begin{bmatrix} c_2 c_3 && s_1 s_2 c_3 - c_1 s_3 && c_1 s_2 c_3 + s_1 s_3 \\ c_2 s_3 && s_1 s_2 s_3 + c_1 c_3 && c_1 s_2 s_3 - s_1 c_3 \\ -s_2 && s_1 c_2 && c_1 c_2 \end{bmatrix} $

From this, and by looking at the first column and the last row, if we want to find an alternative set of angles $\theta'_1 , \theta'_2 , \theta'_3 $ that will produce the same $R$, then we must at least have

$ \sin(\theta_2 ) = \sin(\theta'_2 ) \hspace{25pt} $(From $R_{31}$ )

Suppose we take $\theta'_2 = \theta_2 $, then from the first column of $R$ and the last row of $R$ we must also have $\theta'_1 = \theta_1 $ and $\theta'_3 = \theta_3 $.

However, we can choose to take $\theta'_2 = \pi - \theta_2 $, then it follows by comparison that,

$ \cos(\theta'_3) = - \cos(\theta_3 ) $ and $ \sin(\theta'_3) = -\sin(\theta_3) $

From which it follows that $\theta'_3 = \theta_3 + \pi $

And using the same reasoning, we deduce that $\theta'_1 = \theta_1 + \pi $

Looking at the rest of the $R$ matrix we find that all the expressions will yield the same values when this change is made.

However, let's take the case where $s_2 = \sin(\theta_2) = \pm 1 $

In both cases of the sign, we will have $\cos(\theta_2) = c_2 = 0 $

Then the first column and the last row of $R$ is satisfied for any $\theta_1, \theta_3$. Let's take the case where $s_2 = \sin(\theta_2) = 1 $, then

$R_{12} = s_1 c_3 - c_1 s_3 = \sin(\theta_1 - \theta_3) $

$R_{22} = s_1 s_3 + c_1 c_3 = \cos(\theta_1 - \theta_3)$

$ R_{13} = c_1 c_3 + s_1 s_3 = \cos(\theta_1 - \theta_3)$

$ R_{23} = c_1 s_3 - s_1 c_3 = - \sin(\theta_1 - \theta_3) $

And this means that we can select $\theta_1$ and $\theta_3$ arbitrarily, as long as their difference satisfies the above equations. Similar result holds for the case $s_2 = \sin(\theta_2 ) = -1 $.

Now for the example given in the question, it is given the first set of parameters are $\theta_1 = 0^\circ,\theta_2 = 90^\circ , \theta_3 = 0^\circ$

This gives the rotation matrix

$ R = \begin{bmatrix} 0 && 0 && 1 \\ 0 && 1 && 0 \\ -1 && 0 && 0 \end{bmatrix} $

Thus to generate another set of angles we need to have

$ \sin(\theta'_2) = 1 $ and $ \sin(\theta'_1 - \theta'_3) = 0 $ and $\cos(\theta'_1 - \theta'_3) = 1 $

And this implies that

$\theta'_2 = 90^\circ $ and $ \theta'_1 - \theta'_3 = 0 $

So we can take $\theta'_1 = 60^\circ, \theta'_2 = 90^\circ , \theta'_3 = 60^\circ $, for example.