rat = 0.3 # global fixed param. ang = pi/7 # global fixed param. draw(x,y,l,th) = sprintf(" to %f,%f", x+l*rat*cos(th), y+l*rat*sin(th)) back(x,y) = sprintf(" to %f,%f", x, y) rang(a) = a*(1+0.7*(rand(0)-0.5)) tree(n, x, y, l, th) = (0 < n) ? draw(x, y, l, th).\ tree(n-1, x+l*rat*cos(th), y+l*rat*sin(th), l*(1-rat), th+rang(ang)).\ tree(n-1, x+l*rat*cos(th), y+l*rat*sin(th), l*(1-rat), th-rang(ang)).\ back(x, y): "" N = 10 # ¼¡¿ô Lx = 0.96 Ly = Lx*2.0/3; seed = rand(time(1)) set xr [-Ly:Ly] set yr [0:Lx] unset key unset border unset tics path = tree(N,0,0,1,pi/2) path = sprintf("set object 1 polygon from 0,0").path path = path.sprintf(" to 0,0") eval path set object 1 fillstyle solid 0.8 border lc rgb "dark-green" lw 2 set term pngc enh font ",10" size 480,360 set out "tree.png" plot -1 !display "tree.png" |