loading... Pacem JS

Polygon Compound

Computes the intersection, union or difference of two polygons.

Does not manage holes yet, when union or difference operators are selected.

// sample use
const points0 = [{x: x0, y: y0}, ..., {x: xn, y: yn}];
const points1 = [{x: x0, y: y0}, ..., {x: xn, y: yn}];
const polygon0 = { vertices: points0 };
const polygon1 = { vertices: points1 };
const { polygons, mesh } = Pacem.Geometry.Utils.combinePolygons(polygon0, polygon1, 'intersect' /* 'union' | 'difference' */);