Skip to content

Commit 62c8c04

Browse files
Update readme
1 parent c1c8695 commit 62c8c04

5 files changed

Lines changed: 17 additions & 14 deletions

File tree

‎.github/workflows/build-and-test.yml‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ on:
1111
branches:
1212
- main
1313
- release/*
14-
types: [ labeled, opened, synchronize, reopened ]
14+
types: [ opened, synchronize, reopened ]
1515
jobs:
1616
# Prime a single LFS cache and expose the exact key for the matrix
1717
WarmLFS:

‎.github/workflows/code-coverage.yml‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,8 @@ jobs:
8080
XUNIT_PATH: .\tests\PolygonClipper.Tests # Required for xunit
8181

8282
- name: Codecov Update
83-
uses: codecov/codecov-action@v4
83+
uses: codecov/codecov-action@v5
8484
if: matrix.options.codecov == true && startsWith(github.repository, 'SixLabors')
8585
with:
8686
flags: unittests
87+
token: ${{ secrets.CODECOV_TOKEN }}

‎PolygonClipper.sln‎

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11

22
Microsoft Visual Studio Solution File, Format Version 12.00
33
# Visual Studio Version 18
4-
VisualStudioVersion = 18.2.11415.280 d18.0
4+
VisualStudioVersion = 18.2.11415.280
55
MinimumVisualStudioVersion = 10.0.40219.1
66
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "PolygonClipper", "src\PolygonClipper\PolygonClipper.csproj", "{3C8D945E-6074-437E-B6EA-237BD0C80411}"
77
EndProject
@@ -50,8 +50,6 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "ISSUE_TEMPLATE", "ISSUE_TEM
5050
.github\ISSUE_TEMPLATE\oss-bug-report.yml = .github\ISSUE_TEMPLATE\oss-bug-report.yml
5151
EndProjectSection
5252
EndProject
53-
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Clipper2Lib", "..\..\AngusJohnson\Clipper2\CSharp\Clipper2Lib\Clipper2Lib.csproj", "{442C0648-BED0-CD51-39C6-4D54ACAEC5B3}"
54-
EndProject
5553
Global
5654
GlobalSection(SolutionConfigurationPlatforms) = preSolution
5755
Debug|Any CPU = Debug|Any CPU
@@ -74,10 +72,6 @@ Global
7472
{F1965B36-D896-4BC1-8941-7FE6CEB82CD5}.Debug|Any CPU.Build.0 = Debug|Any CPU
7573
{F1965B36-D896-4BC1-8941-7FE6CEB82CD5}.Release|Any CPU.ActiveCfg = Release|Any CPU
7674
{F1965B36-D896-4BC1-8941-7FE6CEB82CD5}.Release|Any CPU.Build.0 = Release|Any CPU
77-
{442C0648-BED0-CD51-39C6-4D54ACAEC5B3}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
78-
{442C0648-BED0-CD51-39C6-4D54ACAEC5B3}.Debug|Any CPU.Build.0 = Debug|Any CPU
79-
{442C0648-BED0-CD51-39C6-4D54ACAEC5B3}.Release|Any CPU.ActiveCfg = Release|Any CPU
80-
{442C0648-BED0-CD51-39C6-4D54ACAEC5B3}.Release|Any CPU.Build.0 = Release|Any CPU
8175
EndGlobalSection
8276
GlobalSection(SolutionProperties) = preSolution
8377
HideSolutionNode = FALSE
@@ -91,7 +85,6 @@ Global
9185
{F1965B36-D896-4BC1-8941-7FE6CEB82CD5} = {84C4B358-492B-46FC-9F11-FBB76B06BD3F}
9286
{68A8CC40-6AED-4E96-B524-31B1158FDEEA} = {F0882E95-667C-48FE-B43A-24FC55D9F354}
9387
{02EA681E-C7D8-13C7-8484-4AC65E1B71E8} = {6F7A3AE6-C7D1-441F-A203-BA6575931CE2}
94-
{442C0648-BED0-CD51-39C6-4D54ACAEC5B3} = {F0882E95-667C-48FE-B43A-24FC55D9F354}
9588
EndGlobalSection
9689
GlobalSection(ExtensibilityGlobals) = postSolution
9790
SolutionGuid = {2C73BEEC-091B-45E4-A0BD-7D7CD16A8451}

‎README.md‎

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,19 +8,21 @@ SixLabors.PolygonClipper
88
<div align="center">
99

1010
[![Build Status](https://img.shields.io/github/actions/workflow/status/SixLabors/PolygonClipper/build-and-test.yml?branch=main)](https://github.com/SixLabors/PolygonClipper/actions)
11-
[![Code coverage](https://codecov.io/gh/SixLabors/PolygonClipper/branch/main/graph/badge.svg)](https://codecov.io/gh/SixLabors/PolygonClipper)
11+
[![codecov](https://codecov.io/github/SixLabors/PolygonClipper/graph/badge.svg?token=ZEK38fv18V)](https://codecov.io/github/SixLabors/PolygonClipper)
1212
[![License: Six Labors Split](https://img.shields.io/badge/license-Six%20Labors%20Split-%23e30183)](https://github.com/SixLabors/PolygonClipper/blob/main/LICENSE)
1313

1414
</div>
1515

16-
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.
16+
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.
1717

1818
## Features
1919

2020
- Works with non-convex polygons, including holes and multiple disjoint regions
2121
- Handles edge cases like overlapping edges and vertical segments
2222
- Preserves topology: output polygons include hole/contour hierarchy
2323
- Deterministic and robust sweep line algorithm with O((n + k) log n) complexity
24+
- Includes self-intersection removal to normalize input contours for boolean operations
25+
- Uses double precision geometry without coordinate quantization
2426

2527
## Usage
2628

@@ -30,13 +32,20 @@ The API centers around `Polygon` and `Contour` types. Construct input polygons u
3032
Polygon result = PolygonClipper.Intersect(subject, clipping);
3133
```
3234

35+
You can also normalize input before boolean operations if your contours contain self-intersections:
36+
37+
```csharp
38+
Polygon clean = PolygonClipper.RemoveSelfIntersections(input);
39+
```
40+
3341
## Based On
3442

3543
This implementation is based on the algorithm described in:
3644

37-
> F. Martínez et al., "A simple algorithm for Boolean operations on polygons", *Advances in Engineering Software*, 64 (2013), pp. 11–19.
45+
> F. Martínez et al., "A simple algorithm for Boolean operations on polygons", *Advances in Engineering Software*, 64 (2013), pp. 11-19.
3846
> https://sci-hub.se/10.1016/j.advengsoft.2013.04.004
3947
4048
## License
4149

4250
Six Labors Split License. See [`LICENSE`](https://github.com/SixLabors/PolygonClipper/blob/main/LICENSE) for details.
51+

‎tests/PolygonClipper.Tests/PolygonClipper.Tests.csproj‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,11 +21,11 @@
2121
</Choose>
2222

2323
<ItemGroup>
24+
<PackageReference Include="Clipper2" Version="2.0.0" />
2425
<PackageReference Include="coverlet.collector" Version="6.0.4" />
2526
</ItemGroup>
2627

2728
<ItemGroup>
28-
<ProjectReference Include="..\..\..\..\AngusJohnson\Clipper2\CSharp\Clipper2Lib\Clipper2Lib.csproj" />
2929
<ProjectReference Include="..\..\src\PolygonClipper\PolygonClipper.csproj" />
3030
<ProjectReference Include="..\GeoJson\GeoJson.csproj" />
3131
</ItemGroup>

0 commit comments

Comments
 (0)