summaryrefslogtreecommitdiff
path: root/src/projection.cc
diff options
context:
space:
mode:
authorclifford <clifford@b57f626f-c46c-0410-a088-ec61d464b74c>2010-02-01 06:10:07 (GMT)
committerclifford <clifford@b57f626f-c46c-0410-a088-ec61d464b74c>2010-02-01 06:10:07 (GMT)
commit2e6946fd5ae35e751a92e8fba23ac2c4c83518dd (patch)
tree724f13caafdbc069ea9590ab963dad3f70647096 /src/projection.cc
parent4fe6b92040261fe7faea49727d62fbcf61c954fc (diff)
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
Diffstat (limited to 'src/projection.cc')
-rw-r--r--src/projection.cc13
1 files changed, 12 insertions, 1 deletions
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<int> 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();
contact: Jan Huwald // Impressum