Introduction

PolyClipper is a C++ reimplementation of the geometric clipping operations in the R3D library originally written by Devon Powell, as documented in the paper Powell & Abell (2015).

The main focus here is on clipping polygons (in 2D \((x,y)\) coordinates) and polyhedra (in 3D \((x,y,z)\) coordinates) with planes, returning new polygons/polyhedra as the result of this clipping. The input polygons/polyhedra may be non-convex and arbitrarily complex, but the only clipping operation supported is with planes. This is equivalent to intersecting one arbitrary (not necessarily convex) polygon/polyhedron with a convex polygon/polyhedron.

PolyClipper reimplements these clipping operations from R3D for two reasons:
  • PolyClipper removes the hard-coded size limitations of R3D on the number of vertices/complexity of the polygons and polyhedra.

  • PolyClipper also removes the assumption that each vertex in 3D has exactly three neighbors (as well as the related limitation of two neighbors in 2D) – the number of neighbors per vertex is now arbitrary. This also removes the complexity of requiring degenerate/redundant vertices.

Note PolyClipper currently does not provide the generalized voxelization or arbitrary integrals over polygons/polyhedra as provided in R3D. These would be straightforward to add, but were not necessary for the authors needs from the library, which is to generalize the clipping algorithms. The only method of this sort provided by PolyClipper is the ability to do the zeroth and first moment integrals over the polygons/polyhedra.

PolyClipper currently provides both C++ and Python interfaces.

License

PolyClipper is released under the BSD license.

LLNL-CODE-811676

SPDX-License-Identifier: BSD-3