import { type Ring, type Vec2 } from '../source'; /** Ring clean-up thresholds (Parallel City `real-footprint-mass.js` CLEAN). */ export declare const CLEAN: { readonly dupM: 0.08; readonly collinearM: 0.1; readonly minAreaM2: 1; }; /** * Drops repeated points and near-collinear vertices, winds the ring (outer CCW from above, hole CW), and refuses a ring that * is degenerate, under `minArea`, or self-intersecting. Never throws. */ export declare function cleanRing(raw: readonly Vec2[], kind: 'outer' | 'hole', minArea?: number): Ring | null; /** Andrew's monotone chain; returns the hull wound counter-clockwise in the (x, -z) math frame, i.e. CCW from above. */ export declare function convexHull(points: readonly Vec2[]): Vec2[]; /** A rectangle: centre, unit axis `u` (along the LONG side), `v` = (uz, -ux) (to the north of u), half extents. */ export interface OrientedBox { cx: number; cz: number; ux: number; uz: number; /** Half extent along u (>= hd). */ hw: number; /** Half extent along v. */ hd: number; area: number; } export declare function boxV(box: Pick): Vec2; /** The four corners wound counter-clockwise from above: SW, SE, NE, NW for an axis-aligned box. */ export declare function boxCorners(box: OrientedBox): Ring; /** Minimum-area enclosing rectangle (rotating calipers over the hull edges). Ties break to the first hull edge. */ export declare function minAreaBox(ring: readonly Vec2[]): OrientedBox; export declare function polygonArea(outer: Ring, holes?: readonly Ring[]): number; /** * IoU(box, footprint). The box is the minimum-area ENCLOSING rectangle, so it contains the footprint and the intersection * is the footprint itself: IoU = footprintArea / boxArea. (No clipping needed, and exact.) */ export declare function boxFootprintIou(box: OrientedBox, outer: Ring, holes: readonly Ring[]): number; export declare function ringCentroid(ring: readonly Vec2[]): Vec2; export interface PlanTriangulation { /** Outer ring points followed by every hole's points. */ points: Vec2[]; /** Triangles as index triples into `points`, wound counter-clockwise from above. */ triangles: number[]; /** True when the triangles tile the polygon: their areas sum to its area (within 0.5% plus 1 cm^2). */ complete: boolean; } /** Ear-clips a polygon with holes (three's earcut) and winds every triangle counter-clockwise from above. */ export declare function triangulatePlan(outer: readonly Vec2[], holes?: readonly (readonly Vec2[])[]): PlanTriangulation; /** A tiny deterministic string hash (FNV-1a, 32 bit). */ export declare function fnv1a(text: string): number; /** Deterministic uniform [0, 1) from an id and a channel name. */ export declare function hash01(id: string, channel: string): number; /** Squared distance from point `p` to segment `a`-`b`. */ export declare function distSqPointSegment(p: Vec2, a: Vec2, b: Vec2): number; /** Even-odd point containment (points on the boundary may land either side). */ export declare function pointInPolygon(point: Vec2, ring: readonly Vec2[]): boolean;