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 = {
// ...
};
void triangulate() {
Clipper2Lib::PathsD out;
Clipper2Lib::PathsD source = { data };
auto cleaned = Clipper2Lib::Union(source, Clipper2Lib::FillRule::EvenOdd);
Clipper2Lib::Triangulate(cleaned, /*decPlaces=*/ 2, out, /*useDelaunay=*/ false); // exception
}
And the test data: test-data.txt

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.
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:
And the test data: test-data.txt

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.