Offers methods to perform boolean operations on shapes. Use ConstructiveGeometryFactory to create instances of this class. For geodesy calculations see Geodesy. The following shapes are supported:

The resulting shapes will also be Point, Polyline, Polygon, ComplexPolygon instances, or ShapeList instances containing those shapes. For example:

  • Point results from:
    • The union or intersection of two points on top of each other
    • The intersection of a polygon touching another shape with a corner
    • The intersection of a polygon touching another shape with a corner
  • Polyline results from:
    • Set operations with polylines
    • The intersection of filled shapes that touch each other with their boundary
  • ComplexPolygon results from set operations with filled shapes.
  • ShapeList with multiple elements. This occurs if the result consists of multiple polylines, for example, or a combination of points, polylines and polygons.
  • ShapeList without elements: represents an empty result, for example the intersection between two disjoint shapes.

Hierarchy

  • ConstructiveGeometry

Methods

  • Calculates the difference of the given shapes. All next shapes are subtracted from the first shape. The returned shape may be any type of shape, or a shape list of multiple shapes, depending on what is required to describe the resulting shape.

    For example, the difference of the red and blue shape is the green shape:

    ConstructiveGeometry.difference illustration

    Parameters

    • shapes: Shape[]

      The operands of the boolean operation. There must be at least two shapes.

    Returns Shape

    the result of the boolean operation.

  • Calculates the intersection of the given shapes. The resulting shape only contains points that are contained in all of the given shapes. The returned shape may be any type of shape, or a shape list of multiple shapes, depending on what is required to describe the resulting shape.

    For example, the intersection of the red and blue shape is the green shape:

    ConstructiveGeometry.intersection illustration

    Parameters

    • shapes: Shape[]

      The operands of the boolean operation. There must be at least two shapes.

    Returns Shape

    the result of the boolean operation.

  • Calculates the union of the given shapes. The resulting shape contains all points that are contained in any of the given shapes. The returned shape may be any type of shape, or a shape list of multiple shapes, depending on what is required to describe the resulting shape.

    For example, the union of the red and blue shape is the resulting green shape:

    ConstructiveGeometry.union illustration

    Parameters

    • shapes: Shape[]

      The operands of the boolean operation. There must be at least two shapes.

    Returns Shape

    the result of the boolean operation.