| 8 | namespace PyMesh { |
| 9 | |
| 10 | class CSGTree { |
| 11 | public: |
| 12 | typedef std::shared_ptr<CSGTree> Ptr; |
| 13 | static Ptr create(const std::string& engine_name); |
| 14 | static Ptr create_leaf(const std::string& engine_name, |
| 15 | const MatrixFr& vertices, |
| 16 | const MatrixIr& faces); |
| 17 | |
| 18 | public: |
| 19 | CSGTree() = default; |
| 20 | CSGTree(const MatrixFr& vertices, const MatrixIr& faces) : |
| 21 | m_vertices(vertices), m_faces(faces) {} |
| 22 | virtual ~CSGTree() = default; |
| 23 | |
| 24 | public: |
| 25 | void set_operand_1(Ptr tree) { m_tree_1 = tree; } |
| 26 | void set_operand_2(Ptr tree) { m_tree_2 = tree; } |
| 27 | |
| 28 | public: |
| 29 | virtual void compute_union() =0; |
| 30 | virtual void compute_intersection() =0; |
| 31 | virtual void compute_difference() =0; |
| 32 | virtual void compute_symmetric_difference() =0; |
| 33 | virtual VectorI get_face_sources() const { |
| 34 | return VectorI::Zero(0); |
| 35 | }; |
| 36 | virtual VectorI get_mesh_sources() const { |
| 37 | return VectorI::Zero(0); |
| 38 | } |
| 39 | virtual MatrixFr get_vertices() const { return m_vertices; } |
| 40 | virtual MatrixIr get_faces() const { return m_faces; } |
| 41 | virtual size_t get_num_vertices() const { return m_vertices.rows(); } |
| 42 | virtual size_t get_num_faces() const { return m_faces.rows(); } |
| 43 | |
| 44 | protected: |
| 45 | MatrixFr m_vertices; |
| 46 | MatrixIr m_faces; |
| 47 | |
| 48 | Ptr m_tree_1; |
| 49 | Ptr m_tree_2; |
| 50 | }; |
| 51 | |
| 52 | } |
no outgoing calls
no test coverage detected