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

◆ atan2()

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

Definition at line 177 of file s4x12.h.

177 {
178 constexpr s4x12 pi(3.1415926f);
179 constexpr s4x12 pi_over_2(1.5707963f);
180 if (x.mValue == 0 && y.mValue == 0) return s4x12();
181 if (x.mValue == 0) return y.mValue > 0 ? pi_over_2 : -pi_over_2;
182 if (y.mValue == 0) return x.mValue > 0 ? s4x12() : pi;
183 s4x12 ax = abs(x);
184 s4x12 ay = abs(y);
185 s4x12 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 }
static FASTLED_FORCE_INLINE s4x12 atan_unit(s4x12 t) FL_NOEXCEPT
Definition s4x12.h:402
constexpr s4x12() FL_NOEXCEPT=default
constexpr FASTLED_FORCE_INLINE s4x12 abs() const FL_NOEXCEPT
Definition s4x12.h:246

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