summaryrefslogtreecommitdiff
path: root/src/CGALEvaluator.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/CGALEvaluator.h')
-rw-r--r--src/CGALEvaluator.h56
1 files changed, 56 insertions, 0 deletions
diff --git a/src/CGALEvaluator.h b/src/CGALEvaluator.h
new file mode 100644
index 0000000..c1b5ae8
--- /dev/null
+++ b/src/CGALEvaluator.h
@@ -0,0 +1,56 @@
+#ifndef CGALEVALUATOR_H_
+#define CGALEVALUATOR_H_
+
+#include "myqhash.h"
+#include "visitor.h"
+#include "Tree.h"
+#include "CGAL_Nef_polyhedron.h"
+#include "PolySetCGALEvaluator.h"
+
+#include <string>
+#include <map>
+#include <list>
+
+using std::string;
+using std::map;
+using std::list;
+using std::pair;
+
+class CGALEvaluator : public Visitor
+{
+public:
+ enum CsgOp {CGE_UNION, CGE_INTERSECTION, CGE_DIFFERENCE, CGE_MINKOWSKI};
+ CGALEvaluator(const Tree &tree) : tree(tree), psevaluator(*this) {}
+ virtual ~CGALEvaluator() {}
+
+ virtual Response visit(State &state, const AbstractNode &node);
+ virtual Response visit(State &state, const AbstractIntersectionNode &node);
+ virtual Response visit(State &state, const CsgNode &node);
+ virtual Response visit(State &state, const TransformNode &node);
+ virtual Response visit(State &state, const AbstractPolyNode &node);
+ virtual Response visit(State &state, const CgaladvNode &node);
+
+ CGAL_Nef_polyhedron evaluateCGALMesh(const AbstractNode &node);
+ CGAL_Nef_polyhedron evaluateCGALMesh(const PolySet &polyset);
+
+ const Tree &getTree() const { return this->tree; }
+
+private:
+ void addToParent(const State &state, const AbstractNode &node);
+ bool isCached(const AbstractNode &node) const;
+ void process(CGAL_Nef_polyhedron &target, const CGAL_Nef_polyhedron &src, CGALEvaluator::CsgOp op);
+ CGAL_Nef_polyhedron applyToChildren(const AbstractNode &node, CGALEvaluator::CsgOp op);
+ CGAL_Nef_polyhedron applyHull(const CgaladvNode &node);
+
+ string currindent;
+ typedef list<pair<const AbstractNode *, string> > ChildList;
+ map<int, ChildList> visitedchildren;
+
+ const Tree &tree;
+public:
+ // FIXME: Do we need to make this visible? Used for cache management
+ // Note: psevaluator constructor needs this->tree to be initialized first
+ PolySetCGALEvaluator psevaluator;
+};
+
+#endif
contact: Jan Huwald // Impressum