Lets say I'm using atan2
to get the angle between two vectors.
atan2
gives a value in radians. I convert it to degrees using a built in function in Java. This gives me a value between 0
and 180
degrees or between 0
and -180
(the nature of atan2).
Is there a way to convert the value received with this function (after it's been converted to degrees), to the standard 360-degree-system, without changing the angle - only the way it's written? It would make it easier for me to work with.
Thanks
Try this:
double theta = Math.toDegrees(atan2(y, x));
if (theta < 0.0) {
theta += 360.0;
}