I am looking for the simplest possible $O(n \log n)$ algorithm for triangulating a simple polygon. It seems like there should be a simple divide and conquer variant that would fit the bill, ideally one avoiding auxiliary data structures such as trapezoidal decompositions. Indeed, all that would be required is an $O(n)$ algorithm for finding a roughly balanced diagonal. However, I am unable to find any algorithms that are as simple as I (perhaps naively) imagine should exist; nearly all the research is focused on $o(n \log n)$ algorithms, nearly all of which operate via trapezoidal decomposition.
2 Answers
Garey, Johnson, Preparata and Tarjan came up with a simple $O(n\log n)$ algorithm back in 1978. It is described in many lecture notes, for example these lecture notes of Piotr Indyk.
- 280,205
- 27
- 317
- 514
I was looking for such a diagonal as well. As I could not find a simple way to obtain it we applied a linear time cutting of the polygon (Sutherland–Hodgman approach). Given a simple polygon $P$ we take a vertical line $\ell$ and cut through $P$. This can be done if $O(n)$ time by simply iterating over the boundary list of $P$ and verify if $\ell$ is crossed. This produces a set of sub-polygons. Clearly the number of vertices of the polygons to the left of $\ell$ is equal to the number of vertices on the right side of $\ell$, up to a constant at least. Then we triangulated each sub-polygon. Since there are vertices in the sub-polygons due to the cutting we had to also add a repair step to get rid of these additional vertices. For more details look directly at our work.
- 211
- 2
- 6