Prześlij pliki do ''
This commit is contained in:
parent
ccd9672796
commit
656fd70231
75
drzewo.lpy
Normal file
75
drzewo.lpy
Normal file
@ -0,0 +1,75 @@
|
|||||||
|
import random
|
||||||
|
a = 50
|
||||||
|
length = 0.75
|
||||||
|
dl = 0.01
|
||||||
|
globalwidth = 0.5
|
||||||
|
degree = 70
|
||||||
|
def Start():
|
||||||
|
#random.seed(150)
|
||||||
|
pass
|
||||||
|
|
||||||
|
Axiom: SetGuide(treepath,90)_(1)@GsG(0.5)A(1,0.30)
|
||||||
|
derivation length: 100
|
||||||
|
production:
|
||||||
|
A(x,k) :
|
||||||
|
if x%7 == 0:
|
||||||
|
produce /(96)F(6,1-k/5)A(x+1,k+0.1)
|
||||||
|
elif x <= 35:
|
||||||
|
produce /(degree)F(0.7,1-k/5)[SetGuide(treepath2,8)_(0.3)&(90)-(60)B(1,1.0)]A(x+1,k+0.1)
|
||||||
|
B(x,k):
|
||||||
|
r = random.random()
|
||||||
|
if x <= 20:
|
||||||
|
produce F(0.8,0.05+0.25/k)[/(r*500)+(20)_(0.02)F(1)C(1,1.0)]B(x+1,k+1)
|
||||||
|
C(x,k):
|
||||||
|
r = random.random()
|
||||||
|
if x <= 10:
|
||||||
|
produce F(0.6)C(x+1,k+1)
|
||||||
|
|
||||||
|
Leaf(x):
|
||||||
|
produce Sweep(path,section,length,dl,globalwidth,leafwidth)
|
||||||
|
interpretation:
|
||||||
|
endlsystem
|
||||||
|
###### INITIALISATION ######
|
||||||
|
|
||||||
|
__lpy_code_version__ = 1.1
|
||||||
|
|
||||||
|
def __initialiseContext__(context):
|
||||||
|
import openalea.plantgl.all as pgl
|
||||||
|
Color_1 = pgl.Material("Color_1" , ambient = (66,33,0) , diffuse = 0 , specular = (204,204,204) , )
|
||||||
|
Color_1.name = "Color_1"
|
||||||
|
context.turtle.setMaterial(1,Color_1)
|
||||||
|
Color_2 = pgl.Material("Color_2" , ambient = (6,13,2) , diffuse = 5.76923 , )
|
||||||
|
Color_2.name = "Color_2"
|
||||||
|
context.turtle.setMaterial(2,Color_2)
|
||||||
|
import openalea.plantgl.all as pgl
|
||||||
|
path = pgl.BezierCurve2D(
|
||||||
|
pgl.Point3Array([(-0.5, 0, 1),(-0.326083, -0.0978345, 1),(-0.0956592, 0.0176126, 1),(0.0620721, -0.00621237, 1)]) ,
|
||||||
|
)
|
||||||
|
path.name = "path"
|
||||||
|
section = pgl.NurbsCurve2D(
|
||||||
|
ctrlPointList = pgl.Point3Array([(-0.672727, 0, 1),(-0.324715, 0.227106, 1),(0.023332, -0.20146, 1),(0.337225, -0.0436618, 1),(0.695455, 0.00454545, 1)]) ,
|
||||||
|
)
|
||||||
|
section.name = "section"
|
||||||
|
import openalea.plantgl.all as pgl
|
||||||
|
leafwidth = pgl.NurbsCurve2D(
|
||||||
|
ctrlPointList = pgl.Point3Array([(0, 0, 1),(0.0305872, 0.539066, 1),(0.125225, 0.681196, 1),(0.344686, 0.720503, 1),(0.544193, 0.504133, 1),(0.695718, 0.293404, 1),(0.731597, 0.166532, 1),(0.771218, 0.0592187, 1),(0.897377, 0.030847, 1),(1, -0.000465795, 1)]) ,
|
||||||
|
)
|
||||||
|
leafwidth.name = "leafwidth"
|
||||||
|
treepath = pgl.NurbsCurve2D(
|
||||||
|
ctrlPointList = pgl.Point3Array([(-0.5, 0, 1),(-0.238627, 0.00619407, 1),(-0.07298, -0.00805499, 1),(0.0491646, 0.0141531, 1),(0.234358, -9.59484e-005, 1),(0.398942, -0.00805499, 1),(0.565017, -0.00943561, 1)]) ,
|
||||||
|
)
|
||||||
|
treepath.name = "treepath"
|
||||||
|
treepath2 = pgl.NurbsCurve2D(
|
||||||
|
ctrlPointList = pgl.Point3Array([(-0.00917746, 0.0133432, 1),(0.226675, 1.80558, 1),(2.22693, 3.5567, 1),(3.06655, 5.98981, 1)]) ,
|
||||||
|
)
|
||||||
|
treepath2.name = "treepath2"
|
||||||
|
panel_0 = ({'active': True, 'visible': True, 'name': 'Panel 1'},[('Curve2D',path),('Curve2D',section),('Function',leafwidth),('Curve2D',treepath),('Curve2D',treepath2)])
|
||||||
|
parameterset = [panel_0,]
|
||||||
|
context["__functions__"] = [('leafwidth',leafwidth),]
|
||||||
|
context["__curves__"] = [('path',path),('section',section),('treepath',treepath),('treepath2',treepath2),]
|
||||||
|
context["__parameterset__"] = parameterset
|
||||||
|
context["path"] = path
|
||||||
|
context["section"] = section
|
||||||
|
context["leafwidth"] = pgl.QuantisedFunction(leafwidth)
|
||||||
|
context["treepath"] = treepath
|
||||||
|
context["treepath2"] = treepath2
|
75
drzewo.lpy~
Normal file
75
drzewo.lpy~
Normal file
@ -0,0 +1,75 @@
|
|||||||
|
import random
|
||||||
|
a = 50
|
||||||
|
length = 0.75
|
||||||
|
dl = 0.01
|
||||||
|
globalwidth = 0.5
|
||||||
|
degree = 70
|
||||||
|
def Start():
|
||||||
|
#random.seed(150)
|
||||||
|
pass
|
||||||
|
|
||||||
|
Axiom: SetGuide(treepath,90)_(1)@GsG(0.5)A(1,0.30)
|
||||||
|
derivation length: 100
|
||||||
|
production:
|
||||||
|
A(x,k) :
|
||||||
|
if x%7 == 0:
|
||||||
|
produce /(96)F(6,1-k/5)A(x+1,k+1)
|
||||||
|
elif x <= 35:
|
||||||
|
produce /(degree)F(0.7,1-k/5)[SetGuide(treepath2,8)_(0.3)&(90)-(60)B(1,1.0)]A(x+1,k+0.1)
|
||||||
|
B(x,k):
|
||||||
|
r = random.random()
|
||||||
|
if x <= 20:
|
||||||
|
produce F(0.8,0.05+0.25/k)[/(r*500)+(20)_(0.02)F(1)C(1,1.0)]B(x+1,k+1)
|
||||||
|
C(x,k):
|
||||||
|
r = random.random()
|
||||||
|
if x <= 10:
|
||||||
|
produce F(0.6)C(x+1,k+1)
|
||||||
|
|
||||||
|
Leaf(x):
|
||||||
|
produce Sweep(path,section,length,dl,globalwidth,leafwidth)
|
||||||
|
interpretation:
|
||||||
|
endlsystem
|
||||||
|
###### INITIALISATION ######
|
||||||
|
|
||||||
|
__lpy_code_version__ = 1.1
|
||||||
|
|
||||||
|
def __initialiseContext__(context):
|
||||||
|
import openalea.plantgl.all as pgl
|
||||||
|
Color_1 = pgl.Material("Color_1" , ambient = (66,33,0) , diffuse = 0 , specular = (204,204,204) , )
|
||||||
|
Color_1.name = "Color_1"
|
||||||
|
context.turtle.setMaterial(1,Color_1)
|
||||||
|
Color_2 = pgl.Material("Color_2" , ambient = (6,13,2) , diffuse = 5.76923 , )
|
||||||
|
Color_2.name = "Color_2"
|
||||||
|
context.turtle.setMaterial(2,Color_2)
|
||||||
|
import openalea.plantgl.all as pgl
|
||||||
|
path = pgl.BezierCurve2D(
|
||||||
|
pgl.Point3Array([(-0.5, 0, 1),(-0.326083, -0.0978345, 1),(-0.0956592, 0.0176126, 1),(0.0620721, -0.00621237, 1)]) ,
|
||||||
|
)
|
||||||
|
path.name = "path"
|
||||||
|
section = pgl.NurbsCurve2D(
|
||||||
|
ctrlPointList = pgl.Point3Array([(-0.672727, 0, 1),(-0.324715, 0.227106, 1),(0.023332, -0.20146, 1),(0.337225, -0.0436618, 1),(0.695455, 0.00454545, 1)]) ,
|
||||||
|
)
|
||||||
|
section.name = "section"
|
||||||
|
import openalea.plantgl.all as pgl
|
||||||
|
leafwidth = pgl.NurbsCurve2D(
|
||||||
|
ctrlPointList = pgl.Point3Array([(0, 0, 1),(0.0305872, 0.539066, 1),(0.125225, 0.681196, 1),(0.344686, 0.720503, 1),(0.544193, 0.504133, 1),(0.695718, 0.293404, 1),(0.731597, 0.166532, 1),(0.771218, 0.0592187, 1),(0.897377, 0.030847, 1),(1, -0.000465795, 1)]) ,
|
||||||
|
)
|
||||||
|
leafwidth.name = "leafwidth"
|
||||||
|
treepath = pgl.NurbsCurve2D(
|
||||||
|
ctrlPointList = pgl.Point3Array([(-0.5, 0, 1),(-0.238627, 0.00619407, 1),(-0.07298, -0.00805499, 1),(0.0491646, 0.0141531, 1),(0.234358, -9.59484e-005, 1),(0.398942, -0.00805499, 1),(0.565017, -0.00943561, 1)]) ,
|
||||||
|
)
|
||||||
|
treepath.name = "treepath"
|
||||||
|
treepath2 = pgl.NurbsCurve2D(
|
||||||
|
ctrlPointList = pgl.Point3Array([(-0.00917746, 0.0133432, 1),(0.226675, 1.80558, 1),(2.22693, 3.5567, 1),(3.06655, 5.98981, 1)]) ,
|
||||||
|
)
|
||||||
|
treepath2.name = "treepath2"
|
||||||
|
panel_0 = ({'active': True, 'visible': True, 'name': 'Panel 1'},[('Curve2D',path),('Curve2D',section),('Function',leafwidth),('Curve2D',treepath),('Curve2D',treepath2)])
|
||||||
|
parameterset = [panel_0,]
|
||||||
|
context["__functions__"] = [('leafwidth',leafwidth),]
|
||||||
|
context["__curves__"] = [('path',path),('section',section),('treepath',treepath),('treepath2',treepath2),]
|
||||||
|
context["__parameterset__"] = parameterset
|
||||||
|
context["path"] = path
|
||||||
|
context["section"] = section
|
||||||
|
context["leafwidth"] = pgl.QuantisedFunction(leafwidth)
|
||||||
|
context["treepath"] = treepath
|
||||||
|
context["treepath2"] = treepath2
|
Loading…
Reference in New Issue
Block a user