mirror of
https://github.com/SoftFever/OrcaSlicer.git
synced 2025-07-27 00:24:00 -06:00
Handle CGAL exceptions and add tests for mesh boolean operations
Add conversion to exact predicates exact construction kernel format for consecutive booleans (experiments)
This commit is contained in:
parent
6f777264a1
commit
bd76c345f2
6 changed files with 231 additions and 128 deletions
|
@ -2,13 +2,23 @@
|
|||
#define libslic3r_MeshBoolean_hpp_
|
||||
|
||||
#include <memory>
|
||||
#include <exception>
|
||||
|
||||
#include <libslic3r/TriangleMesh.hpp>
|
||||
#include <Eigen/Geometry>
|
||||
|
||||
namespace Slic3r {
|
||||
|
||||
class TriangleMesh;
|
||||
|
||||
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);
|
||||
|
||||
|
@ -16,20 +26,22 @@ namespace cgal {
|
|||
|
||||
struct CGALMesh;
|
||||
|
||||
std::unique_ptr<CGALMesh> triangle_mesh_to_cgal(const TriangleMesh &M);
|
||||
void cgal_to_triangle_mesh(const CGALMesh &cgalmesh, TriangleMesh &out);
|
||||
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);
|
||||
|
||||
// Do self union only with CGAL.
|
||||
void self_union(TriangleMesh& mesh);
|
||||
|
||||
// does A = A - B
|
||||
// CGAL takes non-const objects as arguments. I suppose it doesn't change B but
|
||||
// there is no official garantee.
|
||||
void minus(CGALMesh &A, CGALMesh &B);
|
||||
void self_union(CGALMesh &A);
|
||||
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);
|
||||
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue