Given radius r and angle theta, the cartesian coordinates x and y are given by the formulae:
x = r cos theta
y = r sin theta
Conversely, given x and y, the radius r and angle theta are determined by the formulae:
r = sqrt(x^2+y^2)
theta = "atan2"(y, x)
where "atan2"(y, x) is defined as follows:
"atan2"(y, x) = { (arctan(y/x), " if x > 0"), (arctan(y/x) + pi, " if x < 0 and y >= 0"), (arctan(y/x) - pi, " if x < 0 and y < 0"), (pi/2, " if x = 0 and y > 0"), (-pi/2, " if x = 0 and y < 0"), ("undefined", " if x = 0 and y = 0") :}