/** * Polygon clipping algorithms for shape boolean intersection. * * Implements the Sutherland-Hodgman algorithm for convex polygon clipping * and ear-clipping triangulation for handling concave clip polygons. * * @module geometry/shape-boolean-clipping */ import type { Vec2 } from './shape-boolean-types.js'; /** * Compute the intersection point of two infinite lines defined by segments * AB and CD. Returns `null` when the lines are parallel. * * @param a - First point of line 1. * @param b - Second point of line 1. * @param c - First point of line 2. * @param d - Second point of line 2. * @returns Intersection point or `null` if parallel. */ export declare function lineIntersection(a: Vec2, b: Vec2, c: Vec2, d: Vec2): Vec2 | null; /** * Sutherland-Hodgman algorithm: clip a subject polygon by a convex clip * polygon. * * Both polygons should be in CCW winding order. * * @param subject - Polygon to be clipped. * @param clip - Convex clipping polygon. * @returns Clipped polygon (may be empty if no overlap). */ export declare function sutherlandHodgman(subject: Vec2[], clip: Vec2[]): Vec2[]; /** * Check whether a polygon is convex. * * @param poly - Polygon vertices. * @returns `true` when all cross-products at vertices share the same sign. */ export declare function isConvex(poly: Vec2[]): boolean; /** * Simple ear-clipping triangulation for concave polygon decomposition. * * Returns an array of triangles (3-vertex polygons). * * @param poly - Input polygon (will be normalized to CCW). * @returns Array of triangles. */ export declare function triangulate(poly: Vec2[]): Vec2[][]; /** * Merge a set of (possibly overlapping) convex polygons into fewer polygons. * * Currently removes degenerate polygons and returns the rest as-is, since * the triangulated intersection pieces may share edges. * * @param polys - Array of polygons to merge. * @returns Filtered array with degenerate polygons removed. */ export declare function mergeOverlappingPolygons(polys: Vec2[][]): Vec2[][]; /** * Clip a subject polygon against a clip polygon. * * Handles both convex and concave clip polygons. For concave clips the * polygon is decomposed into triangles via ear-clipping and the subject * is clipped against each triangle individually. * * @param subject - Polygon to clip. * @param clip - Clipping polygon (convex or concave). * @returns Array of resulting polygons (may be empty). */ export declare function clipPolygons(subject: Vec2[], clip: Vec2[]): Vec2[][]; //# sourceMappingURL=shape-boolean-clipping.d.ts.map