Combining two rotations

2.2k Views Asked by At

I'm working on a project, where I have to perform rotations of a point which is on the surface of a sphere of radius 1, around the center of the sphere.

In order to do so, I have a function, let's call it $U$, that is parametrized by 3 angles (real numbers) $\theta$, $\phi$ and $\lambda$, and that performs the following operations on its input: it performs a rotation on $z$ of $\phi$ radians, then a rotation over $y$ of $\theta$ radians, and finally a last rotation, again on $z$, of $\lambda$ radians.

In short: $U(\theta, \phi, \lambda) := R_z(\phi) R_y(\theta) R_z(\lambda)$.

Now here is my question: if I successively apply U with angles $\theta_1, \phi_1, \lambda_1$, and then with other angles $\theta_2, \phi_2, \lambda_2$, is there a method to find which angles $\theta, \phi, \lambda$ would have led to the same rotation in only one application of the function, and if so, how ?

3

There are 3 best solutions below

5
On BEST ANSWER

You can express rotations as matrices. Their combination is found by matrix multiplication.

In your case

it performs a rotation on $z$ of $\phi$ radians, then a rotation over $y$ of $\theta$ radians, and finally a last rotation, again on $z$, of $\lambda$ radians.

we have:

\begin{align} U &= R_z(\lambda) \, R_y(\theta) \, R_z(\phi) \\ &= \begin{pmatrix} \cos\lambda & -\sin\lambda & 0 \\ \sin\lambda & \cos\lambda & 0 \\ 0 & 0 & 1 \end{pmatrix} \begin{pmatrix} \cos\theta & 0 & -\sin\theta \\ 0 & 1 & 0 \\ \sin\theta & 0 & \cos\theta \end{pmatrix} \begin{pmatrix} \cos\phi & -\sin\phi & 0 \\ \sin\phi & \cos\phi & 0 \\ 0 & 0 & 1 \end{pmatrix} \\ &= \begin{pmatrix} \cos\lambda & -\sin\lambda & 0 \\ \sin\lambda & \cos\lambda & 0 \\ 0 & 0 & 1 \end{pmatrix} \begin{pmatrix} \cos\theta \cos\phi & -\cos\theta \sin\phi & -\sin\theta \\ \sin\phi & \cos\phi & 0 \\ \sin\theta \cos\phi & -\sin\theta \sin\phi & \cos\theta \end{pmatrix} \\ &= \begin{pmatrix} \cos\lambda \cos\theta \cos\phi - \sin\lambda \sin\phi & -\cos\lambda \cos\theta \sin\phi - \sin\lambda \cos\phi & -\cos\lambda \sin\theta \\ \sin\lambda \cos\theta \cos\phi + \cos\lambda \sin\phi & -\sin\lambda \cos\theta \sin\phi + \cos\lambda \cos\phi & -\sin\lambda \sin\theta \\ \sin\theta \cos\phi & -\sin\theta \sin\phi & \cos\theta \end{pmatrix} \end{align} This results in a single $3 \times 3$ matrix.

If you have two of those transformations $U_1$ and $U_2$ then the composition is given by the matrix product $$ U_2 U_1 $$ One would have to calculate the resulting matrices and then check if it is possible to easily read the angles from the result.

0
On

A lot of details about this subject are in the Wikipedia article Euler angles. It seems to me that Euler angles are not a good way to parametrize 3D rotations. As an alternative, you can use quaternions as in the Wikipedia article Quaternion and spatial rotations and just multiply quaternions in order to perform 3D rotations. An ambiguity is that a quaternion and its negative give the same rotation.

0
On

Start from the rotation matrix in terms of Euler angles. $$R(\phi,\theta,\lambda)=\begin{pmatrix}R_{11}& R_{12} &R_{13}\\R_{21}& R_{22} &R_{23}\\R_{31}& R_{32} &R_{33}\end{pmatrix}$$

First calculate the inner most angle. If $R_{31}$ and $R_{32}$ are both zero, use $\lambda=0$. Otherwise $$\tan\lambda=\frac{R_{32}}{-R_{31}}$$ You can use the $\arctan2$ function $$\lambda=\arctan2 (R_{32},-R_{31})$$

Now calculate $$R'(\phi,\theta)=R(\phi,\theta,\lambda)R^{-1}_z(\lambda)=R(\phi,\theta,\lambda)R_z(-\lambda)$$

If you do the calculations right, you get $\phi=\arctan2(-R'_{12},R'_{22})$ and $\theta=\arctan2(-R'_{31},R'_{33})$