diff options
author | Marius Kintel <marius@kintel.net> | 2011-11-05 17:25:05 (GMT) |
---|---|---|
committer | Marius Kintel <marius@kintel.net> | 2011-11-05 17:25:05 (GMT) |
commit | f4bd15912a7179ccd4e39adc310900d020f15d8a (patch) | |
tree | 7aa0c007b4321c87f9822028973df141df4207e5 /src/CGALEvaluator.cc | |
parent | 4120846d18c1a7ce5a51169feb1babb0603bddc0 (diff) |
Last CGAL assert fix wasn't enough; expanded the fix to all operators
Diffstat (limited to 'src/CGALEvaluator.cc')
-rw-r--r-- | src/CGALEvaluator.cc | 35 |
1 files changed, 22 insertions, 13 deletions
diff --git a/src/CGALEvaluator.cc b/src/CGALEvaluator.cc index 550f300..797434f 100644 --- a/src/CGALEvaluator.cc +++ b/src/CGALEvaluator.cc @@ -56,20 +56,29 @@ void CGALEvaluator::process(CGAL_Nef_polyhedron &target, const CGAL_Nef_polyhedr if (src.empty()) return; // Empty polyhedron. This can happen for e.g. square([0,0]) if (target.dim != src.dim) return; // If someone tries to e.g. union 2d and 3d objects - switch (op) { - case CGE_UNION: - target += src; - break; - case CGE_INTERSECTION: - target *= src; - break; - case CGE_DIFFERENCE: - target -= src; - break; - case CGE_MINKOWSKI: - target.minkowski(src); - break; + CGAL::Failure_behaviour old_behaviour = CGAL::set_error_behaviour(CGAL::THROW_EXCEPTION); + try { + switch (op) { + case CGE_UNION: + target += src; + break; + case CGE_INTERSECTION: + target *= src; + break; + case CGE_DIFFERENCE: + target -= src; + break; + case CGE_MINKOWSKI: + target.minkowski(src); + break; + } + } + catch (CGAL::Assertion_exception e) { + // union && difference assert triggered by testdata/scad/bugs/rotate-diff-nonmanifold-crash.scad + std::string opstr = op == CGE_UNION ? "union" : op == CGE_INTERSECTION ? "intersection" : op == CGE_DIFFERENCE ? "difference" : op == CGE_MINKOWSKI ? "minkowski" : "UNKNOWN"; + PRINTF("CGAL error in CGAL_Nef_polyhedron's %s operator: %s", opstr.c_str(), e.what()); } + CGAL::set_error_behaviour(old_behaviour); } /*! |