Shapes & spaces

Minimum convex partition calculator for a simple polygon without Steiner points

Partition a simple polygon into the fewest convex pieces using only diagonals between existing vertices.

Your numbers

One row per point or face; use zero-based indices where requested.

Calculated on your device. Your inputs aren’t sent to us.

Your result

Ready when you are

Enter your inputs and select Calculate.

Report an issue

Behind the numbers

How this calculation works

Partition a simple polygon into the fewest convex pieces using only diagonals between existing vertices.

THE FORMULAD(P)=1 for convex P; otherwise min over valid diagonals uv of D(P_left)+D(P_right).

A worked example

The L-shaped default has area 7 and a minimum of two convex quadrilaterals. A diagonal from (0,0) to (1,1) separates its two arms.

Good to know

3–10 simple polygon vertices, integer coordinates within ±1000, no holes or consecutive collinear corners. Complete original-vertex diagonal recursion with exact rational geometry and area checks; no Steiner points. Search cap gives unresolved, not a heuristic optimum.

Partitioning is not triangulating

A convex piece contains the straight segment joining any two of its points. Splitting a gallery into such pieces can simplify collision checks or later geometric calculations. Unlike a triangulation, a convex partition may leave a large quadrilateral or many-sided convex region intact. The goal is the number of pieces, not the number or total length of diagonals.

The allowed cuts connect vertices already present in the polygon. Introducing extra junctions along an edge or inside the polygon changes the optimization problem and can change the best count. This calculator keeps that distinction explicit, so its answer should be compared with other no-Steiner convex partitions rather than with unrestricted geometric decompositions.

Minimum convex partition calculator for a simple polygon without Steiner points worked exampleTwo convex piecesExact area = 7No new vertices
Scroll across to see the full diagram.
The L-shaped default has area 7 and a minimum of two convex quadrilaterals. A diagonal from (0,0) to (1,1) separates its two arms.

Compare this with the Concave polygon triangulation calculator from vertices. Minimize the number of convex pieces using noncrossing diagonals; a triangulation splits everything into triangles regardless of whether pieces could merge.

Preparing the polygon

Enter an ordered simple boundary using integer coordinate pairs. Do not append the first coordinate again. An input that crosses itself does not define the single interior required by this solver. Consecutive collinear corners are rejected because they complicate the interpretation of whether a proposed diagonal is a genuine interior cut.

The result returns the counterclockwise boundary used by the calculation. Each piece is a cyclic list of indices into that returned boundary, accompanied by its coordinates. If the original input was clockwise, use these returned indices rather than assuming the initial row numbering survived unchanged. Coordinates remain the safest way to match a piece with a sketch.

Recognizing legal diagonals

A legal diagonal must stay in the polygon, avoid intervening vertices and create two nondegenerate subpolygons. Merely joining two nonadjacent corners is insufficient: a chord across a concave notch may leave the interior. Exact orientation and segment tests determine admissibility for the supported integer coordinates, rather than relying on a coarse image of the shape.

The same rules are checked inside every recursive subpolygon. A line that was interior to the original boundary can become a boundary or an unsuitable cut after previous splits. Treating the current subproblem geometrically prevents the search from assembling pieces that overlap, omit a region or use an edge that was never available as a partition diagonal.

Why the recursive minimum works

A convex subpolygon needs one piece and no further cuts. A nonconvex partition must contain at least one legal diagonal. Removing any one of its diagonals separates the remaining task into two smaller polygon problems. Trying all legal first diagonals and combining their optimal subpartitions therefore includes every possible diagonal partition in the supported class.

The implementation memoizes repeated subproblems, then compares their resulting piece counts. It does not stop after finding the first valid triangulation or greedily merge only one chosen triangle layout. Equal-count alternatives are possible; the returned witness is one minimum partition, not a claim that the optimal diagonals are uniquely determined.

The L-shaped worked example

The default polygon runs around two perpendicular arms of unit thickness. Its reentrant corner at (1,1) makes the whole polygon nonconvex, so one convex piece is impossible. Joining that corner to (0,0) divides the shape into two quadrilaterals, each with nonnegative successive turns. Their combined area equals the original area of seven square units.

These two observations establish optimality transparently: nonconvexity gives a lower bound of two pieces, and the displayed diagonal supplies a two-piece construction. More complicated polygons require the full search. A larger count of reflex vertices does not by itself specify the exact answer, because one diagonal can interact with several geometric constraints.

Checking the returned pieces

The solver independently checks convexity of every returned piece and compares the sum of their exact signed areas with the original polygon area. These checks complement the recursive construction, which places pieces on opposite sides of admissible diagonals. Area agreement alone would not prove a valid partition if an unrelated algorithm allowed overlapping pieces.

Read piece count first, then inspect the index lists and shared boundaries. A piece with more than three vertices is intentional. It records that further subdivision is unnecessary for convexity. Do not judge the solution by whether its triangles match a Delaunay triangulation; Delaunay geometry optimizes different criteria and does not solve this minimum-piece problem.

Bounds and practical comparisons

The browser search is limited to small polygons, and a resource error leaves the optimum unresolved. Simplifying the input by deleting a true geometric feature can change the answer, so do not remove a reflex corner merely to get under the cap. Only remove redundant straight-boundary points when they do not change the actual polygon.

For downstream operations, keep the returned convex pieces separate and reuse their exact boundary coordinates. If your application permits Steiner points, holes or curved boundaries, this result is not an optimum for that broader model. Those extensions require a different admissible-cut definition and should not be silently inferred from a successful calculation here.

A few questions, answered

Can a piece have five sides?

Yes. Any convex piece can remain intact; the objective minimizes piece count rather than forcing triangles.

Are new Steiner vertices permitted?

No. Every partition diagonal connects original boundary vertices, and no extra interior junctions are introduced.

Why can two valid answers differ?

Different diagonal sets can attain the same minimum piece count. The returned partition is one optimal witness.

Does area agreement alone prove a partition?

No. The recursive admissible-diagonal construction and per-piece convexity checks are also essential.

Find your calculator

Start typing to explore the library.