Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions Common/MathUtils/include/MathUtils/detail/trigonometric.h
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand All @@ -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
Expand Down
Loading