Commit 0e720fc8 authored by YIxin-Hu's avatar YIxin-Hu
Browse files

fix simplify_subdivision_result()

parent e64b78e2
Loading
Loading
Loading
Loading
+3 −0
Original line number Diff line number Diff line
@@ -59,6 +59,9 @@ void floatTetWild::edge_splitting(Mesh& mesh) {
        std::array<int, 2> v_ids = es_queue.top().v_ids;
        es_queue.pop();

        if(tet_vertices[v_ids[0]].is_freezed && tet_vertices[v_ids[1]].is_freezed)
            continue;

        std::vector<std::array<int, 2>> new_edges;
        if (split_an_edge(mesh, v_ids[0], v_ids[1], is_repush, new_edges))
            suc_counter++;
+3 −0
Original line number Diff line number Diff line
@@ -45,6 +45,9 @@ void floatTetWild::edge_swapping(Mesh& mesh) {
        std::array<int, 2> v_ids = es_queue.top().v_ids;
        es_queue.pop();

        if(tet_vertices[v_ids[0]].is_freezed && tet_vertices[v_ids[1]].is_freezed)
            continue;

        std::vector<int> n12_t_ids;
        set_intersection(tet_vertices[v_ids[0]].conn_tets, tet_vertices[v_ids[1]].conn_tets, n12_t_ids);
        if (!is_swappable(v_ids[0], v_ids[1], n12_t_ids))
+3 −3
Original line number Diff line number Diff line
@@ -143,13 +143,13 @@ void floatTetWild::optimization(const std::vector<Vector3> &input_vertices, cons

        Scalar max_energy, avg_energy;
        get_max_avg_energy(mesh, max_energy, avg_energy);
        if (max_energy <= mesh.params.stop_energy)
        if (max_energy <= mesh.params.stop_energy && it_after_al_inserted > M)
            break;

        if (mesh.params.stop_p > 0) {
            int p = get_max_p(mesh);
            cout << "p = " << p << endl;
            if (p <= mesh.params.stop_p)
            if (p <= mesh.params.stop_p && it_after_al_inserted > M)
                break;
        }

@@ -222,7 +222,7 @@ void floatTetWild::optimization(const std::vector<Vector3> &input_vertices, cons
            continue;
        v.sizing_scalar = 1;
    }
    operation(input_vertices, input_faces, input_tags, is_face_inserted, mesh, tree, std::array<int, 5>({{0, 1, 0, 0, 1}}));
    operation(input_vertices, input_faces, input_tags, is_face_inserted, mesh, tree, std::array<int, 5>({{0, 1, 0, 0, 0}}));
}

void floatTetWild::cleanup_empty_slots(Mesh &mesh, double percentage) {
+6 −7
Original line number Diff line number Diff line
@@ -275,6 +275,8 @@ void floatTetWild::insert_triangles_aux(const std::vector<Vector3> &input_vertic
    }
    igl::writeSTL("inserted.stl", V, F);
    ///fortest

    pausee();
}

bool floatTetWild::insert_one_triangle(int insert_f_id, const std::vector<Vector3> &input_vertices,
@@ -390,6 +392,7 @@ bool floatTetWild::insert_one_triangle(int insert_f_id, const std::vector<Vector

    timer.start();
    push_new_tets(mesh, track_surface_fs, points, new_tets, new_track_surface_fs, modified_t_ids, is_again);
//    if(!is_again)
        simplify_subdivision_result(insert_f_id, input_vertices.size(), mesh, tree, track_surface_fs, modified_t_ids);
    time_push_new_tets += timer.getElapsedTime();

@@ -547,8 +550,7 @@ void floatTetWild::simplify_subdivision_result(int insert_f_id, int input_v_size
        for (int t_id: mesh.tet_vertices[v1_id].conn_tets) {
            for (int j = 0; j < 4; j++) {
                if ((!track_surface_fs[t_id][j].empty() && !vector_contains(track_surface_fs[t_id][j], insert_f_id))
                    || (mesh.tets[t_id][j] != v1_id && mesh.tets[t_id].is_surface_fs[j] != NOT_SURFACE
                        && mesh.tets[t_id].is_bbox_fs[j] != NOT_BBOX)) {
                    || (mesh.tets[t_id][j] != v1_id && (mesh.tets[t_id].is_surface_fs[j] != NOT_SURFACE || mesh.tets[t_id].is_bbox_fs[j] != NOT_BBOX))) {
                    is_valid = false;
                    break;
                }
@@ -568,10 +570,6 @@ void floatTetWild::simplify_subdivision_result(int insert_f_id, int input_v_size
        int result = collapse_an_edge(mesh, v_ids[0], v_ids[1], tree, new_edges, _ts, _tet_tss,
                                      is_check_quality);
        if (result > 0) {
//            for (int t_id: v1_conn_tets) {
//                if (mesh.tets[t_id].is_removed)
//                    modified_t_ids.push_back(t_id);
//            }
            for(const auto& e: new_edges){
                if(all_v_ids.find(e[0]) == all_v_ids.end() || all_v_ids.find(e[1]) == all_v_ids.end())
                    continue;
@@ -1455,6 +1453,7 @@ bool floatTetWild::insert_boundary_edges(const std::vector<Vector3> &input_verti
                for (auto &f: cut_fs)
                    mark_known_surface_fs(f, KNOWN_SURFACE);
                known_surface_fs.insert(known_surface_fs.end(), cut_fs.begin(), cut_fs.end());
                cout << "SEMI-FAIL subdivide_tets" << endl;
            }

            is_all_inserted = false;//unless now
+0 −1
Original line number Diff line number Diff line
@@ -349,7 +349,6 @@ int main(int argc, char **argv) {
    stats().record(StateInfo::cutting_id, timer.getElapsedTimeInSec(), mesh.get_v_num(), mesh.get_t_num(),
                   mesh.get_max_energy(), mesh.get_avg_energy(),
                   std::count(is_face_inserted.begin(), is_face_inserted.end(), false));
    pausee();

//    timer.start();
////    cutting(input_vertices, input_faces, mesh, is_face_inserted, tree);