import type { TerrainProvenance } from './tile'; /** Samples per side of one terrain tile and the CELLS between them; neighbours SHARE their boundary row and column. */ export declare const TILE_SAMPLES = 257; export declare const TILE_CELLS: number; /** The grid cap the level format is sized for (16 x 16 tiles, 4 km x 4 km at 1 m per sample). */ export declare const MAX_GRID_TILES = 16; /** * A regularly sampled height field in metres. `heights` is row-major with the row being Z and X the fastest axis, * matching the heightfield binary; `holes` is one byte per sample, 1 meaning the sample is a hole. */ export interface SampleField { samplesX: number; samplesZ: number; metresPerSample: number; originX: number; originZ: number; heights: Float32Array; holes: Uint8Array | null; } /** The authoring grid: the sample spacing a tile ships at, one of `TERRAIN_SAMPLE_SPACINGS`. */ export interface HeightGrid extends SampleField { /** Stamped by `generateTerrain` / `importTerrain` and carried into the terrain source folder. */ provenance?: TerrainProvenance; } /** Metres one 257-sample tile spans at `metresPerSample`: 256 m at 1 m, 1024 m at 4 m. */ export declare function tileMetresFor(metresPerSample: number): number; export declare function tileMetres(field: Pick): number; export declare function assertSampleSpacing(metresPerSample: number): void; export declare function createHeightGrid(samplesX: number, samplesZ: number, originX: number, originZ: number, holes?: boolean, metresPerSample?: number): HeightGrid; /** The grid a `tilesX` x `tilesZ` field of 257-sample tiles needs, with the shared edges counted once. */ export declare function gridForTiles(tilesX: number, tilesZ: number, originX: number, originZ: number, holes?: boolean, metresPerSample?: number): HeightGrid; export declare function assertTileCount(tilesX: number, tilesZ: number): void; export declare function sampleIndex(field: SampleField, i: number, j: number): number; export declare function heightAt(field: SampleField, i: number, j: number): number; export declare function isHoleAt(field: SampleField, i: number, j: number): boolean; export declare function fieldHeightRange(field: SampleField): [number, number]; /** Ground inclination in degrees from central differences; edges degrade to a one-sided difference. */ export declare function slopeDeg(field: SampleField, i: number, j: number): number; /** * Discrete Laplacian in metres^-1, NEGATED so the sign follows the preset rules: positive on crests and ridges, * negative in hollows and gullies. It falls off as 1/spacing^2, so the coarse field and a 4 m authoring grid both read * far smoother than a 1 m tile: a preset's curvature bands mean what the grid's own spacing makes of them. */ export declare function curvature(field: SampleField, i: number, j: number): number; /** Height at (i, j) mapped to 0..1 over `range`, defaulting to the field's own min and max. */ export declare function normalizedHeight(field: SampleField, i: number, j: number, range?: [number, number]): number; /** Bilinear height at a world position, edge-clamped. */ export declare function sampleFieldHeight(field: SampleField, x: number, z: number): number;