c# - I got points on a map.Getting all independent inner polygons that are formed? -
i got points on map , lines connecting points.
how independent inner polygons formed?
the linked picture describes problem.
http://i.imgur.com/0lda3ji.jpg
i'm supposing need tree search algorithm enumerates points , connecting lines in tree structure , searches cycles job kinda on head.
in perfect world example in c#.)
i found:
finding cycles in undirected graphs
but not mark independent polygons. finds possible polygons overlapping ones.
i'm using google maps. use case is: detect clicks on map , draw points. detect click on points , lines between points. need automaticaly generate polygons lines , points. sure can draw polygons. dont know ones (what coordinates - or rather: points choose polygon)
i have no experience in graphics , how colour polygon once you've found it, assuming:
- you have polygons themselves.
- they not patialy overlap or other weird behaviour.
then colouring pseudo code go this:
while listofpolygons not empty temp <- find smallest polygon in listofpolygons colour temp remove listofpolygons polygons containing temp remove temp listofpolygons
notice part finding containing polygons might tricky.
edit:
checking if polygon in polygon b can done checking if corner (vertex?) of located inside b.
Comments
Post a Comment