Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- MAX_ANGLE_OFFSET = 5
- generate_tree = function (pos,initial_axiom,rules_a,rules_b,iterations,angle)
- prop_a=1.0
- prop_b=0.8
- stackPosition = NewStack()
- stackOrientation = NewStack()
- axiom = initial_axiom
- for i = 1, iterations, 1 do
- local temp=""
- for j = 1, #axiom, 1 do
- local c=string.sub(axiom,j,j)
- rValue = (math.random()+ 1.0) / 2.0
- if c=="A" then
- if prop_a > (1.0 - rValue) then
- temp=temp..rules_a
- end
- else
- if c=="B" and rules_b~="" then
- if prop_b > (1.0 - rValue) then
- temp=temp..rules_b
- end
- else
- temp=temp..c
- end
- end
- end
- axiom=temp
- end
- position=matrix:new({0,0,0})
- rotation=matrix:new(4,"I")
- end
- generate_tree({0,0,0},"FFFFFFA","[&FFBFA]////[&BFFFA]////[&FBFFA]","[&FFFA]////[&FFFA]////[&FFFA]",4,30)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement