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

◆ atan2()

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

Definition at line 166 of file s12x4.h.

166 {
167 constexpr s12x4 pi(3.1415926f);
168 constexpr s12x4 pi_over_2(1.5707963f);
169 if (x.mValue == 0 && y.mValue == 0) return s12x4();
170 if (x.mValue == 0) return y.mValue > 0 ? pi_over_2 : -pi_over_2;
171 if (y.mValue == 0) return x.mValue > 0 ? s12x4() : pi;
172 s12x4 ax = abs(x);
173 s12x4 ay = abs(y);
174 s12x4 a;
175 if (ax >= ay) {
176 a = atan_unit(ay / ax);
177 } else {
178 a = pi_over_2 - atan_unit(ax / ay);
179 }
180 if (x.mValue < 0) a = pi - a;
181 if (y.mValue < 0) a = -a;
182 return a;
183 }
constexpr FASTLED_FORCE_INLINE s12x4 abs() const FL_NOEXCEPT
Definition s12x4.h:235
static FASTLED_FORCE_INLINE s12x4 atan_unit(s12x4 t) FL_NOEXCEPT
Definition s12x4.h:391
constexpr s12x4() FL_NOEXCEPT=default

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