1 #ifndef DataFormatsMathAPPROX_ATAN2_H 2 #define DataFormatsMathAPPROX_ATAN2_H 43 return x * (
float(-0xf.8eed2p-4) +
x *
x *
float(0x3.1238p-4));
64 return x * (
float(-0xf.ff73ep-4) +
73 return x * (
float(-0xf.ffe82p-4) +
75 z * (
float(-0x3.18bea8p-4) +
83 return x * (
float(-0xf.fffbep-4) +
85 z * (
float(-0x3.2b4df8p-4) +
94 return x * (
float(-0xf.ffff4p-4) +
95 z * (
float(0x5.552f9p-4 +
z * (
float(-0x3.30f728p-4) +
96 z * (
float(0
x2.39826p-4) +
97 z * (
float(-0
x1.8a880cp-4) +
98 z * (
float(0xe.484d6p-8) +
99 z * (
float(-0x5.93d5p-8) +
z *
float(0
x1.0875dcp-8)))))))));
102 template <
int DEGREE>
104 constexpr float pi4f = 3.1415926535897932384626434 / 4;
105 constexpr float pi34f = 3.1415926535897932384626434 * 3 / 4;
111 auto angle = (
x >= 0) ? pi4f : pi34f;
112 angle += approx_atan2f_P<DEGREE>(
r);
117 template <
int DEGREE>
119 return unsafe_atan2f_impl<DEGREE>(
y,
x);
122 template <
int DEGREE>
124 return unsafe_atan2f_impl<DEGREE>(
y, ((
y == 0.f) & (
x == 0.
f)) ? 0.2
f :
x);
135 template <
int DEGREE>
142 return x * (-664694912.f +
z * 131209024.f);
149 return x * (-680392064.f +
z * (197338400.f +
z * (-54233256.f)));
156 return x * (-683027840.f +
z * (219543904.f +
z * (-99981040.f +
z * 26649684.f)));
163 return x * (-683473920.f +
z * (225785056.f +
z * (-123151184.f +
z * (58210592.f +
z * (-14249276.f)))));
171 (-683549696.f +
z * (227369312.f +
z * (-132297008.f +
z * (79584144.f +
z * (-35987016.f +
z * 8010488.f)))));
178 return x * (-683562624.f +
180 z * (-135400128.f +
z * (90460848.f +
z * (-54431464.f +
z * (22973256.f +
z * (-4657049.f)))))));
186 return x * (-683562624.f +
188 z * (-135400128.f +
z * (90460848.f +
z * (-54431464.f +
z * (22973256.f +
z * (-4657049.f)))))));
191 template <
int DEGREE>
201 auto angle = (
x >= 0) ? pi4 : pi34;
202 angle +=
int(approx_atan2i_P<DEGREE>(
r));
208 template <
int DEGREE>
210 return unsafe_atan2i_impl<DEGREE>(
y,
x);
215 template <
int DEGREE>
222 return x * ((-10142.439453125f) +
z * 2002.0908203125
f);
228 return x * ((-10381.9609375f) +
z * ((3011.1513671875
f) +
z * (-827.538330078125f)));
234 return x * ((-10422.177734375f) +
z * (3349.97412109375
f +
z * ((-1525.589599609375
f) +
z * 406.64190673828125f)));
240 return x * ((-10428.984375f) +
z * (3445.20654296875
f +
z * ((-1879.137939453125
f) +
241 z * (888.22314453125f +
z * (-217.42669677734375f)))));
244 template <
int DEGREE>
247 constexpr short pi4 = short(maxshort / 4);
248 constexpr short pi34 = short(3 * maxshort / 4);
254 auto angle = (
x >= 0) ? pi4 : pi34;
255 angle += short(approx_atan2s_P<DEGREE>(
r));
260 template <
int DEGREE>
262 return unsafe_atan2s_impl<DEGREE>(
y,
x);
267 return std::round(
x * p2i);
282 return std::round(
x * p2i);
constexpr float approx_atan2f_P< 13 >(float x)
constexpr short phi2short(float x)
constexpr int unsafe_atan2i(float y, float x)
constexpr float approx_atan2s_P< 3 >(float x)
constexpr float approx_atan2i_P< 9 >(float x)
constexpr float approx_atan2f_P< 15 >(float x)
constexpr float approx_atan2i_P< 3 >(float x)
constexpr float approx_atan2s_P< 7 >(float x)
constexpr float safe_atan2f(float y, float x)
constexpr float approx_atan2f_P< 7 >(float x)
constexpr float unsafe_atan2f(float y, float x)
constexpr double int2dphi(int x)
constexpr short unsafe_atan2s_impl(float y, float x)
constexpr float approx_atan2s_P(float x)
constexpr float approx_atan2f_P< 5 >(float x)
constexpr float approx_atan2f_P(float x)
Abs< T >::type abs(const T &t)
constexpr float approx_atan2i_P< 15 >(float x)
constexpr float approx_atan2s_P< 9 >(float x)
constexpr float int2phi(int x)
constexpr float approx_atan2i_P(float x)
constexpr float approx_atan2i_P< 7 >(float x)
constexpr short unsafe_atan2s(float y, float x)
constexpr float approx_atan2i_P< 5 >(float x)
constexpr float short2phi(short x)
constexpr float approx_atan2f_P< 11 >(float x)
constexpr float approx_atan2s_P< 5 >(float x)
constexpr float approx_atan2i_P< 11 >(float x)
constexpr float unsafe_atan2f_impl(float y, float x)
constexpr float approx_atan2f_P< 9 >(float x)
constexpr int phi2int(float x)
constexpr float approx_atan2i_P< 13 >(float x)
constexpr int unsafe_atan2i_impl(float y, float x)
constexpr float approx_atan2f_P< 3 >(float x)
T angle(T x1, T y1, T z1, T x2, T y2, T z2)