I wrote an algorithm which divides the polygon to monotone parts, but I dont know, how to divide the polygon to smaller polygons by the diagonals, so I have separate polygon structures which can be processed independently. The code I have tried is obviously wrong:
QPolygonF polyg(polygon); // copy orginal polygon
polyg << diagonalP1 << diagonalP2; // ad the diagonal points
QPolygonF clipped = polygon.intersected(polyg); // get the intersection?
clippedPolygons.append(clipped); // add to the list
This is obviously not working, but I was not able to find any better aproach. Image ilustrating the issue:
In the picture you can see the original polygon with dashed lines representing found diagonals which have to be added. Now I need to get the 4 parts separatly so I can triangulate every each of them independently.