import type { Vec2 } from 'mathcat'; type Box2 = [min: Vec2, max: Vec2]; export type ChunkyTriMeshNode = { /** bounding box of this node in XZ plane */ bounds: Box2; /** * for leaf nodes: index into the triangles array * for internal nodes: negative escape index for tree traversal */ index: number; /** * for leaf nodes: number of triangles in this chunk * for internal nodes: 0 */ count: number; }; /** Spatial chunking structure for triangles */ export type ChunkyTriMesh = { /** tree nodes for spatial hierarchy */ nodes: ChunkyTriMeshNode[]; /** reordered triangle indices */ triangles: number[]; /** maximum triangles per leaf chunk */ maxTrisPerChunk: number; }; /** * Create a chunky triangle mesh from vertices and indices * * @param vertices flat array of vertex positions [x, y, z, x, y, z, ...] * @param indices flat array of triangle indices [i0, i1, i2, i0, i1, i2, ...] * @param trisPerChunk target number of triangles per leaf chunk (default: 256) * @returns ChunkyTriMesh spatial data structure */ export declare const create: (vertices: ArrayLike, indices: ArrayLike, trisPerChunk?: number) => ChunkyTriMesh; /** * Get all triangle chunks that overlap with a rectangular region * * @param chunkyTriMesh the chunky tri mesh to query * @param boundsMin minimum corner of query rectangle [x, z] * @param boundsMax maximum corner of query rectangle [x, z] * @returns Array of node indices that overlap the query region */ export declare const getChunksOverlappingRect: (chunkyTriMesh: ChunkyTriMesh, boundsMin: Vec2, boundsMax: Vec2) => number[]; /** * Get all triangles that overlap with a rectangular region * * @param chunkyTriMesh the chunky tri mesh to query * @param boundsMin minimum corner of query rectangle [x, z] * @param boundsMax maximum corner of query rectangle [x, z] * @returns Flat array of triangle indices [i0, i1, i2, i0, i1, i2, ...] */ export declare const getTrianglesInRect: (chunkyTriMesh: ChunkyTriMesh, boundsMin: Vec2, boundsMax: Vec2) => number[]; /** * Get all triangle chunks that overlap with a line segment * * @param chunkyTriMesh the chunky tri mesh to query * @param p start point of segment [x, z] * @param q end point of segment [x, z] * @returns Array of node indices that overlap the segment */ export declare const getChunksOverlappingSegment: (chunkyTriMesh: ChunkyTriMesh, p: Vec2, q: Vec2) => number[]; export {};