summaryrefslogtreecommitdiff
path: root/src/CGALEvaluator.cc
diff options
context:
space:
mode:
authordon bright <hugh.m.bright@gmail.com>2012-08-20 23:33:13 (GMT)
committerdon bright <hugh.m.bright@gmail.com>2012-08-20 23:33:13 (GMT)
commitf1d4a52f4cc01843f5d7c40499fcfe44cc82712f (patch)
tree2d6717a6deeed4157d84b07f45a41cc9d8f3b9e2 /src/CGALEvaluator.cc
parent0170923b9bb51e198c8a3ad1b98ca5ed74a6c77d (diff)
dont crash if there's infinity or NaN in transformation matrix
Diffstat (limited to 'src/CGALEvaluator.cc')
-rw-r--r--src/CGALEvaluator.cc11
1 files changed, 10 insertions, 1 deletions
diff --git a/src/CGALEvaluator.cc b/src/CGALEvaluator.cc
index ee04e05..c84d21f 100644
--- a/src/CGALEvaluator.cc
+++ b/src/CGALEvaluator.cc
@@ -241,6 +241,15 @@ Response CGALEvaluator::visit(State &state, const TransformNode &node)
// First union all children
N = applyToChildren(node, CGE_UNION);
+ if ( matrix_contains_infinity( node.matrix ) ) {
+ PRINT("Warning: Transformation matrix contains Infinity - removing object.");
+ N.reset();
+ }
+ if ( matrix_contains_nan( node.matrix ) ) {
+ PRINT("Warning: Transformation matrix contains Not-a-Number - removing object");
+ N.reset();
+ }
+
// Then apply transform
// If there is no geometry under the transform, N will be empty and of dim 0,
// just just silently ignore such nodes
@@ -248,7 +257,7 @@ Response CGALEvaluator::visit(State &state, const TransformNode &node)
// Unfortunately CGAL provides no transform method for CGAL_Nef_polyhedron2
// objects. So we convert in to our internal 2d data format, transform it,
// tesselate it and create a new CGAL_Nef_polyhedron2 from it.. What a hack!
-
+
Eigen::Matrix2f testmat;
testmat << node.matrix(0,0), node.matrix(0,1), node.matrix(1,0), node.matrix(1,1);
if (testmat.determinant() == 0) {
contact: Jan Huwald // Impressum