trimesh icon indicating copy to clipboard operation
trimesh copied to clipboard

How to fix non-watertight model? Re-Open

Open angeltemelko opened this issue 4 years ago • 1 comments
trafficstars

Hello,

I was reading the issue #509, and we have the same problem with trimesh.fill_holes()

Is there any improvement on that function or should we still do it by hand?

Any suggestions on how to do It by hand.

THanks

angeltemelko avatar Oct 14 '21 10:10 angeltemelko

Any suggestions on how to do It by hand.

Assuming the winding of existing triangles are consistent:

  • Find all the edges
  • Find all edges AB for which BA does not exist: these outline holes
  • Add these edges to a networkx.Graph, then use connected components to separate them into unconnected holes
  • The simplest way to fill the holes is to find the centroid of the outline's vertices and use that as the tip of new triangles whose bases are the outline edges (if the hole is triangular, you don't need the centroid point), but this doesn't necessarily produce a good or even valid result. There are more complex mesh repair algorithms which take into account the shape of the neighbourhood around the hole.

clbarnes avatar Jan 04 '22 12:01 clbarnes