Copyright © 2021 by K4.org
  (v.0.48.124)

NOTE: Obsolete: Use BooleanProfile instead.

This mixin provides polygon boolean operations between two polygons, resulting in the union, intersection, or difference of those polygons. The polygons need to be supplied in a particular form based on the Geometry.coordinates object of GeoJSON, and support interior holes and 'multi-polygons'. Note that GeoJSON polygons require the the first and last points of a ring be identical.

To use this mixin, add it to any Design which needs this capability, and create 2D polygons as arrays of [x,y] pairs. Then supply these in another array, containing an initial outer polygon and optionally followed by interior 'hole' polygons. The output is also sets of polygons of the same form, which have to be converted back to Points for use.

example
const a = this.Apoints.map(p => [p.x, p.y]);
const b = this.Bpoints.map(p => [p.x, p.y]);
const bool = this.polygonIntersection([a], [b]);
const res = bool[0].map(pair => p(pair[0], pair[1], 0));
return res;

Index

Methods

polygonBoolean

  • polygonBoolean(): Array
  • This calls the internal Martinez implementation. It always returns a set of polygons as an array.

    Flags : method (Note this is uncached)

    Returns Array

polygonDifference

  • polygonDifference(): Array
  • Removes part of a that is covered by b. Note that this can return multiple results.

    Flags : method (Note this is uncached)

    Returns Array

polygonIntersection

  • polygonIntersection(): Array
  • Returns the area of a that is common with b. Note that this can return muliple results.

    Flags : method (Note this is uncached)

    Returns Array

polygonUnion

  • polygonUnion(): Array
  • Returns the area of a and b. Note that this can return muliple results if the areas are disjoint.

    Flags : method (Note this is uncached)

    Returns Array