# Polygon triangulation

In computational geometry, **polygon triangulation** is the decomposition of a polygonal area (simple polygon) **P** into a set of triangles,^{[1]} i.e., finding the set of triangles with pairwise non-intersecting interiors whose union is **P**.

Triangulations may be viewed as special cases of planar straight-line graphs. When there are no holes or added points, triangulations form maximal outerplanar graphs.

## Polygon triangulation without extra vertices

Over time a number of algorithms have been proposed to triangulate a polygon.

### Special cases

A convex polygon is trivial to triangulate in linear time, by adding diagonals from one vertex to all other vertices. The total number of ways to triangulate a convex *n*-gon by non-intersecting diagonals is the (*n* − 2)-th Catalan number, which equals , a solution found by Leonhard Euler.^{[2]}

A monotone polygon can be triangulated in linear time with either the algorithm of A. Fournier and D.Y. Montuno,^{[3]} or the algorithm of Godfried Toussaint.^{[4]}

### Ear clipping method

One way to triangulate a simple polygon is based on the fact that any simple polygon with at least 4 vertices without holes has at least two 'ears', which are triangles with two sides being the edges of the polygon and the third one completely inside it (and with an extra property unimportant for triangulation).^{[5]} The algorithm then consists of finding such an ear, removing it from the polygon (which results in a new polygon that still meets the conditions) and repeating until there is only one triangle left.

This algorithm is easy to implement, but slower than some other algorithms, and it only works on polygons without holes. An implementation that keeps separate lists of convex and concave vertices will run in *O*(*n*^{2}) time. This method is known as *ear clipping* and sometimes *ear trimming*. An efficient algorithm for cutting off ears was discovered by Hossam ElGindy, Hazel Everett, and Godfried Toussaint.^{[6]}

### Using monotone polygons

A simple polygon may be decomposed into monotone polygons as follows.^{[1]}

For each point, check if the neighboring points are both on the same side of the 'sweep line', a horizontal or vertical line on which the point being iterated lies. If they are, check the next sweep line on the other side. Break the polygon on the line between the original point and one of the points on this one.

Note that if you are moving downwards, the points where both of the vertices are below the sweep line are 'split points'. They mark a split in the polygon. From there you have to consider both sides separately.

Using this algorithm to triangulate a simple polygon takes *O*(*n* log *n*) time.

### Dual graph of a triangulation

A useful graph that is often associated with a triangulation of a polygon `P` is the dual graph. Given a triangulation `T _{P}` of

`P`, one defines the graph

`G`(

`T`) as the graph whose vertex set are the triangles of

_{P}`T`, two vertices (triangles) being adjacent if and only if they share a diagonal. It is easy to observe that

_{P}`G`(

`T`) is a tree with maximum degree 3.

_{P}### Computational complexity

For a long time, there was an open problem in computational geometry whether a simple polygon can be triangulated faster than O(`n` log `n`) time.^{[1]} Then, Template:Harvtxt discovered an O(`n` log log `n`)-time algorithm for triangulation,^{[7]} later simplified by Template:Harvtxt.^{[8]} Several improved methods with complexity O(`n` log^{*} `n`) (in practice, indistinguishable from linear time) followed.^{[9]}^{[10]}^{[11]}

Bernard Chazelle showed in 1991 that any simple polygon can be triangulated in linear time, though the proposed algorithm is very complex.^{[12]} A simpler randomized algorithm with linear expected time is also known.^{[13]}

Seidel's decomposition algorithm and Chazelle's triangulation method are discussed in detail in Template:Harvtxt.
^{[14]}

The time complexity of triangulation of an `n`-vertex polygon *with* holes has an Ω(`n` log `n`) lower bound.^{[1]}

## See also

- Nonzero-rule
- Tessellation
- Catalan number
- Point set triangulation
- Delaunay triangulation
- Tiling by regular polygons
- Minimum-weight triangulation, for a point set and for a simple polygon
- Planar graph
- Polygon covering#Covering a polygon with triangles

## References

- ↑
^{1.0}^{1.1}^{1.2}^{1.3}{{#invoke:citation/CS1|citation |CitationClass=citation }} Chapter 3: Polygon Triangulation: pp.45–61. - ↑ Pickover, Clifford A.,
*The Math Book*, Sterling, 2009: p. 184. - ↑ {{#invoke:citation/CS1|citation |CitationClass=citation }}
- ↑ Toussaint, Godfried T. (1984), "A new linear algorithm for triangulating monotone polygons,"
*Pattern Recognition Letters*,**2**(March):155–158. - ↑ Meisters, G. H., "Polygons have ears." American Mathematical Monthly 82 (1975). 648–651
- ↑ ElGindy, H., Everett, H., and Toussaint, G. T., (1993) "Slicing an ear using prune-and-search,"
*Pattern Recognition Letters*,**14**, (9):719–722. - ↑ {{#invoke:citation/CS1|citation |CitationClass=citation }}.
- ↑ {{#invoke:citation/CS1|citation |CitationClass=citation }}.
- ↑ {{#invoke:citation/CS1|citation |CitationClass=citation }}.
- ↑ {{#invoke:citation/CS1|citation |CitationClass=citation }}
- ↑ {{#invoke:citation/CS1|citation |CitationClass=citation }}.
- ↑ {{#invoke:citation/CS1|citation |CitationClass=citation }}
- ↑ {{#invoke:citation/CS1|citation |CitationClass=citation }}
- ↑ {{#invoke:citation/CS1|citation |CitationClass=citation }}.

## External links

- Demo as Flash swf, A Sweep Line algorithm.
- Song Ho's explanation of the OpenGL GLU tesselator