/** * Union algorithm for polygon boolean operations. * * Implements a Weiler-Atherton-inspired boundary walk to merge two * (possibly concave) polygons into their union outline. Falls back to * convex-hull when the walk produces no result. * * @module geometry/shape-boolean-union */ import type { Vec2 } from './shape-boolean-types.js'; /** * Compute the intersection of two line segments (A1→A2 and B1→B2). * * Returns the intersection point together with the parametric `t` values * along each segment, or `null` when the segments do not cross. * * @param a1 - Start of segment A. * @param a2 - End of segment A. * @param b1 - Start of segment B. * @param b2 - End of segment B. * @returns Intersection descriptor or `null`. */ export declare function segmentIntersection(a1: Vec2, a2: Vec2, b1: Vec2, b2: Vec2): { pt: Vec2; tA: number; tB: number; } | null; /** * Find all intersection points between the edges of two polygons. * * @param polyA - First polygon. * @param polyB - Second polygon. * @returns Array of intersection descriptors including the point, edge * indices, and parametric t values. */ export declare function findAllIntersections(polyA: Vec2[], polyB: Vec2[]): Array<{ pt: Vec2; edgeA: number; tA: number; edgeB: number; tB: number; }>; /** * Build a copy of a polygon with intersection vertices inserted at the * correct positions along each edge. * * @param poly - Original polygon. * @param intersections - Intersection descriptors (edge index + parametric t). * @returns Augmented polygon. */ export declare function insertIntersections(poly: Vec2[], intersections: Array<{ pt: Vec2; edge: number; t: number; }>): Vec2[]; /** * Compute the convex hull of a set of points using Andrew's monotone chain * algorithm. * * @param points - Input points. * @returns Vertices of the convex hull in CCW order. */ export declare function convexHull(points: Vec2[]): Vec2[]; /** * Walk along polygon boundaries to construct the union outline. * * Uses a simplified Weiler-Atherton-style approach: augmented polygons * (with intersection vertices inserted) are walked, switching between * polygon A and polygon B at each intersection to trace the exterior * boundary. * * Falls back to convex hull when the walk produces no valid result. * * @param polyA - First polygon (CCW). * @param polyB - Second polygon (CCW). * @returns Array of union result polygons. */ export declare function computeUnionWalk(polyA: Vec2[], polyB: Vec2[]): Vec2[][]; //# sourceMappingURL=shape-boolean-union.d.ts.map