cartesian To Polar Algorithm

Moreover, many physical systems — such as those pertained with body move around a central point or with phenomenon originate from a central point — are simpler and more intuitive to model use polar coordinates. The initial motivation for the introduction of the polar system was the survey of circular and orbital movement. Bernoulli's work extended to finding the radius of curvature of curves expressed in these coordinates. 

In the journal Acta Eruditorum (1691), Jacob Bernoulli used a system with a point on a line, named the pole and polar axis respectively. The calculation is essentially the conversion of the equatorial polar coordinates of Mecca (i.e. its longitude and latitude) to its polar coordinates (i.e. its qibla and distance) relative to a system whose reference meridian is the great circle through the given location and the Earth's poles, and whose polar axis is the line through the location and its antipodal point.

cartesian To Polar source code, pseudocode and analysis