{"id":13532943,"url":"https://github.com/ivanfratric/polypartition","last_synced_at":"2025-04-01T21:31:30.633Z","repository":{"id":31419932,"uuid":"34983347","full_name":"ivanfratric/polypartition","owner":"ivanfratric","description":"Tiny Polygon Partitioning and Triangulation Library","archived":false,"fork":false,"pushed_at":"2024-11-25T12:08:52.000Z","size":162,"stargazers_count":662,"open_issues_count":11,"forks_count":118,"subscribers_count":29,"default_branch":"master","last_synced_at":"2024-11-25T13:21:07.072Z","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/ivanfratric.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,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2015-05-03T11:16:10.000Z","updated_at":"2024-11-25T12:08:57.000Z","dependencies_parsed_at":"2024-11-02T20:30:47.457Z","dependency_job_id":"916ea41b-79cb-426f-88f4-f696a0f54db9","html_url":"https://github.com/ivanfratric/polypartition","commit_stats":{"total_commits":39,"total_committers":10,"mean_commits":3.9,"dds":0.717948717948718,"last_synced_commit":"5dcc93c9c023a2296610ec98539e2377f4285d30"},"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ivanfratric%2Fpolypartition","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ivanfratric%2Fpolypartition/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ivanfratric%2Fpolypartition/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ivanfratric%2Fpolypartition/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ivanfratric","download_url":"https://codeload.github.com/ivanfratric/polypartition/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":246713134,"owners_count":20821843,"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-08-01T07:01:15.211Z","updated_at":"2025-04-01T21:31:29.308Z","avatar_url":"https://github.com/ivanfratric.png","language":"C++","readme":"#### PolyPartition\n\nPolyPartition is a lightweight C++ library for polygon partition\nand triangulation. PolyPartition implements multiple algorithms\nfor both convex partitioning and triangulation. Different\nalgorithms produce different quality of results (and their\ncomplexity varies accordingly). The implemented methods/algorithms\nwith their advantages and disadvantages are outlined below.\n\nFor input parameters and return values see method declarations\nin `polypartition.h`. All methods require that the input polygons\nare not self-intersecting, are defined in the correct vertex order\n(counter-clockwise for non-holes, clockwise for holes), and any holes\nmust be explicitly marked as holes (you can use `SetHole(true)`).\nPolygon vertices can easily be ordered correctly by\ncalling `TPPLPoly::SetOrientation` method.\n\nInput polygon:\n\n![images/test_input.png](images/test_input.png)\n\n#### Triangulation by ear clipping\n\nMethod: `TPPLPartition::Triangulate_EC`\n\nTime/Space complexity: `O(n^2)/O(n)`\n\nSupports holes: Yes, by calling `TPPLPartition::RemoveHoles`.\n\nQuality of solution: Satisfactory in most cases.\n\nExample:\n\n![images/tri_ec.png](images/tri_ec.png)\n\n\n#### Optimal triangulation in terms of edge length using dynamic programming algorithm\n\nMethod: `TPPLPartition::Triangulate_OPT`\n\nTime/Space complexity: `O(n^3)/O(n^2)`\n\nSupports holes: No. You could call `TPPLPartition::RemoveHoles` prior\nto calling `TPPLPartition::Triangulate_OPT`, but the solution would no\nlonger be optimal, thus defeating the purpose.\n\nQuality of solution: Optimal in terms of minimal edge length.\n\nExample:\n\n![images/tri_opt.png](images/tri_opt.png)\n\n\n#### Triangulation by partition into monotone polygons\n\nMethod: `TPPLPartition::Triangulate_MONO`\n\nTime/Space complexity: `O(n*log(n))/O(n)`\n\nSupports holes: Yes, by design\n\nQuality of solution: Poor. Many thin triangles are created in most cases.\n\nExample:\n\n![images/tri_mono.png](images/tri_mono.png)\n\n\n#### Convex partition using Hertel-Mehlhorn algorithm\n\nMethod: `TPPLPartition::ConvexPartition_HM`\n\nTime/Space complexity: `O(n^2)/O(n)`\n\nSupports holes: Yes, by calling `TPPLPartition::RemoveHoles`.\n\nQuality of solution: At most four times the minimum number of convex\npolygons is created. However, in practice it works much better\nthan that and often gives optimal partition.\n\nExample:\n\n![images/conv_hm.png](images/conv_hm.png)\n\n\n#### Optimal convex partition using dynamic programming algorithm by Keil and Snoeyink\n\nMethod: `TPPLPartition::ConvexPartition_OPT`\n\nTime/Space complexity: `O(n^3)/O(n^3)`\n\nSupports holes: No. You could call `TPPLPartition::RemoveHoles`\nprior to calling `TPPLPartition::Triangulate_OPT`, but the solution\nwould no longer be optimal, thus defeating the purpose.\n\nQuality of solution: Optimal. A minimum number of convex polygons is produced.\n\nExample:\n\n![images/conv_opt.png](images/conv_opt.png)\n","funding_links":[],"categories":["Maths","Libraries"],"sub_categories":["C++"],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fivanfratric%2Fpolypartition","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fivanfratric%2Fpolypartition","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fivanfratric%2Fpolypartition/lists"}