export type P2 = [number, number]; export type Ring = P2[]; /** Positive for a ring that is counter-clockwise seen from +Y (north up, east right). */ export declare function ccwArea(ring: Ring): number; export declare function ensureCcw(ring: Ring): Ring; export declare function ensureCw(ring: Ring): Ring; export declare function bounds(ring: Ring): [number, number, number, number]; export declare function centroid(ring: Ring): P2; export declare function pointInRing(point: P2, ring: Ring): boolean; /** A point guaranteed inside a simple ring: the centroid if it is, else the midpoint of the widest horizontal chord. */ export declare function pointInside(ring: Ring): P2; /** Douglas-Peucker on an open polyline; keeps both ends. */ export declare function simplifyLine(points: P2[], tolerance: number): P2[]; /** Closed-ring simplification: split at the vertex farthest from the first so both halves are open lines. */ export declare function simplifyRing(ring: Ring, tolerance: number): Ring; /** Drops consecutive duplicates (within `eps`) and the closing duplicate. */ export declare function dedupeRing(ring: Ring, eps?: number): Ring; /** Removes vertices within `tolerance` metres of the line through their neighbours (repeatedly until stable). */ export declare function removeCollinear(ring: Ring, tolerance?: number): Ring; /** Proper crossing only: shared end points and touching do not count. */ export declare function segmentsCross(a: P2, b: P2, c: P2, d: P2, eps?: number): boolean; /** True when no two non-adjacent edges properly cross. O(n^2), fine for building rings; larger rings go through repair. */ export declare function isSimpleRing(ring: Ring): boolean; /** True when the closed segments share any point: a crossing, a T, a shared end or a collinear overlap. */ export declare function segmentsTouch(a: P2, b: P2, c: P2, d: P2): boolean; /** * True when any two of the rings, or one ring with itself past its neighbours, touch or cross: the strict reading of "clean polygon" * the city-source validator applies (a shared vertex between two holes, or between a hole and the outline, is a fault). * Neighbouring edges of one ring share a vertex by construction and only count when they fold back over each other. * A sweep over edge bounding boxes sorted by x, so a ring of 50 000 edges costs little. */ export declare function ringsTouch(rings: readonly Ring[]): boolean; export interface ClippedRun { points: P2[]; /** Per output point: index into the input of the vertex it IS, or -1 for a point created on the rectangle edge. */ source: number[]; } /** Clips a polyline to the rectangle; a line leaving and re-entering yields several runs. */ export declare function clipPolyline(points: P2[], rect: [number, number, number, number]): ClippedRun[]; export declare function polylineLength(points: P2[]): number; export declare function round2(value: number): number; export declare function roundRing(ring: Ring): Ring;