Triangulating Monotone Polygons

This visualization shows the algorithm for triangulating Y-monotone polygons.

A polygon:

The triangulation of the polygon:

The visualization at the beginning:

An intermediate position with some vertices on the stack:

Identifying diagonals:

After adding the diagonals:

The visualization at the end: