diff options
author | don bright <hugh.m.bright@gmail.com> | 2012-08-22 10:07:46 (GMT) |
---|---|---|
committer | don bright <hugh.m.bright@gmail.com> | 2012-08-22 10:07:46 (GMT) |
commit | 15959bc32cc5ba649babac5636bb544e5e46868b (patch) | |
tree | b5bb3b983d00af0408e95ae1149c7d8134950794 /src/CGALEvaluator.cc | |
parent | 68da5cf2e896b6e482ef4919d23844c21e35124c (diff) |
stop crash bug reported by Giles Bathgate
Diffstat (limited to 'src/CGALEvaluator.cc')
-rw-r--r-- | src/CGALEvaluator.cc | 16 |
1 files changed, 11 insertions, 5 deletions
diff --git a/src/CGALEvaluator.cc b/src/CGALEvaluator.cc index ac6190f..86be59b 100644 --- a/src/CGALEvaluator.cc +++ b/src/CGALEvaluator.cc @@ -150,13 +150,18 @@ CGAL_Nef_polyhedron CGALEvaluator::applyHull(const CgaladvNode &node) } else if (dim == 3) { CGAL_Polyhedron P; - chN.p3->convert_to_Polyhedron(P); - std::transform(P.vertices_begin(), P.vertices_end(), std::back_inserter(points3d), - boost::bind(static_cast<const CGAL_Polyhedron::Vertex::Point_3&(CGAL_Polyhedron::Vertex::*)() const>(&CGAL_Polyhedron::Vertex::point), _1)); + if (!chN.p3->is_simple()) { + PRINT("Object isn't a valid 2-manifold! Please modify your design. See http://en.wikibooks.org/wiki/OpenSCAD_User_Manual/STL_Import_and_Export"); + } + else { + chN.p3->convert_to_Polyhedron(P); + std::transform(P.vertices_begin(), P.vertices_end(), std::back_inserter(points3d), + boost::bind(static_cast<const CGAL_Polyhedron::Vertex::Point_3&(CGAL_Polyhedron::Vertex::*)() const>(&CGAL_Polyhedron::Vertex::point), _1)); + } } chnode->progress_report(); } - + if (dim == 2) { std::list<CGAL_Nef_polyhedron2::Point> result; CGAL::convex_hull_2(points2d.begin(), points2d.end(),std:: back_inserter(result)); @@ -165,7 +170,8 @@ CGAL_Nef_polyhedron CGALEvaluator::applyHull(const CgaladvNode &node) } else if (dim == 3) { CGAL_Polyhedron P; - CGAL::convex_hull_3(points3d.begin(), points3d.end(), P); + if (points3d.size()>3) + CGAL::convex_hull_3(points3d.begin(), points3d.end(), P); N = CGAL_Nef_polyhedron(new CGAL_Nef_polyhedron3(P)); } return N; |