Conversion xyz to spherical coordinates
To convert Cartesian coordinates to spherical coordinates , you can use the following formulas:
Note: Use the atan2(y, x) function for correct quadrant determination.
atan2(y, x)