UNPKG

poly-math-2d

Version:

2D Polygon math: boolean operations, triangulation, graphs, support for holes and non-convex shapes.

13 lines (12 loc) 873 B
import { Point, PointType } from './point.js'; export { Point, PointType }; export type Triangle = [Point, Point, Point]; export declare function pointInTriangle(p: Point, tri: Triangle): boolean; export declare function segmentsIntersect(a1: Point, a2: Point, b1: Point, b2: Point): boolean; export declare function trianglesIntersect(t1: Triangle, t2: Triangle): boolean; export declare function trianglesConvexUnion(t1: Triangle, t2: Triangle): Point[]; export declare function cross(o: Point, a: Point, b: Point): number; export declare function trianglesDifference(subject: Triangle, clip: Triangle): Triangle[]; export declare function polygonIntersectsPolygon(poly1: Point[], poly2: Point[]): boolean; export declare function convexUnion(poly1: Point[], poly2: Point[]): Point[]; export declare function convexDifference(subject: Point[], clip: Point[]): Point[][];