If I have 2 points (x0,y0) which is the center of the circle, and another point (x,y) (this is the red dot on the circle boundary in the image). How can I get the angle of the d
Ah, easy mistake to make. atan
returns the value in radians, not degrees. So you need to multiply the angle by 180/pi
to get it back to degrees. You also need to change your dy
to y0 - y
to be consistent with your dx
. Here's some corrected code.
dx, dy = x0-x, y0-y
angle_in_radians = atan2(dy,dx) # you don't need to cast to float
angle_in_degrees = angle_in_radians * 180 / pi