#ifndef CSGTERM_H_ #define CSGTERM_H_ #include #include #include "memory.h" #include "linalg.h" class PolySet; class CSGTerm { public: enum type_e { TYPE_PRIMITIVE, TYPE_UNION, TYPE_INTERSECTION, TYPE_DIFFERENCE }; type_e type; shared_ptr polyset; std::string label; shared_ptr left; shared_ptr right; Transform3d m; double color[4]; CSGTerm(const shared_ptr &polyset, const Transform3d &matrix, const double color[4], const std::string &label); CSGTerm(type_e type, shared_ptr left, shared_ptr right); CSGTerm(type_e type, CSGTerm *left, CSGTerm *right); ~CSGTerm(); static shared_ptr normalize(shared_ptr &term); static shared_ptr normalize_tail(shared_ptr &term); std::string dump(); }; class CSGChain { public: std::vector > polysets; std::vector matrices; std::vector colors; std::vector types; std::vector labels; CSGChain(); void add(const shared_ptr &polyset, const Transform3d &m, double *color, CSGTerm::type_e type, std::string label); void import(shared_ptr term, CSGTerm::type_e type = CSGTerm::TYPE_UNION); std::string dump(); BoundingBox getBoundingBox() const; }; #endif