# Which method in VTK could I detect and repaire the mesh overlap?

**URL:** https://discourse.vtk.org/t/which-method-in-vtk-could-i-detect-and-repaire-the-mesh-overlap/6070
**Category:** Development
**Created:** [June 25, 2021, 6:31am UTC](https://discourse.vtk.org/t/which-method-in-vtk-could-i-detect-and-repaire-the-mesh-overlap/6070 "2021-06-25T06:31:22Z")
**Posts on this page:** 6
**Page:** 1

<div class="post-metadata">

### Author: ![Koly](https://discourse.vtk.org/letter_avatar_proxy/v4/letter/k/a3d4f5/32.png) [@Koly](https://discourse.vtk.org/u/Koly)
#### Post date: [June 25, 2021, 6:31am UTC](https://discourse.vtk.org/t/which-method-in-vtk-could-i-detect-and-repaire-the-mesh-overlap/6070/1 "2021-06-25T06:31:22Z")

</div>

Which method in VTK could I use to detect and repaire the mesh overlap?

Thanks in advance  
Koly

---

<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: [June 27, 2021, 3:33am UTC](https://discourse.vtk.org/t/which-method-in-vtk-could-i-detect-and-repaire-the-mesh-overlap/6070/2 "2021-06-27T03:33:59Z")

</div>

In general, repairing meshes is very hard and it often requires tedious manual/semiautomatic processing. You are much better off if you can avoid them in the first place.

How do you generate the invalid mesh? Do you get self-intersecting mesh because you extrude a mesh with surface normals? Or do you get overlapping meshes because you append meshes instead of combining them with Boolean mesh operations?

---

<div class="post-metadata">

### Author: ![Koly](https://discourse.vtk.org/letter_avatar_proxy/v4/letter/k/a3d4f5/32.png) [@Koly](https://discourse.vtk.org/u/Koly)
#### Post date: [June 28, 2021, 3:19am UTC](https://discourse.vtk.org/t/which-method-in-vtk-could-i-detect-and-repaire-the-mesh-overlap/6070/3 "2021-06-28T03:19:47Z")

</div>

Ok. I want to know is it also hard to detect meshes and is there any method to detect modes?

The mesh is a STL model which was outputted by 3D modeling software like UG.

---

<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: [June 28, 2021, 3:44am UTC](https://discourse.vtk.org/t/which-method-in-vtk-could-i-detect-and-repaire-the-mesh-overlap/6070/4 "2021-06-28T03:44:48Z")

</div>

Sorry, I don’t understand what you mean by detecting meshes and modes or what is UG. Maybe you could use different words or add screenshots or draw a sketch to make things more clear.

---

<div class="post-metadata">

### Author: ![Koly](https://discourse.vtk.org/letter_avatar_proxy/v4/letter/k/a3d4f5/32.png) [@Koly](https://discourse.vtk.org/u/Koly)
#### Post date: [June 28, 2021, 5:53am UTC](https://discourse.vtk.org/t/which-method-in-vtk-could-i-detect-and-repaire-the-mesh-overlap/6070/6 "2021-06-28T05:53:23Z")

</div>

I‘m sorry to bring your confusion.  
For me, I got the STL triangle mesh, and I will converse the STL to CLI. But the STL mesh sometimes has some errors, like bad edges、holes、Bad triangle（including bad orientation、intersections、Overlap）, which make the conversion errors. So I need to find the errors of STL first.  
UG is a 3D modeling software. Like the following picture.

 ![UG](https://discourse.vtk.org/uploads/default/original/2X/1/133da3412428a889614928467a0fcc7f7e397428.jpeg)

---

<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: [July 13, 2021, 5:19pm UTC](https://discourse.vtk.org/t/which-method-in-vtk-could-i-detect-and-repaire-the-mesh-overlap/6070/7 "2021-07-13T17:19:18Z")

</div>

The best is if you use a modeling software that does not generate invalid meshes. If you must use UG then probably your best bet is to report the issue to the developers and hope they will fix it.
