Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Stack overflow by endless recursion #41

Open
andriy-andreyev opened this issue Apr 7, 2022 · 0 comments
Open

Stack overflow by endless recursion #41

andriy-andreyev opened this issue Apr 7, 2022 · 0 comments

Comments

@andriy-andreyev
Copy link

andriy-andreyev commented Apr 7, 2022

Library stack overflow occurs in case of triangulation of some geometry.

Endless recursion backtrace:

poly2tritest.exe!p2t::Sweep::FlipScanEdgeEvent(p2t::SweepContext & tcx, p2t::Point & ep, p2t::Point & eq, p2t::Triangle & flip_triangle, p2t::Triangle & t, p2t::Point & p)
poly2tritest.exe!p2t::Sweep::FlipEdgeEvent(p2t::SweepContext & tcx, p2t::Point & ep, p2t::Point & eq, p2t::Triangle * t, p2t::Point & p)
poly2tritest.exe!p2t::Sweep::FlipScanEdgeEvent(p2t::SweepContext & tcx, p2t::Point & ep, p2t::Point & eq, p2t::Triangle & flip_triangle, p2t::Triangle & t, p2t::Point & p)
poly2tritest.exe!p2t::Sweep::FlipEdgeEvent(p2t::SweepContext & tcx, p2t::Point & ep, p2t::Point & eq, p2t::Triangle * t, p2t::Point & p)
poly2tritest.exe!p2t::Sweep::FlipScanEdgeEvent(p2t::SweepContext & tcx, p2t::Point & ep, p2t::Point & eq, p2t::Triangle & flip_triangle, p2t::Triangle & t, p2t::Point & p)
poly2tritest.exe!p2t::Sweep::FlipEdgeEvent(p2t::SweepContext & tcx, p2t::Point & ep, p2t::Point & eq, p2t::Triangle * t, p2t::Point & p)
poly2tritest.exe!p2t::Sweep::FlipScanEdgeEvent(p2t::SweepContext & tcx, p2t::Point & ep, p2t::Point & eq, p2t::Triangle & flip_triangle, p2t::Triangle & t, p2t::Point & p)

Test case:

std::vector<p2t::Point*> outlinePtr = {
new p2t::Point(450 , 2250),
new p2t::Point(450 , 1750),
new p2t::Point(400 , 1700),
new p2t::Point(350 , 1650),
new p2t::Point(350 , 500),
new p2t::Point(1050, 1700) };

std::vector<std::vector<p2t::Point*>> holesPtr = {{
new p2t::Point(980, 1636),
new p2t::Point(950, 1600),
new p2t::Point(650, 1230),
new p2t::Point(625, 1247),
new p2t::Point(600, 1250),
new p2t::Point(591, 1350),
new p2t::Point(550, 2050) }};

p2t::CDT cdt(outlinePtr);
for (const auto& holePtr : holesPtr)
    cdt.AddHole(holePtr);
cdt.Triangulate();

Geometry looks like:

image

pierre-dejoue added a commit to pierre-dejoue/poly2tri that referenced this issue Apr 20, 2022
pierre-dejoue added a commit to pierre-dejoue/poly2tri that referenced this issue Apr 20, 2022
pierre-dejoue added a commit to pierre-dejoue/poly2tri that referenced this issue Apr 24, 2022
pierre-dejoue added a commit to pierre-dejoue/poly2tri that referenced this issue May 1, 2022
pierre-dejoue added a commit to pierre-dejoue/poly2tri that referenced this issue May 1, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant