1
$\begingroup$

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?

$\endgroup$
  • $\begingroup$ Is what you're looking for the angle that the projected vector makes with the $z$ axis? $\endgroup$ – user438666 May 7 '18 at 18:59
  • $\begingroup$ @user438666 yes exactly! $\endgroup$ – quantumflash May 7 '18 at 19:04
0
$\begingroup$

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

$\endgroup$
  • 1
    $\begingroup$ Wow, amazing, I can't believe I didn't think of this! Thanks so much! $\endgroup$ – quantumflash May 7 '18 at 19:08
  • $\begingroup$ Wait, but what gave you the insight in the first place to do tan(psi) = x/z? (without going to my answer up top)? Is it because tan(psi) = x/z already takes into account the 3D x and z components projected onto the xz plane? $\endgroup$ – quantumflash May 7 '18 at 19:35
  • $\begingroup$ @quantumflash Orthogonal projection onto the $x$-$z$ plane simply sets $y$ to zero. $\endgroup$ – amd May 7 '18 at 19:44
  • $\begingroup$ @amd thanks! so that implies that the only possible trigonometric function is tan(psi) = x/z because the other two, sin and cos, would involve y? $\endgroup$ – quantumflash May 7 '18 at 19:46
  • $\begingroup$ @quantumflash No. Once you’ve eliminated the $y$ coordinate, you’re just working in two dimensions, with the $z$- and $x$-axes playing the roles of the 2-D $X$- and $Y$-axes, respectively. $\endgroup$ – amd May 7 '18 at 19:49

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.