Skip to content

Add drifting sources with Doppler shift and Mach cone scenes - #1

Merged
fushanbobfan merged 3 commits into
mainfrom
feature/moving-sources
Sep 19, 2026
Merged

fushanbobfan merged 3 commits into
mainfrom
feature/moving-sources

Conversation

@fushanbobfan

Copy link
Copy Markdown
Owner

What

  • Sources can now drift with a per-step velocity (vx, vy). A drifting source is injected into its four surrounding cells with bilinear weights so it glides instead of hopping, and it reflects off the tank border and any wall it runs into.
  • Two new scenes: Doppler shift (source at 0.3 cells/step, below the 0.7 wave speed) and Mach cone (0.95 cells/step, above it).
  • The renderer marks a drifting source on its nearest cell.
  • README covers the new scenes and the drift model.

Why

Moving sources are the other half of what a ripple tank is for: the Doppler shift and the shock cone are hard to picture from formulas and immediate to see here. Bilinear injection matters because a source hopping whole cells at sub-cell speeds injects a stair-stepped signal and spoils the wavefronts.

Tests

Added to the Node suite: fractional-position injection splits evenly between neighbours; a drifting source stays inside the tank and turns around at the border and at walls; a still source is left alone; a zero-crossing count ahead of and behind a moving source shows the Doppler compression; the Doppler and Mach scenes keep the source in bounds and the field finite over 1500 steps. npm test: 31 passing.

Checked in the browser: Doppler shows compressed fronts ahead and stretched ones behind; the Mach scene shows the V-shaped front. Keeping the Mach source under one cell per step avoids the aliasing noise a faster source leaves in its wake.

@fushanbobfan
fushanbobfan merged commit de23dd3 into main Sep 19, 2026
3 checks passed
@fushanbobfan
fushanbobfan deleted the feature/moving-sources branch September 19, 2026 03:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant