function [x,y,z]=klein(u,v)
    r=3
    x=(r+sin(u).*cos(v/2)-sin(v/2).*sin(2*u)).*cos(v)
    y=(r+sin(u).*cos(v/2)-sin(v/2).*sin(2*u)).*sin(v)
    z=r*(sin(u).*sin(v/2)+cos(v/2).*sin(2*u))
endfunction


function [x,y,z]=sphere(u,v)
    r=1
    x= r.*sin(u).*cos(v)
    y=r.*sin(u).*sin(v)
    z=r.*cos(u)
endfunction

figure(0)
u=[0:0.05:2*%pi];
v=[0:0.05:2*%pi+0.02];
[x,y,z]=eval3dp(klein,u,v);
clf;
surf(x,y,z) 

figure(1)
u=[0:0.05:2*%pi];
v=[0:0.05:2*%pi];
[x,y,z]=eval3dp(sphere,u,v);
clf;
surf(x,y,z) 

figure(2)

for t=0.2:0.05:%pi
    u=[%pi-t:0.05:t+%pi];
    v=[0:0.05:2*%pi+0.02];
    [x,y,z]=eval3dp(klein,u,v);
    drawlater()
    clf;
    surf(x,y,z)
    sleep(100)
    drawnow()
end 


for t=0.05:0.05:2*%pi
    u=[0:0.05:t];
    v=[0:0.05:2*%pi];
    [x,y,z]=eval3dp(sphere,u,v);  
    drawlater()
    clf;
     a=get("current_axes")//get the handle of the newly created axes
    a.axes_visible="on"; // makes the axes visible
    a.data_bounds=[-1,-1,-1;1,1,1]; //set the boundary values for the x, y and z coordinates.
  
    surf(x,y,z)
    sleep(100)
    drawnow()
end 

