You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The current 5-point Laplacian in WaveSimulation2D_Real::update() is O(h²) accurate but anisotropic — waves visibly prefer the 4 cardinal directions over the 4 diagonals, producing a square-ish ripple shape (a well-known artifact of this stencil).
At LED-grid resolutions (8×8, 16×16) this is usually invisible. At SUPER_SAMPLE_4X / _8X it becomes noticeable on circular ripples — exactly the case where users opted into more CPU for better visual quality.
Proposed fix
A 9-point isotropic Laplacian — still O(h²) but with isotropic leading error:
∇²u ≈ [ 1/6 · (NW + NE + SW + SE)
+ 2/3 · ( N + S + E + W )
- 10/3 · C ] / h²
Cost: ~2× the reads + ALU per cell vs. the 5-point stencil. Output: rounder ripples.
Default to FivePoint for backward compatibility (existing tests assume current output).
The super-sampled wrapper WaveSimulation2D (in src/fl/math/wave/wave_simulation.h) should default to NinePointIsotropic when SuperSample >= SUPER_SAMPLE_2X, since that's the case where the visual win is felt and the CPU cost is already higher.
Acceptance
New unit test verifies 9-point Laplacian at a center cell equals the analytical value for a known input (delta function, sinusoid).
Visual check on examples/Fx/FxWave2d with single-point impulse — ripple should be round, not square.
Numerical accuracy implication
The 9-point form also helps §1's overflow margin (#3083) since the per-cell coefficients are fractional — the post->>15 term magnitude is smaller. Not a blocker, but a minor secondary benefit.
Activity
zackees commentedon Jun 15, 2026
Parent meta: #3098.
feat(wave): opt-in 9-point isotropic Laplacian for WaveSimulation2D (#…