The atan2
function gives the angle of a point with respect to the X axis, given the point's x and y coordinates. The result typically ranges betwen -180 and 180 degrees, but we can adjust that to [0, 360] later.
You can find the angle between two lines A and B that extend from the origin, by subtracting their atan results:
angle = atan2(a.y, a.x) - atan2(b.y, b.x);
Here, your A point would be (0,1) and your B point would be (0.3, -0.17).
atan2
usually returns the angle in radians and not degrees (check your language's documentation to be sure). If this is the case, you should convert it into degrees here.
angle = angle * 360 / (2*pi);
angle
will now be somewhere between -360 and 360 degrees, so you'll need to perform an additional check to get it in the desired range.
if (angle < 0){
angle = angle + 360;
}