summaryrefslogtreecommitdiff
path: root/src/CGALEvaluator.cc
diff options
context:
space:
mode:
Diffstat (limited to 'src/CGALEvaluator.cc')
-rw-r--r--src/CGALEvaluator.cc9
1 files changed, 7 insertions, 2 deletions
diff --git a/src/CGALEvaluator.cc b/src/CGALEvaluator.cc
index 20c5d5e..60d98b8 100644
--- a/src/CGALEvaluator.cc
+++ b/src/CGALEvaluator.cc
@@ -61,6 +61,11 @@ void CGALEvaluator::process(CGAL_Nef_polyhedron &target, const CGAL_Nef_polyhedr
if (target.dim != 2 && target.dim != 3) {
assert(false && "Dimension of Nef polyhedron must be 2 or 3");
}
+ // Intersecting something with nothing results in nothing
+ if (src.isEmpty() && op == CGE_INTERSECTION) {
+ target = src;
+ return;
+ }
if (src.isEmpty()) return; // Empty polyhedron. This can happen for e.g. square([0,0])
if (target.isEmpty() && op != CGE_UNION) return; // empty op <something> => empty
if (target.dim != src.dim) return; // If someone tries to e.g. union 2d and 3d objects
@@ -708,7 +713,7 @@ CGAL_Nef_polyhedron CGALEvaluator::evaluateCGALMesh(const PolySet &ps)
PRINTB("Alternate construction failed. CGAL error in CGAL_Nef_polyhedron3(): %s", e.what());
}
CGAL::set_error_behaviour(old_behaviour);
- return CGAL_Nef_polyhedron(N);
+ if (N) return CGAL_Nef_polyhedron(N);
}
- return CGAL_Nef_polyhedron();
+ return CGAL_Nef_polyhedron(ps.is2d?2:3);
}
contact: Jan Huwald // Impressum