diff --git a/libs/main/math/pimathbase.h b/libs/main/math/pimathbase.h index 6d5b9169..02ba01a3 100644 --- a/libs/main/math/pimathbase.h +++ b/libs/main/math/pimathbase.h @@ -157,6 +157,34 @@ inline PIVector piAbs(const PIVector & v) { } +template +void normalizeAngleDeg360(T & a) { + while (a < 0.) + a += 360.; + while (a > 360.) + a -= 360.; +} +template +double normalizedAngleDeg360(T a) { + normalizeAngleDeg360(a); + return a; +} + + +template +void normalizeAngleDeg180(T & a) { + while (a < -180.) + a += 360.; + while (a > 180.) + a -= 360.; +} +template +double normalizedAngleDeg180(T a) { + normalizeAngleDeg180(a); + return a; +} + + template bool OLS_Linear(const PIVector> & input, T * out_a, T * out_b) { static_assert(std::is_arithmetic::value, "Type must be arithmetic");