def test_mtglpy_topvine(): fn = path('vinemtg_n.lpy') if not fn.exists(): return l = Lsystem(str(fn)) parameters = {} parameters['carto_file'] = 'geom_n.dat' parameters['picle_file'] = 'vine_n.dat' parameters['TTfin'] = None #l.context().updateNamespace(parameters) c_iter = l.getLastIterationNb() nbstep = l.derivationLength - c_iter tree = l.iterate(l.axiom, c_iter, nbstep) scene = l.sceneInterpretation(tree) mtg = lpy2mtg(tree, l, scene) print(len(mtg)) axial_tree = AxialTree() axial_tree = mtg2lpy(mtg, l, axial_tree) g = lpy2mtg(axial_tree, l, scene) assert len(g) == len(mtg) #axial_tree = mtg2axialtree(mtg, scale, parameters, axial_tree) # Check assert True return mtg, tree, axial_tree
def test_mtglpy_topvine(): fn = path('vinemtg_n.lpy') if not fn.exists(): return l = Lsystem(str(fn)) parameters = {} parameters['carto_file'] = 'geom_n.dat' parameters['picle_file'] = 'vine_n.dat' parameters['TTfin'] = None #l.context().updateNamespace(parameters) c_iter = l.getLastIterationNb() nbstep = l.derivationLength - c_iter tree = l.iterate(l.axiom,c_iter,nbstep) scene = l.sceneInterpretation(tree) mtg = lpy2mtg(tree, l, scene) print len(mtg) axial_tree = AxialTree() axial_tree = mtg2lpy(mtg, l, axial_tree) g = lpy2mtg(axial_tree, l, scene) assert len(g) == len(mtg) #axial_tree = mtg2axialtree(mtg, scale, parameters, axial_tree) # Check assert True return mtg, tree, axial_tree
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) print(scene) world.add(scene, name='test') # axialtree = adapt_axialtree(axialtree, lsystem)
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) print(scene) world.add(scene, name='test') # axialtree = adapt_axialtree(axialtree, lsystem)