{"id":15664110,"url":"https://github.com/rusty1s/rsclipperwrapper","last_synced_at":"2025-05-06T18:48:56.192Z","repository":{"id":36058720,"uuid":"40357394","full_name":"rusty1s/RSClipperWrapper","owner":"rusty1s","description":"A small and simple wrapper for the Clipper library to perform polygon clipping (Swift)","archived":false,"fork":false,"pushed_at":"2019-01-14T21:44:39.000Z","size":118,"stargazers_count":17,"open_issues_count":1,"forks_count":9,"subscribers_count":6,"default_branch":"master","last_synced_at":"2025-03-31T01:51:21.274Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"C++","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/rusty1s.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2015-08-07T11:35:31.000Z","updated_at":"2023-03-10T14:02:17.000Z","dependencies_parsed_at":"2022-09-05T05:20:24.002Z","dependency_job_id":null,"html_url":"https://github.com/rusty1s/RSClipperWrapper","commit_stats":null,"previous_names":[],"tags_count":2,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rusty1s%2FRSClipperWrapper","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rusty1s%2FRSClipperWrapper/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rusty1s%2FRSClipperWrapper/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rusty1s%2FRSClipperWrapper/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/rusty1s","download_url":"https://codeload.github.com/rusty1s/RSClipperWrapper/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":252749681,"owners_count":21798574,"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":[],"created_at":"2024-10-03T13:41:17.074Z","updated_at":"2025-05-06T18:48:56.172Z","avatar_url":"https://github.com/rusty1s.png","language":"C++","funding_links":[],"categories":[],"sub_categories":[],"readme":"# RSClipperWrapper\n\n`RSClipperWrapper` is a small and simple wrapper for [Clipper](http://www.angusj.com/delphi/clipper.php) - an open source freeware library for clipping polygons - by Angus Johnson implemented in **Swift**. The original *Clipper* sources of version 6.2.1 are distributed. *Clipper* is fast, has no errors even on complex polygons (inclusive holes) and comes with the [Boost Software License](http://www.boost.org/LICENSE_1_0.txt) and thus is free for both open source and commerical applications.\n\n`RSClipperWrapper` contains the `Clipper` class to perform clipping on any amount of polygons - **union**, **difference**, **intersection** \u0026 **exclusive-or**.\n\n![alt Union](union.png)\n![alt Difference](difference.png)\n![alt Intersection](intersect.png)\n![alt Xor](xor.png)\n\n## Example\n\n1. Construct polygons, e.g.: `let polygon1 = [CGPoint(x: 0, y: 0), CGPoint(x: 10, y: 10), CGPoint(x: 20, 0)]`\n2. Use on of the static functions of the `Clipper` class to perform a polygon clipping, e.g.: `Clipper.intersectPolygons([polygon1], withPolygons: [polygon2])`\n3. That's it!\n\n`RSClipperWrapper` contains an example project where you can play around with the four different ways of clipping polygons.\n\n## Installation\n\n`RSClipperWrapper` is not yet released on CocoaPod. Instead use\n\n```\nuse_frameworks!\n\npod 'RSClipperWrapper', :git =\u003e 'https://github.com/rusty1s/RSClipperWrapper.git'\n```\n\nin your Podfile and run `pod install`.\n\n## Documentation\n\n### Clipper\n\n\tclass Clipper { ... }\n\nThe `Clipper` class performs polygon clipping -  union, difference, intersection \u0026 exclusive-or. A set of polygons are represented as `[[CGPoint]]` - an array of polygons and a polygon is defined as a finite sequence of `CGPoint`.\n\n#### Enumerations\n\n\tFillType\n\nThe winding rule used to present a polygon.\n\n\tenum FillType {\n        case EvenOdd\n        case NonZero\n        case Positive\n        case Negative\n    }\n\n#### Static methods\n\n\tclass func unionPolygons(subjPolygons: [[CGPoint]], subjFillType: FillType, withPolygons clipPolygons: [[CGPoint]], clipFillType: FillType) -\u003e [[CGPoint]]\n\nConstructs and returns the union of an array of polygons with an array of polygons.\n\n\tclass func differencePolygons(subjPolygons: [[CGPoint]], subjFillType: FillType, fromPolygons clipPolygons: [[CGPoint]], clipFillType: FillType) -\u003e [[CGPoint]]\n\nConstructs and returns the difference of an array of polygons from an array of polygons.\n\n\tclass func intersectPolygons(subjPolygons: [[CGPoint]], subjFillType: FillType, withPolygons clipPolygons: [[CGPoint]], clipFillType: FillType) -\u003e [[CGPoint]]\n\nConstructs and returns the intersection of an array of polygons with an array of polygons.\n\n\tclass func xorPolygons(subjPolygons: [[CGPoint]], subjFillType: FillType, withPolygons clipPolygons: [[CGPoint]], clipFillType: FillType) -\u003e [[CGPoint]]\n\nConstructs and returns the exclusive-or boolean operation of an array of polygons with an array of polygons.\n\nThe default values for `subjFillType` and `clipFillType` are `EvenOdd`.\n\n## Additional information\n\n`RSClipperWrapper` was developed and implemented for the use in *Dig Deeper - the Mining / Crafting / Trading game*. *Dig Depper* is currently in developement and has its own *GitHub* project [here](../../../DigDeeper).\n\n![alt Dig Deeper](../../../DigDeeper/blob/master/logo.png)\n\n## License\n\nCopyright (c) 2015 Matthias Fey \u003cmatthias.fey@tu-dortmund.de\u003e\n\nPermission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the \"Software\"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:\n\nThe above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frusty1s%2Frsclipperwrapper","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Frusty1s%2Frsclipperwrapper","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frusty1s%2Frsclipperwrapper/lists"}