-
Notifications
You must be signed in to change notification settings - Fork 0
/
tree-2.lpy
44 lines (32 loc) · 977 Bytes
/
tree-2.lpy
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
from random import uniform as uni
from random import randint as rint
len = 25
leaflen = 1.8
leafsize = 0.03
bdlen1, bdlen2 = 0.5, 1.5
bcount1, bcount2 = 8,18
basesize = 0.04
Axiom: SetColor(80, 70, 55)SetWidth((len-3)*basesize)FFA(len)
derivation length: 50
production:
A(w):
nproduce -(uni(-2,2))F(1,(w-w/4)*basesize)[SetWidth(0.05)B(w)]
if w > 0:
produce A(w-1)
else:
produce FC(10)
B(w):
num = rint(bcount1, bcount2)
for degree in range(0, 360, 360//num):
degree = degree + uni(-30,30)
nproduce [F(uni(1,3)) /(degree)-(80 + uni(-10,10) )F(uni(bdlen1, bdlen2))C(w+5)]
if w < 2:
for _ in range(3):
nproduce [F(3) randrot(-180,180,-45,45)C(6)] [F(3) randrot(-180,180,-45,45)C(6)]
C(w):
for _ in range(w):
nproduce [SetColor(22, 55, 9)SetWidth(0.03)[\(15)+(25)F(leaflen,leafsize)][/(75)+(25)F(leaflen,leafsize)]]/(uni(15,35))F(0.3)
randrot(r1,r2,t1,t2):
produce /(uni(r1,r2))+(uni(t1,t2))
interpretation:
endlsystem