Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Detecting openings/holes in a closed triangular mesh?

I want to detect (and close) openings and holes/hollowed out parts of a closed mesh. I know that for an open mesh, this can be done by finding the boundary edges (edges belonging to only one triangle) as described here.

But what about a closed mesh, where such boundary edges don't exist? Below is an example image. The box has an opening at the top, while the cylinder has a complete hole. Is there an algorithm to detect these things?

enter image description here

like image 702
Moody Avatar asked Nov 01 '18 08:11

Moody


1 Answers

This sort of problem is studied in a field called computational topology. To distinguish the torus (or multi-torus) from the sphere, it suffices to determine whether (in the language of homology) there exists a 1-cycle that is not a boundary. Assuming you have an orientable manifold, this can be done by comparing the rank/nullity of the matrices corresponding to the relevant boundary operators.

To repair the hole, my intuition would be that finding the shortest cycle that's not a boundary, filling it in, and repeating would give reasonable results, but I don't know off the top of my head how to do that algorithmically.

like image 69
David Eisenstat Avatar answered Sep 22 '22 15:09

David Eisenstat