code
>
twist := proc(seg)
local p,q;
p :=seg[1]: q := seg[2]:
[p,2/3*p+1/3*q+[0,1/3*(q[2]-p[2])]],
[2/3*p+1/3*q+[0,1/3*(q[2]-p[2])],
1/3*p+2/3*q+[0,-1/3*(q[2]-p[2])]],
[1/3*p+2/3*q+[0,-1/3*(q[2]-p[2])],q]; end:
> plot({twist([[0,0],[1,1]])},color=black):
>
bolzano := proc(n,clr)
local i,thread;
thread :=[twist([[0,0],[1,1]])];
for i from 1 to n-1 do thread := map(twist, thread ) od:
plot({op(thread)},color=clr); end: