fix a bug in the implicit hole filling
only the boundary vertices were used to find an implicit surface, when its 1-ring is needed too
This commit is contained in:
parent
50255ebfbb
commit
be6a1d4f8a
@ -239,14 +239,6 @@ pair<vector<float>&, vector<float>&> Hole_Filling::solve_approx(const pair<Eigen
|
|||||||
return {alpha, beta} ;
|
return {alpha, beta} ;
|
||||||
}
|
}
|
||||||
|
|
||||||
// ***** Hole filling
|
|
||||||
|
|
||||||
void Hole_Filling::fill_hole(string out)
|
|
||||||
{
|
|
||||||
// TODO !!!
|
|
||||||
cout << "Au travail !" << endl ;
|
|
||||||
}
|
|
||||||
|
|
||||||
// ***** IO
|
// ***** IO
|
||||||
|
|
||||||
void Hole_Filling::colorize_prop()
|
void Hole_Filling::colorize_prop()
|
||||||
@ -291,7 +283,7 @@ Rect3 Hole_Filling::estimate_BB(const vector<MyMesh::VertexHandle> &vlist)
|
|||||||
return domain ;
|
return domain ;
|
||||||
}
|
}
|
||||||
|
|
||||||
Mesh Hole_Filling::poly_n_out(const Implicit_RBF &implicit, Rect3 domain, string filename)
|
Mesh Hole_Filling::poly_n_out(const Implicit_RBF &implicit, Rect3 domain)
|
||||||
{
|
{
|
||||||
auto implicitEq = [&implicit](Vec3 const& pos)
|
auto implicitEq = [&implicit](Vec3 const& pos)
|
||||||
{
|
{
|
||||||
@ -306,7 +298,6 @@ Mesh Hole_Filling::poly_n_out(const Implicit_RBF &implicit, Rect3 domain, string
|
|||||||
cout << "cubesize "<< cubeSize << endl ;
|
cout << "cubesize "<< cubeSize << endl ;
|
||||||
|
|
||||||
return MarchCube(implicitEq, domain, cubeSize);
|
return MarchCube(implicitEq, domain, cubeSize);
|
||||||
// WriteObjFile(mesh, filename);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -315,26 +306,16 @@ MyMesh fillHoleImplicit(MyMesh &mesh, Hole_Filling &hf,
|
|||||||
std::vector<VertexHandle> verts;
|
std::vector<VertexHandle> verts;
|
||||||
for (HalfedgeHandle hh : hole) {
|
for (HalfedgeHandle hh : hole) {
|
||||||
verts.push_back(mesh.to_vertex_handle(hh));
|
verts.push_back(mesh.to_vertex_handle(hh));
|
||||||
|
verts.push_back(mesh.to_vertex_handle(
|
||||||
|
mesh.next_halfedge_handle(
|
||||||
|
mesh.opposite_halfedge_handle(hh))));
|
||||||
}
|
}
|
||||||
auto [system, pts_list] = hf.compute_approx_mat(verts);
|
auto [system, pts_list] = hf.compute_approx_mat(verts);
|
||||||
auto [alpha, beta] = hf.solve_approx(system, pts_list.size(), 10);
|
auto [alpha, beta] = hf.solve_approx(system, pts_list.size(), 10);
|
||||||
Implicit_RBF rbf(alpha, beta, pts_list);
|
Implicit_RBF rbf(alpha, beta, pts_list);
|
||||||
|
|
||||||
// qDebug() << "";
|
|
||||||
// for (const Point &p : pts_list) {
|
|
||||||
// qDebug() << rbf.val(p);
|
|
||||||
// }
|
|
||||||
|
|
||||||
auto bb = hf.estimate_BB(verts) ;
|
auto bb = hf.estimate_BB(verts) ;
|
||||||
const QString path = "out.obj";
|
Mesh filling = hf.poly_n_out(rbf, bb);
|
||||||
Mesh filling = hf.poly_n_out(rbf, bb, path.toStdString());
|
|
||||||
// MyMesh out_mesh;
|
|
||||||
// OpenMesh::IO::Options options;
|
|
||||||
// options.set(OpenMesh::IO::Options::VertexNormal);
|
|
||||||
// if (!OpenMesh::IO::read_mesh(mesh, path.toUtf8().constData(), options)) {
|
|
||||||
// qWarning() << "Failed to read" << path;
|
|
||||||
// throw runtime_error("Failed to read marching cube output mesh");
|
|
||||||
// }
|
|
||||||
MyMesh ret;
|
MyMesh ret;
|
||||||
for (const Vec3 &v : filling.vertices) {
|
for (const Vec3 &v : filling.vertices) {
|
||||||
VertexHandle vh = ret.new_vertex({v.x, v.y, v.z});
|
VertexHandle vh = ret.new_vertex({v.x, v.y, v.z});
|
||||||
|
@ -106,14 +106,11 @@ public:
|
|||||||
pair<pair<Eigen::MatrixXd &,Eigen::VectorXd &>,vector<MyMesh::Point> &> compute_approx_mat(vector<MyMesh::VertexHandle> vlist) ;
|
pair<pair<Eigen::MatrixXd &,Eigen::VectorXd &>,vector<MyMesh::Point> &> compute_approx_mat(vector<MyMesh::VertexHandle> vlist) ;
|
||||||
pair<vector<float>&, vector<float>&> solve_approx(const pair<Eigen::MatrixXd &, Eigen::VectorXd &> &p, int n, int d) ;
|
pair<vector<float>&, vector<float>&> solve_approx(const pair<Eigen::MatrixXd &, Eigen::VectorXd &> &p, int n, int d) ;
|
||||||
|
|
||||||
// Hole filling
|
|
||||||
void fill_hole(string out) ;
|
|
||||||
|
|
||||||
// IO
|
// IO
|
||||||
void colorize_prop() ;
|
void colorize_prop() ;
|
||||||
void colorize_verts(const vector<MyMesh::VertexHandle> &vlist) ;
|
void colorize_verts(const vector<MyMesh::VertexHandle> &vlist) ;
|
||||||
Rect3 estimate_BB(const vector<MyMesh::VertexHandle> &vlist) ;
|
Rect3 estimate_BB(const vector<MyMesh::VertexHandle> &vlist) ;
|
||||||
Mesh poly_n_out (const Implicit_RBF & implicit, Rect3 domain, std::string filename) ;
|
Mesh poly_n_out (const Implicit_RBF & implicit, Rect3 domain) ;
|
||||||
};
|
};
|
||||||
|
|
||||||
// Other ....
|
// Other ....
|
||||||
|
Loading…
Reference in New Issue
Block a user