I have a frame of reference positioned on a surface of a sphere with the $z$-axis always pointing towards the center of this sphere, which is at distance $d$.
Now given:
- spherical angle $\phi$
- spherical angle $\theta$
- orientation angle $\omega$ (see this link)
I want to construct the transformation which moves the frame of reference, creating a new one. This new frame of reference should always have the $z'$-axis pointing towards the center and be at distance $d$ from it. This scheme illustrates the transformation.
My idea so far:
- Create a sphere with diameter $d$.
- Find the center of the new reference frame given the spherical angles $\phi$ and $\theta$ using spherical coordinates formula.
- Connect the new point to the center of the sphere to get the new $z'$-axis direction.
What I am struggling with is how to include the orientation angle omega and construct the whole transformation (in some popular notation such as axis-angle, quaternions or Euler angles).
$ \renewcommand\vec\mathbf \newcommand\vecg\boldsymbol \newcommand\unit[1]{\hat{\vec{#1}}} \newcommand\unitg[1]{\hat{\vecg{#1}}} $Place the center of your sphere at the origin. As I understand, we are specifying the position of a frame with spherical coordinates $$ x = d\cos\phi\cos\theta,\quad y = d\cos\phi\sin\theta,\quad z = d\sin\phi. $$ This may look different from the spherical coordinates you are used to because $\phi$ is measured from the $xy$-plane instead of from the $z$-axis, giving us a $90^\circ$ shift. Call the Cartesian axes (i.e. the standard basis) $\unit x, \unit y, \unit z$. It seems that your intent is for the frame with $\omega = 0$ to be specified by the (unit) spherical basis vectors $$ \unit r = -\widehat{\frac{\partial\vec r}{\partial r}} = -(\cos\phi\cos\theta)\unit x - (\cos\phi\sin\theta)\unit y - (\sin\phi)\unit z, $$$$ \unitg\phi = \widehat{\frac{\partial\vec r}{\partial\phi}} = -(\sin\phi\cos\theta)\unit x - (\sin\phi\sin\theta)\unit y + (\cos\phi)\unit z, $$$$ \unitg\theta = \widehat{\frac{\partial\vec r}{\partial\theta}} = -(\sin\phi\sin\theta)\unit x + (\cos\phi\cos\theta)\unit y. $$ (These respectively correspond to what you call $z, x, y$ in your diagram, but I prefer not to use this notation and reserve $x, y, z$ for the standard Cartesian axes.) The angle $\omega$ then performs a rotation of $\unitg\theta$ into $\unitg\phi$, meaning our frame vectors are $$ \unit r(\phi,\theta,\omega) = -(\cos\phi\cos\theta)\unit x - (\cos\phi\sin\theta)\unit y - (\sin\phi)\unit z, $$$$\begin{aligned} \unitg\phi(\phi,\theta,\omega) &= -(\sin\omega)\Bigl(-(\sin\phi\cos\theta)\unit x - (\sin\phi\sin\theta)\unit y + (\cos\phi)\unit z\Bigr) + (\cos\omega)\Bigl(-(\sin\phi\sin\theta)\unit x + (\cos\phi\cos\theta)\unit y\Bigr) \\ &= (\sin\omega\sin\phi\cos\theta-\cos\omega\sin\phi\sin\theta)\unit x + (\sin\omega\sin\phi\sin\theta+\cos\omega\cos\phi\cos\theta)\unit y - (\cos\omega\cos\phi\cos\theta)\unit z \end{aligned}$$$$\begin{aligned} \unitg\theta(\phi,\theta,\omega) &= (\cos\omega)\Bigl(-(\sin\phi\cos\theta)\unit x - (\sin\phi\sin\theta)\unit y + (\cos\phi)\unit z\Bigr) + (\sin\omega)\Bigl(-(\sin\phi\sin\theta)\unit x + (\cos\phi\cos\theta)\unit y\Bigr) \\ &= -(\cos\omega\sin\phi\cos\theta+\sin\omega\sin\phi\sin\theta)\unit x + (\sin\omega\cos\phi\cos\theta-\cos\omega\sin\phi\sin\theta)\unit y + (\cos\omega\cos\phi)\unit z \end{aligned}$$ Thus we have a rotation matrix from the $(0,0,0)$-frame $-\unit x, \unit z, \unit y$ given by $$\begin{pmatrix} \cos\phi\cos\theta & -\cos\omega\sin\phi\cos\theta - \sin\omega\sin\phi\sin\theta & \sin\omega\sin\phi\cos\theta-\cos\omega\sin\phi\sin\theta \\ \cos\phi\sin\theta & \sin\omega\cos\phi\cos\theta-\cos\omega\sin\phi\sin\theta & \sin\omega\sin\phi\sin\theta+\cos\omega\cos\phi\cos\theta \\ \sin\phi & \cos\omega\cos\phi & -\cos\omega\cos\phi\cos\theta \end{pmatrix}.$$