Loading src/MeshImprovement.cpp +43 −0 Original line number Diff line number Diff line Loading @@ -1381,6 +1381,49 @@ void floatTetWild::filter_outside(Mesh& mesh, bool invert_faces) { } } void floatTetWild::filter_outside_floodfill(Mesh& mesh, bool invert_faces) { auto &tets = mesh.tets; auto &tet_vertices = mesh.tet_vertices; std::queue<int> t_queue; for (int i = 0; i < tets.size(); i++) { if (tets[i].is_removed) continue; for (int j = 0; j < 4; j++) { if (tets[i].is_bbox_fs[j] != NOT_BBOX) { t_queue.push(i); tets[i].is_removed = true; break; } } } while (!t_queue.empty()) { int t_id = t_queue.front(); t_queue.pop(); for (int j = 0; j < 4; j++) { if (tets[t_id].is_bbox_fs[j] != NOT_BBOX || tets[t_id].is_surface_fs[j] != NOT_SURFACE) continue; int n_t_id = get_opp_t_id(mesh, t_id, j); if (n_t_id < 0 || tets[n_t_id].is_removed) continue; tets[n_t_id].is_removed = true; t_queue.push(n_t_id); } for (int j = 0; j < 4; j++) { vector_erase(tet_vertices[tets[t_id][j]].conn_tets, t_id); } } for (int i = 0; i < tet_vertices.size(); i++) { if (tet_vertices[i].is_removed) continue; if (tet_vertices[i].conn_tets.empty()) tet_vertices[i].is_removed = true; } } void floatTetWild::mark_outside(Mesh& mesh, bool invert_faces){ Eigen::MatrixXd C(mesh.get_t_num(), 3); C.setZero(); Loading src/MeshImprovement.h +1 −0 Original line number Diff line number Diff line Loading @@ -29,6 +29,7 @@ namespace floatTetWild { void boolean_operation(Mesh& mesh, int op); void boolean_operation(Mesh& mesh, const json &csg_tree_with_ids); void filter_outside(Mesh& mesh, bool invert_faces = false); void filter_outside_floodfill(Mesh& mesh, bool invert_faces = false); void mark_outside(Mesh& mesh, bool invert_faces = false); void smooth_open_boundary(Mesh& mesh, const AABBWrapper& tree); void smooth_open_boundary_aux(Mesh& mesh, const AABBWrapper& tree); Loading src/main.cpp +8 −2 Original line number Diff line number Diff line Loading @@ -210,6 +210,8 @@ int main(int argc, char **argv) { bool disable_wn = false; command_line.add_flag("--disable-wn", disable_wn, "Disable winding number."); bool use_floodfill = false; command_line.add_flag("--use-floodfill", use_floodfill, "Use flood-fill to extract interior volume."); #ifdef LIBIGL_WITH_TETGEN Loading Loading @@ -427,10 +429,14 @@ int main(int argc, char **argv) { t.is_removed = true; } } else { if(!disable_wn) if(!disable_wn) { if(use_floodfill) { filter_outside_floodfill(mesh); } else filter_outside(mesh); } } } if(params.manifold_surface){ manifold_surface(mesh); } Loading Loading
src/MeshImprovement.cpp +43 −0 Original line number Diff line number Diff line Loading @@ -1381,6 +1381,49 @@ void floatTetWild::filter_outside(Mesh& mesh, bool invert_faces) { } } void floatTetWild::filter_outside_floodfill(Mesh& mesh, bool invert_faces) { auto &tets = mesh.tets; auto &tet_vertices = mesh.tet_vertices; std::queue<int> t_queue; for (int i = 0; i < tets.size(); i++) { if (tets[i].is_removed) continue; for (int j = 0; j < 4; j++) { if (tets[i].is_bbox_fs[j] != NOT_BBOX) { t_queue.push(i); tets[i].is_removed = true; break; } } } while (!t_queue.empty()) { int t_id = t_queue.front(); t_queue.pop(); for (int j = 0; j < 4; j++) { if (tets[t_id].is_bbox_fs[j] != NOT_BBOX || tets[t_id].is_surface_fs[j] != NOT_SURFACE) continue; int n_t_id = get_opp_t_id(mesh, t_id, j); if (n_t_id < 0 || tets[n_t_id].is_removed) continue; tets[n_t_id].is_removed = true; t_queue.push(n_t_id); } for (int j = 0; j < 4; j++) { vector_erase(tet_vertices[tets[t_id][j]].conn_tets, t_id); } } for (int i = 0; i < tet_vertices.size(); i++) { if (tet_vertices[i].is_removed) continue; if (tet_vertices[i].conn_tets.empty()) tet_vertices[i].is_removed = true; } } void floatTetWild::mark_outside(Mesh& mesh, bool invert_faces){ Eigen::MatrixXd C(mesh.get_t_num(), 3); C.setZero(); Loading
src/MeshImprovement.h +1 −0 Original line number Diff line number Diff line Loading @@ -29,6 +29,7 @@ namespace floatTetWild { void boolean_operation(Mesh& mesh, int op); void boolean_operation(Mesh& mesh, const json &csg_tree_with_ids); void filter_outside(Mesh& mesh, bool invert_faces = false); void filter_outside_floodfill(Mesh& mesh, bool invert_faces = false); void mark_outside(Mesh& mesh, bool invert_faces = false); void smooth_open_boundary(Mesh& mesh, const AABBWrapper& tree); void smooth_open_boundary_aux(Mesh& mesh, const AABBWrapper& tree); Loading
src/main.cpp +8 −2 Original line number Diff line number Diff line Loading @@ -210,6 +210,8 @@ int main(int argc, char **argv) { bool disable_wn = false; command_line.add_flag("--disable-wn", disable_wn, "Disable winding number."); bool use_floodfill = false; command_line.add_flag("--use-floodfill", use_floodfill, "Use flood-fill to extract interior volume."); #ifdef LIBIGL_WITH_TETGEN Loading Loading @@ -427,10 +429,14 @@ int main(int argc, char **argv) { t.is_removed = true; } } else { if(!disable_wn) if(!disable_wn) { if(use_floodfill) { filter_outside_floodfill(mesh); } else filter_outside(mesh); } } } if(params.manifold_surface){ manifold_surface(mesh); } Loading