% Hollow stars recursing, designed to fill a page of A4 paper. beginfig(1); z0=(210/2mm, 297/2mm); % Center of page. numeric radius; radius=93mm; % Radius of enclosing circle. numeric startang; startang=90; % For rotating the whole thing. numeric np, n; np=9; n=50; % number of points and number of levels deep. numeric ang; ang=360/np; % Angle between points. % Define the points of the biggest (outer) star. for i=1 upto np: z[i]=z0+radius*dir(startang+(i-1)*ang); endfor for j=1 upto n: % Find the points for the next smaller star. for i=1 upto np: z[j*np+i]=(z[(j-1)*np+i]--z[(j-1)*np+((i+1) mod np)+1]) intersectionpoint (z[(j-1)*np+((i-2) mod np)+1]--z[(j-1)*np+(i mod np)+1]); endfor % Draw the black triangles for this star. for i=1 upto np: fill z[(j-1)*np+i]--z[j*np+i]--z[j*np+((i-2) mod np)+1]--cycle; endfor endfor endfig; % Loopy fibres. beginfig(2); pair cent; cent=(210/2mm, 297/2mm); % Center of page. numeric radius; radius=93mm; % Radius of enclosing circle. numeric startang; startang=90; % For rotating the whole thing. numeric np; np=11; % number of points and number of levels deep. numeric ang; ang=360/np; % Angle between points. numeric lt, llt; lt=9mm; llt=1mm;% Line thickness. numeric kmx; kmx=5; % Number of curves in each loop. numeric imx; imx=10; % Number of half-periods in each curve. numeric perd; perd=2/imx; % Period of curves. for j=1 upto np: numeric x[], y[], x[]l, x[]r, y[]l, y[]r; path op, ip; % Outer path and inner path. path iop, iip; % Inner outer path and inner inner path. numeric a; a=startang+(j-1)*ang; penpos 0(1/3lt, a); z0=cent; penpos 1(lt, a+180); z1=cent+radius*dir(a); penpos 2(1/3(lt-2llt), a); z2=cent; penpos 3(lt-2llt, a+180); z3=cent+radius*dir(a); op=z0l..z1l..cycle; ip=z0r..z1r..cycle; iop=z2l..z3l..cycle; iip=z2r..z3r..cycle; % draw op; draw ip; draw iop; draw iip; for k=0 upto kmx: numeric phs; phs=k/kmx*perd; path insp, outp; outp= for i=0 upto imx*2-1: if odd i: (point ((phs+i/imx) mod 2) of iip).. else: (point ((phs+i/imx) mod 2) of op).. fi endfor cycle; insp= for i=0 upto imx*2-1: if odd i: (point ((phs+i/imx) mod 2) of ip).. else: (point ((phs+i/imx) mod 2) of iop).. fi endfor cycle; fill (subpath (0,(length outp)) of outp)-- (subpath ((length insp),0) of insp)--cycle; endfor endfor endfig; end