summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorMarius Kintel <marius@kintel.net>2011-11-05 17:25:05 (GMT)
committerMarius Kintel <marius@kintel.net>2011-11-05 17:25:05 (GMT)
commitf4bd15912a7179ccd4e39adc310900d020f15d8a (patch)
tree7aa0c007b4321c87f9822028973df141df4207e5 /src
parent4120846d18c1a7ce5a51169feb1babb0603bddc0 (diff)
Last CGAL assert fix wasn't enough; expanded the fix to all operators
Diffstat (limited to 'src')
-rw-r--r--src/CGALEvaluator.cc35
-rw-r--r--src/CGAL_Nef_polyhedron.cc25
2 files changed, 26 insertions, 34 deletions
diff --git a/src/CGALEvaluator.cc b/src/CGALEvaluator.cc
index 550f300..797434f 100644
--- a/src/CGALEvaluator.cc
+++ b/src/CGALEvaluator.cc
@@ -56,20 +56,29 @@ void CGALEvaluator::process(CGAL_Nef_polyhedron &target, const CGAL_Nef_polyhedr
if (src.empty()) return; // Empty polyhedron. This can happen for e.g. square([0,0])
if (target.dim != src.dim) return; // If someone tries to e.g. union 2d and 3d objects
- switch (op) {
- case CGE_UNION:
- target += src;
- break;
- case CGE_INTERSECTION:
- target *= src;
- break;
- case CGE_DIFFERENCE:
- target -= src;
- break;
- case CGE_MINKOWSKI:
- target.minkowski(src);
- break;
+ CGAL::Failure_behaviour old_behaviour = CGAL::set_error_behaviour(CGAL::THROW_EXCEPTION);
+ try {
+ switch (op) {
+ case CGE_UNION:
+ target += src;
+ break;
+ case CGE_INTERSECTION:
+ target *= src;
+ break;
+ case CGE_DIFFERENCE:
+ target -= src;
+ break;
+ case CGE_MINKOWSKI:
+ target.minkowski(src);
+ break;
+ }
+ }
+ catch (CGAL::Assertion_exception e) {
+ // union && difference assert triggered by testdata/scad/bugs/rotate-diff-nonmanifold-crash.scad
+ std::string opstr = op == CGE_UNION ? "union" : op == CGE_INTERSECTION ? "intersection" : op == CGE_DIFFERENCE ? "difference" : op == CGE_MINKOWSKI ? "minkowski" : "UNKNOWN";
+ PRINTF("CGAL error in CGAL_Nef_polyhedron's %s operator: %s", opstr.c_str(), e.what());
}
+ CGAL::set_error_behaviour(old_behaviour);
}
/*!
diff --git a/src/CGAL_Nef_polyhedron.cc b/src/CGAL_Nef_polyhedron.cc
index ccfde24..2538b64 100644
--- a/src/CGAL_Nef_polyhedron.cc
+++ b/src/CGAL_Nef_polyhedron.cc
@@ -6,8 +6,6 @@
#include "dxfdata.h"
#include "dxftess.h"
#include <CGAL/minkowski_sum_3.h>
-#include <CGAL/assertions_behaviour.h>
-#include <CGAL/exceptions.h>
CGAL_Nef_polyhedron& CGAL_Nef_polyhedron::operator+=(const CGAL_Nef_polyhedron &other)
{
@@ -25,16 +23,8 @@ CGAL_Nef_polyhedron& CGAL_Nef_polyhedron::operator*=(const CGAL_Nef_polyhedron &
CGAL_Nef_polyhedron& CGAL_Nef_polyhedron::operator-=(const CGAL_Nef_polyhedron &other)
{
- // 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);
+ if (this->dim == 2) (*this->p2) -= (*other.p2);
+ else if (this->dim == 3) (*this->p3) -= (*other.p3);
return *this;
}
@@ -42,15 +32,8 @@ extern CGAL_Nef_polyhedron2 minkowski2(const CGAL_Nef_polyhedron2 &a, const CGAL
CGAL_Nef_polyhedron &CGAL_Nef_polyhedron::minkowski(const CGAL_Nef_polyhedron &other)
{
- CGAL::Failure_behaviour old_behaviour = CGAL::set_error_behaviour(CGAL::THROW_EXCEPTION);
- try {
- if (this->dim == 2) (*this->p2) = minkowski2(*this->p2, *other.p2);
- else if (this->dim == 3) (*this->p3) = CGAL::minkowski_sum_3(*this->p3, *other.p3);
- }
- catch (CGAL::Assertion_exception e) {
- PRINTF("CGAL error in minkowski %s", e.what());
- CGAL::set_error_behaviour(old_behaviour);
- }
+ if (this->dim == 2) (*this->p2) = minkowski2(*this->p2, *other.p2);
+ else if (this->dim == 3) (*this->p3) = CGAL::minkowski_sum_3(*this->p3, *other.p3);
return *this;
}
contact: Jan Huwald // Impressum