I'm working on a dial that rotates around a circle.
This dial should lets you mousemove anywhere in a circle to adjust the position of the dial to a point on the circle with the same angle as the click. For example, from the dial above if you clicked the spot shown in pink below I'd move the dial above that point but on the circle.
I know how to get the position of a point on a circle given a radius and an angle (in radians). That's this formula:
x = Cos(angle) * radius + CenterX; y = Sin(angle) * radius + CenterY;
However, I am looking to do somewhat of the opposite -- I've got a click point, which I want to turn into a point on a circle (where the control knob goes). I'm trying to use this point (and a given radius) to figure out the angle in radians for it, so that I can place the control knob on the circle at the same angle.
Is there a handy formula I can use to accomplish this?