polar to cartesian
To convert from Polar Coordinates (r,θ) to Cartesian Coordinates (x,y) : x = r × cos( θ ) y = r × sin( θ )
Source: www.mathsisfun.com
cartesian to polar
#include <cmath> // Cartesian (x,y) --> Polar (r,theta) r = sqrt(x*x + y*y); theta = atan(y/x);