Loading src/EdgeCollapsing.cpp +2 −0 Original line number Diff line number Diff line Loading @@ -289,6 +289,8 @@ int floatTetWild::collapse_an_edge(Mesh& mesh, int v1_id, int v2_id, const AABBW old_max_quality = tets[t_id].quality; } } if(old_max_quality>1e10) is_check_quality = false; for (int t_id:n1_t_ids) { int j = js_n1_t_ids[ii++]; Scalar new_q = get_quality(tet_vertices[v2_id], tet_vertices[tets[t_id][mod4(j + 1)]], Loading src/EdgeSplitting.cpp +22 −0 Original line number Diff line number Diff line Loading @@ -140,6 +140,28 @@ bool floatTetWild::split_an_edge(Mesh& mesh, int v1_id, int v2_id, bool is_repus for (int t_id1: old_t_ids) is_splittable[t_id1] = false; tet_vertices[v_id].is_removed = true; //fortest cout<<"fail "<<v1_id<<" "<<v2_id<<endl; cout<<"is_surface_edge = "<<is_surface_edge(mesh, v1_id, v2_id, old_t_ids)<<endl; cout<<tet_vertices[v1_id].is_on_surface<<" "<<tet_vertices[v2_id].is_on_surface<<endl; if(vector_contains(old_t_ids, 1260)) cout<<"contains 1260"<<endl; for(int t_id: old_t_ids) { cout << "t" << t_id << ": " << mesh.tets[t_id].quality << endl; mesh.tets[t_id].print(); auto& t = tets[t_id]; for(int j=0;j<4;j++) { cout << mesh.tet_vertices[mesh.tets[t_id][j]].pos.transpose() << endl; cout << (int)mesh.tets[t_id].is_surface_fs[j] << endl; cout<<get_area(tet_vertices[t[(j+1)%4]].pos, tet_vertices[t[(j+2)%4]].pos, tet_vertices[t[(j+3)%4]].pos)<<endl; } } cout<<"v "<<tet_vertices[v1_id].pos.transpose()<<endl; cout<<"v "<<tet_vertices[v2_id].pos.transpose()<<endl; cout<<"l 1 2"<<endl; pausee(); //fortest return false; } } Loading src/EdgeSwapping.cpp +17 −2 Original line number Diff line number Diff line Loading @@ -60,17 +60,21 @@ void floatTetWild::edge_swapping(Mesh& mesh) { break; } bool is_success = false; std::vector<std::array<int, 2>> new_edges; if (n12_t_ids.size() == 3 && remove_an_edge_32(mesh, v_ids[0], v_ids[1], n12_t_ids, new_edges)) { suc_counter3++; is_success = true; // output_info(mesh); } if (n12_t_ids.size() == 4 && remove_an_edge_44(mesh, v_ids[0], v_ids[1], n12_t_ids, new_edges)) { suc_counter4++; is_success = true; // output_info(mesh); } if (n12_t_ids.size() == 5 && remove_an_edge_56(mesh, v_ids[0], v_ids[1], n12_t_ids, new_edges)) { suc_counter5++; is_success = true; // output_info(mesh); } Loading Loading @@ -245,6 +249,12 @@ bool floatTetWild::remove_an_edge_32(Mesh& mesh, int v1_id, int v2_id, const std } bool floatTetWild::remove_an_edge_44(Mesh& mesh, int v1_id, int v2_id, const std::vector<int>& old_t_ids, std::vector<std::array<int, 2>>& new_edges) { bool is_check = false; if(v1_id == 482 && v2_id == 504){ is_check = true; pausee("v1_id == 482 && v2_id == 504"); } const int N = 4; if (old_t_ids.size() != N) return false; Loading Loading @@ -338,12 +348,17 @@ bool floatTetWild::remove_an_edge_44(Mesh& mesh, int v1_id, int v2_id, const std std::vector<Scalar> tmp_new_qs; for (auto &t: tmp_new_tets) { Scalar q = get_quality(tet_vertices[t[0]], tet_vertices[t[1]], tet_vertices[t[2]], tet_vertices[t[3]]); if (q >= old_max_quality) return false; if (q >= old_max_quality) { is_break = true; break; // return false; } if (q > new_max_quality) new_max_quality = q; tmp_new_qs.push_back(q); } if (is_break) continue; is_valid = true; old_max_quality = new_max_quality; Loading src/FloatTetCutting.h +0 −3 Original line number Diff line number Diff line Loading @@ -66,8 +66,5 @@ namespace floatTetWild { inline Vector3 get_normal(const Vector3& a, const Vector3& b, const Vector3& c) { return ((b - c).cross(a - c)).normalized(); } inline Scalar get_area(const Vector3& a, const Vector3& b, const Vector3& c) { return ((b - c).cross(a - c)).norm(); } } #endif //FLOATTETWILD_FLOATTETCUTTING_H src/LocalOperations.h +4 −0 Original line number Diff line number Diff line Loading @@ -47,6 +47,10 @@ namespace floatTetWild { void get_new_tet_slots(Mesh& mesh, int n, std::vector<int>& new_conn_tets); inline Scalar get_area(const Vector3& a, const Vector3& b, const Vector3& c) { return ((b - c).cross(a - c)).norm(); } template<typename T> void vector_unique(std::vector<T>& v){ std::sort(v.begin(), v.end()); Loading Loading
src/EdgeCollapsing.cpp +2 −0 Original line number Diff line number Diff line Loading @@ -289,6 +289,8 @@ int floatTetWild::collapse_an_edge(Mesh& mesh, int v1_id, int v2_id, const AABBW old_max_quality = tets[t_id].quality; } } if(old_max_quality>1e10) is_check_quality = false; for (int t_id:n1_t_ids) { int j = js_n1_t_ids[ii++]; Scalar new_q = get_quality(tet_vertices[v2_id], tet_vertices[tets[t_id][mod4(j + 1)]], Loading
src/EdgeSplitting.cpp +22 −0 Original line number Diff line number Diff line Loading @@ -140,6 +140,28 @@ bool floatTetWild::split_an_edge(Mesh& mesh, int v1_id, int v2_id, bool is_repus for (int t_id1: old_t_ids) is_splittable[t_id1] = false; tet_vertices[v_id].is_removed = true; //fortest cout<<"fail "<<v1_id<<" "<<v2_id<<endl; cout<<"is_surface_edge = "<<is_surface_edge(mesh, v1_id, v2_id, old_t_ids)<<endl; cout<<tet_vertices[v1_id].is_on_surface<<" "<<tet_vertices[v2_id].is_on_surface<<endl; if(vector_contains(old_t_ids, 1260)) cout<<"contains 1260"<<endl; for(int t_id: old_t_ids) { cout << "t" << t_id << ": " << mesh.tets[t_id].quality << endl; mesh.tets[t_id].print(); auto& t = tets[t_id]; for(int j=0;j<4;j++) { cout << mesh.tet_vertices[mesh.tets[t_id][j]].pos.transpose() << endl; cout << (int)mesh.tets[t_id].is_surface_fs[j] << endl; cout<<get_area(tet_vertices[t[(j+1)%4]].pos, tet_vertices[t[(j+2)%4]].pos, tet_vertices[t[(j+3)%4]].pos)<<endl; } } cout<<"v "<<tet_vertices[v1_id].pos.transpose()<<endl; cout<<"v "<<tet_vertices[v2_id].pos.transpose()<<endl; cout<<"l 1 2"<<endl; pausee(); //fortest return false; } } Loading
src/EdgeSwapping.cpp +17 −2 Original line number Diff line number Diff line Loading @@ -60,17 +60,21 @@ void floatTetWild::edge_swapping(Mesh& mesh) { break; } bool is_success = false; std::vector<std::array<int, 2>> new_edges; if (n12_t_ids.size() == 3 && remove_an_edge_32(mesh, v_ids[0], v_ids[1], n12_t_ids, new_edges)) { suc_counter3++; is_success = true; // output_info(mesh); } if (n12_t_ids.size() == 4 && remove_an_edge_44(mesh, v_ids[0], v_ids[1], n12_t_ids, new_edges)) { suc_counter4++; is_success = true; // output_info(mesh); } if (n12_t_ids.size() == 5 && remove_an_edge_56(mesh, v_ids[0], v_ids[1], n12_t_ids, new_edges)) { suc_counter5++; is_success = true; // output_info(mesh); } Loading Loading @@ -245,6 +249,12 @@ bool floatTetWild::remove_an_edge_32(Mesh& mesh, int v1_id, int v2_id, const std } bool floatTetWild::remove_an_edge_44(Mesh& mesh, int v1_id, int v2_id, const std::vector<int>& old_t_ids, std::vector<std::array<int, 2>>& new_edges) { bool is_check = false; if(v1_id == 482 && v2_id == 504){ is_check = true; pausee("v1_id == 482 && v2_id == 504"); } const int N = 4; if (old_t_ids.size() != N) return false; Loading Loading @@ -338,12 +348,17 @@ bool floatTetWild::remove_an_edge_44(Mesh& mesh, int v1_id, int v2_id, const std std::vector<Scalar> tmp_new_qs; for (auto &t: tmp_new_tets) { Scalar q = get_quality(tet_vertices[t[0]], tet_vertices[t[1]], tet_vertices[t[2]], tet_vertices[t[3]]); if (q >= old_max_quality) return false; if (q >= old_max_quality) { is_break = true; break; // return false; } if (q > new_max_quality) new_max_quality = q; tmp_new_qs.push_back(q); } if (is_break) continue; is_valid = true; old_max_quality = new_max_quality; Loading
src/FloatTetCutting.h +0 −3 Original line number Diff line number Diff line Loading @@ -66,8 +66,5 @@ namespace floatTetWild { inline Vector3 get_normal(const Vector3& a, const Vector3& b, const Vector3& c) { return ((b - c).cross(a - c)).normalized(); } inline Scalar get_area(const Vector3& a, const Vector3& b, const Vector3& c) { return ((b - c).cross(a - c)).norm(); } } #endif //FLOATTETWILD_FLOATTETCUTTING_H
src/LocalOperations.h +4 −0 Original line number Diff line number Diff line Loading @@ -47,6 +47,10 @@ namespace floatTetWild { void get_new_tet_slots(Mesh& mesh, int n, std::vector<int>& new_conn_tets); inline Scalar get_area(const Vector3& a, const Vector3& b, const Vector3& c) { return ((b - c).cross(a - c)).norm(); } template<typename T> void vector_unique(std::vector<T>& v){ std::sort(v.begin(), v.end()); Loading