FastLED 3.9.15
Loading...
Searching...
No Matches

◆ atan2()

static FASTLED_FORCE_INLINE s8x8 fl::s8x8::atan2 ( s8x8 y,
s8x8 x )
inlinestatic

Definition at line 177 of file s8x8.h.

177 {
178 constexpr s8x8 pi(3.1415926f);
179 constexpr s8x8 pi_over_2(1.5707963f);
180 if (x.mValue == 0 && y.mValue == 0) return s8x8();
181 if (x.mValue == 0) return y.mValue > 0 ? pi_over_2 : -pi_over_2;
182 if (y.mValue == 0) return x.mValue > 0 ? s8x8() : pi;
183 s8x8 ax = abs(x);
184 s8x8 ay = abs(y);
185 s8x8 a;
186 if (ax >= ay) {
187 a = atan_unit(ay / ax);
188 } else {
189 a = pi_over_2 - atan_unit(ax / ay);
190 }
191 if (x.mValue < 0) a = pi - a;
192 if (y.mValue < 0) a = -a;
193 return a;
194 }
constexpr s8x8() FL_NOEXCEPT=default
constexpr FASTLED_FORCE_INLINE s8x8 abs() const FL_NOEXCEPT
Definition s8x8.h:246
static FASTLED_FORCE_INLINE s8x8 atan_unit(s8x8 t) FL_NOEXCEPT
Definition s8x8.h:403

References s8x8(), abs(), atan_unit(), FASTLED_FORCE_INLINE, FL_NOEXCEPT, fl::x, and fl::y.

Referenced by acos(), and asin().

+ Here is the call graph for this function:
+ Here is the caller graph for this function: