mirror of https://github.com/vitalif/openscad
remove #ifdefs for eigen version 2 ( see issue #532 )
parent
f80865c950
commit
2f4617ddef
|
@ -74,26 +74,16 @@ shared_ptr<CSGTerm> CSGTerm::createCSGTerm(type_e type, shared_ptr<CSGTerm> left
|
|||
const BoundingBox &rightbox = right->getBoundingBox();
|
||||
Vector3d newmin, newmax;
|
||||
if (type == TYPE_INTERSECTION) {
|
||||
#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) {
|
||||
#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
|
||||
|
@ -143,23 +133,13 @@ void CSGTerm::initBoundingBox()
|
|||
Vector3d newmin, newmax;
|
||||
switch (this->type) {
|
||||
case TYPE_UNION:
|
||||
#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:
|
||||
#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:
|
||||
|
|
|
@ -15,13 +15,8 @@ typedef Eigen::AlignedBox<double, 3> BoundingBox;
|
|||
using Eigen::Matrix3f;
|
||||
using Eigen::Matrix3d;
|
||||
using Eigen::Matrix4d;
|
||||
#if EIGEN_WORLD_VERSION >= 3
|
||||
#define Transform3d Eigen::Affine3d
|
||||
#define Transform2d Eigen::Affine2d
|
||||
#else
|
||||
using Eigen::Transform3d;
|
||||
using Eigen::Transform2d;
|
||||
#endif
|
||||
|
||||
bool matrix_contains_infinity( const Transform3d &m );
|
||||
bool matrix_contains_nan( const Transform3d &m );
|
||||
|
|
Loading…
Reference in New Issue