trimesh
trimesh copied to clipboard
How to fix non-watertight model? Re-Open
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
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.