Skip to content

raisin::WaterWaveSpectrum ​

struct · #include <rayrai/Water.hpp>

Parameters of generateGerstnerWaves(): a wind-driven set of waves, long to short.

Wave i of n gets the rank a = 1 - i / n, jittered by randomness / n. Its wavelength is mix(minWavelength, maxWavelength, a^wavelengthFalloff), its amplitude mix(minAmplitude, maxAmplitude, a^amplitudeFalloff) and its steepness mix(longWaveSteepness, shortWaveSteepness, (i / n)^steepnessFalloff), scaled down together when they add up to more than maxSteepnessSum. Wave 0 travels along the wind; the others are turned by a random angle within +-directionSpreadRadians.

Public attributes ​

waveCount ​

cpp
int waveCount

Number of waves, [1, kMaxWaterWaves].

seed ​

cpp
uint32_t seed

Seed of the directions, the jitter and the phases.

windAngleRadians ​

cpp
float windAngleRadians

Dominant travel direction, radians from +X toward +Y.

directionSpreadRadians ​

cpp
float directionSpreadRadians

Half range of the direction offsets, [0, pi].

minWavelength ​

cpp
float minWavelength

Shortest wave, metres (> 0).

maxWavelength ​

cpp
float maxWavelength

Longest wave, metres (>= minWavelength).

wavelengthFalloff ​

cpp
float wavelengthFalloff

Rank exponent of the wavelength (> 0); larger values give more short waves.

minAmplitude ​

cpp
float minAmplitude

Amplitude of the shortest wave, metres (>= 0).

maxAmplitude ​

cpp
float maxAmplitude

Amplitude of the longest wave, metres (>= minAmplitude).

amplitudeFalloff ​

cpp
float amplitudeFalloff

Rank exponent of the amplitude (> 0).

longWaveSteepness ​

cpp
float longWaveSteepness

Steepness of the longest wave, [0, 1].

shortWaveSteepness ​

cpp
float shortWaveSteepness

Steepness of the shortest wave, [0, 1].

steepnessFalloff ​

cpp
float steepnessFalloff

Rank exponent of the steepness (> 0).

randomness ​

cpp
float randomness

Rank jitter, [0, 1].

maxSteepnessSum ​

cpp
float maxSteepnessSum

Upper bound of the summed steepness, [0, 1]; the steepness of every wave is scaled down to meet it. A sum up to 1 never folds the surface over.

RaiSim — physics for robotics and AI.