Boolean operations on polygons

Boolean operations on polygons are a set of Boolean operations (AND, OR, NOT, XOR, ...) operating on one or more sets of polygons in computer graphics. These sets of operations are widely used in computer graphics, CAD, and in EDA (in integrated circuit physical design and verification software). These are also used for activities like rapid prototyping in product design, medical device development, or even the creation of elaborate artworks. [1]

Different boolean operations

## Algorithms

[edit]

* Greiner–Hormann clipping algorithm
* Vatti clipping algorithm
* Sutherland–Hodgman algorithm (special case algorithm)
* Weiler–Atherton clipping algorithm (special case algorithm)

## Uses in software

[edit]

Early algorithms for Boolean operations on polygons were based on the use of bitmaps. Using bitmaps in modeling polygon shapes has many drawbacks. One of the drawbacks is that the memory usage can be very large, since the resolution of polygons is proportional to the number of bits used to represent polygons. The higher the resolution is desired, the more the number of bits is required.

Modern implementations for Boolean operations on polygons tend to use plane sweep algorithms (or Sweep line algorithms). A list of papers using plane sweep algorithms for Boolean operations on polygons can be found in References below.

Boolean operations on convex polygons and monotone polygons of the same direction may be performed in linear time.[2]

## See also

[edit]

* Boolean algebra
* Computational geometry
* Constructive solid geometry, a method of defining three-dimensional shapes using a similar set of operations
* Geometry processing
* General Polygon Clipper, a C library which computes the results of clipping operations

## Notes

[edit]

1. ^ "Blog - MeshLib - 3D Mesh Processing Library Python, C++". Retrieved 2025-06-09.
2. ^ Katz, Matthew J.; Overmars, Mark H.; Sharir, Micha (1992), "Efficient hidden surface removal for objects with small union size", Computational Geometry: Theory and Applications, 2 (4): 223–234, doi:10.1016/0925-7721(92)90024-M.

## Bibliography

[edit]

* Mark de Berg, Marc van Kreveld, Mark Overmars, and Otfried Schwarzkopf, Computational Geometry - Algorithms and Applications, Second Edition, 2000
* Jon Louis Bentley and Thomas A. Ottmann, Algorithms for Reporting and Counting Geometric Intersections, IEEE Transactions on Computers, Vol. C-28, No. 9, September 1979, pp. 643–647
* Jon Louis Bentley and Derick Wood, An Optimal Worst Case Algorithm for Reporting Intersections of Rectangles, IEEE Transactions on Computers, Vol. C-29. No. 7, July 1980, pp. 571–577
* Ulrich Lauther, An O(N log N) Algorithm for Boolean Mask Operations, 18th Design Automation Conference, 1981, pp. 555–562
* James A. Wilmore, Efficient Boolean Operations on IC Masks, 18th Design Automation Conference, 1981, pp. 571–579
* Nievergelt, J.; Preparata, F. P. (October 1982). "Plane-Sweep Algorithms for Intersecting Geometric Figures". Communications of the ACM. 25 (10): 739–747\. CiteSeerX 10.1.1.83.3275. doi:10.1145/358656.358681. S2CID 16606107.
* Thomas Ottmann, Peter Widmayer, and Derick Wood, "A Fast Algorithm for the Boolean Masking Problem," Computer Vision, Graphics, and Image Processing, 30, 1985, pp. 249–268

## External links

[edit]

* UIUC Computational Geometry Pages
* Constructive planar geometry, by Dave Eberly.

Software

* Michael Leonov has compiled a comparison of polygon clippers.
* Angus Johnson has also compared three clipping libraries.
* SINED GmbH has compared performance and memory utilization of three polygon clippers Archived 2012-11-16 at the Wayback Machine.
* A comparison of 5 clipping libraries at rogue-modron.blogspot.com
* A commercial library for 3D Boolean operations: sgCore C++/C# library.
* The comp.graphics.algorithms FAQ, solutions to mathematical problems with 2D and 3D Polygons.
* Matthias Kramm's gfxpoly, a free C library for 2D polygons (BSD license).
* Klaas Holwerda's Boolean, a C++ library for 2D polygons.
* David Kennison's Polypack, a FORTRAN library based on the Vatti algorithm.
* Klamer Schutte's Clippoly, a polygon clipper written in C++.
* Michael Leonov's poly_Boolean, a C++ library, which extends the Schutte algorithm.
* Angus Johnson's Clipper, an open-source freeware library (written in Delphi, C++ and C#) that's based on the Vatti algorithm.
* clipper2 crate, a safe Rust wrapper for Angus Johnson's Clipper2 library.
* Nail Sharipov’s iOverlay Rust Polygon Boolean Operations library: Supports intersection, union, difference, xor, and self-intersections for all polygon varieties.
* GeoLib, a commercial library available in C++ and C#.
* Alan Murta's GPC Archived 2011-02-27 at the Wayback Machine, General Polygon Clipper library.
* PolygonLib Archived 2012-11-16 at the Wayback Machine, C++ and COM libraries for 2D polygons (optimized for large polygon sets, built-in spatial indices).