Q:

Formula to find an angle of point on a coordinate plane

Given a plane and an arbitrary (x,y) point, is there a succinct formula to find the angle of that point against the positive y-axis? For example, pictured below the green point is 0 degrees, blue 45 degrees, red 180 degrees, and a point such as the pink one is 315 degrees, not 45 degrees from the the positive y-axis.

A:

The function that will help give you what you want is the “atan2” function. The way it measures the angle is counter-clockwise from the horizontal axis, and it gives an answer between $-180^\circ$ and $180^\circ$. Since you want to measure the angle clockwise, you need to add a minus sign, and since you want answers between $0^\circ$ and $360^\circ$, you need to adjust for that also. Can you figure out a nice formula for just what you want now?

