[Math] move a point up and down along a sphere

3dcoordinate systemsgeometry

I have a problem where i have a sphere and 1 point that can be anywhere on that sphere's surface. The Sphere is at the center point (0,0,0).

I now need to get 2 new points, 1 just a little below the and another little above this in reference to the Y axis. If needed or simpler to solve, the points can be about 15º above and below the original point, this viewing the movement on a 2D circle.

Thank you in advance for any given help.

EDIT:

This is to be used on a world globe where the selected point will never be on the top or bottom.

EDIT:

I'm using the latitude and longitude suggested by rlgordonma and user1551

what I'm doing is adding and subtracting a fixed value to ϕ

These 2 apear correctly, at least they apear to look in place:
The original point is in the middle of the 2 bars.
The sphere has R=1 all the coords i'm putting here are rounded because they are to big (computer processed)

enter image description here
coord: (0.77, 0.62, 0,11)

enter image description here
coord: (0.93, -0.65, 0.019)

these don't:

enter image description here
coord: (-0.15, 0.59, 0.79)

enter image description here
coord: (-0.33, 0.73, -0.815)

there are other occasions for both but i didn't want to put all here.

calcs:

    R = 1
    φ = arctan(y/x)
    θ = arccos(z/1)
//to move up only one is used
    φ = φ + π/50
//to move down only one is used
    φ = φ - π/50

    (x,y,z)=(sinθ cosφ, sinθ sinφ, cosθ)

Best Answer

What you need is a conversion between the spherical coordinate system and the Cartesian coordinate system. If $r$ denotes the radius of the sphere, $\theta=\text{polar angle}=\frac\pi2-\text{latitude}\in[0,\pi]$ ($0$ = North pole, $\pi$ = South pole) and $\varphi=\text{longitude}\in[0,2\pi)$, then the conversion from spherical coordinates to Cartesian coordinates is given by \begin{equation} (r,\theta,\varphi)\mapsto(x,y,z)=(r\sin\theta\cos\varphi,\,r\sin\theta\sin\varphi,\,r\cos\theta).\tag{1} \end{equation} To convert back from spherical coordinates to Cartesian coordinates to spherical coordinates, do the following: \begin{align} r&=\sqrt{x^2+y^2+z^2},\\ \theta&=\operatorname{acos}(z/r),\\ \varphi&=\operatorname{atan2}(y,x), \end{align} where atan2 is the quadrant-aware variation of the arc-tangent function. (Certainly you don't need the first equation in your case, as $r$ is a constant.) If you need to report the longtitude in your software, you should check the range of the implementations of acos and atan2 on your computer. If, e.g., the range of atan2 on your computer is $[-\pi,\pi)$, then you should compute $\varphi$ as the remainder of $\operatorname{atan2}(y,x)+2\pi$ modulo $2\pi$.

If you swing the point upward along a meridian by $15^\circ=\pi/12$ radians, the adusted spherical coordinates become $$ \begin{cases} (r,\theta-\frac\pi{12},\varphi)&\text{ if }\, \frac\pi{12}\le\theta\le\pi,\\ (r,\frac\pi{12}-\theta,-\varphi)&\text{ if }\, 0\le\theta<\frac\pi{12}. \end{cases} $$ Put these new spherical coordinates into $(1)$, you get the Cartesian coordinates of the adjusted point. Similarly, if you swing the point downward by $15^\circ$ along a meridian, the adusted spherical coordinates become $$ \begin{cases} (r,\theta+\frac\pi{12},\varphi)&\text{ if } 0\le\theta\le\pi-\frac\pi{12},\\ (r,2\pi-\theta-\frac\pi{12},-\varphi)&\text{ if } \pi-\frac\pi{12}<\theta\le\pi. \end{cases} $$

Related Question