export class OccluderIndex { constructor(cellSize?: number); nodes: any[]; cellSize: number; grid: Map; /** Returns grid cell keys that overlap the given AABB. */ _cellKeys(minX: any, minY: any, maxX: any, maxY: any): number[]; /** * Find all previously inserted occluders whose bounding boxes overlap with the given face bounds. * @param {number} minX - Minimum x of query AABB * @param {number} minY - Minimum y of query AABB * @param {number} maxX - Maximum x of query AABB * @param {number} maxY - Maximum y of query AABB * @returns {number[][][]} Array of overlapping occluder polygons (each polygon is an array of [x,y] pairs) */ getOverlapping(minX: number, minY: number, maxX: number, maxY: number): number[][][]; /** * Clip a polygon against all previously inserted occluders. * Returns an array of visible polygon fragments. */ clip(poly: any): any[]; /** * Add a polygon as an occluder to the spatial index. * Optionally provide pre-calculated bounding box to save processing time. * @param {number[][]} poly - Polygon as array of [x,y] pairs * @param {number} [minX] - Pre-calculated AABB min x * @param {number} [minY] - Pre-calculated AABB min y * @param {number} [maxX] - Pre-calculated AABB max x * @param {number} [maxY] - Pre-calculated AABB max y */ insert(poly: number[][], minX?: number, minY?: number, maxX?: number, maxY?: number): void; /** * Subtracts an occluder (must be convex and CW) from a subject polygon. * Returns an array of fragments of the subject that reside OUTSIDE the occluder. * @param {number[][]} subject - Subject polygon as array of [x,y] pairs * @param {number[][]} occluder - Convex CW occluder polygon as array of [x,y] pairs * @returns {number[][][]} Array of visible polygon fragments */ subtractConvex(subject: number[][], occluder: number[][]): number[][][]; /** * Splits a polygon by an infinite line passing through p1 and p2. * Points to the left of p1→p2 go into front, to the right into back. * @param {number[][]} poly - Polygon as array of [x,y] pairs * @param {number[]} p1 - First point on the splitting line * @param {number[]} p2 - Second point on the splitting line * @returns {{front: number[][], back: number[][]}} Front and back polygon fragments */ splitPolygonByLine(poly: number[][], p1: number[], p2: number[]): { front: number[][]; back: number[][]; }; /** * Compute the intersection point of lines p1→p2 and p3→p4. * @param {number[]} p1 - First point of line 1 * @param {number[]} p2 - Second point of line 1 * @param {number[]} p3 - First point of line 2 * @param {number[]} p4 - Second point of line 2 * @returns {number[]|null} Intersection point [x,y] or null if parallel */ lineIntersect(p1: number[], p2: number[], p3: number[], p4: number[]): number[] | null; /** * Compute the signed area of a polygon. Positive = CCW, negative = CW. * @param {number[][]} poly - Polygon as array of [x,y] pairs * @returns {number} Signed area */ calcSignedArea(poly: number[][]): number; /** * Compute the absolute area of a polygon. * @param {number[][]} poly - Polygon as array of [x,y] pairs * @returns {number} Absolute area */ calcArea(poly: number[][]): number; }