Loading src/EdgeCollapsing.cpp +4 −4 Original line number Diff line number Diff line Loading @@ -36,7 +36,7 @@ void edge_collapsing_aux(Mesh& mesh, const AABBWrapper& tree, std::vector<std::a std::priority_queue<ElementInQueue, std::vector<ElementInQueue>, cmp_s> ec_queue; for (auto &e:edges) { Scalar l_2 = get_edge_length_2(mesh, e[0], e[1]); if (is_collapsable_length(mesh, e[0], e[1], l_2) && is_collapsable_boundary(mesh, e[0], e[1])) { if (is_collapsable_length(mesh, e[0], e[1], l_2) && is_collapsable_boundary(mesh, e[0], e[1], tree)) { ec_queue.push(ElementInQueue(e, l_2)); ec_queue.push(ElementInQueue({{e[1], e[0]}}, l_2)); } Loading Loading @@ -72,7 +72,7 @@ void edge_collapsing_aux(Mesh& mesh, const AABBWrapper& tree, std::vector<std::a if (!is_valid_edge(mesh, v_ids[0], v_ids[1])) continue; if(! is_collapsable_boundary(mesh, v_ids[0], v_ids[1])) if(! is_collapsable_boundary(mesh, v_ids[0], v_ids[1], tree)) continue; Scalar weight = get_edge_length_2(mesh, v_ids[0], v_ids[1]); Loading Loading @@ -548,8 +548,8 @@ bool floatTetWild::is_collapsable_length(Mesh& mesh, int v1_id, int v2_id, Scala return false; } bool floatTetWild::is_collapsable_boundary(Mesh& mesh, int v1_id, int v2_id) { if (mesh.tet_vertices[v1_id].is_on_boundary && !mesh.tet_vertices[v2_id].is_on_boundary) bool floatTetWild::is_collapsable_boundary(Mesh& mesh, int v1_id, int v2_id, const AABBWrapper& tree) { if (mesh.tet_vertices[v1_id].is_on_boundary && !is_boundary_edge(mesh, v1_id, v2_id, tree)) return false; return true; Loading src/EdgeCollapsing.h +1 −1 Original line number Diff line number Diff line Loading @@ -13,7 +13,7 @@ namespace floatTetWild { bool is_edge_freezed(Mesh& mesh, int v1_id, int v2_id); bool is_collapsable_bbox(Mesh& mesh, int v1_id, int v2_id); bool is_collapsable_length(Mesh& mesh, int v1_id, int v2_id, Scalar l_2); bool is_collapsable_boundary(Mesh& mesh, int v1_id, int v2_id); bool is_collapsable_boundary(Mesh& mesh, int v1_id, int v2_id, const AABBWrapper& tree); } #endif //FLOATTETWILD_EDGECOLLAPSING_H src/MeshImprovement.cpp +8 −8 Original line number Diff line number Diff line Loading @@ -597,6 +597,14 @@ bool floatTetWild::update_scaling_field(Mesh &mesh, Scalar max_energy) { } void floatTetWild::output_info(Mesh& mesh, const AABBWrapper& tree) { std::ofstream fout(mesh.params.output_path+"_"+mesh.params.postfix+"_b_vs.xyz"); for(auto& v: mesh.tet_vertices){ if(v.is_removed || !v.is_on_boundary) continue; fout<<v.pos[0]<<" "<<v.pos[1]<<" "<<v.pos[2]<<endl; } fout.close(); if(mesh.params.is_quiet) return; Loading Loading @@ -914,14 +922,6 @@ void floatTetWild::output_info(Mesh& mesh, const AABBWrapper& tree) { // MeshIO::write_mesh(mesh.params.output_path+"_"+mesh.params.postfix+"test.msh", mesh); output_surface(mesh, mesh.params.output_path+"_"+mesh.params.postfix+"_opt"); std::ofstream fout(mesh.params.output_path+"_"+mesh.params.postfix+"_b_vs.xyz"); for(auto& v: tet_vertices){ if(v.is_removed || !v.is_on_boundary) continue; fout<<v.pos[0]<<" "<<v.pos[1]<<" "<<v.pos[2]<<endl; } fout.close(); // //pausee(); return; Loading src/TriangleInsertion.cpp +39 −25 Original line number Diff line number Diff line Loading @@ -358,20 +358,20 @@ void floatTetWild::insert_triangles_aux(const std::vector<Vector3> &input_vertic mesh.is_input_all_inserted = true; logger().info("#b_edge1 = {}, #b_edges2 = {}", b_edges1.size(), b_edges2.size()); // ///fortest // Eigen::MatrixXd V(input_vertices.size(), 3); // Eigen::MatrixXi F(std::count(is_face_inserted.begin(), is_face_inserted.end(), true), 3); // for (int i = 0; i < input_vertices.size(); i++) // V.row(i) = input_vertices[i]; // int cnt = 0; // for (int i = 0; i < input_faces.size(); i++) { // if (!is_face_inserted[i]) // continue; // F.row(cnt) << input_faces[i][0], input_faces[i][1], input_faces[i][2]; // cnt++; // } // igl::writeSTL("inserted.stl", V, F); // ///fortest ///fortest Eigen::MatrixXd V(input_vertices.size(), 3); Eigen::MatrixXi F(std::count(is_face_inserted.begin(), is_face_inserted.end(), false), 3); for (int i = 0; i < input_vertices.size(); i++) V.row(i) = input_vertices[i]; int cnt = 0; for (int i = 0; i < input_faces.size(); i++) { if (is_face_inserted[i]) continue; F.row(cnt) << input_faces[i][0], input_faces[i][1], input_faces[i][2]; cnt++; } igl::writeSTL(mesh.params.output_path+"_"+mesh.params.postfix+"_uninserted.stl", V, F); ///fortest // //fortest // std::ofstream fout("b_vs.xyz"); Loading @@ -381,17 +381,20 @@ void floatTetWild::insert_triangles_aux(const std::vector<Vector3> &input_vertic // fout<<v.pos[0]<<" "<<v.pos[1]<<" "<<v.pos[2]<<endl; // } // fout.close(); // // // fout.open("b_es.obj"); // for(auto& e: b_edges1){ // fout<<"v "<<input_vertices[e[0]].transpose()<<endl; // fout<<"v "<<input_vertices[e[1]].transpose()<<endl; // } // for(int i=0;i<b_edges1.size();i++){ // fout<<"l "<<i*2+1<<" "<<i*2+2<<endl; // } // fout.close(); // //fortest // std::ofstream fout(mesh.params.output_path+"_"+mesh.params.postfix+"_b_es.obj"); for(int i=0;i<tree.tmp_b_mesh.vertices.nb();i++){ fout<<"v "<<tree.tmp_b_mesh.vertices.point(i)[0]<<" " <<tree.tmp_b_mesh.vertices.point(i)[1]<<" " <<tree.tmp_b_mesh.vertices.point(i)[2]<<endl; } for(int i=0;i<tree.tmp_b_mesh.facets.nb();i++) { fout << "l " << tree.tmp_b_mesh.facets.vertex(i, 1) + 1 << " " << tree.tmp_b_mesh.facets.vertex(i, 2) + 1 << endl; } fout.close(); //fortest pausee(); } Loading Loading @@ -2546,6 +2549,17 @@ void floatTetWild::mark_surface_fs(const std::vector<Vector3> &input_vertices, c if(known_surface_fs.empty() && known_not_surface_fs.empty()) return; // Eigen::MatrixXd V(known_surface_fs.size()*3, 3); // Eigen::MatrixXi F(known_surface_fs.size(), 3); // for(int i=0;i<known_surface_fs.size();i++) { // for (int j = 0; j < 3; j++) // V.row(i * 3 + j) = mesh.tet_vertices[known_surface_fs[i][j]].pos; // F.row(i) << i * 3, i * 3 + 1, i * 3 + 2; // } // igl::writeOFF("known_surface_fs.off",V, F); // pausee("writing known_surface_fs.off"); //b_edges std::vector<std::array<int, 2>> tmp_edges; for (const auto &f: known_surface_fs) { Loading Loading
src/EdgeCollapsing.cpp +4 −4 Original line number Diff line number Diff line Loading @@ -36,7 +36,7 @@ void edge_collapsing_aux(Mesh& mesh, const AABBWrapper& tree, std::vector<std::a std::priority_queue<ElementInQueue, std::vector<ElementInQueue>, cmp_s> ec_queue; for (auto &e:edges) { Scalar l_2 = get_edge_length_2(mesh, e[0], e[1]); if (is_collapsable_length(mesh, e[0], e[1], l_2) && is_collapsable_boundary(mesh, e[0], e[1])) { if (is_collapsable_length(mesh, e[0], e[1], l_2) && is_collapsable_boundary(mesh, e[0], e[1], tree)) { ec_queue.push(ElementInQueue(e, l_2)); ec_queue.push(ElementInQueue({{e[1], e[0]}}, l_2)); } Loading Loading @@ -72,7 +72,7 @@ void edge_collapsing_aux(Mesh& mesh, const AABBWrapper& tree, std::vector<std::a if (!is_valid_edge(mesh, v_ids[0], v_ids[1])) continue; if(! is_collapsable_boundary(mesh, v_ids[0], v_ids[1])) if(! is_collapsable_boundary(mesh, v_ids[0], v_ids[1], tree)) continue; Scalar weight = get_edge_length_2(mesh, v_ids[0], v_ids[1]); Loading Loading @@ -548,8 +548,8 @@ bool floatTetWild::is_collapsable_length(Mesh& mesh, int v1_id, int v2_id, Scala return false; } bool floatTetWild::is_collapsable_boundary(Mesh& mesh, int v1_id, int v2_id) { if (mesh.tet_vertices[v1_id].is_on_boundary && !mesh.tet_vertices[v2_id].is_on_boundary) bool floatTetWild::is_collapsable_boundary(Mesh& mesh, int v1_id, int v2_id, const AABBWrapper& tree) { if (mesh.tet_vertices[v1_id].is_on_boundary && !is_boundary_edge(mesh, v1_id, v2_id, tree)) return false; return true; Loading
src/EdgeCollapsing.h +1 −1 Original line number Diff line number Diff line Loading @@ -13,7 +13,7 @@ namespace floatTetWild { bool is_edge_freezed(Mesh& mesh, int v1_id, int v2_id); bool is_collapsable_bbox(Mesh& mesh, int v1_id, int v2_id); bool is_collapsable_length(Mesh& mesh, int v1_id, int v2_id, Scalar l_2); bool is_collapsable_boundary(Mesh& mesh, int v1_id, int v2_id); bool is_collapsable_boundary(Mesh& mesh, int v1_id, int v2_id, const AABBWrapper& tree); } #endif //FLOATTETWILD_EDGECOLLAPSING_H
src/MeshImprovement.cpp +8 −8 Original line number Diff line number Diff line Loading @@ -597,6 +597,14 @@ bool floatTetWild::update_scaling_field(Mesh &mesh, Scalar max_energy) { } void floatTetWild::output_info(Mesh& mesh, const AABBWrapper& tree) { std::ofstream fout(mesh.params.output_path+"_"+mesh.params.postfix+"_b_vs.xyz"); for(auto& v: mesh.tet_vertices){ if(v.is_removed || !v.is_on_boundary) continue; fout<<v.pos[0]<<" "<<v.pos[1]<<" "<<v.pos[2]<<endl; } fout.close(); if(mesh.params.is_quiet) return; Loading Loading @@ -914,14 +922,6 @@ void floatTetWild::output_info(Mesh& mesh, const AABBWrapper& tree) { // MeshIO::write_mesh(mesh.params.output_path+"_"+mesh.params.postfix+"test.msh", mesh); output_surface(mesh, mesh.params.output_path+"_"+mesh.params.postfix+"_opt"); std::ofstream fout(mesh.params.output_path+"_"+mesh.params.postfix+"_b_vs.xyz"); for(auto& v: tet_vertices){ if(v.is_removed || !v.is_on_boundary) continue; fout<<v.pos[0]<<" "<<v.pos[1]<<" "<<v.pos[2]<<endl; } fout.close(); // //pausee(); return; Loading
src/TriangleInsertion.cpp +39 −25 Original line number Diff line number Diff line Loading @@ -358,20 +358,20 @@ void floatTetWild::insert_triangles_aux(const std::vector<Vector3> &input_vertic mesh.is_input_all_inserted = true; logger().info("#b_edge1 = {}, #b_edges2 = {}", b_edges1.size(), b_edges2.size()); // ///fortest // Eigen::MatrixXd V(input_vertices.size(), 3); // Eigen::MatrixXi F(std::count(is_face_inserted.begin(), is_face_inserted.end(), true), 3); // for (int i = 0; i < input_vertices.size(); i++) // V.row(i) = input_vertices[i]; // int cnt = 0; // for (int i = 0; i < input_faces.size(); i++) { // if (!is_face_inserted[i]) // continue; // F.row(cnt) << input_faces[i][0], input_faces[i][1], input_faces[i][2]; // cnt++; // } // igl::writeSTL("inserted.stl", V, F); // ///fortest ///fortest Eigen::MatrixXd V(input_vertices.size(), 3); Eigen::MatrixXi F(std::count(is_face_inserted.begin(), is_face_inserted.end(), false), 3); for (int i = 0; i < input_vertices.size(); i++) V.row(i) = input_vertices[i]; int cnt = 0; for (int i = 0; i < input_faces.size(); i++) { if (is_face_inserted[i]) continue; F.row(cnt) << input_faces[i][0], input_faces[i][1], input_faces[i][2]; cnt++; } igl::writeSTL(mesh.params.output_path+"_"+mesh.params.postfix+"_uninserted.stl", V, F); ///fortest // //fortest // std::ofstream fout("b_vs.xyz"); Loading @@ -381,17 +381,20 @@ void floatTetWild::insert_triangles_aux(const std::vector<Vector3> &input_vertic // fout<<v.pos[0]<<" "<<v.pos[1]<<" "<<v.pos[2]<<endl; // } // fout.close(); // // // fout.open("b_es.obj"); // for(auto& e: b_edges1){ // fout<<"v "<<input_vertices[e[0]].transpose()<<endl; // fout<<"v "<<input_vertices[e[1]].transpose()<<endl; // } // for(int i=0;i<b_edges1.size();i++){ // fout<<"l "<<i*2+1<<" "<<i*2+2<<endl; // } // fout.close(); // //fortest // std::ofstream fout(mesh.params.output_path+"_"+mesh.params.postfix+"_b_es.obj"); for(int i=0;i<tree.tmp_b_mesh.vertices.nb();i++){ fout<<"v "<<tree.tmp_b_mesh.vertices.point(i)[0]<<" " <<tree.tmp_b_mesh.vertices.point(i)[1]<<" " <<tree.tmp_b_mesh.vertices.point(i)[2]<<endl; } for(int i=0;i<tree.tmp_b_mesh.facets.nb();i++) { fout << "l " << tree.tmp_b_mesh.facets.vertex(i, 1) + 1 << " " << tree.tmp_b_mesh.facets.vertex(i, 2) + 1 << endl; } fout.close(); //fortest pausee(); } Loading Loading @@ -2546,6 +2549,17 @@ void floatTetWild::mark_surface_fs(const std::vector<Vector3> &input_vertices, c if(known_surface_fs.empty() && known_not_surface_fs.empty()) return; // Eigen::MatrixXd V(known_surface_fs.size()*3, 3); // Eigen::MatrixXi F(known_surface_fs.size(), 3); // for(int i=0;i<known_surface_fs.size();i++) { // for (int j = 0; j < 3; j++) // V.row(i * 3 + j) = mesh.tet_vertices[known_surface_fs[i][j]].pos; // F.row(i) << i * 3, i * 3 + 1, i * 3 + 2; // } // igl::writeOFF("known_surface_fs.off",V, F); // pausee("writing known_surface_fs.off"); //b_edges std::vector<std::array<int, 2>> tmp_edges; for (const auto &f: known_surface_fs) { Loading