Note on coordinate axes

It may be obvious, but if we assume (x,y), the coordinate axis is (0,0) in the upper left corner of the screen, (+x,y) in the right direction, and (x,+y) in the downward direction.
This is convenient here because it has the same coordinate axes as photoshop.

You can use Math.atan(y/x), for example, to find the angle, but be careful not to use negative coordinates at this time, because it will confuse your mind.
The way the first through fourth quadrants rotate is opposite to the normal (the direction we learned in mathematics)!

This is what got me hooked at first.