ENH: mcut: disable debug related logic
found a crash in dump_mesh, disable debug currently Change-Id: I9f210ce074333e95233af08d3e782546107091dd
This commit is contained in:
parent
f4a9eeb9d3
commit
dbcfec8a32
|
@ -37,17 +37,17 @@ using MapMatrixXiUnaligned = Eigen::Map<const Eigen::Matrix<int, Eigen::Dynami
|
||||||
TriangleMesh eigen_to_triangle_mesh(const EigenMesh &emesh)
|
TriangleMesh eigen_to_triangle_mesh(const EigenMesh &emesh)
|
||||||
{
|
{
|
||||||
auto &VC = emesh.first; auto &FC = emesh.second;
|
auto &VC = emesh.first; auto &FC = emesh.second;
|
||||||
|
|
||||||
indexed_triangle_set its;
|
indexed_triangle_set its;
|
||||||
its.vertices.reserve(size_t(VC.rows()));
|
its.vertices.reserve(size_t(VC.rows()));
|
||||||
its.indices.reserve(size_t(FC.rows()));
|
its.indices.reserve(size_t(FC.rows()));
|
||||||
|
|
||||||
for (Eigen::Index i = 0; i < VC.rows(); ++i)
|
for (Eigen::Index i = 0; i < VC.rows(); ++i)
|
||||||
its.vertices.emplace_back(VC.row(i).cast<float>());
|
its.vertices.emplace_back(VC.row(i).cast<float>());
|
||||||
|
|
||||||
for (Eigen::Index i = 0; i < FC.rows(); ++i)
|
for (Eigen::Index i = 0; i < FC.rows(); ++i)
|
||||||
its.indices.emplace_back(FC.row(i));
|
its.indices.emplace_back(FC.row(i));
|
||||||
|
|
||||||
return TriangleMesh { std::move(its) };
|
return TriangleMesh { std::move(its) };
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -68,12 +68,12 @@ void minus(EigenMesh &A, const EigenMesh &B)
|
||||||
{
|
{
|
||||||
auto &[VA, FA] = A;
|
auto &[VA, FA] = A;
|
||||||
auto &[VB, FB] = B;
|
auto &[VB, FB] = B;
|
||||||
|
|
||||||
Eigen::MatrixXd VC;
|
Eigen::MatrixXd VC;
|
||||||
Eigen::MatrixXi FC;
|
Eigen::MatrixXi FC;
|
||||||
igl::MeshBooleanType boolean_type(igl::MESH_BOOLEAN_TYPE_MINUS);
|
igl::MeshBooleanType boolean_type(igl::MESH_BOOLEAN_TYPE_MINUS);
|
||||||
igl::copyleft::cgal::mesh_boolean(VA, FA, VB, FB, boolean_type, VC, FC);
|
igl::copyleft::cgal::mesh_boolean(VA, FA, VB, FB, boolean_type, VC, FC);
|
||||||
|
|
||||||
VA = std::move(VC); FA = std::move(FC);
|
VA = std::move(VC); FA = std::move(FC);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -92,7 +92,7 @@ void self_union(EigenMesh &A)
|
||||||
|
|
||||||
igl::MeshBooleanType boolean_type(igl::MESH_BOOLEAN_TYPE_UNION);
|
igl::MeshBooleanType boolean_type(igl::MESH_BOOLEAN_TYPE_UNION);
|
||||||
igl::copyleft::cgal::mesh_boolean(V, F, Eigen::MatrixXd(), Eigen::MatrixXi(), boolean_type, VC, FC);
|
igl::copyleft::cgal::mesh_boolean(V, F, Eigen::MatrixXd(), Eigen::MatrixXi(), boolean_type, VC, FC);
|
||||||
|
|
||||||
A = std::move(result);
|
A = std::move(result);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -195,7 +195,7 @@ indexed_triangle_set cgal_to_indexed_triangle_set(const _Mesh &cgalmesh)
|
||||||
indexed_triangle_set its;
|
indexed_triangle_set its;
|
||||||
its.vertices.reserve(cgalmesh.num_vertices());
|
its.vertices.reserve(cgalmesh.num_vertices());
|
||||||
its.indices.reserve(cgalmesh.num_faces());
|
its.indices.reserve(cgalmesh.num_faces());
|
||||||
|
|
||||||
const auto &faces = cgalmesh.faces();
|
const auto &faces = cgalmesh.faces();
|
||||||
const auto &vertices = cgalmesh.vertices();
|
const auto &vertices = cgalmesh.vertices();
|
||||||
int vsize = int(vertices.size());
|
int vsize = int(vertices.size());
|
||||||
|
@ -219,7 +219,7 @@ indexed_triangle_set cgal_to_indexed_triangle_set(const _Mesh &cgalmesh)
|
||||||
if (i == 3)
|
if (i == 3)
|
||||||
its.indices.emplace_back(facet);
|
its.indices.emplace_back(facet);
|
||||||
}
|
}
|
||||||
|
|
||||||
return its;
|
return its;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -343,7 +343,7 @@ void segment(CGALMesh& src, std::vector<CGALMesh>& dst, double smoothing_alpha =
|
||||||
//if (id > 2) {
|
//if (id > 2) {
|
||||||
// mesh_merged.join(out);
|
// mesh_merged.join(out);
|
||||||
//}
|
//}
|
||||||
//else
|
//else
|
||||||
{
|
{
|
||||||
dst.emplace_back(std::move(CGALMesh(out)));
|
dst.emplace_back(std::move(CGALMesh(out)));
|
||||||
}
|
}
|
||||||
|
@ -401,9 +401,9 @@ template<class Op> void _mesh_boolean_do(Op &&op, indexed_triangle_set &A, const
|
||||||
CGALMesh meshB;
|
CGALMesh meshB;
|
||||||
triangle_mesh_to_cgal(A.vertices, A.indices, meshA.m);
|
triangle_mesh_to_cgal(A.vertices, A.indices, meshA.m);
|
||||||
triangle_mesh_to_cgal(B.vertices, B.indices, meshB.m);
|
triangle_mesh_to_cgal(B.vertices, B.indices, meshB.m);
|
||||||
|
|
||||||
_cgal_do(op, meshA, meshB);
|
_cgal_do(op, meshA, meshB);
|
||||||
|
|
||||||
A = cgal_to_indexed_triangle_set(meshA.m);
|
A = cgal_to_indexed_triangle_set(meshA.m);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -617,14 +617,14 @@ void do_boolean(McutMesh &srcMesh, const McutMesh &cutMesh, const std::string &b
|
||||||
{
|
{
|
||||||
// create context
|
// create context
|
||||||
McContext context = MC_NULL_HANDLE;
|
McContext context = MC_NULL_HANDLE;
|
||||||
McResult err = mcCreateContext(&context, static_cast<McFlags>(MC_DEBUG));
|
McResult err = mcCreateContext(&context, 0);
|
||||||
// add debug callback according to https://cutdigital.github.io/mcut.site/tutorials/debugging/
|
// add debug callback according to https://cutdigital.github.io/mcut.site/tutorials/debugging/
|
||||||
mcDebugMessageCallback(context, mcDebugOutput, nullptr);
|
mcDebugMessageCallback(context, mcDebugOutput, nullptr);
|
||||||
mcDebugMessageControl(
|
mcDebugMessageControl(
|
||||||
context,
|
context,
|
||||||
MC_DEBUG_SOURCE_ALL,
|
MC_DEBUG_SOURCE_ALL,
|
||||||
MC_DEBUG_TYPE_ALL,
|
MC_DEBUG_TYPE_ERROR,
|
||||||
MC_DEBUG_SEVERITY_ALL,
|
MC_DEBUG_SEVERITY_MEDIUM,
|
||||||
true);
|
true);
|
||||||
// We can either let MCUT compute all possible meshes (including patches etc.), or we can
|
// We can either let MCUT compute all possible meshes (including patches etc.), or we can
|
||||||
// constrain the library to compute exactly the boolean op mesh we want. This 'constrained' case
|
// constrain the library to compute exactly the boolean op mesh we want. This 'constrained' case
|
||||||
|
@ -773,14 +773,14 @@ std::vector<TriangleMesh> make_boolean(const McutMesh &srcMesh, const McutMesh &
|
||||||
{
|
{
|
||||||
// create context
|
// create context
|
||||||
McContext context = MC_NULL_HANDLE;
|
McContext context = MC_NULL_HANDLE;
|
||||||
McResult err = mcCreateContext(&context, static_cast<McFlags>(MC_DEBUG));
|
McResult err = mcCreateContext(&context, 0);
|
||||||
// add debug callback according to https://cutdigital.github.io/mcut.site/tutorials/debugging/
|
// add debug callback according to https://cutdigital.github.io/mcut.site/tutorials/debugging/
|
||||||
mcDebugMessageCallback(context, mcDebugOutput, nullptr);
|
mcDebugMessageCallback(context, mcDebugOutput, nullptr);
|
||||||
mcDebugMessageControl(
|
mcDebugMessageControl(
|
||||||
context,
|
context,
|
||||||
MC_DEBUG_SOURCE_ALL,
|
MC_DEBUG_SOURCE_ALL,
|
||||||
MC_DEBUG_TYPE_ALL,
|
MC_DEBUG_TYPE_ERROR,
|
||||||
MC_DEBUG_SEVERITY_ALL,
|
MC_DEBUG_SEVERITY_MEDIUM,
|
||||||
true);
|
true);
|
||||||
// We can either let MCUT compute all possible meshes (including patches etc.), or we can
|
// We can either let MCUT compute all possible meshes (including patches etc.), or we can
|
||||||
// constrain the library to compute exactly the boolean op mesh we want. This 'constrained' case
|
// constrain the library to compute exactly the boolean op mesh we want. This 'constrained' case
|
||||||
|
|
Loading…
Reference in New Issue