From 5a8b764ab2342659761ff5202635830e7baea964 Mon Sep 17 00:00:00 2001 From: kintel Date: Tue, 2 Feb 2010 17:39:23 +0000 Subject: Let the known case of polygon intersection spew out an error message instead of crashing git-svn-id: http://svn.clifford.at/openscad/trunk@412 b57f626f-c46c-0410-a088-ec61d464b74c diff --git a/src/dxftess-cgal.cc b/src/dxftess-cgal.cc index 68b85db..2e80fea 100644 --- a/src/dxftess-cgal.cc +++ b/src/dxftess-cgal.cc @@ -10,6 +10,8 @@ #include #include #include +#include +#include typedef CGAL::Exact_predicates_inexact_constructions_kernel K; typedef CGAL::Triangulation_vertex_base_2 Vb; @@ -100,6 +102,9 @@ void dxf_tesselate(PolySet *ps, DxfData *dxf, double rot, bool up, bool /* do_tr QHash edge_to_triangle; QHash edge_to_path; + CGAL::Failure_behaviour old_behaviour = CGAL::set_error_behaviour(CGAL::THROW_EXCEPTION); + try { + // read path data and copy all relevant infos for (int i = 0; i < dxf->paths.count(); i++) { @@ -151,6 +156,14 @@ void dxf_tesselate(PolySet *ps, DxfData *dxf, double rot, bool up, bool /* do_tr } } + } + catch (CGAL::Assertion_exception e) { + PRINTF("ERROR: Polygon intersection detected. Skipping affected polygons."); + CGAL::set_error_behaviour(old_behaviour); + return; + } + CGAL::set_error_behaviour(old_behaviour); + // run delaunay triangulation std::list list_of_seeds; CGAL::refine_Delaunay_mesh_2_without_edge_refinement(cdt, -- cgit v0.10.1