[Math] How to project 3D vector on unit sphere to 2D in $xz$ plane

projective-geometrypythonspherical coordinatesspherical-geometrytrigonometry

I'm trying to use Python to do something that I thought would be simple geometry, but I don't understand the math behind what I'm computing.

I want to project a 3D vector on the unit sphere to 2D on the xz plane, and then compute the 2D projected angle of the projected vector on the xz plane (say, relative to the z-axis). I already know the spherical angles $\theta$ (the 3D polar angle relative to z-axis) and $\phi$ (the 3D azimuthal angle, relative to the x-axis for the 3D vector projected onto the xy plane).

I was told that the 2D projected angle $\psi$ (in the xz plane, relative to the z-axis) can be computed via

tan($\psi$) = tan($\theta$)cos($\phi$)

but it's not obvious to me how to derive that. How do I verify that formula?

Best Answer

Say your point has coordinates $(x,y,z) = (r \sin\theta \cos \phi, r \sin \theta \sin \phi, r \cos \theta)$. Then, $$\tan \psi = \frac{x}{z} = \frac{r \sin \theta \cos \phi}{r \cos \theta} = \tan \theta \cos \phi$$

Related Question