From 908114858dfea1bf771570427fb0033d2bd039a1 Mon Sep 17 00:00:00 2001 From: papush! Date: Wed, 5 Jan 2022 15:58:45 +0100 Subject: [PATCH] fix hole filling --- src/hole_filling.cpp | 20 ++------------------ 1 file changed, 2 insertions(+), 18 deletions(-) diff --git a/src/hole_filling.cpp b/src/hole_filling.cpp index 4f04e2f..d522d16 100644 --- a/src/hole_filling.cpp +++ b/src/hole_filling.cpp @@ -308,12 +308,12 @@ MyMesh fillHoleImplicit(MyMesh &mesh, Hole_Filling &hf, for (HalfedgeHandle hh : hole) { verts.push_back(mesh.to_vertex_handle(hh)); } + auto bb = hf.estimate_BB(verts) ; verts = hf.next_neighbors(verts); auto [system, pts_list] = hf.compute_approx_mat(verts); auto [alpha, beta] = hf.solve_approx(system, pts_list.size(), 10); Implicit_RBF rbf(alpha, beta, pts_list); - auto bb = hf.estimate_BB(verts) ; Mesh filling = hf.poly_n_out(rbf, bb); MyMesh ret; for (const Vec3 &v : filling.vertices) { @@ -331,27 +331,11 @@ MyMesh fillHoleImplicit(MyMesh &mesh, Hole_Filling &hf, std::vector fillHolesImplicit(MyMesh &mesh, float scale, float discr) { - Hole_Filling hf(mesh, scale, discr); mesh.holes = findHoles(mesh); std::vector fillings; for (auto hole : mesh.holes) { + Hole_Filling hf(mesh, scale, discr); fillings.push_back(fillHoleImplicit(mesh, hf, hole)); } return fillings; - - // auto sdf = [&](Vec3 const& v) { return v.Norm() - 10.; }; - // Rect3 domain {{-10, -10, -10}, {20, 20, 20}}; - // auto filling = MarchCube(sdf, domain); - // WriteObjFile(filling, "out.obj"); - // MyMesh ret; - // for (const Vec3 &v : filling.vertices) { - // VertexHandle vh = ret.new_vertex({v.x, v.y, v.z}); - // ret.set_color(vh, ret.default_color); - // } - // for (const Triangle &t : filling.triangles) { - // ret.add_face(ret.vertex_handle(t[0]), - // ret.vertex_handle(t[1]), - // ret.vertex_handle(t[2])); - // } - // return {ret}; }