# is there any way to check mesh is watertight?

**URL:** https://discourse.vtk.org/t/is-there-any-way-to-check-mesh-is-watertight/3169
**Category:** Support
**Created:** [April 28, 2020, 2:10pm UTC](https://discourse.vtk.org/t/is-there-any-way-to-check-mesh-is-watertight/3169 "2020-04-28T14:10:57Z")
**Posts on this page:** 4
**Page:** 1

<div class="post-metadata">

### Author: ![srbn.ghosh99](https://discourse.vtk.org/letter_avatar_proxy/v4/letter/s/cdc98d/32.png) [@srbn.ghosh99](https://discourse.vtk.org/u/srbn.ghosh99)
#### Post date: [April 28, 2020, 2:10pm UTC](https://discourse.vtk.org/t/is-there-any-way-to-check-mesh-is-watertight/3169/1 "2020-04-28T14:10:57Z")

</div>

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?

---

<div class="post-metadata">

### Author: ![lassoan](https://discourse.vtk.org/user_avatar/discourse.vtk.org/lassoan/32/50_2.png) [@lassoan](https://discourse.vtk.org/u/lassoan)
#### Post date: [April 29, 2020, 8:39pm UTC](https://discourse.vtk.org/t/is-there-any-way-to-check-mesh-is-watertight/3169/2 "2020-04-29T20:39:31Z")

</div>

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.

---

<div class="post-metadata">

### Author: ![banesullivan](https://discourse.vtk.org/user_avatar/discourse.vtk.org/banesullivan/32/7143_2.png) [@banesullivan](https://discourse.vtk.org/u/banesullivan)
#### Post date: [April 30, 2020, 12:20am UTC](https://discourse.vtk.org/t/is-there-any-way-to-check-mesh-is-watertight/3169/3 "2020-04-30T00:20:14Z")

</div>

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

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

```

---

<div class="post-metadata">

### Author: ![srbn.ghosh99](https://discourse.vtk.org/letter_avatar_proxy/v4/letter/s/cdc98d/32.png) [@srbn.ghosh99](https://discourse.vtk.org/u/srbn.ghosh99)
#### Post date: [April 30, 2020, 10:02pm UTC](https://discourse.vtk.org/t/is-there-any-way-to-check-mesh-is-watertight/3169/4 "2020-04-30T22:02:27Z")

</div>

Thank you for your response.
