summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorkintel <kintel@b57f626f-c46c-0410-a088-ec61d464b74c>2010-03-23 23:06:38 (GMT)
committerkintel <kintel@b57f626f-c46c-0410-a088-ec61d464b74c>2010-03-23 23:06:38 (GMT)
commit3ba0ab30e665e544af5cd3eea38a96f8b1eeae8a (patch)
tree041d36e60f3b607d9ad4e4c48f48c03cd03cd5ab /src
parentd99f5562744dfb9dc640956c63d7a93e22e307c1 (diff)
Don't crash on illegal polygon winding - write an error and skip the object
git-svn-id: http://svn.clifford.at/openscad/trunk@488 b57f626f-c46c-0410-a088-ec61d464b74c
Diffstat (limited to 'src')
-rw-r--r--src/polyset.cc12
1 files changed, 11 insertions, 1 deletions
diff --git a/src/polyset.cc b/src/polyset.cc
index 8eccf37..b8e77f4 100644
--- a/src/polyset.cc
+++ b/src/polyset.cc
@@ -26,6 +26,8 @@
#include "polyset.h"
#include "printutils.h"
#include "Preferences.h"
+#include <CGAL/assertions_behaviour.h>
+#include <CGAL/exceptions.h>
#include <Eigen/Core>
#include <Eigen/LU>
@@ -647,8 +649,10 @@ CGAL_Nef_polyhedron PolySet::render_cgal_nef_polyhedron() const
#endif
}
- else
+ else // not (this->is2d)
{
+ CGAL::Failure_behaviour old_behaviour = CGAL::set_error_behaviour(CGAL::THROW_EXCEPTION);
+ try {
CGAL_Polyhedron P;
CGAL_Build_PolySet builder(this);
P.delegate(builder);
@@ -657,6 +661,12 @@ CGAL_Nef_polyhedron PolySet::render_cgal_nef_polyhedron() const
#endif
CGAL_Nef_polyhedron3 N(P);
return CGAL_Nef_polyhedron(N);
+ }
+ catch (CGAL::Assertion_exception e) {
+ PRINTF("ERROR: Illegal polygonal object - make sure all polygons are defined with the same winding order. Skipping affected object.");
+ CGAL::set_error_behaviour(old_behaviour);
+ return CGAL_Nef_polyhedron();
+ }
}
return CGAL_Nef_polyhedron();
}
contact: Jan Huwald // Impressum