**triangulate_test**,
an Octave code which
calls triangulate(), which
triangulates a polygon.

The computer code and data files described and made available on this web page are distributed under the MIT license

triangulate, an Octave code which triangulates a (possibly nonconvex) polygon, based on a C program by Joseph ORourke.

- triangulate_test.m, calls all the tests.
- triangulate_test.sh, runs all the tests.
- triangulate_test.txt, the output file.

**COMB** is an example of a "comb" polygon of 10 vertices

- comb_nodes.txt, the vertex coordinates.
- comb.png, a PNG image of the polygon.
- comb_triangulated.png, a PNG image of the triangulated polygon.
- comb.txt, the output file.
- comb_diagonals.txt, the internal diagonal edges.
- comb_elements.txt, the triangles that make up the polygon.

**HAND** outlines a hand using 59 vertices.

- hand_nodes.txt, the vertex coordinates.
- hand.png, a PNG image of the polygon.
- hand_triangulated.png, a PNG image of the triangulated polygon.
- hand.txt, the output file.
- hand_diagonals.txt, the internal diagonal edges.
- hand_elements.txt, the triangles that make up the polygon.

**I18** is an example of a complicated nonconvex polygon, using 18 vertices.

- i18_nodes.txt, the vertex coordinates.
- i18.png, a PNG image of the polygon.
- i18_triangulated.png, a PNG image of the triangulated polygon.
- i18.txt, the output file.
- i18_diagonals.txt, the diagonal edges.
- i18_elements.txt, the triangles that make up the polygon.

**SNAKE** is an example defining a "snake" polygon using 12 vertices.

- snake_nodes.txt, the vertex coordinates.
- snake.png, a PNG image of the polygon.
- snake_triangulated.png, a PNG image of the triangulated polygon.
- snake.txt, the output file.
- snake_diagonals.txt, the diagonal edges.
- snake_elements.txt, the triangles that make up the polygon.

**SQUARE** is an example defining a square, using 4 vertices.

- square_nodes.txt, the vertex coordinates.
- square.png, a PNG image of the polygon.
- square_triangulated.png, a PNG image of the triangulated polygon.
- square.txt, the output file.
- square_diagonals.txt, the diagonal edges.
- square_elements.txt, the triangles that make up the polygon.

**TE53** is an example in which the vertices have been (incorrectly)
listed in clockwise order. The program detects this problem and reverses
the ordering before proceeding. The example uses 26 vertices.

- te53_nodes.txt, the vertex coordinates.
- te53.png, a PNG image of the polygon.
- te53_triangulated.png, a PNG image of the triangulated polygon.
- te53.txt, the output file.
- te53_diagonals.txt, the diagonal edges.
- te53_elements.txt, the triangles that make up the polygon.

**TRIANGLE** is an example defining a triangle, using 3 vertices.

- triangle_nodes.txt, the vertex coordinates.
- triangle.png, a PNG image of the polygon.
- triangle_triangulated.png, a PNG image of the triangulated polygon.
- triangle.txt, the output file.
- triangle_diagonals.txt, the diagonal edges.
- triangle_elements.txt, the triangles that make up the polygon.