Formula

R = sqrt(x * x + y * y) , angle = atan(y/x)

Where,
Rectangle coordinates:
x and y - horizontal and vertical distances from the origin.

Polar coordinates(r, q):
r - the distance from the origin to the point.
q - the angle measured from the positive x axis to the point.
t - angle (in degrees).