MCPcopy Create free account
hub / github.com/FastLED/FastLED / atan2

Method atan2

src/fl/math/fixed_point/base.h:180–197  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

178 }
179
180 static FASTLED_FORCE_INLINE Derived atan2(Derived y, Derived x) {
181 constexpr Derived pi(3.1415926f);
182 constexpr Derived pi_over_2(1.5707963f);
183 if (x.mValue == 0 && y.mValue == 0) return Derived();
184 if (x.mValue == 0) return y.mValue > 0 ? pi_over_2 : -pi_over_2;
185 if (y.mValue == 0) return x.mValue > 0 ? Derived() : pi;
186 Derived ax = abs(x);
187 Derived ay = abs(y);
188 Derived a;
189 if (ax >= ay) {
190 a = atan_unit(ay / ax);
191 } else {
192 a = pi_over_2 - atan_unit(ax / ay);
193 }
194 if (x.mValue < 0) a = pi - a;
195 if (y.mValue < 0) a = -a;
196 return a;
197 }
198
199 static FASTLED_FORCE_INLINE Derived asin(Derived x) {
200 constexpr Derived one(1.0f);

Callers

nothing calls this directly

Calls 2

DerivedClass · 0.50
absFunction · 0.50

Tested by

no test coverage detected