MCPcopy Create free account
hub / github.com/FastLED/FastLED / WaveSimulation2D_Real

Method WaveSimulation2D_Real

src/fl/math/wave/wave_simulation_real.cpp.hpp:182–194  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

180}
181
182WaveSimulation2D_Real::WaveSimulation2D_Real(u32 W, u32 H,
183 float speed, float dampening) FL_NOEXCEPT
184 : width(W), height(H), stride(W + 2),
185 grid1((W + 2) * (H + 2)),
186 grid2((W + 2) * (H + 2)), whichGrid(0),
187 // CFL stability bound for the explicit leapfrog 5-point stencil in 2D
188 // is C^2 <= 1/2. Negative speed has no physical meaning. Clamp at the
189 // boundary to keep the Q15 fixed-point kernel both stable and within
190 // i32 overflow margins (paired with the i64 promote in update()).
191 mCourantSq(wave_detail::float_to_fixed(fl::clamp(speed, 0.0f, 0.5f))),
192 // Dampening exponent; e.g., 6 means a factor of 2^6 = 64.
193 mDampening(static_cast<int>(dampening)),
194 mDampDecayQ15(wave_detail::compute_damp_decay_q15(static_cast<int>(dampening))) {}
195
196void WaveSimulation2D_Real::setSpeed(float something) {
197 // See constructor for clamp rationale.

Callers

nothing calls this directly

Calls 3

float_to_fixedFunction · 0.85
clampFunction · 0.85
compute_damp_decay_q15Function · 0.85

Tested by

no test coverage detected