Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 4 additions & 13 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ Clipper2-java is a fast planar geometry library for:

The interface of *Clipper2-java* aims to match the original C# version closely.

For simple use cases, the static methods in `clipper2.Clipper` are sufficient.
For simple use cases, the static methods in `Clipper` class are sufficient.

For advanced scenarios (open paths, PolyTree nesting, reusing engines), use `Clipper64` / `ClipperD` directly.

Expand All @@ -35,25 +35,16 @@ Note Clipper2’s core algorithms operate on **integer coordinates** for numeric
```java
Paths64 subj = new Paths64();
Paths64 clip = new Paths64();
subj.add(Clipper.MakePath(new int[] { 100, 50, 10, 79, 65, 2, 65, 98, 10, 21 }));
clip.add(Clipper.MakePath(new int[] { 98, 63, 4, 68, 77, 8, 52, 100, 19, 12 }));
Paths64 solution = Clipper.Union(subj, clip, FillRule.NonZero);
subj.add(Clipper.makePath(new int[] { 100, 50, 10, 79, 65, 2, 65, 98, 10, 21 }));
clip.add(Clipper.makePath(new int[] { 98, 63, 4, 68, 77, 8, 52, 100, 19, 12 }));
Paths64 solution = Clipper.union(subj, clip, FillRule.NonZero);
solution.get(0).forEach(p -> System.out.println(p.toString()));
```

### Installation (Maven / Gradle)

*Clipper2-java* is available as a Maven/Gradle artifact via [Jitpack](https://jitpack.io/#micycle1/Clipper2-java).

## Port Info
* _tangiblesoftwaresolutions_' C# to Java Converter did the heavy lifting (but then a lot of manual work was required).
* Wrapper objects are used to replicate C# `ref` (pass-by-reference) behaviour. This isn't very Java-esque but avoids an unmanageable refactoring effort.
* Code passes all tests: polygon, line and polytree.
* Uses lower-case (x, y) for point coordinates.
* Private local variables have been renamed to their _camelCase_ variant but public methods (i.e. those of `Clipper.class`) retain their C# _PascalCase_ names (for now...).
* Benchmarks can be run by including `jmh:benchmark` to the chosen maven goal.
* `scanlineList` from `ClipperBase` uses Java `TreeSet` (variable renamed to `scanlineSet`).

## Benchmark
_lightbringer's_ Java [port](https://github.com/lightbringer/clipper-java) of Clipper1 is benchmarked against this project in the benchmarks. *Clipper2-java* is faster, which becomes more pronounced input size grows.
```
Expand Down
4 changes: 2 additions & 2 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>micycle</groupId>
<groupId>com.github.micycle</groupId>
<artifactId>clipper2</artifactId>
<version>1.5.4</version>
<version>2.0.1</version>
<name>Clipper2</name>
<properties>
<jmh.version>1.36</jmh.version>
Expand Down
84 changes: 0 additions & 84 deletions src/main/java/clipper2/Minkowski.java

This file was deleted.

Loading