Commit 34922f5f authored by YIxin-Hu's avatar YIxin-Hu
Browse files

add untangle()

parent cecd609a
Loading
Loading
Loading
Loading
+2 −2
Original line number Diff line number Diff line
@@ -289,8 +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;
//    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)]],
+21 −21
Original line number Diff line number Diff line
@@ -141,27 +141,27 @@ bool floatTetWild::split_an_edge(Mesh& mesh, int v1_id, int v2_id, bool is_repus
                        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
//                    //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;
                }
            }
+5 −5
Original line number Diff line number Diff line
@@ -249,11 +249,11 @@ 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");
    }
//    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)
+1 −1
Original line number Diff line number Diff line
@@ -922,7 +922,7 @@ Scalar floatTetWild::AMIPS_energy(const std::array<Scalar, 12>& T) {
    Scalar res = AMIPS_energy_aux(T);
//    return res;

    if (res > 1e7) {
    if (res > 1e8) {
//        //fortest
//        cnt_large++;
//        if(!is_energy_unstable(T, res)){
+8 −0
Original line number Diff line number Diff line
@@ -11,6 +11,14 @@ namespace floatTetWild {

    int get_opp_t_id(const Mesh& mesh, int t_id, int j);
    void set_opp_t_id(Mesh& mesh, int t_id, int j);
    inline int get_local_f_id(int t_id, int v1_id, int v2_id, int v3_id, Mesh &mesh) {
        for (int j = 0; j < 4; j++) {
            if (mesh.tets[t_id][j] != v1_id && mesh.tets[t_id][j] != v2_id && mesh.tets[t_id][j] != v3_id)
                return j;
        }
        assert(false);
        return -1;
    }

    void get_all_edges(const Mesh& mesh, std::vector<std::array<int, 2>>& edges);
    void get_all_edges(const Mesh& mesh, const std::vector<int>& t_ids, std::vector<std::array<int, 2>>& edges, bool skip_freezed = false);
Loading