I have a list of line segments in no particular order.
I want to find all enclosed spaces (polygons) formed by the segments. Is there an efficient algorithm or method that I could use to do this?
The following image illustrates the problem. How can I detect the green polygons, given the black line segments?