tic();

Setangle(65,45);
Setwindow([-2.5,2.5], [-1.5,1.5]);

r=0.5;
R=1.5;
fd=list('p', 'x=(R+r*cos(v))*cos(u)',..
             'y=(R+r*cos(v))*sin(u)',..
             'z=r*sin(v)',..
             'u=[0,2*%pi]', 'v=[0,2*%pi]', ' ');
surface=Sf3data(fd, 50, 50);

//Windisp(Projpara(surface));

outline=Sfbdparadata(fd, 100);

Lr=(1:10)*2*%pi/10; //Lr=[K,2*K,...,10*K] (K=2*%pi/10)
LR=(1:10)*2*%pi/10; 
wire=Wireparadata(outline, fd, LR, Lr, 100);

//Windisp(Projpara(outline, wire));

function v=v(t); v=8*t; endfunction
function f=f(t); f=[(R+r*cos(v(t)))*cos(t),..
                    (R+r*cos(v(t)))*sin(t),..
                    r*sin(v(t))]; endfunction

C=Spacecurve('[f(t)]', 't=[0,2*%pi]', 'N=300');
Crv=Crv3onsfparadata(C, outline, fd);
hCrv=Crv3onsfHiddenData();

Windisp(Projpara(Crv, outline));


Openfile('tex/surface_sample3_1.tex');
Beginpicture('1.5cm');
Drwline(Projpara(outline), 1.5);
Drwline(Projpara(wire), 0.5);
Endpicture(0);
Closefile();

Openfile('tex/surface_sample3_2.tex');
Beginpicture('1.5cm');
Drwline(Projpara(outline), 2.0);
Drwline(Projpara(Crv), 1.0);
Setpen(0.5);
Dashline(Projpara(hCrv), 1, 0.5);
Endpicture(0);
Closefile();

T=toc();
minute=floor(T/60);
second=floor(T-60*minute);
disp(strcat([string(minute), ' minutes ', string(second), ' seconds']));
