Skip to content

raisin::GerstnerWave ​

struct · #include <rayrai/Water.hpp>

One trochoidal (Gerstner) wave.

With k = 2 pi / wavelength, omega = sqrt(g k) and theta = k * dot(direction, p) - omega * t + phase, the surface point that rests at the horizontal position p moves to p - direction * (steepness / k) * sin(theta) and rises to amplitude * cos(theta). The wave travels along direction; the points gather at the crests, which grow sharper with the steepness, and spread out in the troughs.

Public attributes ​

direction ​

cpp
glm::vec2 direction

Travel direction in the water body frame (normalized; must not be zero).

wavelength ​

cpp
float wavelength

Crest-to-crest distance, metres (> 0).

amplitude ​

cpp
float amplitude

Crest height above the mean level, metres (>= 0).

steepness ​

cpp
float steepness

k times the horizontal displacement amplitude, [0, 1]: 0 is a sine wave, 1 a cusped crest. Where the crests of several waves meet and their steepness adds up above 1, the surface folds over itself.

phase ​

cpp
float phase

Phase offset, radians.

RaiSim — physics for robotics and AI.