fix hole filling

This commit is contained in:
papush! 2022-01-05 15:58:45 +01:00
parent 9aac4d09e6
commit 908114858d
1 changed files with 2 additions and 18 deletions

View File

@ -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<MyMesh> fillHolesImplicit(MyMesh &mesh,
float scale, float discr) {
Hole_Filling hf(mesh, scale, discr);
mesh.holes = findHoles(mesh);
std::vector<MyMesh> 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};
}