diff options
author | Marius Kintel <marius@kintel.net> | 2014-01-16 03:23:50 (GMT) |
---|---|---|
committer | Marius Kintel <marius@kintel.net> | 2014-01-16 03:23:50 (GMT) |
commit | bf0d9edf38132049a2d8a8f5de4d6e70657a8870 (patch) | |
tree | 5559625acd9496f855fd7e377b75ce5318cf7d21 /src | |
parent | 1fc52f8cd47213131e0eb76ccf184b5c7388c6b9 (diff) |
Change behavior of intersection: intersecting something with an empty object will be empty
Diffstat (limited to 'src')
-rw-r--r-- | src/CGALEvaluator.cc | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/src/CGALEvaluator.cc b/src/CGALEvaluator.cc index 37d4fd8..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 |