Baike.dev
All toolsOnline toolsAI codingTrendingOpen sourceNewsSubmit
Log in
< Back to tools
P

polypartition

> 编程语言
Open source

Tiny Polygon Partitioning and Triangulation Library

703 stars0 likes1 views
WebsiteGitHub

About

Tiny Polygon Partitioning and Triangulation Library

PolyPartition

PolyPartition is a lightweight C++ library for polygon partition and triangulation. PolyPartition implements multiple algorithms for both convex partitioning and triangulation. Different algorithms produce different quality of results (and their complexity varies accordingly). The implemented methods/algorithms with their advantages and disadvantages are outlined below.

For input parameters and return values see method declarations in polypartition.h. All methods require that the input polygons are not self-intersecting, are defined in the correct vertex order (counter-clockwise for non-holes, clockwise for holes), and any holes must be explicitly marked as holes (you can use SetHole(true)). Polygon vertices can easily be ordered correctly by calling TPPLPoly::SetOrientation method.

Input polygon:

Triangulation by ear clipping

Method: TPPLPartition::Triangulate_EC

Time/Space complexity: O(n^2)/O(n)

Supports holes: Yes, by calling TPPLPartition::RemoveHoles.

Quality of solution: Satisfactory in most cases.

Example:

Optimal triangulation in terms of edge length using dynamic programming algorithm

Method: TPPLPartition::Triangulate_OPT

Time/Space complexity: O(n^3)/O(n^2)

Supports holes: No. You could call TPPLPartition::RemoveHoles prior to calling TPPLPartition::Triangulate_OPT, but the solution would no longer be optimal, thus defeating the purpose.

Quality of solution: Optimal in terms of minimal edge length.

Example:

Triangulation by partition into monotone polygons

Method: TPPLPartition::Triangulate_MONO

Time/Space complexity: O(n*log(n))/O(n)

Supports holes: Yes, by design

Quality of solution: Poor. Many thin triangles are created in most cases.

Example:

Convex partition using Hertel-Mehlhorn algorithm

Method: TPPLPartition::ConvexPartition_HM

Time/Space complexity: O(n^2)/O(n)

Supports holes: Yes, by calling TPPLPartition::RemoveHoles.

Quality of solution: At most four times the minimum number of convex polygons is created. However, in practice it works much better than that and often gives optimal partition.

Example:

Optimal convex partition using dynamic programming algorithm by Keil and Snoeyink

Method: TPPLPartition::ConvexPartition_OPT

Time/Space complexity: O(n^3)/O(n^3)

Supports holes: No. You could call TPPLPartition::RemoveHoles prior to calling TPPLPartition::Triangulate_OPT, but the solution would no longer be optimal, thus defeating the purpose.

Quality of solution: Optimal. A minimum number of convex polygons is produced.

Example:

Issues· 0 open

View all issuesOpen on GitHub

No open issues yet, or sync has not completed.

> Tags

C++

No comments yet. Be the first to share.

> Details

PublishedAug 1, 2026
UpdatedSep 17, 2026
Category编程语言
PricingOpen source

> Related tools

T
TypeScript
JavaScript 的超集,为前端与全栈提供静态类型
P
Python
通用编程语言,广泛用于 Web、数据与 AI
G
Go
Google 推出的简洁高效系统语言