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

◆ atan2()

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

Definition at line 176 of file s8x24.h.

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

References s8x24(), 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: