fill_hole() generates bad results
Describe the bug Closing holes generates very bad results (with new vertices very far away) even on simple meshes.
To Reproduce Steps to reproduce the behavior:
- load the attached mesh
- pmp::fill_hole(mesh, pmp::Halfedge(5));
Expected behavior
input:
get:
expected:
Thanks for reporting, I could reproduce the issue.
The input mesh has a degenerate face (0 area triangle) that spoils the fairing step used at the end of the hole filling algorithm. You could either remove the degenerate face (or otherwise repair the input) or do without the fairing step.
Leaving the issue open as a reminder that we might want to have a check for this before running the algorithm.
Thank you for the quick reply, however the input mesh does not have any face with zero or close to zero area. Does PMP have functionality to find and remove zero area faces? Or you meant immediately after hole filling the mesh and before fairing it has faces with zero area?
The input mesh has a degenerate face with area 0.000002 at the boundary
You can't see the face, but the shading gives you a hint. After removing this face:
Running hole filling after removing this face:
Thank you! Is there a function in pmp that can remove such faces? Which is the minimum area for a face to be considered safe for hole filling?
We currently have no general function for repairing degenerate faces. This particular case was straightforward since the face was directly on the boundary, so I just removed it like this:
for (auto f : mesh.faces())
if (face_area(mesh, f) < 1.0e-5)
mesh.delete_face(f);
mesh.garbage_collection();