{"id":16147823,"url":"https://github.com/bakercp/ofxclipper","last_synced_at":"2025-03-18T18:32:16.125Z","repository":{"id":3357132,"uuid":"4402661","full_name":"bakercp/ofxClipper","owner":"bakercp","description":"An openFrameworks wrapper for Clipper - \"an open source freeware polygon clipping library\".","archived":false,"fork":false,"pushed_at":"2020-08-18T04:12:26.000Z","size":246,"stargazers_count":37,"open_issues_count":6,"forks_count":13,"subscribers_count":6,"default_branch":"master","last_synced_at":"2025-02-28T11:38:09.196Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"C++","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/bakercp.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.md","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2012-05-22T05:34:45.000Z","updated_at":"2024-12-27T22:16:48.000Z","dependencies_parsed_at":"2022-09-07T08:20:49.227Z","dependency_job_id":null,"html_url":"https://github.com/bakercp/ofxClipper","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bakercp%2FofxClipper","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bakercp%2FofxClipper/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bakercp%2FofxClipper/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bakercp%2FofxClipper/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/bakercp","download_url":"https://codeload.github.com/bakercp/ofxClipper/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":243945478,"owners_count":20372894,"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-10T00:27:40.776Z","updated_at":"2025-03-18T18:32:15.764Z","avatar_url":"https://github.com/bakercp.png","language":"C++","funding_links":[],"categories":[],"sub_categories":[],"readme":"ofxClipper\n==========\n\n![Screenshot](https://github.com/bakercp/ofxClipper/raw/master/screen.png)\n\nDescription\n-----------\n\nAn [openFrameworks](http://www.openframeworks.cc/) wrapper for [Clipper](http://www.angusj.com/delphi/clipper.php) - \"an open source freeware polygon clipping library\".\n\nFrom the author's website:\n\n_\"The Clipper library primarily performs the boolean clipping operations - intersection, union, difference \u0026 xor - on 2D polygons. It also performs polygon offsetting._\n\n_The library handles complex (self-intersecting) polygons, polygons with holes and polygons with overlapping co-linear edges._\n_Input polygons for clipping can use EvenOdd, NonZero, Positive and Negative filling modes._\n_The clipping code is based on the Vatti clipping algorithm, and out performs other clipping libraries.\"_\n\nNotes\n-----\n\n#### Animation\n\nClipper works internally with integers. If you do slow animated clipping operations, motion may not be smooth. One solution is to do supersampling. To get 0.1 pixel resolution (10x the default) multiply all ofPolyline vertex coordinates by 10, use the enlarged polyline with Clipper, and finally scale the result down with `ofScale(0.1)` when drawing the result.\n\n#### Filled shapes\n\nClipper outputs a `std::vector\u003cofPolyline\u003e`. ofPolyline can not be rendered as a filled shape (OF 0.10). One way to draw polylines as filled shapes is to use `ofVertex()`:\n\n```cpp\nofBeginShape();\nfor(auto\u0026 v: aPolyline)\n{\n    ofVertex(v);\n}\nofEndShape();\n```\n\n[http://www.openframeworks.cc/](http://www.openframeworks.cc/)\n\nInstallation\n------------\n\nTo use ofxClipper, first you need to download and install [Open Frameworks](https://github.com/openframeworks/openFrameworks).\n\nTo get a copy of the repository you can download the source from [http://github.com/bakercp/ofxClipper](http://github.com/bakercp/ofxClipper) or, alternatively, you can use git clone:\n\n```\ngit clone git://github.com/bakercp/ofxClipper.git\n```\n\nThe addon should sit in `openFrameworks/addons/ofxClipper/`.\n\n#### Which version to use?\n\nofxClipper has been tested with the latest development version of openFrameworks.\n\nExample\n-------\n```cpp\nvoid ofApp::draw()\n{\n    ofTranslate(ofGetWidth() / 2, ofGetHeight() / 2);\n\n    // Create two partially overlapping rotating pentagons\n\n    ofPolyline pa, pb;\n\n    for(int i = 0; i \u003c 5; i++)\n    {\n        float a = i * glm::two_pi\u003cfloat\u003e() / 5 + ofGetElapsedTimef();\n        pa.addVertex(300 * std::cos(a) - 80, 300 * std::sin(a));\n        pb.addVertex(300 * std::cos(-a) + 80, 300 * std::sin(-a));\n    }\n\n    pa.close();\n    pb.close();\n\n    // Create and populate clipper\n    ofx::Clipper clipper;\n    clipper.addPolyline(pa, ClipperLib::ptSubject);\n    clipper.addPolyline(pb, ClipperLib::ptClip);\n\n    // Calculate intersection between the two pentagons\n    auto intersection = clipper.getClipped(ClipperLib::ClipType::ctIntersection);\n\n    // Draw result\n    for (auto\u0026 line: intersection)\n    {\n        line.draw();\n    }\n}\n```\n\nNote: this minimal example tries to be short, not fast. Avoid creating instances of `ofPolyline` and `ofx::Clipper` inside `draw()`.\n\nBuild Status\n------------\n\nNo CI.\n\nCompatibility\n-------------\n\nThe `stable` branch of this repository is meant to be compatible with the openFrameworks [stable branch](https://github.com/openframeworks/openFrameworks/tree/stable), which corresponds to the latest official openFrameworks release.\n\nThe `master` branch of this repository is meant to be compatible with the openFrameworks [master branch](https://github.com/openframeworks/openFrameworks/tree/master).\n\nSome past openFrameworks releases are supported via tagged versions, but only `stable` and `master` branches are actively supported.\n\nVersioning\n----------\n\nThis project uses Semantic Versioning, although strict adherence will only come into effect at version 1.0.0.\n\nLicensing\n---------\n\nSee [LICENSE.md](LICENSE.md)\n\nContributing\n------------\n\nCheck out the [Help Wanted](https://github.com/bakercp/ofxClipper/issues?q=is%3Aissue+is%3Aopen+label%3A%22help+wanted%22) tag in the issues section for specific ideas or propose your own new ideas.\n\nPull Requests are always welcome, so if you make any improvements please feel free to float them back upstream :)\n\n1.  Fork this repository.\n2.  Create your feature branch (`git checkout -b my-new-feature`).\n3.  Commit your changes (`git commit -am 'Add some feature'`).\n4.  Push to the branch (`git push origin my-new-feature`).\n5.  Create new Pull Request.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbakercp%2Fofxclipper","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fbakercp%2Fofxclipper","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbakercp%2Fofxclipper/lists"}