import { type Box3, type Vec2, type Vec3 } from 'mathcat'; import { type BuildContextState } from './build-context.js'; import { type ArrayLike } from './common.js'; export type HeightfieldSpan = { /** the lower limit of the span */ min: number; /** the upper limit of the span */ max: number; /** the area id assigned to the span */ area: number; /** the next heightfield span */ next: HeightfieldSpan | null; }; export type Heightfield = { /** the width of the heightfield (along x axis in cell units) */ width: number; /** the height of the heightfield (along z axis in cell units) */ height: number; /** the bounds in world space */ bounds: Box3; /** the vertical size of each cell (minimum increment along y) */ cellHeight: number; /** the vertical size of each cell (minimum increment along x and z) */ cellSize: number; /** the heightfield of spans, (width*height) */ spans: (HeightfieldSpan | null)[]; }; export declare const calculateGridSize: (outGridSize: Vec2, bounds: Box3, cellSize: number) => [width: number, height: number]; export declare const createHeightfield: (width: number, height: number, bounds: Box3, cellSize: number, cellHeight: number) => Heightfield; /** * Adds a span to the heightfield. If the new span overlaps existing spans, * it will merge the new span with the existing ones. */ export declare const addHeightfieldSpan: (heightfield: Heightfield, x: number, z: number, min: number, max: number, areaID: number, flagMergeThreshold: number) => boolean; export declare const rasterizeTriangles: (ctx: BuildContextState, heightfield: Heightfield, vertices: ArrayLike, indices: ArrayLike, triAreaIds: ArrayLike, flagMergeThreshold?: number) => boolean; export declare const filterLowHangingWalkableObstacles: (heightfield: Heightfield, walkableClimb: number) => void; export declare const filterLedgeSpans: (heightfield: Heightfield, walkableHeight: number, walkableClimb: number) => void; export declare const filterWalkableLowHeightSpans: (heightfield: Heightfield, walkableHeight: number) => void; export declare function rasterizeSphere(heightfield: Heightfield, center: Vec3, radius: number, area: number, flagMergeThreshold: number, ctx: BuildContextState): void; export declare function rasterizeCapsule(heightfield: Heightfield, start: Vec3, end: Vec3, radius: number, area: number, flagMergeThreshold: number, ctx: BuildContextState): void; export declare function rasterizeCylinder(heightfield: Heightfield, start: Vec3, end: Vec3, radius: number, area: number, flagMergeThreshold: number, ctx: BuildContextState): void; export declare function rasterizeBox(heightfield: Heightfield, center: Vec3, halfEdges: Vec3[], area: number, flagMergeThreshold: number, ctx: BuildContextState): void; export declare function rasterizeConvex(heightfield: Heightfield, vertices: number[], triangles: number[], area: number, flagMergeThreshold: number, ctx: BuildContextState): void;