Barnsley fern
Posted: Tue Sep 12, 2017 10:20 pm
Code: Select all
w,h = #.scrsize()
x,y = 0
>
r = #.rnd(100)
? r<85, x,y = f2(x,y)
? r!<85 & r<92, x,y = f3(x,y)
? r!<92 & r<99, x,y = f4(x,y)
? r!<99, x,y = f1(y)
#.drawpoint(x/10*w+w/2,h-y/10*h,0,0.5,0,0.1)
<
f1(y) <= 0, 0.16*y
f2(x,y) <= 0.85*x+0.04*y, -0.04*x+0.85*y+1.6
f3(x,y) <= 0.2*x-0.26*y, 0.23*x+0.22*y+1.6
f4(x,y) <= -0.15*x+0.28*y, 0.26*x+0.24*y+0.44