Factor a 3D rotation as a rotation along an horizontal axis followed by a rotation along the vertical

94 Views Asked by At

As the title says, I am trying to find, for any rotation R, a unit vector $u = [u_x, u_y, 0]$, and two angles $\alpha$ and $\beta$, such that R is equal to a rotation of angle $\alpha$ around $u$ and a rotation of angle $\beta$ around $[0, 0, 1]$. I have trouble finding out if this is always possible, and if such a factorization is unique.

I am not particularly interested in $u$, $\alpha$ and $\beta$ directly, but more in the factorisation of $R$ as a product of rotation matrices or quaternions.

Going through Euler angles does not give me what I want because the composition of the pitch and roll rotations will give some amount of rotation around the Z axis. I have tried to express the problem through matrices and quaternions, and while some terms can be easily expressed (at least up to a sign), the computation gets too unwieldy for me.

3

There are 3 best solutions below

0
On BEST ANSWER

Here is a computation using quaternions, which avoids any trigonometric computation.

For any quaternion $q = a i + b j + c k + d$, we say that it represents a vertical rotation if $a = b = 0$, and a horizontal rotation if $c = 0$. We want to factor any quaternion $q$ as $q^Hq^Z$, where $q^Z$ and $q^H$ respectively represent a verical and a horizontal rotation.

Let $q'= c k + d$. Then a direct computation shows that $q * \bar q'$ represents a horizontal rotation (where $\bar q' = -ck + d$ is the conjugate of $q'$). We therefore get the required factorization by setting $q^Z = q' / ||q'||$ and $q^H = q \bar q^Z$. ( ||q'|| = 0 implies that c = 0 and $q$ is already a horizontal rotation, in which case we can set $q^Z = 1$).

As a bonus, the same computation shows that $\bar q' * q$ also represents a horizontal rotation. So we get that the vertical rotation of the factorisation is independent of the order of the factorisation, i.e. for any unit $q$, $q = q^Z q^H_1 = q^H_2 q^Z$.

1
On

Let rotation $R$ be about vector $OA$ (pink in the figure) of angle $\varphi$, vector $u=OB$ (green in the figure) in the $xy$ plane the axis of rotation $U$ (by angle $\alpha$), and $(0,0,1)$ (blue) the axis of rotation $Z$ (by angle $\beta$). We must find $u$, $\alpha$ and $\beta$ such that $R=ZU$.

From $Ru=ZUu$ it follows $Ru=Zu$, hence the image $OB'$ of vector $u$ under rotation $R$ must lie in the $xy$ plane. If $M$ is the midpoint of $BB'$ then line $OM$ is the projection of line $OA$ on the $xy$ plane, and $\angle BOM=\beta/2$. Moreover, if $C$ is the projection of $B$ on line $OA$ and $\angle AOK=\theta$, then we have: $$ BM=OM\tan{\beta\over2}=CM\tan{\varphi\over2} \quad\text{and}\quad CM=OM\cos\theta, $$ that is: $$ \tag{1} \tan{\beta\over2}=\cos\theta\tan{\varphi\over2}. $$ We have then a first result: angle $\beta$ is given by equation $(1)$ and the direction of vector $u$ is obtained by rotating by $-\beta/2$ about $z$-axis the projection of vector $OA$ on $xy$ plane.

To find $\alpha$ let's consider the rotation of vector $OA$. From $OA=R(OA)=ZU(OA)$ it follows $Z^{-1}(OA)=U(OA)$, hence the image $OA'$ of $OA$ under $U$ is also obtained by rotating $OA$ by angle $-\beta$ about $z$-axis. If $N$ is the midpoint of $AA'$, $K$ is the projection of $A$ on $z$-axis and $D$ is the projection of $A$ on line $OB$, then we have: $$ A'N=A'K\sin{\beta\over2}=DN\tan{\alpha\over2} \quad\text{and}\quad DN=OK=AK\cot\theta, $$ that is: $$ \tag{2} \tan{\alpha\over2}=\tan\theta\sin{\beta\over2}= {\sin\theta\tan({\varphi/2})\over\sqrt{1+\cos^2\theta\tan^2({\varphi/2})}}. $$

To prove that $R=ZU$ one only needs to prove that both rotations give the same result when applied to a third independent vector, for instance $(0,0,1)$. I did the check with the help of Mathematica and can write here the details if needed.

enter image description here

0
On

$ \renewcommand\vec\mathbf \newcommand\uvec[1]{\hat{\vec#1}} \renewcommand\Re{\mathop{\mathrm{Re}}} \renewcommand\Im{\mathop{\mathrm{Im}}} $Consider the axis-angle representation $R = (\uvec r, \theta)$, $U = (\uvec u, \alpha)$, and $Z = (\uvec z, \beta)$. Form the Rodrigues vectors $$ \vec R = \uvec r\tan\frac\theta2,\quad \vec U = \uvec u\tan\frac\alpha2,\quad \vec Z = \uvec z\tan\frac\beta2. $$ If we interpret vectors as imaginary quaternions (with $\uvec z = k$), then we have a close relationship between the Rodrigues vectors and the quaternion representation of a rotation; for example $$ \vec R = \frac{\Im q_R}{\Re q_R},\quad q_R \propto 1 + \vec R. $$ Note that when $\Re q_R = 0$ (a $180^\circ$ rotation) this formula is invalid even in the form $(\Re q_R)\vec R = \Im q_R$. We want $R$ to be the composition of $U$ followed by $Z$; this means that the Rodrigues vectors satisfy $$ \vec R = \frac{\vec U + \vec Z - \vec U\times\vec Z}{1 - \vec U\cdot\vec Z} = \vec U + \vec Z - \vec U\times\vec Z. \tag{$*$} $$ Because $\vec U$ and $\vec U\times\vec Z$ both lie in the plane orthogonal to $\vec Z$ we see immediately that $$ \vec Z = (\vec R\cdot\uvec z)\uvec z. $$

So now consider that we have $R$ in quaternion form $q_R$. Then we have the following formulas for the quaternions $q_U$ and $q_Z$: $$ q_Z = C\left(1 + T\uvec z\right),\quad q_U = \bar q_Zq_R, $$$$ T = \frac{\uvec z\cdot\Im q_R}{\Re q_R} = (\uvec z\cdot\uvec r)\tan\frac\theta2,\quad C = \frac1{\sqrt{1 + T^2}} $$ where $\bar q_Z$ is the conjugate. Note that $q_Z$ is just $1 + T\uvec z$ normalized.

We could instead solve for $\vec U$ directly: since $\vec U$ and $\vec Z$ are orthogonal we have $\vec U\vec Z = \vec U\times\vec Z$ whence ($*$) becomes $$ \vec R - \vec Z = \vec U(1 - \vec Z) \implies \vec U = \frac{(\vec R - \vec Z)(1 + \vec Z)}{1 + |\vec Z|^2}. $$ This expands to give $$ \vec U = \frac{\vec R + R_z(\vec R\times\uvec z - \uvec z)}{1 + R_z^2},\quad R_z = \vec R\cdot\uvec z. \tag{$**$} $$

The Rodrigues vector representation is invalid for $180^\circ$ rotations, so we have to consider the case $\theta = 180^\circ$. Let $$ C_Z = \cos\beta/2,\quad C_U = \cos\alpha/2. $$ In this case $q_R = \uvec r$. If both $\alpha,\beta \ne 180^\circ$ then $Z, U$ have Rodrigues vectors and we can write $$ \uvec r = C_ZC_U(1 + \vec Z)(1 + \vec U) = C_ZC_U(1 + \vec Z + \vec U + \vec Z\times\vec U) $$ using the fact that $\vec Z\vec U = \vec Z\times\vec U$ because they are orthogonal. But this is impossible because the RHS has a nonzero scalar component, so at least one of $\alpha,\beta$ must be $180^\circ$. If $\beta = 180^\circ$ then we easily get $$ \uvec r = \uvec zq_U \implies q_Z = \uvec z,\quad q_U = -\uvec z\uvec r = \uvec z\cdot\uvec r - \uvec z\times\uvec r. $$ The $q_U$ obtained is in fact the same as taking $\theta = 180^\circ$ in ($**$).

The case where $\alpha = 180^\circ$ but $\beta \ne 180^\circ$ I am still struggling to figure out. One thing I can derive is the following: we may write $\uvec r = q_Z\uvec u$, and if we let $q_Z'$ be the quaternion rotating $\uvec r$ to $\uvec u$ about the $z$-axis then $$ \uvec u = q_Z'\uvec r\bar q_Z' = q_Z'q_Z\uvec u\bar q_Z' \implies 1 = (q_Z')^2q_Z $$ because $\uvec u$ is orthogonal to $\uvec z$ and so $\uvec u\bar q_Z' = q_Z'\uvec u$; and $q_Z$ and $q_Z'$ commute because they are about the same axis. Thus we may conclude that $\uvec u$ is obtained by inverting the $Z$ rotation, halving its angle, and applying it to $\uvec r$.