add tau constant

This commit is contained in:
Casper Lamboo 2018-05-28 13:53:32 +02:00
parent fd6e5cebbd
commit 3944202a83

View File

@ -131,9 +131,10 @@ function lineSegmentsCross(a, b, c, d) {
return (r > 0.0 && r < 1.0) && (s >= 0.0 && s <= 1.0); return (r > 0.0 && r < 1.0) && (s >= 0.0 && s <= 1.0);
} }
const TAU = Math.PI * 2.0;
function normalizeAngle(a) { function normalizeAngle(a) {
a %= Math.PI * 2; a %= TAU;
return a > 0.0 ? a : a + Math.PI * 2; return a > 0.0 ? a : a + TAU;
} }
function betweenAngles(n, a, b) { function betweenAngles(n, a, b) {