tic();

Setangle(70,-65);
Setwindow([-1.5,1.5], [-1.5,1.5]);

fd=list('z=x^2-y^2', 'x=r*cos(t)', 'y=r*sin(t)',..
        'r=[0,1]', 't=[0,2*%pi]', 'e');

function f=f(x,y); f=x^2-y^2; endfunction
    
surface=Sf3data(fd, 50, 50, [50,70]);

Windisp(Projpara(surface));

outline=Sfbdparadata(fd, 100);

K=8*%pi;
C=Spacecurve('[theta/K*cos(theta),..
               theta/K*sin(theta),..
               f(theta/K*cos(theta), theta/K*sin(theta))]',..
             'theta=[0,8*%pi]', 'N=300');
Crv=Crv3onsfparadata(C, outline, fd);
hCrv=Crv3onsfHiddenData();

//planeC=Spacecurve('[theta/K*cos(theta), theta/K*sin(theta), -2]',..
//                  'theta=[0,8*%pi]', 'N=300');
//L1=Spaceline([[-1.5,0,-2], [1.5,0,-2]]);
//L2=Spaceline([[0,-1.5,-2], [0,1.5,-2]]);
//Sq=Spaceline([[1.2,1.2,-2], [-1.2,1.2,-2], [-1.2,-1.2,-2],..
//              [1.2,-1.2,-2], [1.2,1.2,-2]]);

//Windisp(Projpara(Crv, outline, planeC, L1, L2, Sq));
//Windisp(Projpara(hCrv, outline));

N=8;
LCrv1=list();
for i=1:(N-1)
  R=i/N;
  tmp1=Spacecurve('[R*cos(t), R*sin(t), f(R*cos(t), R*sin(t))]',..
                  't=[0,2*%pi]', 'N=150');
  LCrv1($+1)=Crv3onsfparadata(tmp1, outline, fd);
end

M=20;
LCrv2=list();
for i=1:M
  theta=2*%pi/M*i;
  tmp2=Spacecurve('[r*cos(theta),..
                    r*sin(theta),..
                    f(r*cos(theta), r*sin(theta))]',..
                  'r=[0,1]', 'N=150');
  LCrv2($+1)=Crv3onsfparadata(tmp2, outline, fd);
end

Windisp(Projpara(LCrv1, LCrv2, outline));

Openfile('tex/surface_sample2_1.tex');
Beginpicture('1.5cm');
Drwline(Projpara(outline), 1.5);
Drwline(Projpara(LCrv1, LCrv2), 0.5);
Endpicture(0);
Closefile();

Openfile('tex/surface_sample2_2.tex');
Beginpicture('1.5cm');
Drwline(Projpara(outline), 1.5);
Drwline(Projpara(Crv), 0.5);
Setpen(0.5);
Dashline(Projpara(hCrv), 0.4, 0.4);
Endpicture(0);
Closefile();

//Setwindow([-1.7,1.7], [-2.5,1.5]);
//Openfile('tex/surface_sample2_3.tex');
//Beginpicture('1.5cm');
//Drwline(Projpara(outline), 1.5);
//Drwline(Projpara(L1, L2), 1.0);
//Drwline(Projpara(C, planeC, Sq), 0.5);
//Endpicture(0);
//Closefile();

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

