def cubes(self) -> Iterable[MeshBuilder]: """ Generates all cubes of the menger sponge as individual MeshBuilder() objects. Yields: MeshBuilder() """ faces = self.faces() for vertices in self: mesh = MeshBuilder() mesh.add_mesh(vertices=vertices, faces=faces) yield mesh
def pyramids(self) -> Iterable[MeshBuilder]: """ Generates all pyramids of the sierpinsky pyramid as individual MeshBuilder() objects. Yields: MeshBuilder() """ faces = self.faces() for vertices in self: mesh = MeshBuilder() mesh.add_mesh(vertices=vertices, faces=faces) yield mesh
def cube(center: bool = True, matrix: Matrix44 = None) -> MeshBuilder: """ Create a `cube <https://en.wikipedia.org/wiki/Cube>`_ as :class:`~ezdxf.render.MeshBuilder` object. Args: matrix: transformation matrix as :class:`~ezdxf.math.Matrix44` object center: 'mass' center of cube, ``(0, 0, 0)`` if ``True``, else first corner at ``(0, 0, 0)`` """ mesh = MeshBuilder() vertices = _cube0_vertices if center else _cube_vertices vectices = vertices if matrix is None else matrix.transform_vectors( vertices) mesh.add_mesh(vertices=vectices, faces=cube_faces) return mesh
def cube(center: bool = True, matrix: Matrix44 = None) -> MeshBuilder: """ Create a cube as MeshBuilder() object. Args: matrix: transformation matrix center: 'mass' center of cube in (0, 0, 0) if True, else first corner at (0, 0, 0) Returns: MeshBuilder() """ mesh = MeshBuilder() vertices = _cube0_vertices if center else _cube_vertices vectices = vertices if matrix is None else matrix.transform_vectors( vertices) mesh.add_mesh(vertices=vectices, faces=cube_faces) return mesh