Expand description
Boolean operations on simple polygons by the Greiner-Hormann algorithm.
Both polygons are walked as cyclic vertex lists with their mutual edge intersections inserted; each intersection is classified as an entry into or exit from the other polygon, and the result is traced by following one polygon until the next intersection, then switching to the other. Degenerate configurations (a vertex on the other polygon’s boundary, overlapping collinear edges) are resolved by perturbing the clip polygon by a relative 1e-9, so results are exact up to that tolerance. Results are counter-clockwise outer boundaries and clockwise holes. Holes arise in a difference when the clip polygon lies strictly inside the subject, and in a union when the two polygons enclose a region between them; areas add up correctly when the holes’ negative signed areas are included.
See the book entry Convex hulls and polygon booleans.
Enums§
- Boolean
Operation - The boolean operation.
Functions§
- point_
in_ polygon - Whether
pis inside the polygon (even-odd rule). - polygon_
boolean - Applies
operationto the simple polygonssubjectandclip(either orientation).