diff --git a/Common/MathUtils/include/MathUtils/detail/trigonometric.h b/Common/MathUtils/include/MathUtils/detail/trigonometric.h index 3b363d1955a18..afdfbb57b0f28 100644 --- a/Common/MathUtils/include/MathUtils/detail/trigonometric.h +++ b/Common/MathUtils/include/MathUtils/detail/trigonometric.h @@ -275,12 +275,11 @@ GPUhdi() constexpr T fastATan2(T y, T x) // Average inaccuracy: 0.00048 // Max inaccuracy: 0.00084 // Speed: 6.2 times faster than atan2f() - constexpr T Pi = 3.1415926535897932384626433832795; - auto atan = [](T a) -> T { // returns the arctan for the angular range [-Pi/4, Pi/4] // the polynomial coefficients are taken from: // https://stackoverflow.com/questions/42537957/fast-accurate-atan-arctan-approximation-algorithm + constexpr T Pi = 3.1415926535897932384626433832795; constexpr T A = 0.0776509570923569; constexpr T B = -0.287434475393028; constexpr T C = ((Pi / 4) - A - B); @@ -290,6 +289,7 @@ GPUhdi() constexpr T fastATan2(T y, T x) auto atan2P = [atan](T yy, T xx) -> T { // fast atan2(yy,xx) for the angular range [0,+Pi] + constexpr T Pi = 3.1415926535897932384626433832795; constexpr T Pi025 = 1 * Pi / 4; constexpr T Pi075 = 3 * Pi / 4; const T x1 = xx + yy; // point p1 (x1,y1) = (xx,yy) - Pi/4