diff options
author | don bright <hugh.m.bright@gmail.com> | 2012-10-28 18:01:10 (GMT) |
---|---|---|
committer | don bright <hugh.m.bright@gmail.com> | 2012-10-28 18:01:10 (GMT) |
commit | ec41b7e4321986140bffdb87ca7efefb1d57f881 (patch) | |
tree | bd9e580562d814d06ac9a1718efdbf296bbc52e0 /src/PolySetCGALEvaluator.cc | |
parent | 0473a0eff3ccaaf8632c41b4ee9ced2fd716ed3a (diff) |
move failure-detection so there is only one reset of error behavior.
Diffstat (limited to 'src/PolySetCGALEvaluator.cc')
-rw-r--r-- | src/PolySetCGALEvaluator.cc | 25 |
1 files changed, 11 insertions, 14 deletions
diff --git a/src/PolySetCGALEvaluator.cc b/src/PolySetCGALEvaluator.cc index 225ff05..6ff1e35 100644 --- a/src/PolySetCGALEvaluator.cc +++ b/src/PolySetCGALEvaluator.cc @@ -104,10 +104,10 @@ public: *(output_nefpoly2d) *= *(tmpnef2d); } - log << "\n<!-- ======== output tmp nef: ==== -->\n" - << OpenSCAD::dump_svg( *tmpnef2d ) << "\n" - << "\n<!-- ======== output accumulator: ==== -->\n" - << OpenSCAD::dump_svg( *output_nefpoly2d ) << "\n"; + log << "\n<!-- ======== output tmp nef: ==== -->\n" + << OpenSCAD::dump_svg( *tmpnef2d ) << "\n" + << "\n<!-- ======== output accumulator: ==== -->\n" + << OpenSCAD::dump_svg( *output_nefpoly2d ) << "\n"; contour_counter++; } else { @@ -176,17 +176,10 @@ PolySet *PolySetCGALEvaluator::evaluatePolySet(const ProjectionNode &node) } catch (const CGAL::Failure_exception &e) { PRINTB("CGAL error in projection node during bigbox intersection: %s", e.what()); - sum.reset(); + sum.p3.reset( new CGAL_Nef_polyhedron3() ); } } - CGAL::set_error_behaviour(old_behaviour); - - if (sum.empty()) { - PRINT("WARNING: Projection failed."); - return NULL; - } - // remove z coordinates to make CGAL_Nef_polyhedron2 log << OpenSCAD::svg_header( 480, 100000 ) << "\n"; try { @@ -204,16 +197,20 @@ PolySet *PolySetCGALEvaluator::evaluatePolySet(const ProjectionNode &node) } log << "<!-- volume end. -->\n"; } - log << "</svg>\n"; - nef_poly.p2 = zremover.output_nefpoly2d; nef_poly.dim = 2; } catch (const CGAL::Failure_exception &e) { PRINTB("CGAL error in projection node while flattening: %s", e.what()); } + log << "</svg>\n"; CGAL::set_error_behaviour(old_behaviour); + if ( sum.p3->is_empty() ) { + PRINT("WARNING: projection() failed."); + return NULL; + } + // Extract polygons in the XY plane, ignoring all other polygons // FIXME: If the polyhedron is really thin, there might be unwanted polygons // in the XY plane, causing the resulting 2D polygon to be self-intersection |