move(s) = sprintf(" rto %f,%f",s*cos(th),s*sin(th)) rot(x) = sprintf("", th = th + x) dragon(n,angl) = (0 < n) ? rot(angl).\ dragon(n-1, -pi/4).rot(-2*angl).\ dragon(n-1, +pi/4).rot(angl) : move(1) N = 12 # order th = pi/2 # global variable set xr [-18:91] set yr [-25:50] unset key unset border unset tics set size ratio -1 set term pngc enh font ",10" size 480,360 set out "dragon.png" th = 0 path = dragon(N,pi/4) path = sprintf("set object 1 polygon from 0,0").path path = path.sprintf(" to 10000,-10000 lw 0.4") eval path set object 1 fillstyle border lc rgb "dark-goldenrod" plot -100 !display "dragon.png" |