Menu

#208 SimplifyPolygons fails to merge horizontal edges

*
open
None
1
2021-08-03
2021-08-03
No

Hi,

SimplifyPolygons has a problem when processing horizontal joins. The polygon merging done for the first join modifies the polygon points in a way that the second join can not be processed afterwards (the GetOverlap no longer detects an overlap and ignores it). That's why the following examples return more than one result polygon:

int main()
{
    Paths paths({
        { {110,50}, {110,100}, {90,100} },
        { {10,100}, {100,100}, {100,190} },
        { {40,50}, {40,100}, {20,100} },
    });

    Paths simplifiedPaths;
    SimplifyPolygons(paths, simplifiedPaths, ClipperLib::pftPositive);

    cout << "simplified:" << endl;
    cout << simplifiedPaths << endl;
}

Second example:

    Paths paths({
        { {90,100}, {80,100}, {85,60} },
        { {10,100}, {90,100}, {50,190} },
        { {110,100}, {85,100}, {97,60} },
        { {105,100}, {115,100}, {110,140} }
    });

I've attached two images for visualization.

2 Attachments

Discussion

Anonymous
Anonymous

Add attachments
Cancel





MongoDB Logo MongoDB