Skip to content

Commit

Permalink
feat: add id to zmesh.Mesh
Browse files Browse the repository at this point in the history
  • Loading branch information
william-silversmith committed Jul 27, 2024
1 parent 8bc40e3 commit 8a462aa
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
4 changes: 3 additions & 1 deletion zmesh/_zmesh.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -183,7 +183,9 @@ class Mesher:
transpose=False
)

return self._normalize_simplified_mesh(mesh, voxel_centered, physical=True)
mesh = self._normalize_simplified_mesh(mesh, voxel_centered, physical=True)
mesh.id = int(label)
return mesh

def _normalize_simplified_mesh(self, mesh, voxel_centered, physical):
points = np.array(mesh['points'], dtype=np.float32)
Expand Down
3 changes: 2 additions & 1 deletion zmesh/mesh.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,11 @@ class Mesh:
ndarray[float32, ndim=2] self.normals: [ [nx,ny,nz], ... ]
"""
def __init__(self, vertices, faces, normals):
def __init__(self, vertices, faces, normals, id=None):
self.vertices = vertices
self.faces = faces
self.normals = normals
self.id = id

def __len__(self):
return self.vertices.shape[0]
Expand Down

0 comments on commit 8a462aa

Please sign in to comment.