The following question: https://math.stackexchange.com/questions/1319615/how-to-calculate-opposite-direction-angle shows the formula for doing this. How would I write this: (α+180) mod 360 in javascript. (a is a variable)
You should use the % operator:
var angle = 210;
var oppositeAngle = (angle + 180) % 360;
console.log(oppositeAngle);
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With