filter faces to make better/simpler meshes

This commit is contained in:
Laura Klünder 2017-11-14 01:29:17 +01:00
parent 1e8305a281
commit dd8d160a10
2 changed files with 16 additions and 3 deletions

View file

@ -74,6 +74,12 @@ class HybridGeometry:
add_faces={crop_id: tuple((faces*scale+offset) for faces in self.faces)
for crop_id, faces in self.add_faces})
def filter(self, **kwargs):
return HybridGeometry(geom=self.geom, crop_ids=self.crop_ids,
faces=tuple(mesh.filter(**kwargs) for mesh in self.faces),
add_faces={crop_id: tuple(mesh.filter(**kwargs) for mesh in faces)
for crop_id, faces in self.add_faces.items()})
@property
def is_empty(self):
return not self.faces and not any(self.add_faces.values())
@ -333,6 +339,11 @@ class Mesh:
def __add__(self, other):
return Mesh(self.top+other, self.sides+other, self.bottom+other)
def filter(self, top=True, sides=True, bottom=True):
return Mesh(top=self.top if top else None,
sides=self.sides if sides else None,
bottom=self.bottom if bottom else None)
class LevelGeometries:
def __init__(self):