# Rotation on a sphere and change in coordinates

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?

-
presumably you want $x_1 = a$, $y_1 = b$, and $z_1 = c$ so that the line actually goes through the center of the sphere (and so is a symmetry axis)? –  Willie Wong Nov 7 '12 at 15:14
No, the line is arbitrary. The point rotates around the line in such a way that it always stays on the sphere. –  Adam Nov 7 '12 at 19:38
Then I am afraid I have no idea what you mean by "rotates around the line in such a way that it always stays on the sphere". If you are not restricting it using any sort of symmetry, there are uncountably many circle actions on the sphere. Hence there isn't just "the" new coordinates of the point $P$; point $P$ can be practically anywhere on the sphere. –  Willie Wong Nov 8 '12 at 8:46
Dear Willie, you are right. Could you tell me the new coordinates in the case you mentioned - when the line is passing through the center of the sphere. –  Adam Nov 8 '12 at 13:36

[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}$$

-
Thank you. But when we rotate the point about a line through the center, the point always stays on the sphere. Going back to my initial question when the line is arbitrary.If we rotate the point with some angle, then it will leave the sphere. But the line connecting the image of the point with the center of rotation will meet the sphere at some point $P'$. This point is the image of our initial point on the sphere after the rotation. How can I get the coordinates of it? –  Adam Nov 9 '12 at 0:35
@Adam: that detail is something that you should've mentioned in your original post after my second comment. :-). Can you edit it into your question so it will be clearer to the readers? –  Willie Wong Nov 9 '12 at 8:33
@Adam: hang on: the statement "But the line connecting the image of the point with the center of rotation will meet the sphere at some point $P'$" is not true. Let the sphere be the unit sphere centered around $(2,0,0)$. Let the line of rotation to be the $z$ axis. Let the angle be $\pi/2$. If the initial point is $P = (3,0,0)$ it gets rotated to $P' = (0,3,0)$. Any line through $P'$ and the $z$ axis will lie in the $y$-$z$ plane and will not intersect the sphere. Do you mean instead "... the line connecting the image with the center of the sphere..."? –  Willie Wong Nov 9 '12 at 8:43
Dear Willie, no I didn't mean that. I got confused. I have one more question. If we consider the same problem in spheric coordinates ($P(r,\phi, \psi)$ what will be the transformation that gives the new coordinates $P_1(r, \phi_1, \psi_1)$? –  Adam Nov 12 '12 at 11:53
@Adam: through an arbitrary center point of spherical coordinates that is not tied to the given sphere or the line? The answer would be messy. You are probably better off converting to rectangular coordinates and then converting back after you do the transformation. –  Willie Wong Nov 12 '12 at 13:17