コード例 #1
0
ファイル: test_cut_module.py プロジェクト: pradal/WALTer
def force_cut(lstring):
    fake_rule = """
    Fake:
      produce Fake"""
    fake_lsys = Lsystem()
    fake_lsys.addRule(fake_rule)
    fake_lsys.axiom = lstring
    return fake_lsys.iterate()
コード例 #2
0
def lsystem(file_name, axiom='', derivationlength=-1, parameters={}):
    """ Build a lsystem object from file_name """
    l = Lsystem(file_name, parameters)

    if len(axiom):
        l.makeCurrent()
        if type(axiom) != AxialTree:
            axiom = AxialTree(axiom)
        l.axiom = axiom
        #l.done()
    if derivationlength >= 0:
        l.derivationLength = derivationlength

    return l
コード例 #3
0
ファイル: lpy_nodes.py プロジェクト: gkoehl/lpy
def lsystem(file_name, axiom = '', derivationlength = -1, parameters = {}):
    """ Build a lsystem object from file_name """
    l = Lsystem(file_name, parameters)

    if len(axiom):
        l.makeCurrent()
        if type(axiom) != AxialTree:
            axiom = AxialTree(axiom)
        l.axiom = axiom
        #l.done()
    if derivationlength >= 0:
        l.derivationLength = derivationlength

    return l    
コード例 #4
0
ファイル: test_manual_lpy.py プロジェクト: shiva16/openalea
N = 2

derivation length: N

production: 

F(x) :
  produce  F(x/3.0)+F(x/3.0)--F(x/3.0)+F(x/3.0)

endlsystem


'''

lsystem.setCode(str(code), context)
lsystem.axiom = "_(0.01)-(90)F(1)"

print('\n----lsystem:')
print(lsystem)
print('\n----axialtree:', axialtree)

axialtree = lsystem.iterate(3)

print('\n----lsystem:')
print(lsystem)
print('\n----axialtree:', axialtree)

lsystem.getLastIterationNb()  # iterate 4 -> getLastIterationNb == 3
lsystem.derivationLength  # see keyword in lpy code

scene = lsystem.sceneInterpretation(axialtree)
コード例 #5
0
N = 2

derivation length: N

production: 

F(x) :
  produce  F(x/3.0)+F(x/3.0)--F(x/3.0)+F(x/3.0)

endlsystem


'''

lsystem.setCode(str(code), context)
lsystem.axiom = "_(0.01)-(90)F(1)"

print('\n----lsystem:')
print(lsystem)
print('\n----axialtree:', axialtree)

axialtree = lsystem.iterate(3)

print('\n----lsystem:')
print(lsystem)
print('\n----axialtree:', axialtree)


lsystem.getLastIterationNb()  # iterate 4 -> getLastIterationNb == 3
lsystem.derivationLength  # see keyword in lpy code
コード例 #6
0
def shoot_grow(g, demand_only=True):
    lsys = Lsystem(str(os.path.join(lsysdir, 'morphogenesis.lpy')), {'demand_only': demand_only})
    lsys.axiom = mtg2lpy(g, lsys, AxialTree())
    axt = lsys.iterate()
    scene = lsys.sceneInterpretation(axt)
    return lpy2mtg(axt, lsys, scene)