8#ifndef IGL_COPYLEFT_CGAL_CSG_TREE_H
9#define IGL_COPYLEFT_CGAL_CSG_TREE_H
11#include "../../MeshBooleanType.h"
14#include <CGAL/Exact_predicates_exact_constructions_kernel.h>
15#include <CGAL/number_utils.h>
31 typedef Eigen::MatrixXi
POBF;
32 typedef Eigen::Matrix<ExactScalar,Eigen::Dynamic,3>
MatrixX3E;
43 size_t m_number_of_birth_faces;
59 m_number_of_birth_faces(other.m_number_of_birth_faces)
67 swap(first.m_V,second.m_V);
70 swap(first.m_F,second.m_F);
71 swap(first.m_J,second.m_J);
72 swap(first.m_number_of_birth_faces,second.m_number_of_birth_faces);
99 std::for_each(m_J.data(),m_J.data()+m_J.size(),
100 [&](
typename VectorJ::Scalar & j) ->
void
107 assert(j<(A.F().rows()+B.F().rows()));
108 j = A.number_of_birth_faces()+(B.J()(j-A.F().rows()));
111 m_number_of_birth_faces =
112 A.number_of_birth_faces() + B.number_of_birth_faces();
118 const std::string & s):
128 template <
typename DerivedV>
129 CSGTree(
const Eigen::PlainObjectBase<DerivedV> & V,
const POBF & F)
134 m_V = V.template cast<ExactScalar>();
137 m_number_of_birth_faces = m_F.rows();
139 m_J = VectorJ::LinSpaced(
140 m_number_of_birth_faces,0,m_number_of_birth_faces-1);
150 template <
typename DerivedV>
154 dV.resize(m_V.rows(),m_V.cols());
155 for(
int i = 0;i<m_V.rows();i++)
157 for(
int j = 0;j<m_V.cols();j++)
159 dV(i,j) = CGAL::to_double(m_V(i,j));
179 return m_number_of_birth_faces;
Class for defining and computing a constructive solid geometry result out of a tree of boolean operat...
Definition CSGTree.h:27
const size_t & number_of_birth_faces() const
Definition CSGTree.h:177
CSGTree(const CSGTree &A, const CSGTree &B, const std::string &s)
This is an overloaded member function, provided for convenience. It differs from the above function o...
Definition CSGTree.h:115
CGAL::Epeck::FT ExactScalar
Definition CSGTree.h:29
CSGTree(const Eigen::PlainObjectBase< DerivedV > &V, const POBF &F)
"Leaf" node with identity operation on assumed "solid" mesh (V,F)
Definition CSGTree.h:129
CSGTree & operator=(CSGTree other)
Definition CSGTree.h:75
const POBF & F() const
Definition CSGTree.h:165
friend void swap(CSGTree &first, CSGTree &second)
Definition CSGTree.h:63
CSGTree(CSGTree &&other)
Definition CSGTree.h:80
CSGTree(const CSGTree &other)
Definition CSGTree.h:51
DerivedV cast_V() const
Definition CSGTree.h:151
const MatrixX3E & V() const
Definition CSGTree.h:144
Eigen::VectorXi VectorJ
Definition CSGTree.h:33
CSGTree()
Definition CSGTree.h:45
CSGTree(const CSGTree &A, const CSGTree &B, const MeshBooleanType &type)
Construct and compute a boolean operation on existing CSGTree nodes.
Definition CSGTree.h:91
Eigen::MatrixXi POBF
Definition CSGTree.h:31
const VectorJ & J() const
Definition CSGTree.h:172
Eigen::Matrix< ExactScalar, Eigen::Dynamic, 3 > MatrixX3E
Definition CSGTree.h:32
bool mesh_boolean(const Eigen::MatrixBase< DerivedVA > &VA, const Eigen::MatrixBase< DerivedFA > &FA, const Eigen::MatrixBase< DerivedVB > &VB, const Eigen::MatrixBase< DerivedFB > &FB, const MeshBooleanType &type, Eigen::PlainObjectBase< DerivedVC > &VC, Eigen::PlainObjectBase< DerivedFC > &FC, Eigen::PlainObjectBase< DerivedJ > &J)
Compute Boolean csg operations on "solid", consistently oriented meshes.
bool string_to_mesh_boolean_type(const std::string &s, MeshBooleanType &type)
Convert string to boolean type.
MeshBooleanType
Boolean operation types.
Definition MeshBooleanType.h:14