The 3-D polar coordinate system or the spherical coordinate system involves the distance from the origin and 2 angles

The position of point P is described as (r, phi ,theta ),
where r = the distance from the origin (O),
phi = the horizontal azimuth angle measured on the XY plane from the X axis in the counterclockwise direction,
theta = the azimuth angle measured from the Z axis.
The relationship between the spherical coordinates and the Cartesian coordinates are

