Skip to content

Function: resolveTileLevel()

ts
function resolveTileLevel(seaLevel, elevation): number;

Resolves the signed terrain level of a tile relative to sea level — a caller-friendly index independent from the absolute band count:

  • 0 = the band currently sitting at the waterline.
  • -1 = one band below the waterline (shallows); deeper bands go -2, -3, ....
  • 1 = one band above the waterline; peaks climb 2, 3, .... On dry or frozen bodies (no sea), seaLevel is -1: the call just returns the absolute band index so every tile stays in [0, N-1].

Parameters

ParameterTypeDescription
seaLevelnumberSea level elevation from the simulation (band space).
elevationnumberTile elevation — integer band index [0, N-1].

Returns

number

Signed integer level.

Distribué sous la licence indiquée dans le dépôt.