2011-07-31 03:58:51 +04:00
|
|
|
#ifndef CGALEVALUATOR_H_
|
|
|
|
#define CGALEVALUATOR_H_
|
2010-03-19 06:07:01 +03:00
|
|
|
|
2010-09-07 04:01:51 +04:00
|
|
|
#include "visitor.h"
|
2011-09-01 06:09:06 +04:00
|
|
|
#include "CGAL_Nef_polyhedron.h"
|
2011-07-31 03:58:51 +04:00
|
|
|
#include "PolySetCGALEvaluator.h"
|
2010-04-12 08:57:02 +04:00
|
|
|
|
2010-03-19 06:07:01 +03:00
|
|
|
#include <string>
|
|
|
|
#include <map>
|
|
|
|
#include <list>
|
2010-03-29 05:31:47 +04:00
|
|
|
|
2011-07-31 03:58:51 +04:00
|
|
|
class CGALEvaluator : public Visitor
|
2010-03-19 06:07:01 +03:00
|
|
|
{
|
|
|
|
public:
|
2011-09-07 00:03:52 +04:00
|
|
|
enum CsgOp {CGE_UNION, CGE_INTERSECTION, CGE_DIFFERENCE, CGE_MINKOWSKI};
|
2011-10-01 03:36:30 +04:00
|
|
|
CGALEvaluator(const class Tree &tree) : tree(tree), psevaluator(*this) {}
|
2011-07-31 03:58:51 +04:00
|
|
|
virtual ~CGALEvaluator() {}
|
2010-03-19 06:07:01 +03:00
|
|
|
|
2010-09-07 04:01:51 +04:00
|
|
|
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);
|
2011-09-06 16:57:24 +04:00
|
|
|
virtual Response visit(State &state, const CgaladvNode &node);
|
2010-03-19 06:07:01 +03:00
|
|
|
|
2011-07-31 03:58:51 +04:00
|
|
|
CGAL_Nef_polyhedron evaluateCGALMesh(const AbstractNode &node);
|
|
|
|
CGAL_Nef_polyhedron evaluateCGALMesh(const PolySet &polyset);
|
2010-03-29 05:31:47 +04:00
|
|
|
|
2010-11-03 21:26:06 +03:00
|
|
|
const Tree &getTree() const { return this->tree; }
|
|
|
|
|
2010-03-19 06:07:01 +03:00
|
|
|
private:
|
2011-10-27 02:49:55 +04:00
|
|
|
void addToParent(const State &state, const AbstractNode &node, const CGAL_Nef_polyhedron &N);
|
2010-03-29 05:31:47 +04:00
|
|
|
bool isCached(const AbstractNode &node) const;
|
2011-07-31 03:58:51 +04:00
|
|
|
void process(CGAL_Nef_polyhedron &target, const CGAL_Nef_polyhedron &src, CGALEvaluator::CsgOp op);
|
2011-09-11 12:51:55 +04:00
|
|
|
CGAL_Nef_polyhedron applyToChildren(const AbstractNode &node, CGALEvaluator::CsgOp op);
|
|
|
|
CGAL_Nef_polyhedron applyHull(const CgaladvNode &node);
|
2013-03-10 06:28:43 +04:00
|
|
|
CGAL_Nef_polyhedron applyResize(const CgaladvNode &node);
|
2010-03-19 06:07:01 +03:00
|
|
|
|
2011-10-27 02:49:55 +04:00
|
|
|
typedef std::pair<const AbstractNode *, CGAL_Nef_polyhedron> ChildItem;
|
2011-10-26 19:00:18 +04:00
|
|
|
typedef std::list<ChildItem> ChildList;
|
2011-10-01 03:36:30 +04:00
|
|
|
std::map<int, ChildList> visitedchildren;
|
2010-03-19 06:07:01 +03:00
|
|
|
|
2010-04-12 08:57:02 +04:00
|
|
|
const Tree &tree;
|
2012-01-10 02:59:53 +04:00
|
|
|
CGAL_Nef_polyhedron root;
|
2011-09-09 07:53:05 +04:00
|
|
|
public:
|
|
|
|
// FIXME: Do we need to make this visible? Used for cache management
|
|
|
|
// Note: psevaluator constructor needs this->tree to be initialized first
|
2011-07-31 03:58:51 +04:00
|
|
|
PolySetCGALEvaluator psevaluator;
|
2010-03-19 06:07:01 +03:00
|
|
|
};
|
|
|
|
|
|
|
|
#endif
|