I'm trying to understand spherical coordinates but this is confusing me. To convert longitude ($\theta$) and latitude ($\phi$) to cartesian coordinates, I've seen two formulas.
$X = \cos(\phi)\cos(\theta)$
$Y = \cos(\phi)\sin(\theta)$
$Z = \sin(\phi)$
$X = \sin(\phi)\cos(\theta)$
$Y = \sin(\phi)\sin(\theta)$
$Z = \cos(\phi)$
which one is the correct way or why these two methods exist?
The difference between these two groups of formulas is where $\phi=0$ is. The first group has $Z=\sin(0)=0$ (the equator) when $\phi=0$, and the second group has $Z=\cos(0)=1$ (the north pole) when $\phi=0$. It's just a convention of whether you measure your angles from the equator or from the north pole. If the word "latitude" is used, it might be preferable to use the first group, since the non-mathematical definition of "latitude" measures from the equator.