You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+24-12Lines changed: 24 additions & 12 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -2,18 +2,30 @@
2
2
3
3
[](https://github.com/SixLabors/PolygonClipper/blob/master/LICENSE)
4
4
5
-
## A Simple Algorithm for Boolean Operations on Polygons
5
+
A C# implementation of the Martínez–Rueda algorithm for performing Boolean operations on polygons. This library supports union, intersection, difference, and xor operations on complex polygons with holes, multiple contours, and self-intersections.
6
6
7
-
*Francisco Martínez, Carlos Ogayar, Juan R. Jiménez, Antonio J. Rueda*
This repository contains the beginnings of an attempted port of the original public domain C++ implementation by the main author of the paper Francisco Martínez.
9
+
- Works with non-convex polygons, including holes and multiple disjoint regions
10
+
- Handles edge cases like overlapping edges and vertical segments
11
+
- Preserves topology: output polygons include hole/contour hierarchy
12
+
- Deterministic and robust sweep line algorithm with O((n + k) log n) complexity
12
13
13
-
The original code can be found in the reference folder.
14
-
15
-
The plan is to implement a performant port, add additional tests and some method by which to generate renders of output clipping operations.
16
-
17
-
This is currently an intellectual exercise but I believe a C# port could be very useful in many applications if proven successful.
18
-
19
-
All and any assistance is gratefully accepted. :heart:
14
+
## Usage
15
+
16
+
The API centers around `Polygon` and `Contour` types. Construct input polygons using contours, then apply Boolean operations via the `PolygonClipper` class:
0 commit comments