diff --git a/vespa/Delaunay/vtkCGALDelaunay2.cxx b/vespa/Delaunay/vtkCGALDelaunay2.cxx index b2b0e661c78b6a5271fecf178c8c99d53f5a871a..eb07aa05bcecf3cb50abec104d36df23716851cb 100644 --- a/vespa/Delaunay/vtkCGALDelaunay2.cxx +++ b/vespa/Delaunay/vtkCGALDelaunay2.cxx @@ -98,7 +98,17 @@ int vtkCGALDelaunay2::RequestData( { poly.emplace_back(pts[p->GetId(i)]); } - delaunay.insert_constraint(poly.begin(), poly.end(), true); + try + { + delaunay.insert_constraint(poly.begin(), poly.end(), true); + } + catch(const std::exception& e) + { + // If we have an invalid constraint (for example overlaping edges) + // we just ignore the constraint and continue + vtkWarningMacro("Ill-formed constraint detected : constraint ignored."); + continue; + } } vtkCellArray* lines = input->GetLines(); @@ -113,7 +123,17 @@ int vtkCGALDelaunay2::RequestData( { line.emplace_back(pts[l->GetId(i)]); } - delaunay.insert_constraint(line.begin(), line.end()); + try + { + delaunay.insert_constraint(line.begin(), line.end()); + } + catch(const std::exception& e) + { + // If we have an invalid constraint (for example overlaping edges) + // we just ignore the constraint and continue + vtkWarningMacro("Ill-formed constraint detected : constraint ignored."); + continue; + } } // Add points