Ejemplo n.º 1
0
def PlantGL(scene):
    fn = tempfile.mktemp(suffix=".png")
    Viewer.frameGL.setBgColor(255, 255, 255)
    Viewer.animation(True)
    Viewer.display(scene)
    Viewer.saveSnapshot(fn, "png")
    img = Image(fn)
    os.unlink(fn)
    return img
Ejemplo n.º 2
0
def plot(axiom = '', lsystem = None):
    """ Plot a string """
    if len(axiom) == 0:
        axiom = lsystem.axiom
    elif type(axiom) != AxialTree:
        if lsystem: lsystem.makeCurrent()
        axiom = AxialTree(axiom)
        if lsystem: lsystem.done()
    if (lsystem):
        Viewer.animation(False)
        lsystem.plot(axiom)
    else:
        plot(axiom)
    return (axiom,)
Ejemplo n.º 3
0
def plot(axiom='', lsystem=None):
    """ Plot a string """
    if len(axiom) == 0:
        axiom = lsystem.axiom
    elif type(axiom) != AxialTree:
        if lsystem: lsystem.makeCurrent()
        axiom = AxialTree(axiom)
        if lsystem: lsystem.done()
    if (lsystem):
        Viewer.animation(False)
        lsystem.plot(axiom)
    else:
        plot(axiom)
    return (axiom, )
Ejemplo n.º 4
0
def animate(lsystem, timestep):
    """ Animate a lsystem """

    if (lsystem):
        Viewer.animation(True)
        lsystem.animate(timestep * 0.01)
Ejemplo n.º 5
0
def animate(lsystem, timestep):
    """ Animate a lsystem """

    if(lsystem):
        Viewer.animation(True)
        lsystem.animate(timestep * 0.01)