From dbcfec8a32041eeaa173646dfe27938143bd048f Mon Sep 17 00:00:00 2001 From: "lane.wei" Date: Tue, 1 Aug 2023 15:35:18 +0800 Subject: [PATCH] ENH: mcut: disable debug related logic found a crash in dump_mesh, disable debug currently Change-Id: I9f210ce074333e95233af08d3e782546107091dd --- src/libslic3r/MeshBoolean.cpp | 36 +++++++++++++++++------------------ 1 file changed, 18 insertions(+), 18 deletions(-) diff --git a/src/libslic3r/MeshBoolean.cpp b/src/libslic3r/MeshBoolean.cpp index 2a36f5465..5e8a83fe5 100644 --- a/src/libslic3r/MeshBoolean.cpp +++ b/src/libslic3r/MeshBoolean.cpp @@ -37,17 +37,17 @@ using MapMatrixXiUnaligned = Eigen::Map()); - + for (Eigen::Index i = 0; i < FC.rows(); ++i) its.indices.emplace_back(FC.row(i)); - + return TriangleMesh { std::move(its) }; } @@ -68,12 +68,12 @@ void minus(EigenMesh &A, const EigenMesh &B) { auto &[VA, FA] = A; auto &[VB, FB] = B; - + Eigen::MatrixXd VC; Eigen::MatrixXi FC; igl::MeshBooleanType boolean_type(igl::MESH_BOOLEAN_TYPE_MINUS); igl::copyleft::cgal::mesh_boolean(VA, FA, VB, FB, boolean_type, VC, 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::copyleft::cgal::mesh_boolean(V, F, Eigen::MatrixXd(), Eigen::MatrixXi(), boolean_type, VC, FC); - + A = std::move(result); } @@ -195,7 +195,7 @@ indexed_triangle_set cgal_to_indexed_triangle_set(const _Mesh &cgalmesh) indexed_triangle_set its; its.vertices.reserve(cgalmesh.num_vertices()); its.indices.reserve(cgalmesh.num_faces()); - + const auto &faces = cgalmesh.faces(); const auto &vertices = cgalmesh.vertices(); int vsize = int(vertices.size()); @@ -219,7 +219,7 @@ indexed_triangle_set cgal_to_indexed_triangle_set(const _Mesh &cgalmesh) if (i == 3) its.indices.emplace_back(facet); } - + return its; } @@ -343,7 +343,7 @@ void segment(CGALMesh& src, std::vector& dst, double smoothing_alpha = //if (id > 2) { // mesh_merged.join(out); //} - //else + //else { dst.emplace_back(std::move(CGALMesh(out))); } @@ -401,9 +401,9 @@ template void _mesh_boolean_do(Op &&op, indexed_triangle_set &A, const CGALMesh meshB; triangle_mesh_to_cgal(A.vertices, A.indices, meshA.m); triangle_mesh_to_cgal(B.vertices, B.indices, meshB.m); - + _cgal_do(op, meshA, meshB); - + 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 McContext context = MC_NULL_HANDLE; - McResult err = mcCreateContext(&context, static_cast(MC_DEBUG)); + McResult err = mcCreateContext(&context, 0); // add debug callback according to https://cutdigital.github.io/mcut.site/tutorials/debugging/ mcDebugMessageCallback(context, mcDebugOutput, nullptr); mcDebugMessageControl( context, MC_DEBUG_SOURCE_ALL, - MC_DEBUG_TYPE_ALL, - MC_DEBUG_SEVERITY_ALL, + MC_DEBUG_TYPE_ERROR, + MC_DEBUG_SEVERITY_MEDIUM, true); // 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 @@ -773,14 +773,14 @@ std::vector make_boolean(const McutMesh &srcMesh, const McutMesh & { // create context McContext context = MC_NULL_HANDLE; - McResult err = mcCreateContext(&context, static_cast(MC_DEBUG)); + McResult err = mcCreateContext(&context, 0); // add debug callback according to https://cutdigital.github.io/mcut.site/tutorials/debugging/ mcDebugMessageCallback(context, mcDebugOutput, nullptr); mcDebugMessageControl( context, MC_DEBUG_SOURCE_ALL, - MC_DEBUG_TYPE_ALL, - MC_DEBUG_SEVERITY_ALL, + MC_DEBUG_TYPE_ERROR, + MC_DEBUG_SEVERITY_MEDIUM, true); // 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