%! % Fractal leaf % Rehmi & Don /rnd % limit ==> 0..limit-1 { random mul floor } def /fractlevel % granularity branchscale branchangle ==> dict { 20 dict begin /branchangles exch def /branchscale exch def /granularity exch def currentdict end } def /deffractal % [ dict ... ==> dict { counttomark null exch { 1 index exch /nextlevel exch put } repeat exch pop } def /drawline { newpath 0 0 moveto 0 1 lineto stroke } def /fractal { % fract ==> --- begin drawline granularity { /grain exch def 0 grain translate branchangles { /branchangle exch def gsave branchangle rotate nextlevel null eq not { branchscale scale nextlevel fractal } { drawline } ifelse grestore } forall 0 grain neg translate } for pause end } def /test { 0 setlinewidth 288 50 translate 260 260 scale fractlevels fractal } def /fractlevels [ {1 1 1} {branchangle 2 div cos .1 add dup mul .3 add dup } [-110 -60 0 60 110] fractlevel {.08 .03 1} {grain 110 mul 50 add sin dup mul 7 div dup} {[-60 grain 30 mul add 60 grain 30 mul sub]} fractlevel {.05 100 rnd 1000 div .14 add 1} {.4 grain .3 mul sub dup} {[89 grain 85 mul sub -89 grain 85 mul add 70 grain 40 mul sub 30 rnd sub -70 grain 40 mul add 30 rnd add]} fractlevel {0 1 -1} {1 1} [] fractlevel deffractal def test