In the vtkFillHolesFilter algorithm is the following line of code for the case of multiple edge neighbors
else if (neighbors->GetNumberOfIds() > 1)
{
// have to logically split this vertex
valid = 0;
}
which reads like an unfinished TODO item. I’ve come across this scenario with a collection of data and a model surface that I would characterize as more complex than perhaps typical, but not overly complex. When ‘valid’ is set to 0, the algorithm simply doesn’t behave well. I’ve written further details in the issue tracker: https://gitlab.kitware.com/vtk/vtk/-/issues/19209 Because of the unfinished nature of the algorithm, Mathieu and Will suggested opening a discourse on the topic.
I offered a fix for the multiple-neighbors case which makes vtkFillHolesFilter more robust for poly-data in which it arises. With the patch, the algorithm does go on to construct a triangulation, ‘valid’ becoming 0 is less likely and if the ‘valid’ variable were to become zero the algorithm terminates rather than leading to unpredictable behavior. However, what the patch doesn’t do is take into consideration the spatial relationship of neighbor edges and how that might reflect in the general quality of the triangulation. Will suggested the base construct of vtkFillHolesFilter may not be sufficiently sophisticated, as it basically extracts free edges from the links built from the polys and follows wherever they lead to.
So, I’m inviting folks to have a look at the issue and make any suggestions about a more thorough approach. Should the algorithm take a step back and construct a better topology prior to selecting the triangulation contours? Is there, perhaps, another algorithm that has effectively done something similar? (Sometimes I notice a hunk of VTK code that seems like it could have been useful in some other algorithm.)