eulerjs API / @eulerjs/marine / WaveSurface
WaveSurface
Defined in: packages/marine/src/waves/WaveSurface.ts:8
A moving sea surface, as the physics needs it: a pure function of position and time, whose points also move sideways (so a world position's height takes finding which point of the undisturbed grid has moved there). SumOfSines and SpectralWaves are both one.
Properties
| Property | Modifier | Type | Description | Defined in |
|---|---|---|---|---|
lastGridPoint | readonly | object | The undisplaced grid point the last heightAt or heightFrom found. | packages/marine/src/waves/WaveSurface.ts:18 |
lastGridPoint.x | readonly | number | - | packages/marine/src/waves/WaveSurface.ts:18 |
lastGridPoint.z | readonly | number | - | packages/marine/src/waves/WaveSurface.ts:18 |
Methods
heightAt()
heightAt(
worldX,
worldZ,
time
): number;Defined in: packages/marine/src/waves/WaveSurface.ts:10
Height of the surface directly above or below the world position (worldX, worldZ) at time.
Parameters
| Parameter | Type |
|---|---|
worldX | number |
worldZ | number |
time | number |
Returns
number
heightFrom()
heightFrom(
worldX,
worldZ,
time,
startGridX,
startGridZ,
iterations
): number;Defined in: packages/marine/src/waves/WaveSurface.ts:16
Like heightAt, but starts the search for the undisplaced grid point at (startGridX, startGridZ) and runs iterations steps; a good start needs one. The grid point found is left in lastGridPoint.
Parameters
| Parameter | Type |
|---|---|
worldX | number |
worldZ | number |
time | number |
startGridX | number |
startGridZ | number |
iterations | number |
Returns
number
normalAt()
normalAt(
worldX,
worldZ,
time,
target?
): Vector3;Defined in: packages/marine/src/waves/WaveSurface.ts:20
Upward unit normal of the surface at the world position (worldX, worldZ).
Parameters
| Parameter | Type |
|---|---|
worldX | number |
worldZ | number |
time | number |
target? | Vector3 |
Returns
Vector3
prefetch()?
optional prefetch(time): void;Defined in: packages/marine/src/waves/WaveSurface.ts:31
A hint that the surface will be asked about at time soon, for a surface that can get ready ahead (SpectralWaves in a worker).
Parameters
| Parameter | Type |
|---|---|
time | number |
Returns
void
riseRate()?
optional riseRate(
gridX,
gridZ,
time
): number;Defined in: packages/marine/src/waves/WaveSurface.ts:29
How fast the surface point that started at grid position (gridX, gridZ) rises at time, in m/s: the water's own vertical velocity there, which is slower than the surface rises at a fixed place as a steep crest passes it. For floating bodies to move with the water. A surface without it, Buoyancy damps against the surface's rise at the place instead.
Parameters
| Parameter | Type |
|---|---|
gridX | number |
gridZ | number |
time | number |
Returns
number
surfacePoint()
surfacePoint(
gridX,
gridZ,
time,
target?
): Vector3;Defined in: packages/marine/src/waves/WaveSurface.ts:22
Where the surface point that started at grid position (gridX, gridZ) is at time, displaced sideways as well as up.
Parameters
| Parameter | Type |
|---|---|
gridX | number |
gridZ | number |
time | number |
target? | Vector3 |
Returns
Vector3
