poly-math-2d
Version:
2D Polygon math: boolean operations, triangulation, graphs, support for holes and non-convex shapes.
30 lines (29 loc) • 1.06 kB
TypeScript
import { Point, Triangle as P2DTriangle } from './poly2d.js';
import { PolygonMap } from './polygon-map.js';
export { Point };
export declare class TPolygon {
mainTriangle: P2DTriangle;
centerPoint: Point;
connections: TPolygonConnection[];
constructor(triangle: P2DTriangle);
}
export declare class TPolygonConnection {
neighbor: TPolygon;
distance: number;
constructor(neighbor: TPolygon, distance: number);
}
export declare class Polygon {
points: Point[];
tpolygons: TPolygon[];
holes: Polygon[];
constructor(points: Point[], holes?: Polygon[]);
private _rebuildTriangulation;
isConvex(): boolean;
isPointInPolygon(point: Point): boolean;
isPointInPolygonTriangulated(point: Point): boolean;
static isPointInPolygon(point: Point, polygon: Polygon): boolean;
static isPointInPolygonTriangulated(point: Point, polygon: Polygon): boolean;
unionPolygon(other: Polygon): PolygonMap;
differencePolygon(other: Polygon): PolygonMap;
static fromClippingResult(result: any): Polygon[];
}