Search code examples
pymesh

pymesh collapse_short_edges function makes mesh empty


I want to ask pymesh issue, not sure if it is a bug. when I call

pymesh, info = pm.collapse_short_edges(pymesh, 1e-6)  
print("face: ", pymesh.num_faces)  
print("vertices: ", pymesh.num_vertices)  
pymesh, info1 = pm.collapse_short_edges(pymesh, 0.05, preserve_feature=True)  
print("face: ", pymesh.num_faces)  
print("vertices: ", pymesh.num_vertices)  

It prints out as below:

INFO:pymesh.meshutils.collapse_short_edges:0 edges collapsed
face:  12
vertices:  8
INFO:pymesh.meshutils.collapse_short_edges:Minimum edge threshold: 0.05
INFO:pymesh.meshutils.collapse_short_edges:6 edges collapsed
face:  0
vertices:  0

so after "collapse_short_edges" func, the mesh no longer has any faces nor vertices. It happened to some of my meshes.  How do we fix this?


Solution

  • Based on their documentation, "It is possible for a mesh to consist of 0 vertices or 0 faces or 0 voxels."
    What you can do are:
    1. Save it to see if the mesh still looks normal

    pymesh.save_mesh()
    
    1. Save a tmp mesh and decide if you want it or not.

      tmp, info = pm.collapse_short_edges(original_mesh, threshold)