diff options
author | Marius Kintel <marius@kintel.net> | 2012-08-28 03:35:39 (GMT) |
---|---|---|
committer | Marius Kintel <marius@kintel.net> | 2012-08-28 03:35:39 (GMT) |
commit | aab3c36f90977c6a20253b1742b741eb22b8fd1c (patch) | |
tree | 7faae96faaf567dba60266e085edc7010d2152f1 /src | |
parent | 0e9d66f5326860122c997ca084a1f3df7c5ca2f0 (diff) | |
parent | 2ac32862901dc28fe4d360b7c444e679cad430d7 (diff) |
Merge pull request #189 from openscad/issue188
Issue188
Diffstat (limited to 'src')
-rw-r--r-- | src/CGALEvaluator.cc | 14 |
1 files changed, 10 insertions, 4 deletions
diff --git a/src/CGALEvaluator.cc b/src/CGALEvaluator.cc index ac6190f..064a36a 100644 --- a/src/CGALEvaluator.cc +++ b/src/CGALEvaluator.cc @@ -150,9 +150,14 @@ 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("Hull() currently requires 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(); } @@ -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; |