[Math] Rotation on a sphere and change in coordinates

geometry

Given a point $P$ with coordinates $(P_x,P_y,P_z)$ on the sphere
$$(x-a)^2 +(y-b)^2 +(z-c)^2 = R^2$$
and a line with equation
$$\frac{x-x_1}{x_2-x_1}=\frac{y-y_1}{y_2-y_1}=\frac{z-z_1}{z_2-z_1}.$$
where $(x_1,y_1,z_1)$ and $(x_2, y_2, z_2)$ are the two points determining the line.
How do I obtain the new coordinates of the point $P$ after rotation about the line on angle $\theta$ such that the point stays on the sphere?

Best Answer

[Edit: the following answer addresses the case of the line through the center of the sphere.]

Note: there is an ambiguity due to the fact that "angle $\theta$" does not specify which way the rotation is going (you can call the North Pole the South Pole, and suddenly the Earth rotate in the other way!)

What I will assume is that you are given the center $(a,b,c)$ of the sphere and a vector $(\alpha,\beta,\gamma) \neq (0,0,0)$ so that $x_2 = a + \alpha$, $y_2 = b + \beta$, and $z_2 = c + \gamma$. We shall assume the rotation is right handed relative to the vector $(\alpha,\beta,\gamma)$, that is, if you look along the direction given by $(\alpha,\beta,\gamma)$, the rotation is clockwise. Note that for any $\lambda \neq 0$, $(\alpha,\beta,\gamma)$ and $(\lambda \alpha,\lambda\beta,\lambda\gamma)$ determine the same line. But if $\lambda < 0$ their rotational directions are opposite.

For convenience we will require that the vector $(\alpha,\beta,\gamma)$ is a unit vector, that is $\alpha^2 + \beta^2 + \gamma^2 = 1$. We can always get this by dividing the vector by its length.

Then we can use this formula here plus a translation: a point $(x,y,z)$ is sent to $$ \begin{pmatrix} x \\ y \\ z\end{pmatrix} \mapsto \begin{pmatrix} a \\ b \\ c\end{pmatrix} + \begin{pmatrix} \cos \theta + (1 - \cos \theta)\alpha^2 & \alpha\beta(1-\cos\theta) - \gamma \sin\theta & \alpha\gamma(1-\cos\theta) + \beta \sin\theta \\ \alpha \beta(1-\cos\theta) + \gamma \sin\theta & \cos\theta + (1-\cos\theta)\beta^2 & \beta\gamma(1-\cos\theta) - \alpha\sin\theta\\ \alpha\gamma(1-\cos\theta) - \beta \sin\theta & \beta\gamma(1-\cos\theta) + \alpha\sin\theta & \cos\theta + (1-\cos\theta) \gamma^2 \end{pmatrix} \begin{pmatrix} x - a \\ y - b \\ z - c\end{pmatrix} $$