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, angl).rot(-2*angl).\ dragon(n-1, angl).rot(angl) : move(1) N = 12 # order th = pi/2 # global variable set xr [-32:96] set yr [-24:70] unset key unset border unset tics set size ratio -1 set term pngc enh font ",10" size 480,360 set out "c_curve.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.5") eval path set object 1 fillstyle border lc rgb "turquoise" plot -100 !display "c_curve.png" |