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

◆ seti16()

void fl::WaveSimulation2D::seti16 ( size_t x,
size_t y,
int16_t value )

Definition at line 127 of file wave_simulation.cpp.

127 {
128 if (!has(x, y))
129 return;
130
131 // radius in pixels of your diamond
132 int rad = static_cast<int>(multiplier) / 2;
133
134 for (size_t j = 0; j < multiplier; ++j) {
135 for (size_t i = 0; i < multiplier; ++i) {
136 // compute offset from the center of this block
137 int dx = static_cast<int>(i) - rad;
138 int dy = static_cast<int>(j) - rad;
139
140 // keep only those points whose Manhattan distance ≤ rad
141 if (ABS(dx) + ABS(dy) > rad)
142 continue;
143
144 size_t xx = x * multiplier + i;
145 size_t yy = y * multiplier + j;
146 if (sim->has(xx, yy)) {
147 sim->seti16(xx, yy, v16);
148 }
149 }
150 }
151}
uint32_t x[NUM_LAYERS]
Definition Fire2023.ino:80
uint32_t y[NUM_LAYERS]
Definition Fire2023.ino:81
fl::scoped_ptr< WaveSimulation2D_Real > sim
bool has(size_t x, size_t y) const
#define ABS(x)
Definition math_macros.h:12

References ABS, has(), multiplier, sim, x, and y.

Referenced by setf().

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