We have a polygon, given as a list of vertex in counter-clockwise direction starting from the bottom most(points
). Some diagonals of the same polygon are given(none of them intersect), as a set of pair of points(diagonals
).
We have to find all the faces the polygon is cut into(as a list of vertex for each face).
The output would include the following faces:
face1 = [(-68,-36), (-53,-40), (-39,44)]
face2 = [(-53,-40), (-21,37), (-12, 6), (-5,49)]
...
As you might have noticed, the diagonals cut the polygon into monotone polygons with respect to x-axis. If this might help in anyway.
I have been at this problem for several hours now. I can't seem to find any problem even related to it. Any help would be appreciated, thanks.
Edit: The problem can be reduced to finding all simple cycles in a graph(i.e. chordless cycles). I found these similar questions:
Finding polygons within an undirected Graph
Find all chordless cycles in an undirected graph
However, the accepted solution in the second one does not seem to work.