You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Exception when triangulating messy polygon with useDelauney=false #1089
Sorry I couldn't get cleaner test data for this, I really just couldn't recreate it with any other data (though the cause seems obvious, I can't read the code to figure out why).
With the simple source:
#include<clipper2/clipper.h>
Clipper2Lib::PathD data = {
// ...
};
voidtriangulate() {
Clipper2Lib::PathsD out;
Clipper2Lib::PathsD source = { data };
auto cleaned = Clipper2Lib::Union(source, Clipper2Lib::FillRule::EvenOdd);
Clipper2Lib::Triangulate(cleaned, /*decPlaces=*/2, out, /*useDelaunay=*/false); // exception
}
Clipper2 throws undefined_error ("There is an undefined error in Clipper2")
The issue seems to be with the geometry (imported into Blender for a visualisation):
(or if this is unclear):
Point 390 and 409 are on top of each other, on top of another line passing through underneath.
Point 409 being added and then retriangulating the mesh causes undefined_error (and removing the point fixes the issue)
I also have found sometimes an infinite loop occurs with similar circumstances, but I can't seem to be able to recreate it - if I do I'll update with the data I used.
The exception is raised from RemoveEdgeFromVertex, line 199 where an edge is removed from a vertex which doesn't have it, with the following parameters:
(vert has 0 edges attached to it, edge has two valid vertices, both with zero edges)
...which is called from Delaunay::RemoveIntersection, line 550 (should Delaunay be used when useDelaunay=false? Not sure how the codebase is laid out)
with e1 at the time of RemoveEdgeFromVertex being an edge with two vertices (both having two valid edges), and e2 being an edge with two vertices (both without any edges)
...which is called from Delaunay::FixupEdgeIntersects, line 585
The full call stack is below:
Do the edges with vertices with zero edges have anything to do with the issue? Not sure if this is really an issue, but if it isn't then I'm not sure why it's throwing undefined_error and not some more descriptive error.
Activity
AurelBec commentedon May 11, 2026
It may be related to your issue (from the last screen, the line mentioning DoError), I've found that in this code
ecmight be used unitialized inScalePathsthis behavior might interfere with your code, as you are trying to read the error code 🤔
edit: since the latest release tag,
ecis now correctly initialized when declared, which version of clipper2 were you using?undefined06855 commentedon May 11, 2026
commit hash

642390d, which is the latest commit apparently:https://github.com/undefined06855/Lasso-Select/blob/main/CMakeLists.txt#L29