Commit 3c5c7c10 authored by Yixin Hu's avatar Yixin Hu
Browse files

fixing open boundary

parent 651a7109
Loading
Loading
Loading
Loading
+7 −4
Original line number Diff line number Diff line
@@ -549,10 +549,13 @@ bool floatTetWild::is_collapsable_length(Mesh& mesh, int v1_id, int v2_id, Scala
}

bool floatTetWild::is_collapsable_boundary(Mesh& mesh, int v1_id, int v2_id) {
    return true;

    if (mesh.tet_vertices[v1_id].on_boundary_e_id >= 0 && mesh.tet_vertices[v2_id].on_boundary_e_id
        && mesh.tet_vertices[v1_id].on_boundary_e_id != mesh.tet_vertices[v2_id].on_boundary_e_id)
    if (mesh.tet_vertices[v1_id].is_on_boundary && !mesh.tet_vertices[v2_id].is_on_boundary)
        return false;
    return true;


//    if (mesh.tet_vertices[v1_id].on_boundary_e_id >= 0 && mesh.tet_vertices[v2_id].on_boundary_e_id
//        && mesh.tet_vertices[v1_id].on_boundary_e_id != mesh.tet_vertices[v2_id].on_boundary_e_id)
//        return false;
//    return true;
}
 No newline at end of file
+27 −3
Original line number Diff line number Diff line
@@ -914,6 +914,14 @@ 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;
@@ -1492,7 +1500,19 @@ void floatTetWild::untangle(Mesh &mesh) {

void floatTetWild::smooth_open_boundary(Mesh& mesh, const AABBWrapper& tree) {
    mark_outside(mesh);
    smooth_open_boundary_aux(mesh, tree);

    return;
    for(int i=0;i<10;i++) {
        mark_outside(mesh);
        smooth_open_boundary_aux(mesh, tree);
        for(auto& t: mesh.tets)
            t.is_outside = false;
    }
    mark_outside(mesh);
}

void floatTetWild::smooth_open_boundary_aux(Mesh& mesh, const AABBWrapper& tree) {
    auto &tets = mesh.tets;
    auto &tet_vertices = mesh.tet_vertices;

@@ -1542,7 +1562,7 @@ void floatTetWild::smooth_open_boundary(Mesh& mesh, const AABBWrapper& tree) {
    if (!has_open_boundary)
        return;

    const int IT = 5;
    const int IT = 8;
    for (int it = 0; it < IT; it++) {
        ///laplacian
        int cnt = 0;
@@ -1605,15 +1625,19 @@ void floatTetWild::smooth_open_boundary(Mesh& mesh, const AABBWrapper& tree) {
        cout<<cnt<<"/"<<cnt_s<<endl;

        ///regular optimization
        for(auto& v: tet_vertices){
            if(v.is_on_surface)
                v.is_freezed = true;
        }
        edge_collapsing(mesh, tree);
//        edge_swapping(mesh);
//        edge_collapsing(mesh, tree);
        vertex_smoothing(mesh, tree);
//        vertex_smoothing(mesh, tree);

        ///unfreeze
        for (int v_id; v_id < tet_vertices.size(); v_id++) {
//            if (is_b_vs[v_id])
            if (!conn_b_fs[v_id].empty())
//            if (!conn_b_fs[v_id].empty())
                tet_vertices[v_id].is_freezed = false;
        }
    }
+1 −0
Original line number Diff line number Diff line
@@ -21,6 +21,7 @@ namespace floatTetWild {
    void filter_outside(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);
    void manifold_surface(Mesh& mesh);

    void output_info(Mesh& mesh, const AABBWrapper& tree);