Math has defeated me once again. This is such a simple task, but I can't manage to get it done.
Scenario: I draw on a SurfaceView a round image. The user touches a point on image border and starts to drag it adround. I need to rotate the circle image according to user movement. I have two important piece of information, the image center X,Y coordinates and the touched points coordinates.
As you can see in the image, the user touched a point, according to my draw the touched point angle should be around 40. I can't manage to calculate it properly.
I tried using this formula:
angle = Math.atan2(touchedY - centerY, touchedX - centerX) * 180 / Math.PI
I can't manage to understand how I should calculate the angle, as it is now, it doesn't work properly and values are not good. For instance, in the case of the image, the angle calculate is -50.
Thank you for your time, any informations is gladly taken.
LE: Actually I did a mistake I think, as mentioned below. Should the circle be like: