How do I calculate the angles between a point on a sphere and each unit vector in $\Bbb R ^3$?

782 Views Asked by At

Given the Cartesian coordinates of any point $p$ on the surface of a sphere in $\Bbb R ^3$, how do I calculate the angles between each axis $(x, y, z)$ and the vector $n$ defined by origin $o$ and $p$.

For convenience sake I'll say that origin $o$ equals $(0,0,0)$ so that $n = p$

I begun my attempt by calculating the direction cosines, but now that I want to calculate the angles using inverse cosines, I realize that a sphere has eight octants and that cosines have 2 angles in some of them.

Is there a more elegant way to solve this? And if so, how do I approach this?

2

There are 2 best solutions below

3
On BEST ANSWER

Compute the scalar product and divide by the norms of the vectors: in your case, this would be $\frac 1 {\| p \|} (p_x x + p_y y + p_z z)$ (assuming $\|(x,y,z)\| = 1$). This gives you the cosine of the angle you are looking for, so now apply $\arccos$ and that is your angle (between $0$ and $\pi$).

0
On

Suppose you have some point $p$ on your sphere. And the vector from the origin to that point is represented by:

$$\vec{p}=\begin{pmatrix}p_1 \\ p_2\\p_3\end{pmatrix}$$

If you want to know the angle between that vector $\vec{p}$ and any other vector $\vec{x}$, you can use the dot product:

$$\vec{p} \cdot \vec{x}=\lvert p\rvert \lvert q\rvert \cos \alpha$$

where $\alpha$ represents the angle between $\vec{p}$ and $\vec{x}$. Solving for $\alpha$:

$$\alpha=\cos^{-1}(\frac{\vec{p} \cdot \vec{x}}{\lvert p\rvert \lvert q\rvert})$$

Hope this helps.