# Detecting a hole in a mesh

This topic is 2385 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

## Recommended Posts

I have an algorithm to find the boundary edges of a triangles. As the mesh has holes (infact several holes) my algorithm return both the edges in the mesh boundary and edges adjacent to the hole region.

My question is how to differentiate between them. So that I can determine collection of those edges which forms a hole.

##### Share on other sites
Hidden
AFAIK there is no clear distinction. Topologically the boundary of a "hole" and the outside boundary of an open mesh is one and the same. The following are just ideas ...

* If you know that the mesh should be a 2-manifold, any boundary must surround a hole.

* If the mesh forms a flat surface, then you can determine the outer contour and distinguish it from any inner contour.

* If the mesh forms a nearly flat surface, then a projection and sub-sequent outer contour determination could work.

* Perhaps the surface normals at the boundary must not differ significantly (i.e. more than a threshold) from the normals of a "hole" filler to classify the boundary to be one of a hole (i.e. some kind of curvature assessment).

[font="arial, verdana, tahoma, sans-serif"][size="2"]AFAIK there is no clear distinction. Topologically the boundary of a "hole" and the outside boundary of an open mesh is one and the same. The following are just ideas ...

* If you know that the mesh should be a 2-manifold, any boundary must surround a hole.

* If the mesh forms a flat surface, then you can determine the outer contour and distinguish it from any inner contour.

* If the mesh forms a nearly flat surface, then a projection and sub-sequent outer contour determination could work.

* Perhaps the surface normals at the boundary must not differ significantly (i.e. more than a threshold) from the normals of a "hole" filler to classify the boundary to be one of a hole (i.e. some kind of curvature assessment).[/size][/font]
[size="3"][size=2]
[/size][/size]
[size="3"][size=2]The question is, what is the human formulated criterion to distinguish a hole from the mesh's outside?[/size][/size]

##### Share on other sites
Hmm..

Get the edges of the hole, and pick 2 points on the opposit sides. Then you could check if the polygons are on the inner side or the outer side...

Not propably very good and might not work on non convex holes though...

##### Share on other sites
Based on the idea that hole edges would form a line loop and so would outside edges, you could differentiate between the two by line loop length.

1) Find an edge
2) Count the edges in that loop
3) If edgecount < SOMENUMBER, edge is a hole edge.

Note you could also exit early from the count loop once you know the count is greater than SOMENUMBER

##### Share on other sites
As haegarr pointed out, there is no difference between the two. Think of a cylinder that is missing the top and bottom faces. You can continuously modified it by making one of the openings bigger and making the whole thing flat. At the end of this process, it is clear what you mean by "hole" and "boundary", but at the beginning both openings looked identical. At what point in the process do you want to label them? As you see, there is no natural answer.

What do you need this for?

##### Share on other sites

This topic is 2385 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

## Create an account

Register a new account

• ### Forum Statistics

• Total Topics
628663
• Total Posts
2984111

• 10
• 10
• 9
• 9
• 10