'Detecting holes in a dirty triangle mesh (algorithm)

Detecting holes in a triangle mesh should be easy: Collect the edges that have only one adjacent triangle (degree-1 edges) and construct closed polylines from it. However, the mesh has been made from a scanned point cloud and it has bubbles. Thus the set of degree-1 edges does not completely describe the hole. The image below shows

  • Degree-1 edges in red
  • Degree-2 edges in black
  • Degree-3 edges in purple

I try already to find a paths to close the polylines. But that's not really a robust solution. Any ideas?

enter image description here

enter image description here



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source