@thi.ng/geom-clip-line
Version:
2D line clipping (Liang-Barsky)
34 lines • 1.27 kB
TypeScript
import type { ReadonlyVec, Vec } from "@thi.ng/vectors";
/**
* Computes all intersection points of the **infinite** line defined by `a`, `b`
* with the given polygon. Returns an array of segments where the line is inside
* the polygon.
*
* @remarks
* "Infinite" here means the line extends indefinitely on either side and
* intersections are found also outside the segment a..b. If only intra-segment
* intersections are desired, use {@link clipLineSegmentPoly} instead.
*
* @param a
* @param b
* @param poly
*/
export declare const clipLinePoly: (a: ReadonlyVec, b: ReadonlyVec, poly: ReadonlyVec[]) => Vec<number>[][] | undefined;
/**
* Similar to {@link clipLinePoly}, but only considers intersections within the
* given line segment.
*
* @param a
* @param b
* @param poly
*/
export declare const clipLineSegmentPoly: (a: ReadonlyVec, b: ReadonlyVec, poly: ReadonlyVec[]) => Vec<number>[][] | undefined;
/**
* Similar to {@link clipLineSegmentPoly}, but for polylines. Returns array of
* new vertex chunks where the given polyline is inside the given bounding poly.
*
* @param pts
* @param poly
*/
export declare const clipPolylinePoly: (pts: ReadonlyVec[], poly: ReadonlyVec[]) => ReadonlyVec[][];
//# sourceMappingURL=clip-poly.d.ts.map