x, y direction to degree

python, trigonometry

Solution

Depending on what 'North' means, i.e. along which axis, and what direction the angles are supposed to go, the following code should be a solution to your problem:

 math.atan2(y,x)/math.pi*180

This gives you the angle of a point(x,y) from the origin, counter-clockwise with 'North' along the x-axis.

Problem

I have a tuple `(x, y)` with `x` and `y` in [-1, 1]. The tuple represents a movement in any direction. I would like to convert this to a 360 degree angle, where 0 represents north.

Original source