Skip to content

gz_waves: Gerstner backend - Part 2/4#883

Merged
caguero merged 5 commits into
vrx4from
caguero/waves-02-gerstner
Jul 3, 2026
Merged

gz_waves: Gerstner backend - Part 2/4#883
caguero merged 5 commits into
vrx4from
caguero/waves-02-gerstner

Conversation

@caguero

@caguero caguero commented Jun 19, 2026

Copy link
Copy Markdown
Collaborator

This patch adds the first wave engine, the analytic Gerstner (sum-of-sines) backend. It depends only on the core; no FFT, no rendering, no EncinoWaves.

No on-screen waves yet

This PR adds the engine + source + GUI registrar, but the surface is drawn by WaterVisual, which lands in PR3 (gz_waves_rendering). The first visible Gerstner waves appear once core + this engine + rendering are all in — i.e. at PR3. PR2 is exercised headless (its tests) and by the Wavefield component it publishes.

@caguero caguero changed the title gz_waves_provider_gerstner: Gerstner backend - Part 2/4 gz_waves: Gerstner backend - Part 2/4 Jun 19, 2026
@caguero
caguero force-pushed the caguero/waves-02-gerstner branch 5 times, most recently from 3b09c80 to bb957dc Compare June 22, 2026 17:16
@caguero
caguero force-pushed the caguero/waves-01-core branch from 9698e33 to 33bb4e8 Compare June 25, 2026 21:32
caguero and others added 3 commits July 1, 2026 00:02
…GUI registrar

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Signed-off-by: Carlos Aguero <caguero@honurobotics.com>
…leanup

Drop Eigen in favor of gz::math vectors (matching the core interface),
wire gz-math into the engine target, switch members to gz-style
(this->member, no trailing underscore), and factor the per-component
phase into a shared Phase() helper.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Signed-off-by: Carlos Agüero <caguero@honurobotics.com>
…uard

Switch the engine's diagnostics from std::cerr to gzerr (wiring gz-common
into the engine target), and reject a non-positive <period> in
SetParameters — which would otherwise make omega=2*pi/period infinite and
the PMS spectrum blow up — leaving the field flat instead. Adds a test.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Signed-off-by: Carlos Agüero <caguero@honurobotics.com>
@caguero
caguero force-pushed the caguero/waves-02-gerstner branch from bb957dc to 2e79cc6 Compare June 30, 2026 22:02
@caguero
caguero changed the base branch from caguero/waves-01-core to vrx4 June 30, 2026 22:02
Drop the retired "backend" / "wave model" terms in comments and Doxygen
in favour of "engine" / "wave field engine", matching the WavesSystemBase
and WAVES_DESIGN.md vocabulary settled in the PR1 review.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Signed-off-by: Carlos Aguero <caguero@honurobotics.com>
@bsb808

bsb808 commented Jul 3, 2026

Copy link
Copy Markdown
Collaborator

This is great. Just a few notes for posterity:

  • This adds the legacy implementation back into the new modular architecture of gz_waves: core - Part 1/4 #882
  • The Gerstner/sum-of-sines engine (legacy) uses the Gerstner kinematics for the shader, but simplifies this to linear kinematics in the physics.
  • It also cleans up some a few wave generation implementation details in the new port.

@bsb808 bsb808 left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM — Part 2/4: the analytic Gerstner engine behind the new IWaveField interface.

… split

Per bsb808's note on #883: the analytic Gerstner engine applies full
Gerstner horizontal chop only in the render grid (Update/Field, for the
shader); the point queries (Elevation/ParticleVelocity/Normal) that
buoyancy reads use linear (Airy) vertical-only kinematics. Document this
deliberate approximation in the class doc.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Signed-off-by: Carlos Aguero <caguero@honurobotics.com>
@caguero

caguero commented Jul 3, 2026

Copy link
Copy Markdown
Collaborator Author

This is great. Just a few notes for posterity:

  • This adds the legacy implementation back into the new modular architecture of gz_waves: core - Part 1/4 #882
  • The Gerstner/sum-of-sines engine (legacy) uses the Gerstner kinematics for the shader, but simplifies this to linear kinematics in the physics.
  • It also cleans up some a few wave generation implementation details in the new port.

Thanks, I added some notes in 3be0dcd

@caguero
caguero merged commit 5fcc453 into vrx4 Jul 3, 2026
@caguero
caguero deleted the caguero/waves-02-gerstner branch July 3, 2026 13:38
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.

2 participants