From 2e6946fd5ae35e751a92e8fba23ac2c4c83518dd Mon Sep 17 00:00:00 2001 From: clifford Date: Mon, 1 Feb 2010 06:10:07 +0000 Subject: Clifford Wolf: Projection: detect cases where people do like to project something that isn't a 2-manifold git-svn-id: http://svn.clifford.at/openscad/trunk@402 b57f626f-c46c-0410-a088-ec61d464b74c diff --git a/src/projection.cc b/src/projection.cc index 159a805..2d08cff 100644 --- a/src/projection.cc +++ b/src/projection.cc @@ -190,9 +190,14 @@ PolySet *ProjectionNode::render_polyset(render_mode_e rm) const CGAL_Nef_polyhedron Ncube = cube->render_cgal_nef_polyhedron(); cube->unlink(); - PolySet *ps3 = new PolySet(); // N.p3 *= CGAL_Nef_polyhedron3(CGAL_Plane(0, 0, 1, 0), CGAL_Nef_polyhedron3::INCLUDED); N.p3 *= Ncube.p3; + if (!N.p3.is_simple()) { + PRINTF("WARNING: Body of projection(cut = true) isn't valid 2-manifold! Modify your design.."); + goto cant_project_non_simple_polyhedron; + } + + PolySet *ps3 = new PolySet(); cgal_nef3_to_polyset(ps3, &N); Grid2d conversion_grid(GRID_COARSE); for (int i = 0; i < ps3->polygons.size(); i++) { @@ -219,6 +224,11 @@ PolySet *ProjectionNode::render_polyset(render_mode_e rm) const } else { + if (!N.p3.is_simple()) { + PRINTF("WARNING: Body of projection(cut = false) isn't valid 2-manifold! Modify your design.."); + goto cant_project_non_simple_polyhedron; + } + PolySet *ps3 = new PolySet(); cgal_nef3_to_polyset(ps3, &N); CGAL_Nef_polyhedron np; @@ -269,6 +279,7 @@ PolySet *ProjectionNode::render_polyset(render_mode_e rm) const ps3->unlink(); } +cant_project_non_simple_polyhedron: PolySet::ps_cache.insert(key, new PolySet::ps_cache_entry(ps->link())); print_messages_pop(); -- cgit v0.10.1