Angle RestrictPhi(Angle phi) { if (std::isnan(phi.value())) { ERROR("function called with NaN"); return phi; } while (phi >= Pi()) phi -= TwoPi(); while (phi < -Pi()) phi += TwoPi(); return phi; }
inline float Tau() { return TwoPi(); }
Angle Wrap(Angle phi) { phi -= double(sgn(phi)) * TwoPi(); return phi; }