2

我想知道将两个网格(使用修剪网格构建)并将它们合并在一起的最佳方法是什么。这个想法是识别每个网格上的一个面,并使用这两个面将两者连接起来。

4

1 回答 1

2

Two main approaches:

  1. Use a boolean mesh operation: trimesh docu . But you must have openSCAD or Blender installed for that.
  1. Merge the vertices with "brute force": (Have the list of trimesh meshes to merge in "yourList")

     vertice_list = [mesh.vertices for mesh in yourList]
     faces_list = [mesh.faces for mesh in yourList]
     faces_offset = np.cumsum([v.shape[0] for v in vertice_list])
     faces_offset = np.insert(faces_offset, 0, 0)[:-1]
    
     vertices = np.vstack(vertice_list)
     faces = np.vstack([face + offset for face, offset in zip(faces_list, faces_offset)])
    
     merged__meshes = trimesh.Trimesh(vertices, faces)
    
于 2020-06-24T13:09:31.827 回答