summaryrefslogtreecommitdiff
path: root/src/csgterm.cc
diff options
context:
space:
mode:
authordon bright <hugh.m.bright@gmail.com>2012-08-18 20:28:36 (GMT)
committerdon bright <hugh.m.bright@gmail.com>2012-08-18 20:28:36 (GMT)
commit9f6819e68501de16563aeaaadd65dfc915092169 (patch)
tree26beade954d4748b44ec303e2fd2e12584abe885 /src/csgterm.cc
parent8740ac3574c5249c9c22f5436d3b14f4f0563a66 (diff)
initial rework to enable eigen3 per issue #174.
1. enable eigen3 in qmake build system 2. convert Transform3d and cwise() per the eigen2->eigen3 porting faq online 3. get rid of 'using namespace boost::filesystem' as it conflicts with eigen3
Diffstat (limited to 'src/csgterm.cc')
-rw-r--r--src/csgterm.cc42
1 files changed, 34 insertions, 8 deletions
diff --git a/src/csgterm.cc b/src/csgterm.cc
index 0e68320..aed97b2 100644
--- a/src/csgterm.cc
+++ b/src/csgterm.cc
@@ -66,16 +66,29 @@ shared_ptr<CSGTerm> CSGTerm::createCSGTerm(type_e type, shared_ptr<CSGTerm> left
// http://www.cc.gatech.edu/~turk/my_papers/pxpl_csg.pdf
const BoundingBox &leftbox = left->getBoundingBox();
const BoundingBox &rightbox = right->getBoundingBox();
+ Vector3d newmin, newmax;
if (type == TYPE_INTERSECTION) {
- BoundingBox newbox(leftbox.min().cwise().max(rightbox.min()),
- leftbox.max().cwise().min(rightbox.max()));
+#if EIGEN_WORLD_VERSION == 2
+ newmin = leftbox.min().cwise().max( rightbox.min() );
+ newmax = leftbox.max().cwise().min( rightbox.max() );
+#else
+ newmin = leftbox.min().array().cwiseMax( rightbox.min().array() );
+ newmax = leftbox.max().array().cwiseMin( rightbox.max().array() );
+#endif
+ BoundingBox newbox( newmin, newmax );
if (newbox.isNull()) {
return shared_ptr<CSGTerm>(); // Prune entire product
}
}
else if (type == TYPE_DIFFERENCE) {
- BoundingBox newbox(leftbox.min().cwise().max(rightbox.min()),
- leftbox.max().cwise().min(rightbox.max()));
+#if EIGEN_WORLD_VERSION == 2
+ newmin = leftbox.min().cwise().max( rightbox.min() );
+ newmax = leftbox.max().cwise().min( rightbox.max() );
+#else
+ newmin = leftbox.min().array().cwiseMax( rightbox.min().array() );
+ newmax = leftbox.max().array().cwiseMin( rightbox.max().array() );
+#endif
+ BoundingBox newbox( newmin, newmax );
if (newbox.isNull()) {
return left; // Prune the negative component
}
@@ -119,14 +132,27 @@ void CSGTerm::initBoundingBox()
else {
const BoundingBox &leftbox = this->left->getBoundingBox();
const BoundingBox &rightbox = this->right->getBoundingBox();
+ Vector3d newmin, newmax;
switch (this->type) {
case TYPE_UNION:
- this->bbox = this->m * BoundingBox(leftbox.min().cwise().min(rightbox.min()),
- leftbox.max().cwise().max(rightbox.max()));
+#if EIGEN_WORLD_VERSION == 2
+ newmin = leftbox.min().cwise().min( rightbox.min() );
+ newmax = leftbox.max().cwise().max( rightbox.max() );
+#else
+ newmin = leftbox.min().array().cwiseMin( rightbox.min().array() );
+ newmax = leftbox.max().array().cwiseMax( rightbox.max().array() );
+#endif
+ this->bbox = this->m * BoundingBox( newmin, newmax );
break;
case TYPE_INTERSECTION:
- this->bbox = this->m * BoundingBox(leftbox.min().cwise().max(rightbox.min()),
- leftbox.max().cwise().min(rightbox.max()));
+#if EIGEN_WORLD_VERSION == 2
+ newmin = leftbox.min().cwise().max( rightbox.min() );
+ newmax = leftbox.max().cwise().min( rightbox.max() );
+#else
+ newmin = leftbox.min().array().cwiseMax( rightbox.min().array() );
+ newmax = leftbox.max().array().cwiseMin( rightbox.max().array() );
+#endif
+ this->bbox = this->m * BoundingBox( newmin, newmax );
break;
case TYPE_DIFFERENCE:
this->bbox = this->m * leftbox;
contact: Jan Huwald // Impressum