Skip to content

PolyClipper provides methods to clip arbitrary polygons (in 2D) and polyhedra (in 3D) by planes.

License

Notifications You must be signed in to change notification settings

LLNL/PolyClipper

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

PolyClipper

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.

Documentation

PolyClipper is documented at readthedocs.

Note the source for this documentation is embedded in the PolyClipper repository under docs/.

Contributions

Contributions are welcome, and should be provided as pull requests to the main repository. Note all contributions must be provided under the same license for distribution (in this case the BSD license).

License

PolyClipper is released under the BSD license.

LLNL-CODE-811676

SPDX-License-Identifier: BSD-3

About

PolyClipper provides methods to clip arbitrary polygons (in 2D) and polyhedra (in 3D) by planes.

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published