is there any way to check mesh is watertight?

Hi,

I have used PolyDataConnectivityFilter to get rid of disconnected vertices. Is that enough to check if the mesh is watertight? Or I need to use any other filter to check if the mesh is watertight?
Could you suggest, please?

Connectivity is about how many pieces your mesh consists of. It does not tell if the pieces are watertight or not.

You can run clean polydata and hole filling filters, but I don’t think there is any way to guarantee that the result is watertight.

Also note that for practical applications, having a “watertight” mesh is not enough. You also want to avoid non-manifold edges, triangles with incorrect winding, elements with extreme aspect ratio, very thin walls, etc. These are quite hard problems and solutions are typically application-dependent.

You could also use the vtk.vtkFeatureEdges filter to search for internal edges. A water tight mesh would have none:

import vtk
alg = vtk.vtkFeatureEdges()
alg.FeatureEdgesOff()
alg.BoundaryEdgesOn()
alg.NonManifoldEdgesOn()
alg.SetInputDataObject(mesh)
alg.Update()
is_water_tight = alg.GetOutput().GetNumberOfCells() < 1
3 Likes

Thank you for your response.