import type { Maybe } from "@thi.ng/api"; import type { MultiFn2 } from "@thi.ng/defmulti"; import type { IShape, IShape2 } from "./api.js"; import type { ReadonlyVec } from "@thi.ng/vectors"; import { ComplexPolygon } from "./api/complex-polygon.js"; import { Group } from "./api/group.js"; import { Line } from "./api/line.js"; import { Path } from "./api/path.js"; import { Polygon } from "./api/polygon.js"; import { Polyline } from "./api/polyline.js"; /** * Function overrides for {@link clipConvex}. */ export type ClipConvexFn = { (shape: ComplexPolygon, boundary: IShape2 | ReadonlyVec[]): Maybe; (shape: Group, boundary: IShape2 | ReadonlyVec[]): Maybe; (shape: Line, boundary: IShape2 | ReadonlyVec[]): Maybe; (shape: Path, boundary: IShape2 | ReadonlyVec[]): Maybe; (shape: Polyline, boundary: IShape2 | ReadonlyVec[]): Maybe; (shape: IShape2, boundary: IShape2 | ReadonlyVec[]): Maybe; } & MultiFn2>; /** * Takes a shape and a boundary (both convex), then uses the Sutherland-Hodgeman * algorithm to compute a clipped version of the shape (against the boundary) * and returns an array of resulting clipped shape(s) or `undefined` if there're * no remaining result vertices (i.e. if the original shape was clipped * entirely). * * @remarks * Internally uses * [`sutherlandHodgeman`](https://docs.thi.ng/umbrella/geom-clip-poly/functions/sutherlandHodgeman.html). * For groups, calls itself for each child shape individually and returns a new * group of results (if any). * * For {@link ComplexPolygon}s, children are only processed if the main boundary * hasn't been completely clipped. Similarly for closed paths, where sub-paths * (holes) are only processed if the clipped main path has remaining vertices. * * Paths are always first sampled/converted to polygons or polylines. * * Currently implemented for: * * - {@link Circle} * - {@link ComplexPolygon} * - {@link Ellipse} * - {@link Extra} * - {@link Group} * - {@link Line} * - {@link Path} * - {@link Polygon} * - {@link Quad} * - {@link Triangle} * * @param shape * @param boundary */ export declare const clipConvex: ClipConvexFn; //# sourceMappingURL=clip-convex.d.ts.map