OrcaSlicer latest
OrcaSlicer
Loading...
Searching...
No Matches
Slic3r::MeshBoolean Namespace Reference

Namespaces

namespace  cgal
namespace  mcut

Typedefs

using MapMatrixXfUnaligned = Eigen::Map<const Eigen::Matrix<float, Eigen::Dynamic, Eigen::Dynamic, Eigen::RowMajor | Eigen::DontAlign>>
using MapMatrixXiUnaligned = Eigen::Map<const Eigen::Matrix<int, Eigen::Dynamic, Eigen::Dynamic, Eigen::RowMajor | Eigen::DontAlign>>
using EigenMesh = std::pair<Eigen::MatrixXd, Eigen::MatrixXi>

Functions

TriangleMesh eigen_to_triangle_mesh (const EigenMesh &emesh)
EigenMesh triangle_mesh_to_eigen (const TriangleMesh &mesh)
void minus (EigenMesh &A, const EigenMesh &B)
void minus (TriangleMesh &A, const TriangleMesh &B)
void self_union (EigenMesh &A)
void self_union (TriangleMesh &mesh)

Typedef Documentation

◆ EigenMesh

using Slic3r::MeshBoolean::EigenMesh = std::pair<Eigen::MatrixXd, Eigen::MatrixXi>

◆ MapMatrixXfUnaligned

using Slic3r::MeshBoolean::MapMatrixXfUnaligned = Eigen::Map<const Eigen::Matrix<float, Eigen::Dynamic, Eigen::Dynamic, Eigen::RowMajor | Eigen::DontAlign>>

◆ MapMatrixXiUnaligned

using Slic3r::MeshBoolean::MapMatrixXiUnaligned = Eigen::Map<const Eigen::Matrix<int, Eigen::Dynamic, Eigen::Dynamic, Eigen::RowMajor | Eigen::DontAlign>>

Function Documentation

◆ eigen_to_triangle_mesh()

TriangleMesh Slic3r::MeshBoolean::eigen_to_triangle_mesh ( const EigenMesh & emesh)
74{
75 auto &VC = emesh.first; auto &FC = emesh.second;
76
77 indexed_triangle_set its;
78 its.vertices.reserve(size_t(VC.rows()));
79 its.indices.reserve(size_t(FC.rows()));
80
81 for (Eigen::Index i = 0; i < VC.rows(); ++i)
82 its.vertices.emplace_back(VC.row(i).cast<float>());
83
84 for (Eigen::Index i = 0; i < FC.rows(); ++i)
85 its.indices.emplace_back(FC.row(i));
86
87 return TriangleMesh { std::move(its) };
88}
Definition TriangleMesh.hpp:94

Referenced by minus(), and self_union().

Here is the caller graph for this function:

◆ minus() [1/2]

void Slic3r::MeshBoolean::minus ( EigenMesh & A,
const EigenMesh & B )
104{
105 auto &[VA, FA] = A;
106 auto &[VB, FB] = B;
107
108 Eigen::MatrixXd VC;
109 Eigen::MatrixXi FC;
110 igl::MeshBooleanType boolean_type(igl::MESH_BOOLEAN_TYPE_MINUS);
111 igl::copyleft::cgal::mesh_boolean(VA, FA, VB, FB, boolean_type, VC, FC);
112
113 VA = std::move(VC); FA = std::move(FC);
114}

Referenced by minus().

Here is the caller graph for this function:

◆ minus() [2/2]

void Slic3r::MeshBoolean::minus ( TriangleMesh & A,
const TriangleMesh & B )
117{
121}
EigenMesh triangle_mesh_to_eigen(const TriangleMesh &mesh)
Definition MeshBoolean.cpp:90
std::pair< Eigen::MatrixXd, Eigen::MatrixXi > EigenMesh
Definition MeshBoolean.hpp:20
void minus(EigenMesh &A, const EigenMesh &B)
Definition MeshBoolean.cpp:103
TriangleMesh eigen_to_triangle_mesh(const EigenMesh &emesh)
Definition MeshBoolean.cpp:73

References eigen_to_triangle_mesh(), minus(), and triangle_mesh_to_eigen().

Here is the call graph for this function:

◆ self_union() [1/2]

void Slic3r::MeshBoolean::self_union ( EigenMesh & A)
124{
125 EigenMesh result;
126 auto &[V, F] = A;
127 auto &[VC, FC] = result;
128
129 igl::MeshBooleanType boolean_type(igl::MESH_BOOLEAN_TYPE_UNION);
130 igl::copyleft::cgal::mesh_boolean(V, F, Eigen::MatrixXd(), Eigen::MatrixXi(), boolean_type, VC, FC);
131
132 A = std::move(result);
133}
@ F
Definition libslic3r.h:145

References Slic3r::F.

Referenced by self_union().

Here is the caller graph for this function:

◆ self_union() [2/2]

void Slic3r::MeshBoolean::self_union ( TriangleMesh & mesh)
136{
137 auto eM = triangle_mesh_to_eigen(mesh);
138 self_union(eM);
139 mesh = eigen_to_triangle_mesh(eM);
140}
void self_union(EigenMesh &A)
Definition MeshBoolean.cpp:123

References eigen_to_triangle_mesh(), self_union(), and triangle_mesh_to_eigen().

Here is the call graph for this function:

◆ triangle_mesh_to_eigen()

EigenMesh Slic3r::MeshBoolean::triangle_mesh_to_eigen ( const TriangleMesh & mesh)
91{
92 EigenMesh emesh;
93 emesh.first = MapMatrixXfUnaligned(mesh.its.vertices.front().data(),
94 Eigen::Index(mesh.its.vertices.size()),
95 3).cast<double>();
96
97 emesh.second = MapMatrixXiUnaligned(mesh.its.indices.front().data(),
98 Eigen::Index(mesh.its.indices.size()),
99 3);
100 return emesh;
101}
indexed_triangle_set its
Definition TriangleMesh.hpp:164
Eigen::Map< const Eigen::Matrix< float, Eigen::Dynamic, Eigen::Dynamic, Eigen::RowMajor|Eigen::DontAlign > > MapMatrixXfUnaligned
Definition MeshBoolean.cpp:70
Eigen::Map< const Eigen::Matrix< int, Eigen::Dynamic, Eigen::Dynamic, Eigen::RowMajor|Eigen::DontAlign > > MapMatrixXiUnaligned
Definition MeshBoolean.cpp:71

References Slic3r::TriangleMesh::its.

Referenced by minus(), and self_union().

Here is the caller graph for this function: