Example #1
0
    def bottomFace():
        data = numpy.zeros(2, dtype=mesh.Mesh.dtype)

        # Top of the cube
        data['vectors'][0] = numpy.array([[0, 1, 0], [1, 0, 0], [0, 0, 0]])
        data['vectors'][1] = numpy.array([[1, 0, 0], [0, 1, 0], [1, 1, 0]])
        return data

    def renderMeshes(self):

        # Create a new plot
        figure = pyplot.figure()
        axes = mplot3d.Axes3D(figure)

        # Render the cube faces
        for m in self.meshes:
            axes.add_collection3d(mplot3d.art3d.Poly3DCollection(m.vectors))

        # Auto scale to the mesh size
        scale = numpy.concatenate([m.points for m in self.meshes]).flatten(-1)
        axes.auto_scale_xyz(scale, scale, scale)

        # Show the plot to the screen
        pyplot.show()


if __name__ == '__main__':
    lg = Life()
    lg.readSolution('FrogIn5/solution4.bin')
    LifeSTL(lg, saveDir='FrogMeshes', render=False)