I want to know what would be the best way to take two meshes (constructed using trimmesh) and merge them together. The idea would be to identify a face on each mesh and connect the two using those two faces.
I want to know what would be the best way to take two meshes (constructed using trimmesh) and merge them together. The idea would be to identify a face on each mesh and connect the two using those two faces.
Two main approaches:
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)