I got points on a map and lines connecting those points.
How do I get all independent inner polygons that are formed?
The linked picture describes the problem.
I'm supposing I need a tree search algorithm that enumerates all the points and connecting lines in a tree structure and then searches for cycles but this job is kinda over my head.
In a perfect world the example would be in C#.)
I actually have no experience in graphics and how to actually colour a polygon once you've found it, but assuming:
Then the colouring pseudo code could go something like this:
while listOfPolygons is not empty temp <- find smallest polygon in listOfPolygons colour temp remove from listOfPolygons all polygons containing temp remove temp from listOfPolygons
Notice that the part about finding the containing polygons might be tricky.
Checking if polygon A is in polygon B can be done by checking if any corner (vertex?) of A is located inside B.