|
@@ -12,15 +12,16 @@
|
|
|
#include "../cgal/assign_scalar.h"
|
|
|
#include "../cgal/propagate_winding_numbers.h"
|
|
|
#include "../cgal/remesh_self_intersections.h"
|
|
|
-#include "../remove_unreferenced.h"
|
|
|
-#include "../unique_simplices.h"
|
|
|
-#include "../slice.h"
|
|
|
+#include "../../remove_unreferenced.h"
|
|
|
+#include "../../unique_simplices.h"
|
|
|
+#include "../../slice.h"
|
|
|
|
|
|
#include <CGAL/Exact_predicates_exact_constructions_kernel.h>
|
|
|
#include <algorithm>
|
|
|
|
|
|
|
|
|
namespace igl {
|
|
|
+ namespace copyleft {
|
|
|
namespace boolean {
|
|
|
namespace mesh_boolean_helper {
|
|
|
typedef CGAL::Epeck Kernel;
|
|
@@ -39,12 +40,12 @@ namespace igl {
|
|
|
Eigen::PlainObjectBase<DerivedFo>& Fo,
|
|
|
Eigen::PlainObjectBase<DerivedJ>& J) {
|
|
|
Eigen::VectorXi I;
|
|
|
- igl::cgal::RemeshSelfIntersectionsParam params;
|
|
|
+ igl::copyleft::cgal::RemeshSelfIntersectionsParam params;
|
|
|
|
|
|
DerivedVo Vr;
|
|
|
DerivedFo Fr;
|
|
|
Eigen::MatrixXi IF;
|
|
|
- igl::cgal::remesh_self_intersections(V, F, params, Vr, Fr, IF, J, I);
|
|
|
+ igl::copyleft::cgal::remesh_self_intersections(V, F, params, Vr, Fr, IF, J, I);
|
|
|
assert(I.size() == Vr.rows());
|
|
|
|
|
|
// Merge coinciding vertices into non-manifold vertices.
|
|
@@ -164,6 +165,7 @@ namespace igl {
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
template <
|
|
@@ -177,7 +179,7 @@ typename ResolveFunc,
|
|
|
typename DerivedVC,
|
|
|
typename DerivedFC,
|
|
|
typename DerivedJ>
|
|
|
-IGL_INLINE void igl::boolean::per_face_winding_number_binary_operation(
|
|
|
+IGL_INLINE void igl::copyleft::boolean::per_face_winding_number_binary_operation(
|
|
|
const Eigen::PlainObjectBase<DerivedVA> & VA,
|
|
|
const Eigen::PlainObjectBase<DerivedFA> & FA,
|
|
|
const Eigen::PlainObjectBase<DerivedVB> & VB,
|
|
@@ -188,7 +190,7 @@ IGL_INLINE void igl::boolean::per_face_winding_number_binary_operation(
|
|
|
Eigen::PlainObjectBase<DerivedVC > & VC,
|
|
|
Eigen::PlainObjectBase<DerivedFC > & FC,
|
|
|
Eigen::PlainObjectBase<DerivedJ > & J) {
|
|
|
- using namespace igl::boolean::mesh_boolean_helper;
|
|
|
+ using namespace igl::copyleft::boolean::mesh_boolean_helper;
|
|
|
|
|
|
typedef typename DerivedVC::Scalar Scalar;
|
|
|
typedef typename DerivedFC::Scalar Index;
|
|
@@ -213,7 +215,7 @@ IGL_INLINE void igl::boolean::per_face_winding_number_binary_operation(
|
|
|
Eigen::VectorXi labels(num_faces);
|
|
|
std::transform(CJ.data(), CJ.data()+CJ.size(), labels.data(),
|
|
|
[&](int i) { return i<FA.rows() ? 0:1; });
|
|
|
- igl::cgal::propagate_winding_numbers(V, F, labels, W);
|
|
|
+ igl::copyleft::cgal::propagate_winding_numbers(V, F, labels, W);
|
|
|
assert(W.rows() == num_faces);
|
|
|
if (W.cols() == 2) {
|
|
|
assert(FB.rows() == 0);
|
|
@@ -275,7 +277,7 @@ IGL_INLINE void igl::boolean::per_face_winding_number_binary_operation(
|
|
|
MatrixX3S Vs(V.rows(), V.cols());
|
|
|
for (size_t i=0; i<V.rows(); i++) {
|
|
|
for (size_t j=0; j<V.cols(); j++) {
|
|
|
- igl::cgal::assign_scalar(V(i,j), Vs(i,j));
|
|
|
+ igl::copyleft::cgal::assign_scalar(V(i,j), Vs(i,j));
|
|
|
}
|
|
|
}
|
|
|
Eigen::VectorXi newIM;
|
|
@@ -291,7 +293,7 @@ typename DerivedFB,
|
|
|
typename DerivedVC,
|
|
|
typename DerivedFC,
|
|
|
typename DerivedJ>
|
|
|
-IGL_INLINE void igl::boolean::mesh_boolean(
|
|
|
+IGL_INLINE void igl::copyleft::boolean::mesh_boolean(
|
|
|
const Eigen::PlainObjectBase<DerivedVA > & VA,
|
|
|
const Eigen::PlainObjectBase<DerivedFA > & FA,
|
|
|
const Eigen::PlainObjectBase<DerivedVB > & VB,
|
|
@@ -300,7 +302,7 @@ IGL_INLINE void igl::boolean::mesh_boolean(
|
|
|
Eigen::PlainObjectBase<DerivedVC > & VC,
|
|
|
Eigen::PlainObjectBase<DerivedFC > & FC,
|
|
|
Eigen::PlainObjectBase<DerivedJ > & J) {
|
|
|
- using namespace igl::boolean::mesh_boolean_helper;
|
|
|
+ using namespace igl::copyleft::boolean::mesh_boolean_helper;
|
|
|
typedef Eigen::Matrix<
|
|
|
ExactScalar,
|
|
|
Eigen::Dynamic,
|
|
@@ -316,30 +318,30 @@ IGL_INLINE void igl::boolean::mesh_boolean(
|
|
|
|
|
|
switch (type) {
|
|
|
case MESH_BOOLEAN_TYPE_UNION:
|
|
|
- igl::boolean::per_face_winding_number_binary_operation(
|
|
|
- VA, FA, VB, FB, igl::boolean::BinaryUnion(),
|
|
|
- igl::boolean::KeepInside(), resolve_func, VC, FC, J);
|
|
|
+ igl::copyleft::boolean::per_face_winding_number_binary_operation(
|
|
|
+ VA, FA, VB, FB, igl::copyleft::boolean::BinaryUnion(),
|
|
|
+ igl::copyleft::boolean::KeepInside(), resolve_func, VC, FC, J);
|
|
|
break;
|
|
|
case MESH_BOOLEAN_TYPE_INTERSECT:
|
|
|
- igl::boolean::per_face_winding_number_binary_operation(
|
|
|
- VA, FA, VB, FB, igl::boolean::BinaryIntersect(),
|
|
|
- igl::boolean::KeepInside(), resolve_func, VC, FC, J);
|
|
|
+ igl::copyleft::boolean::per_face_winding_number_binary_operation(
|
|
|
+ VA, FA, VB, FB, igl::copyleft::boolean::BinaryIntersect(),
|
|
|
+ igl::copyleft::boolean::KeepInside(), resolve_func, VC, FC, J);
|
|
|
break;
|
|
|
case MESH_BOOLEAN_TYPE_MINUS:
|
|
|
- igl::boolean::per_face_winding_number_binary_operation(
|
|
|
- VA, FA, VB, FB, igl::boolean::BinaryMinus(),
|
|
|
- igl::boolean::KeepInside(), resolve_func, VC, FC, J);
|
|
|
+ igl::copyleft::boolean::per_face_winding_number_binary_operation(
|
|
|
+ VA, FA, VB, FB, igl::copyleft::boolean::BinaryMinus(),
|
|
|
+ igl::copyleft::boolean::KeepInside(), resolve_func, VC, FC, J);
|
|
|
break;
|
|
|
case MESH_BOOLEAN_TYPE_XOR:
|
|
|
- igl::boolean::per_face_winding_number_binary_operation(
|
|
|
- VA, FA, VB, FB, igl::boolean::BinaryXor(),
|
|
|
- igl::boolean::KeepInside(), resolve_func, VC, FC, J);
|
|
|
+ igl::copyleft::boolean::per_face_winding_number_binary_operation(
|
|
|
+ VA, FA, VB, FB, igl::copyleft::boolean::BinaryXor(),
|
|
|
+ igl::copyleft::boolean::KeepInside(), resolve_func, VC, FC, J);
|
|
|
break;
|
|
|
case MESH_BOOLEAN_TYPE_RESOLVE:
|
|
|
//op = binary_resolve();
|
|
|
- igl::boolean::per_face_winding_number_binary_operation(
|
|
|
- VA, FA, VB, FB, igl::boolean::BinaryResolve(),
|
|
|
- igl::boolean::KeepAll(), resolve_func, VC, FC, J);
|
|
|
+ igl::copyleft::boolean::per_face_winding_number_binary_operation(
|
|
|
+ VA, FA, VB, FB, igl::copyleft::boolean::BinaryResolve(),
|
|
|
+ igl::copyleft::boolean::KeepAll(), resolve_func, VC, FC, J);
|
|
|
break;
|
|
|
default:
|
|
|
throw std::runtime_error("Unsupported boolean type.");
|
|
@@ -353,7 +355,7 @@ typename DerivedVB,
|
|
|
typename DerivedFB,
|
|
|
typename DerivedVC,
|
|
|
typename DerivedFC>
|
|
|
-IGL_INLINE void igl::boolean::mesh_boolean(
|
|
|
+IGL_INLINE void igl::copyleft::boolean::mesh_boolean(
|
|
|
const Eigen::PlainObjectBase<DerivedVA > & VA,
|
|
|
const Eigen::PlainObjectBase<DerivedFA > & FA,
|
|
|
const Eigen::PlainObjectBase<DerivedVB > & VB,
|
|
@@ -362,17 +364,17 @@ IGL_INLINE void igl::boolean::mesh_boolean(
|
|
|
Eigen::PlainObjectBase<DerivedVC > & VC,
|
|
|
Eigen::PlainObjectBase<DerivedFC > & FC) {
|
|
|
Eigen::Matrix<typename DerivedFC::Index, Eigen::Dynamic,1> J;
|
|
|
- return igl::boolean::mesh_boolean(VA,FA,VB,FB,type,VC,FC,J);
|
|
|
+ return igl::copyleft::boolean::mesh_boolean(VA,FA,VB,FB,type,VC,FC,J);
|
|
|
}
|
|
|
|
|
|
#ifdef IGL_STATIC_LIBRARY
|
|
|
// Explicit template specialization
|
|
|
-template void igl::boolean::mesh_boolean<Eigen::Matrix<double, -1, -1, 0, -1, -1>, Eigen::Matrix<int, -1, -1, 0, -1, -1>, Eigen::Matrix<double, -1, -1, 0, -1, -1>, Eigen::Matrix<int, -1, -1, 0, -1, -1>, Eigen::Matrix<double, -1, -1, 0, -1, -1>, Eigen::Matrix<int, -1, -1, 0, -1, -1> >(Eigen::PlainObjectBase<Eigen::Matrix<double, -1, -1, 0, -1, -1> > const&, Eigen::PlainObjectBase<Eigen::Matrix<int, -1, -1, 0, -1, -1> > const&, Eigen::PlainObjectBase<Eigen::Matrix<double, -1, -1, 0, -1, -1> > const&, Eigen::PlainObjectBase<Eigen::Matrix<int, -1, -1, 0, -1, -1> > const&, igl::boolean::MeshBooleanType const&, Eigen::PlainObjectBase<Eigen::Matrix<double, -1, -1, 0, -1, -1> >&, Eigen::PlainObjectBase<Eigen::Matrix<int, -1, -1, 0, -1, -1> >&);
|
|
|
-template void igl::boolean::mesh_boolean<Eigen::Matrix<CGAL::Lazy_exact_nt<CGAL::Gmpq>, -1, 3, 0, -1, 3>, Eigen::Matrix<int, -1, -1, 0, -1, -1>, Eigen::Matrix<CGAL::Lazy_exact_nt<CGAL::Gmpq>, -1, 3, 0, -1, 3>, Eigen::Matrix<int, -1, -1, 0, -1, -1>, Eigen::Matrix<CGAL::Lazy_exact_nt<CGAL::Gmpq>, -1, 3, 0, -1, 3>, Eigen::Matrix<int, -1, -1, 0, -1, -1>, Eigen::Matrix<long, -1, 1, 0, -1, 1> >(Eigen::PlainObjectBase<Eigen::Matrix<CGAL::Lazy_exact_nt<CGAL::Gmpq>, -1, 3, 0, -1, 3> > const&, Eigen::PlainObjectBase<Eigen::Matrix<int, -1, -1, 0, -1, -1> > const&, Eigen::PlainObjectBase<Eigen::Matrix<CGAL::Lazy_exact_nt<CGAL::Gmpq>, -1, 3, 0, -1, 3> > const&, Eigen::PlainObjectBase<Eigen::Matrix<int, -1, -1, 0, -1, -1> > const&, igl::boolean::MeshBooleanType const&, Eigen::PlainObjectBase<Eigen::Matrix<CGAL::Lazy_exact_nt<CGAL::Gmpq>, -1, 3, 0, -1, 3> >&, Eigen::PlainObjectBase<Eigen::Matrix<int, -1, -1, 0, -1, -1> >&, Eigen::PlainObjectBase<Eigen::Matrix<long, -1, 1, 0, -1, 1> >&);
|
|
|
-template void igl::boolean::mesh_boolean<Eigen::Matrix<double, -1, -1, 0, -1, -1>, Eigen::Matrix<int, -1, -1, 0, -1, -1>, Eigen::Matrix<double, -1, -1, 0, -1, -1>, Eigen::Matrix<int, -1, -1, 0, -1, -1>, Eigen::Matrix<double, -1, -1, 0, -1, -1>, Eigen::Matrix<int, -1, -1, 0, -1, -1>, Eigen::Matrix<int, -1, 1, 0, -1, 1> >(Eigen::PlainObjectBase<Eigen::Matrix<double, -1, -1, 0, -1, -1> > const&, Eigen::PlainObjectBase<Eigen::Matrix<int, -1, -1, 0, -1, -1> > const&, Eigen::PlainObjectBase<Eigen::Matrix<double, -1, -1, 0, -1, -1> > const&, Eigen::PlainObjectBase<Eigen::Matrix<int, -1, -1, 0, -1, -1> > const&, igl::boolean::MeshBooleanType const&, Eigen::PlainObjectBase<Eigen::Matrix<double, -1, -1, 0, -1, -1> >&, Eigen::PlainObjectBase<Eigen::Matrix<int, -1, -1, 0, -1, -1> >&, Eigen::PlainObjectBase<Eigen::Matrix<int, -1, 1, 0, -1, 1> >&);
|
|
|
+template void igl::copyleft::boolean::mesh_boolean<Eigen::Matrix<double, -1, -1, 0, -1, -1>, Eigen::Matrix<int, -1, -1, 0, -1, -1>, Eigen::Matrix<double, -1, -1, 0, -1, -1>, Eigen::Matrix<int, -1, -1, 0, -1, -1>, Eigen::Matrix<double, -1, -1, 0, -1, -1>, Eigen::Matrix<int, -1, -1, 0, -1, -1> >(Eigen::PlainObjectBase<Eigen::Matrix<double, -1, -1, 0, -1, -1> > const&, Eigen::PlainObjectBase<Eigen::Matrix<int, -1, -1, 0, -1, -1> > const&, Eigen::PlainObjectBase<Eigen::Matrix<double, -1, -1, 0, -1, -1> > const&, Eigen::PlainObjectBase<Eigen::Matrix<int, -1, -1, 0, -1, -1> > const&, igl::copyleft::boolean::MeshBooleanType const&, Eigen::PlainObjectBase<Eigen::Matrix<double, -1, -1, 0, -1, -1> >&, Eigen::PlainObjectBase<Eigen::Matrix<int, -1, -1, 0, -1, -1> >&);
|
|
|
+template void igl::copyleft::boolean::mesh_boolean<Eigen::Matrix<CGAL::Lazy_exact_nt<CGAL::Gmpq>, -1, 3, 0, -1, 3>, Eigen::Matrix<int, -1, -1, 0, -1, -1>, Eigen::Matrix<CGAL::Lazy_exact_nt<CGAL::Gmpq>, -1, 3, 0, -1, 3>, Eigen::Matrix<int, -1, -1, 0, -1, -1>, Eigen::Matrix<CGAL::Lazy_exact_nt<CGAL::Gmpq>, -1, 3, 0, -1, 3>, Eigen::Matrix<int, -1, -1, 0, -1, -1>, Eigen::Matrix<long, -1, 1, 0, -1, 1> >(Eigen::PlainObjectBase<Eigen::Matrix<CGAL::Lazy_exact_nt<CGAL::Gmpq>, -1, 3, 0, -1, 3> > const&, Eigen::PlainObjectBase<Eigen::Matrix<int, -1, -1, 0, -1, -1> > const&, Eigen::PlainObjectBase<Eigen::Matrix<CGAL::Lazy_exact_nt<CGAL::Gmpq>, -1, 3, 0, -1, 3> > const&, Eigen::PlainObjectBase<Eigen::Matrix<int, -1, -1, 0, -1, -1> > const&, igl::copyleft::boolean::MeshBooleanType const&, Eigen::PlainObjectBase<Eigen::Matrix<CGAL::Lazy_exact_nt<CGAL::Gmpq>, -1, 3, 0, -1, 3> >&, Eigen::PlainObjectBase<Eigen::Matrix<int, -1, -1, 0, -1, -1> >&, Eigen::PlainObjectBase<Eigen::Matrix<long, -1, 1, 0, -1, 1> >&);
|
|
|
+template void igl::copyleft::boolean::mesh_boolean<Eigen::Matrix<double, -1, -1, 0, -1, -1>, Eigen::Matrix<int, -1, -1, 0, -1, -1>, Eigen::Matrix<double, -1, -1, 0, -1, -1>, Eigen::Matrix<int, -1, -1, 0, -1, -1>, Eigen::Matrix<double, -1, -1, 0, -1, -1>, Eigen::Matrix<int, -1, -1, 0, -1, -1>, Eigen::Matrix<int, -1, 1, 0, -1, 1> >(Eigen::PlainObjectBase<Eigen::Matrix<double, -1, -1, 0, -1, -1> > const&, Eigen::PlainObjectBase<Eigen::Matrix<int, -1, -1, 0, -1, -1> > const&, Eigen::PlainObjectBase<Eigen::Matrix<double, -1, -1, 0, -1, -1> > const&, Eigen::PlainObjectBase<Eigen::Matrix<int, -1, -1, 0, -1, -1> > const&, igl::copyleft::boolean::MeshBooleanType const&, Eigen::PlainObjectBase<Eigen::Matrix<double, -1, -1, 0, -1, -1> >&, Eigen::PlainObjectBase<Eigen::Matrix<int, -1, -1, 0, -1, -1> >&, Eigen::PlainObjectBase<Eigen::Matrix<int, -1, 1, 0, -1, 1> >&);
|
|
|
#undef IGL_STATIC_LIBRARY
|
|
|
-#include "../remove_unreferenced.cpp"
|
|
|
+#include "../../remove_unreferenced.cpp"
|
|
|
template void igl::remove_unreferenced<Eigen::Matrix<CGAL::Lazy_exact_nt<CGAL::Gmpq>, -1, 3, 0, -1, 3>, Eigen::Matrix<int, -1, -1, 0, -1, -1>, Eigen::Matrix<CGAL::Lazy_exact_nt<CGAL::Gmpq>, -1, 3, 0, -1, 3>, Eigen::Matrix<int, -1, -1, 0, -1, -1>, Eigen::Matrix<int, -1, 1, 0, -1, 1> >(Eigen::PlainObjectBase<Eigen::Matrix<CGAL::Lazy_exact_nt<CGAL::Gmpq>, -1, 3, 0, -1, 3> > const&, Eigen::PlainObjectBase<Eigen::Matrix<int, -1, -1, 0, -1, -1> > const&, Eigen::PlainObjectBase<Eigen::Matrix<CGAL::Lazy_exact_nt<CGAL::Gmpq>, -1, 3, 0, -1, 3> >&, Eigen::PlainObjectBase<Eigen::Matrix<int, -1, -1, 0, -1, -1> >&, Eigen::PlainObjectBase<Eigen::Matrix<int, -1, 1, 0, -1, 1> >&);
|
|
|
-#include "../slice.cpp"
|
|
|
+#include "../../slice.cpp"
|
|
|
template void igl::slice<Eigen::PlainObjectBase<Eigen::Matrix<CGAL::Lazy_exact_nt<CGAL::Gmpq>, -1, 3, 0, -1, 3> >, Eigen::Matrix<int, -1, 1, 0, -1, 1>, Eigen::PlainObjectBase<Eigen::Matrix<CGAL::Lazy_exact_nt<CGAL::Gmpq>, -1, 3, 0, -1, 3> > >(Eigen::PlainObjectBase<Eigen::Matrix<CGAL::Lazy_exact_nt<CGAL::Gmpq>, -1, 3, 0, -1, 3> > const&, Eigen::PlainObjectBase<Eigen::Matrix<int, -1, 1, 0, -1, 1> > const&, int, Eigen::PlainObjectBase<Eigen::Matrix<CGAL::Lazy_exact_nt<CGAL::Gmpq>, -1, 3, 0, -1, 3> >&);
|
|
|
#endif
|