I'm currently writing an y-monotone sweep line algorithm to triangulate non-convex polygons. The first step to achieve this is to make the polygon y-monotone.
Pseudocode of MakeMonotone
from the book "Computation Geometry by Mark de Berg" (https://archive.org/details/computationalgeo00berg):
Now to my question:
In that book and all other websites I found, there is no explanation how to exactly sort the edges in the mentioned "binary search tree T". The only thing mentioned in the referenced book is "The left-to-right order of the leaves of T corresponds to the left-to-right order of the edges". But by what properties/attributes the edges are ordered in that tree? It's also unclear to me, how exactly an edge should be represented in the binary tree (start point? end point? combination of both?).
My most naive approach would be to find out for all edges in T the intersection with the sweep and line and the calculate which of them is closest to the current verex. But given that in every book/university slides, the inner working of T is not explained further, it must be way easier.
The binary search tree should support the following operations:
- insert a new edge
- find edge to the left of the vertex currently on the sweep line
- remove an edge