summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarius Kintel <marius@kintel.net>2011-11-05 17:07:56 (GMT)
committerMarius Kintel <marius@kintel.net>2011-11-05 17:07:56 (GMT)
commit4120846d18c1a7ce5a51169feb1babb0603bddc0 (patch)
tree59156a17a848c49b2d2e425b5196a57f0d707e8e
parent73c715ad9c7e9a9f2d5888caa967239064bba262 (diff)
Catch a CGAL assert caused by a subtraction resulting in non-manifold geometry. see testdata/scad/bugs/rotate-diff-nonmanifold-crash.scad
-rw-r--r--src/CGAL_Nef_polyhedron.cc12
-rw-r--r--testdata/scad/bugs/rotate-diff-nonmanifold-crash.scad4
2 files changed, 14 insertions, 2 deletions
diff --git a/src/CGAL_Nef_polyhedron.cc b/src/CGAL_Nef_polyhedron.cc
index 975c9a4..ccfde24 100644
--- a/src/CGAL_Nef_polyhedron.cc
+++ b/src/CGAL_Nef_polyhedron.cc
@@ -25,8 +25,16 @@ CGAL_Nef_polyhedron& CGAL_Nef_polyhedron::operator*=(const CGAL_Nef_polyhedron &
CGAL_Nef_polyhedron& CGAL_Nef_polyhedron::operator-=(const CGAL_Nef_polyhedron &other)
{
- if (this->dim == 2) (*this->p2) -= (*other.p2);
- else if (this->dim == 3) (*this->p3) -= (*other.p3);
+ // Triggered by testdata/scad/bugs/rotate-diff-nonmanifold-crash.scad
+ CGAL::Failure_behaviour old_behaviour = CGAL::set_error_behaviour(CGAL::THROW_EXCEPTION);
+ try {
+ if (this->dim == 2) (*this->p2) -= (*other.p2);
+ else if (this->dim == 3) (*this->p3) -= (*other.p3);
+ }
+ catch (CGAL::Assertion_exception e) {
+ PRINTF("CGAL error in CGAL_Nef_polyhedron::operator-=(): %s", e.what());
+ }
+ CGAL::set_error_behaviour(old_behaviour);
return *this;
}
diff --git a/testdata/scad/bugs/rotate-diff-nonmanifold-crash.scad b/testdata/scad/bugs/rotate-diff-nonmanifold-crash.scad
new file mode 100644
index 0000000..d7011d9
--- /dev/null
+++ b/testdata/scad/bugs/rotate-diff-nonmanifold-crash.scad
@@ -0,0 +1,4 @@
+difference() {
+ rotate_extrude($fn=5) translate([4,0,0]) square([10, 10], center=true);
+ translate([6,6,6]) sphere(r=10);
+}
contact: Jan Huwald // Impressum