PrusaSlicer-NonPlainar/src/libslic3r/MeshBoolean.hpp
tamasmeszaros eb4b24e136 Hollowing: randomize hole mesh translations before unification.
To prevent self intersections in the output mesh.
2020-02-07 16:33:04 +01:00

50 lines
1.3 KiB
C++

#ifndef libslic3r_MeshBoolean_hpp_
#define libslic3r_MeshBoolean_hpp_
#include <memory>
#include <exception>
#include <libslic3r/TriangleMesh.hpp>
#include <Eigen/Geometry>
namespace Slic3r {
namespace MeshBoolean {
using EigenMesh = std::pair<Eigen::MatrixXd, Eigen::MatrixXi>;
TriangleMesh eigen_to_triangle_mesh(const EigenMesh &emesh);
EigenMesh triangle_mesh_to_eigen(const TriangleMesh &mesh);
void minus(EigenMesh &A, const EigenMesh &B);
void self_union(EigenMesh &A);
void minus(TriangleMesh& A, const TriangleMesh& B);
void self_union(TriangleMesh& mesh);
namespace cgal {
struct CGALMesh;
struct CGALMeshDeleter { void operator()(CGALMesh *ptr); };
std::unique_ptr<CGALMesh, CGALMeshDeleter> triangle_mesh_to_cgal(const TriangleMesh &M);
TriangleMesh cgal_to_triangle_mesh(const CGALMesh &cgalmesh);
// Do boolean mesh difference with CGAL bypassing igl.
void minus(TriangleMesh &A, const TriangleMesh &B);
void plus(TriangleMesh &A, const TriangleMesh &B);
void intersect(TriangleMesh &A, const TriangleMesh &B);
void minus(CGALMesh &A, CGALMesh &B);
void plus(CGALMesh &A, CGALMesh &B);
void intersect(CGALMesh &A, CGALMesh &B);
bool does_self_intersect(const TriangleMesh &mesh);
bool does_self_intersect(const CGALMesh &mesh);
}
} // namespace MeshBoolean
} // namespace Slic3r
#endif // libslic3r_MeshBoolean_hpp_