{"id":20750532,"url":"https://github.com/micycle1/clipper2-java","last_synced_at":"2025-04-28T12:53:04.154Z","repository":{"id":59462775,"uuid":"535652127","full_name":"micycle1/Clipper2-java","owner":"micycle1","description":"Java port of Clipper2, a Polygon Clipping and Offsetting Library","archived":false,"fork":false,"pushed_at":"2025-04-18T02:17:57.000Z","size":604,"stargazers_count":33,"open_issues_count":0,"forks_count":14,"subscribers_count":5,"default_branch":"master","last_synced_at":"2025-04-18T13:27:47.884Z","etag":null,"topics":["clipper","geometry","offsetting","polygon","polygon-clipping"],"latest_commit_sha":null,"homepage":"http://www.angusj.com/clipper2/Docs/Overview.htm","language":"Java","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/micycle1.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2022-09-12T12:18:23.000Z","updated_at":"2025-04-18T02:16:11.000Z","dependencies_parsed_at":"2023-09-27T14:39:42.372Z","dependency_job_id":"2d4f0e71-bf42-4700-95e5-6eee867d55af","html_url":"https://github.com/micycle1/Clipper2-java","commit_stats":null,"previous_names":[],"tags_count":8,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/micycle1%2FClipper2-java","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/micycle1%2FClipper2-java/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/micycle1%2FClipper2-java/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/micycle1%2FClipper2-java/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/micycle1","download_url":"https://codeload.github.com/micycle1/Clipper2-java/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":251318773,"owners_count":21570419,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["clipper","geometry","offsetting","polygon","polygon-clipping"],"created_at":"2024-11-17T08:27:47.823Z","updated_at":"2025-04-28T12:53:04.149Z","avatar_url":"https://github.com/micycle1.png","language":"Java","funding_links":[],"categories":[],"sub_categories":[],"readme":"[![](https://jitpack.io/v/micycle1/Clipper2-java.svg)](https://jitpack.io/#micycle1/Clipper2-java)\n\n\n# Clipper2-java\nA Java port of _[Clipper2](https://github.com/AngusJohnson/Clipper2)_, an open source freeware software library that performs line and polygon clipping, and offsetting.\n\n## Usage\n\n### Overview\n\nThe interface of *Clipper2-java* is identical to the original C# version.\n\nThe `Clipper` class provides static methods for clipping, path-offsetting, minkowski-sums and path simplification.\nFor more complex clipping operations (e.g. when clipping open paths or when outputs are expected to include polygons nested within holes of others), use the `Clipper64` or `ClipperD` classes directly.\n\n### Maven\n*Clipper2-java* is available as Maven/Gradle artifact via [Jitpack](https://jitpack.io/#micycle1/Clipper2-java).\n\n### Example\n\n```java\nPaths64 subj = new Paths64();\nPaths64 clip = new Paths64();\nsubj.add(Clipper.MakePath(new int[] { 100, 50, 10, 79, 65, 2, 65, 98, 10, 21 }));\nclip.add(Clipper.MakePath(new int[] { 98, 63, 4, 68, 77, 8, 52, 100, 19, 12 }));\nPaths64 solution = Clipper.Union(subj, clip, FillRule.NonZero);\nsolution.get(0).forEach(p -\u003e System.out.println(p.toString()));\n```\n\n\n## Port Info\n* _tangiblesoftwaresolutions_' C# to Java Converter did the heavy lifting (but then a lot of manual work was required).\n* Wrapper objects are used to replicate C# `ref` (pass-by-reference) behaviour. This isn't very Java-esque but avoids an unmanageable refactoring effort.\n* Code passes all tests: polygon, line and polytree.\n* Uses lower-case (x, y) for point coordinates.\n* 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...).\n* Benchmarks can be run by including `jmh:benchmark` to the chosen maven goal.\n* `scanlineList` from `ClipperBase` uses Java `TreeSet` (variable renamed to `scanlineSet`).\n\n## Benchmark\n_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.\n```\nBenchmark               (edgeCount)  Mode  Cnt  Score   Error  Units\nClipper1.Intersection         1000  avgt    2  0.209           s/op\nClipper1.Intersection         2000  avgt    2  1.123           s/op\nClipper1.Intersection         4000  avgt    2  9.691           s/op\nClipper2.Intersection         1000  avgt    2  0.130           s/op\nClipper2.Intersection         2000  avgt    2  0.852           s/op\nClipper2.Intersection         4000  avgt    2  3.465           s/op\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmicycle1%2Fclipper2-java","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmicycle1%2Fclipper2-java","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmicycle1%2Fclipper2-java/lists"}