eulerjs API / @eulerjs/marine / SurfaceGrid
SurfaceGrid
Defined in: packages/marine/src/waves/SurfaceGrid.ts:25
The surface sampled on a horizontal grid fixed in the world, then interpolated bilinearly. Buoyancy uses it so its cost depends on the area under a hull, not on how finely the hull is voxelized. Nodes keep their grid-point offset between updates, so one inversion iteration per node is enough while the area moves slowly.
Interpolation rounds off the sharp wave crests: on the default sea, 0.5 m spacing is off by 3 mm on average and up to about 2 cm at the sharpest crests; the error shrinks with the square of the spacing.
Constructors
Constructor
new SurfaceGrid(waves, spacing?): SurfaceGrid;Defined in: packages/marine/src/waves/SurfaceGrid.ts:39
Parameters
| Parameter | Type | Default value |
|---|---|---|
waves | WaveSurface | undefined |
spacing? | number | 0.5 |
Returns
SurfaceGrid
Properties
| Property | Modifier | Type | Defined in |
|---|---|---|---|
spacing | readonly | number | packages/marine/src/waves/SurfaceGrid.ts:27 |
waves | readonly | WaveSurface | packages/marine/src/waves/SurfaceGrid.ts:26 |
Accessors
knowsRiseRate
Get Signature
get knowsRiseRate(): boolean;Defined in: packages/marine/src/waves/SurfaceGrid.ts:74
Whether the waves say how fast the water at the surface rises: if not, riseRateAt is no use.
Returns
boolean
nodeCount
Get Signature
get nodeCount(): number;Defined in: packages/marine/src/waves/SurfaceGrid.ts:46
Number of nodes sampled by the last update.
Returns
number
Methods
heightAt()
heightAt(worldX, worldZ): number;Defined in: packages/marine/src/waves/SurfaceGrid.ts:79
Interpolated surface height; positions outside the last updated rectangle use its edge.
Parameters
| Parameter | Type |
|---|---|
worldX | number |
worldZ | number |
Returns
number
riseRateAt()
riseRateAt(worldX, worldZ): number;Defined in: packages/marine/src/waves/SurfaceGrid.ts:84
Interpolated speed the water at the surface rises, m/s, where the waves say (knowsRiseRate).
Parameters
| Parameter | Type |
|---|---|
worldX | number |
worldZ | number |
Returns
number
update()
update(
minimumX,
maximumX,
minimumZ,
maximumZ,
time
): void;Defined in: packages/marine/src/waves/SurfaceGrid.ts:51
Samples every node needed to interpolate inside the given world rectangle at time.
Parameters
| Parameter | Type |
|---|---|
minimumX | number |
maximumX | number |
minimumZ | number |
maximumZ | number |
time | number |
Returns
void
