From ec85e65ee983258db44770f246537562a16d141b Mon Sep 17 00:00:00 2001 From: don bright Date: Fri, 12 Aug 2011 18:48:59 -0500 Subject: [PATCH] fix build errors on windows --- src/CGALEvaluator.cc | 38 +++++++++++++++++++------------------- src/CGALEvaluator.h | 2 +- src/CSGTermEvaluator.cc | 20 ++++++++++---------- src/CSGTermEvaluator.h | 2 +- src/func.cc | 1 + 5 files changed, 32 insertions(+), 31 deletions(-) diff --git a/src/CGALEvaluator.cc b/src/CGALEvaluator.cc index c2513434..22583a7e 100644 --- a/src/CGALEvaluator.cc +++ b/src/CGALEvaluator.cc @@ -40,7 +40,7 @@ bool CGALEvaluator::isCached(const AbstractNode &node) const Modifies target by applying op to target and src: target = target [op] src */ -void CGALEvaluator::process(CGAL_Nef_polyhedron &target, const CGAL_Nef_polyhedron &src, CsgOp op) +void CGALEvaluator::process(CGAL_Nef_polyhedron &target, const CGAL_Nef_polyhedron &src, CGALEvaluator::CsgOp op) { if (target.dim != 2 && target.dim != 3) { assert(false && "Dimension of Nef polyhedron must be 2 or 3"); @@ -48,19 +48,19 @@ void CGALEvaluator::process(CGAL_Nef_polyhedron &target, const CGAL_Nef_polyhedr if (target.dim == 2) { switch (op) { - case UNION: + case CGE_UNION: target.p2 += src.p2; break; - case INTERSECTION: + case CGE_INTERSECTION: target.p2 *= src.p2; break; - case DIFFERENCE: + case CGE_DIFFERENCE: target.p2 -= src.p2; break; - case MINKOWSKI: + case CGE_MINKOWSKI: target.p2 = minkowski2(target.p2, src.p2); break; - case HULL: + case CGE_HULL: //FIXME: Port convex hull to a binary operator or process it all in the end somehow // target.p2 = convexhull2(target.p2, src.p2); // target.p2 = convexhull2(polys); @@ -69,19 +69,19 @@ void CGALEvaluator::process(CGAL_Nef_polyhedron &target, const CGAL_Nef_polyhedr } else if (target.dim == 3) { switch (op) { - case UNION: + case CGE_UNION: target.p3 += src.p3; break; - case INTERSECTION: + case CGE_INTERSECTION: target.p3 *= src.p3; break; - case DIFFERENCE: + case CGE_DIFFERENCE: target.p3 -= src.p3; break; - case MINKOWSKI: + case CGE_MINKOWSKI: target.p3 = minkowski3(target.p3, src.p3); break; - case HULL: + case CGE_HULL: // FIXME: Print warning: hull() not supported in 3D break; } @@ -130,7 +130,7 @@ Response CGALEvaluator::visit(State &state, const AbstractNode &node) { if (state.isPrefix() && isCached(node)) return PruneTraversal; if (state.isPostfix()) { - if (!isCached(node)) applyToChildren(node, UNION); + if (!isCached(node)) applyToChildren(node, CGE_UNION); addToParent(state, node); } return ContinueTraversal; @@ -140,7 +140,7 @@ Response CGALEvaluator::visit(State &state, const AbstractIntersectionNode &node { if (state.isPrefix() && isCached(node)) return PruneTraversal; if (state.isPostfix()) { - if (!isCached(node)) applyToChildren(node, INTERSECTION); + if (!isCached(node)) applyToChildren(node, CGE_INTERSECTION); addToParent(state, node); } return ContinueTraversal; @@ -151,16 +151,16 @@ Response CGALEvaluator::visit(State &state, const CsgNode &node) if (state.isPrefix() && isCached(node)) return PruneTraversal; if (state.isPostfix()) { if (!isCached(node)) { - CsgOp op; + CGALEvaluator::CsgOp op; switch (node.type) { case CSG_TYPE_UNION: - op = UNION; + op = CGE_UNION; break; case CSG_TYPE_DIFFERENCE: - op = DIFFERENCE; + op = CGE_DIFFERENCE; break; case CSG_TYPE_INTERSECTION: - op = INTERSECTION; + op = CGE_INTERSECTION; break; } applyToChildren(node, op); @@ -176,7 +176,7 @@ Response CGALEvaluator::visit(State &state, const TransformNode &node) if (state.isPostfix()) { if (!isCached(node)) { // First union all children - applyToChildren(node, UNION); + applyToChildren(node, CGE_UNION); // Then apply transform CGAL_Nef_polyhedron N = this->cache[this->tree.getString(node)]; @@ -235,7 +235,7 @@ Response CGALEvaluator::visit(State &state, const AbstractPolyNode &node) if (state.isPostfix()) { if (!isCached(node)) { // First union all children - applyToChildren(node, UNION); + applyToChildren(node, CGE_UNION); // Then apply polyset operation PolySet *ps = node.evaluate_polyset(AbstractPolyNode::RENDER_CGAL, &this->psevaluator); diff --git a/src/CGALEvaluator.h b/src/CGALEvaluator.h index 282d6ab8..9a1c88cc 100644 --- a/src/CGALEvaluator.h +++ b/src/CGALEvaluator.h @@ -22,7 +22,7 @@ using std::pair; class CGALEvaluator : public Visitor { public: - enum CsgOp {UNION, INTERSECTION, DIFFERENCE, MINKOWSKI, HULL}; + enum CsgOp {CGE_UNION, CGE_INTERSECTION, CGE_DIFFERENCE, CGE_MINKOWSKI, CGE_HULL}; // FIXME: If a cache is not given, we need to fix this ourselves CGALEvaluator(QHash &cache, const Tree &tree) : cache(cache), tree(tree), psevaluator(*this) {} virtual ~CGALEvaluator() {} diff --git a/src/CSGTermEvaluator.cc b/src/CSGTermEvaluator.cc index 769c87f3..451929ca 100644 --- a/src/CSGTermEvaluator.cc +++ b/src/CSGTermEvaluator.cc @@ -45,11 +45,11 @@ void CSGTermEvaluator::applyToChildren(const AbstractNode &node, CSGTermEvaluato if (t2 && !t1) { t1 = t2; } else if (t2 && t1) { - if (op == UNION) { + if (op == CSGT_UNION) { t1 = new CSGTerm(CSGTerm::TYPE_UNION, t1, t2); - } else if (op == DIFFERENCE) { + } else if (op == CSGT_DIFFERENCE) { t1 = new CSGTerm(CSGTerm::TYPE_DIFFERENCE, t1, t2); - } else if (op == INTERSECTION) { + } else if (op == CSGT_INTERSECTION) { t1 = new CSGTerm(CSGTerm::TYPE_INTERSECTION, t1, t2); } } @@ -67,7 +67,7 @@ void CSGTermEvaluator::applyToChildren(const AbstractNode &node, CSGTermEvaluato Response CSGTermEvaluator::visit(State &state, const AbstractNode &node) { if (state.isPostfix()) { - applyToChildren(node, UNION); + applyToChildren(node, CSGT_UNION); addToParent(state, node); } return ContinueTraversal; @@ -76,7 +76,7 @@ Response CSGTermEvaluator::visit(State &state, const AbstractNode &node) Response CSGTermEvaluator::visit(State &state, const AbstractIntersectionNode &node) { if (state.isPostfix()) { - applyToChildren(node, INTERSECTION); + applyToChildren(node, CSGT_INTERSECTION); addToParent(state, node); } return ContinueTraversal; @@ -120,13 +120,13 @@ Response CSGTermEvaluator::visit(State &state, const CsgNode &node) CsgOp op; switch (node.type) { case CSG_TYPE_UNION: - op = UNION; + op = CSGT_UNION; break; case CSG_TYPE_DIFFERENCE: - op = DIFFERENCE; + op = CSGT_DIFFERENCE; break; case CSG_TYPE_INTERSECTION: - op = INTERSECTION; + op = CSGT_INTERSECTION; break; } applyToChildren(node, op); @@ -157,7 +157,7 @@ Response CSGTermEvaluator::visit(State &state, const TransformNode &node) state.setMatrix(m); } if (state.isPostfix()) { - applyToChildren(node, UNION); + applyToChildren(node, CSGT_UNION); addToParent(state, node); } return ContinueTraversal; @@ -168,7 +168,7 @@ Response CSGTermEvaluator::visit(State &state, const RenderNode &node) { PRINT("WARNING: Found render() statement but compiled without CGAL support!"); if (state.isPostfix()) { - applyToChildren(node, UNION); + applyToChildren(node, CSGT_UNION); addToParent(state, node); } return ContinueTraversal; diff --git a/src/CSGTermEvaluator.h b/src/CSGTermEvaluator.h index beb12013..ff62cc1a 100644 --- a/src/CSGTermEvaluator.h +++ b/src/CSGTermEvaluator.h @@ -34,7 +34,7 @@ public: vector &background); private: - enum CsgOp {UNION, INTERSECTION, DIFFERENCE, MINKOWSKI}; + enum CsgOp {CSGT_UNION, CSGT_INTERSECTION, CSGT_DIFFERENCE, CSGT_MINKOWSKI}; void addToParent(const State &state, const AbstractNode &node); void applyToChildren(const AbstractNode &node, CSGTermEvaluator::CsgOp op); diff --git a/src/func.cc b/src/func.cc index fd4bd7e4..c10963cd 100644 --- a/src/func.cc +++ b/src/func.cc @@ -30,6 +30,7 @@ #include "dxfdim.h" #include "builtin.h" #include +#include #include "mathc99.h" AbstractFunction::~AbstractFunction()