Skip to content

Some inputs causing infinite recursion #3

@rproepp

Description

@rproepp

Hi, the following input causes an infinite recursion, resulting in a stack overflow:

#include "ConcavePolygon.h"

int main()
{
    std::vector<cxd::Vertex > vertices =
    {
        cxd::Vec2({0.500000000000, 0.500000000000}),
        cxd::Vec2({0.500000000000, -0.498161792755}),
        cxd::Vec2({-0.497167110443, -0.498161792755}),
        cxd::Vec2({-0.497167110443, 0.277573525906}),
        cxd::Vec2({-0.415014147758, 0.273897051811}),
        cxd::Vec2({-0.349858343601, 0.297794103622}),
        cxd::Vec2({-0.168555259705, 0.435661762953}),
        cxd::Vec2({-0.151558041573, 0.465073525906}),
        cxd::Vec2({-0.151558041573, 0.500000000000}),
        cxd::Vec2({-0.072237968445, 0.500000000000}),
        cxd::Vec2({-0.043909311295, 0.430147051811}),
        cxd::Vec2({-0.024079322815, 0.408088237047}),
        cxd::Vec2({0.038243621588, 0.376838237047}),
        cxd::Vec2({0.109065175056, 0.367647051811}),
        cxd::Vec2({0.160056650639, 0.369485288858}),
        cxd::Vec2({0.245042502880, 0.393382370472}),
        cxd::Vec2({0.301699697971, 0.441176474094}),
        cxd::Vec2({0.332861185074, 0.500000000000})
    };

    cxd::ConcavePolygon concavePoly(vertices);
    concavePoly.convexDecomp(0);

    std::vector<cxd::ConcavePolygon> subPolygonList;
    concavePoly.returnLowestLevelPolys(subPolygonList);

    std::cout << "Num Polys: " << subPolygonList.size() << std::endl;

    return 0;
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions