FastLED 3.10.8
Loading...
Searching...
No Matches

◆ emitOrbitalDots()

void fl::FlowFieldFP::emitOrbitalDots ( s16x16 t)
private

Definition at line 723 of file flowfield.cpp.hpp.

723 {
724 int w = mState.width;
725 int h = mState.height;
726 int minDim = fl::min(w, h);
727 int n = mParams.dot_count;
728 constexpr s16x16 half(0.5f);
729 constexpr s16x16 two_pi(6.2831853f);
730 s16x16 fn = s16x16(n);
731 s16x16 inv_fn = s16x16(1) / fn; // Precompute reciprocal (was dividing per dot)
732 s16x16 ocx = s16x16(w) * half - half;
733 s16x16 ocy = s16x16(h) * half - half;
734 s16x16 orad = s16x16(minDim) * s16x16(0.35f);
735 s16x16 base = t * s16x16(3);
736 constexpr s16x16 dotDiam(1.5f);
737 s16x16 step = two_pi * inv_fn; // Use precomputed reciprocal
738
739 for (int i = 0; i < n; i++) {
740 s16x16 a = base + s16x16(i) * step;
741 s16x16 sin_a, cos_a;
742 s16x16::sincos(a, sin_a, cos_a);
743 s16x16 cx = ocx + cos_a * orad;
744 s16x16 cy = ocy + sin_a * orad;
745 CRGB c = rainbow(t, mColorShift_fp, s16x16(i) * inv_fn);
746 drawDot(cx, cy, dotDiam, c.r, c.g, c.b);
747 }
748}
void rainbow()
Params mParams
Definition flowfield.h:286
FlowFieldFPState mState
Definition flowfield.h:400
void drawDot(s16x16 cx, s16x16 cy, s16x16 diam, u8 cr, u8 cg, u8 cb) FL_NO_EXCEPT
s16x16 mColorShift_fp
Definition flowfield.h:405
static FASTLED_FORCE_INLINE void sincos(s16x16 angle, s16x16 &out_sin, s16x16 &out_cos) FL_NO_EXCEPT
Definition s16x16.h:355
fl::CRGB CRGB
Definition video.h:18
FL_DISABLE_WARNING_PUSH U constexpr common_type_t< T, U > min(T a, U b) FL_NO_EXCEPT
Definition math.h:71
constexpr enable_if< is_fixed_point< T >::value, T >::type step(T edge, T x) FL_NO_EXCEPT

References drawDot(), fl::FL_NO_EXCEPT, mColorShift_fp, fl::min(), fl::FlowField::mParams, mState, rainbow(), fl::s16x16::sincos(), fl::step(), and fl::t.

Referenced by drawImpl().

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