73 {
74
76 int R =
static_cast<int>(
fl::ceil(r));
77
78 int cx = static_cast<int>(fx + (fx >= 0.0f ? 0.5f : -0.5f));
79 int cy = static_cast<int>(fy + (fy >= 0.0f ? 0.5f : -0.5f));
80 float r2 = r * r;
81 for (int dy = -R; dy <= R; ++dy) {
82 for (int dx = -R; dx <= R; ++dx) {
83 float d2 = static_cast<float>(dx * dx + dy * dy);
84 if (d2 <= r2) {
85 float fall = 1.0f - (d2 / (r2 + 0.0001f));
86 float vf = 255.0f * fall;
87 if (vf < 0.0f) vf = 0.0f;
88 if (vf > 255.0f) vf = 255.0f;
89 u8 v =
static_cast<u8>(vf);
91 }
92 }
93 }
94}
void plotDot(fl::span< CRGB > leds, int x, int y, u8 v) const
constexpr enable_if< is_fixed_point< T >::value, T >::type ceil(T x) FL_NOEXCEPT
constexpr enable_if< is_fixed_point< T >::value, T >::type clamp(T x, T lo, T hi) FL_NOEXCEPT