I'm creating union of polygons without holes. Input polygons are without holes and also output one should be. I already have working algorithm for finding it for two polygons. But in case of more than two there is a problem. As a union shouldn't be disjoint polygon, when I try to compute sum of them one by one I have a problem in such case:
Then polygon 1 meets polygon 2 the union is disjoint (so my algorithm does not compute sum). In second loop of course it makes union with 3rd and 4th polygon, but output is wihout 2nd polygon. So does any one know kind of fast and accurate algorithm of doing it? Probably a good idea would be to sort polygons by intersections first, but I can't think of any fast algorithms for that and also not quite I'm not sure how they should be sorted.