Rotating a point in spherical coordinates around Cartesian axis

17.5k Views Asked by At

If I have a point in spherical coordinates, and I rotate it around one of the Cartesian axes, what will be the new spherical coordinates for the point? Both spherical and Cartesian coordinate systems have the same origin. Rotation axes go through origin as in the image below.

enter image description here

I'm building a mechanical device that has a camera rotating around object, and camera's relative coordinates should remain same while object rotates. I've read Wikipedia pages about transformation matrices etc, but those goes way over my head.

2

There are 2 best solutions below

0
On

Denote rotation matrix about an axis $\omega$ and rotation angle $\theta$ by $R_\omega(\theta)$. Then the Cartesian coordinate of a point can be represented by spherical coordinates in the following way: $$ \left[\begin{array}{c} x\\ y\\ z \end{array}\right]=R_z(\theta)\cdot R_y(\varphi)\cdot rz,\quad z=\left[\begin{array}{c} 0\\ 0\\ 1 \end{array}\right] $$ Then rotate the point $p=(x,y,z)$ about the three coordinate axes is given by (note that $R_z(\sigma)\cdot z=z, \forall \sigma\in\mathbb R$): $$ \begin{split} R_x(\alpha)\cdot R_z(\theta)\cdot R_y(\varphi)\cdot rz&=R_z(\theta')\cdot R_y(\varphi')\cdot rz\\ (&=R_z(\theta')\cdot R_y(\varphi')\cdot R_z(\sigma')\cdot rz) \end{split} $$ $$ \begin{split} R_y(\beta)\cdot R_z(\theta)\cdot R_y(\varphi)\cdot rz&=R_z(\theta'')\cdot R_y(\varphi'')\cdot rz\\ (&=R_z(\theta'')\cdot R_y(\varphi'')\cdot R_z(\sigma'')\cdot rz) \end{split} $$ and $$ R_z(\gamma)\cdot R_z(\theta)\cdot R_y(\varphi)\cdot rz=R_z(\theta+\gamma)\cdot R_y(\varphi)\cdot rz $$ This way, you see that for rotation about $z$, the result is immediate, and for rotation about $x$, this is the problem of transform between $YZX$ and $ZYZ$ Euler angles, and for $y$ it is between $YZY$ and $ZYZ$ Euler angles. There are ready-to-use routines for solving this problem (it might help to use quaternions to deal with the consecutive rotation if you intend to write the code yourself).

0
On

You can work with the rotation operators in $\mathbb{C}^2$. This method is well-known in quantum mechanics (rotation on the Bloch sphere).

I assume the following spherical coordinates system ($\theta$: colatitude, $\phi$: longitude): enter image description here

Given the coordinate angles $(\theta, \phi)$, define a vector $Q(\theta, \phi)$ in $\mathbb{C}^2$ by $$ Q(\theta, \phi) = \begin{pmatrix} \cos \frac{\theta}{2} \\ e^{i\phi}\sin\frac{\theta}{2}\end{pmatrix}. $$ Conversely, given a vector $\begin{pmatrix} z_1 \\ z_2 \end{pmatrix} \in \mathbb{C}^2$, define the coordinate angles $(\theta, \phi)$ by $$ Q^{-1}\begin{pmatrix} z_1 \\ z_2 \end{pmatrix} = \left( 2\, \textrm{atan} \frac{\textrm{Mod}(z_2)}{\textrm{Mod}(z_1)}, \textrm{Arg}(z_2)-\textrm{Arg}(z_1)\right). $$

Then the rotation to the angle $\alpha$ around a Cartesian axis maps the coordinate angles $(\theta,\phi)$ to the coordinate angles $$ (\theta', \phi') = (Q^{-1} \circ R_{\textrm{axis}}(\alpha) \circ Q)(\theta,\phi) $$ where the rotation operator $R_{\textrm{axis}}(\alpha)$ is, depending on the rotation axis: \begin{gather} R_x(\alpha) = \begin{pmatrix} \cos\frac{\alpha}{2} & -i\sin\frac{\alpha}{2} \\ -i\sin\frac{\alpha}{2} & \cos\frac{\alpha}{2} \end{pmatrix}, \\ R_y(\alpha) = \begin{pmatrix} \cos\frac{\alpha}{2} & -\sin\frac{\alpha}{2} \\ \sin\frac{\alpha}{2} & \cos\frac{\alpha}{2} \end{pmatrix}, \\ R_z(\alpha) = \begin{pmatrix} e^{-i\frac{\alpha}{2}} & 0 \\ 0 & e^{i\frac{\alpha}{2}} \end{pmatrix}. \end{gather}