gasket := proc (a,b,L,k,m) description `returns Sierpinski's triangular curve`; local p, np; p := []; if k = 0 then p := [plots[polygonplot]([[a,b],[a+L,b],[a,b+L]],style = line)]: end if; np := plots[polygonplot]([[a,b+1/2*L],[a+1/2*L,b],[a+1/2*L,b+1/2*L]], color = green); p := [op(p),np]; if k < m then np := gasket(a,b,1/2*L,k+1,m); p := [op(p),op(np)]; np := gasket(a,b+1/2*L,1/2*L,k+1,m); p := [op(p),op(np)]; np := gasket(a+1/2*L,b,1/2*L,k+1,m); p := [op(p),op(np)]; end if; return p; end proc;