scan-context/src2/fast_evaluator/src/XY2Theta.m

18 lines
361 B
Mathematica
Raw Normal View History

2021-10-19 00:52:28 +00:00
function [ theta ] = XY2Theta( x, y )
if (x >= 0 && y >= 0)
theta = 180/pi * atan(y/x);
end
if (x < 0 && y >= 0)
theta = 180 - ((180/pi) * atan(y/(-x)));
end
if (x < 0 && y < 0)
theta = 180 + ((180/pi) * atan(y/x));
end
if ( x >= 0 && y < 0)
theta = 360 - ((180/pi) * atan((-y)/x));
end
end