Iperbole come NURBS

size(20cm,0);
import graph3;
import three;
import palette;
import animate;
animation A=animation("coniche2");
A.global=false;
draw(scale(3,3,3)*unitsphere,invisible);

for(int i=0 ;i<20;++i) {
  real angle=i*pi/20;
  currentprojection=perspective(1,-0.4,2*abs(sin(angle))+1.5);
  
  draw(-0.5X -- 3X, arrow=Arrow3(), L=Label("$x$", position=EndPoint, align=W));
  draw(-0.5Y -- 3Y, arrow=Arrow3(), L=Label("$y$", position=EndPoint));
  draw(-0.5Z -- 3Z, arrow=Arrow3(), L=Label("$z$", position=EndPoint));

  triple F_orig(pair uv) {
    real t=uv.x;
    real s=uv.y;
    return (t, t*sin(s), t*cos(s));
  }

  surface surf_o2=surface(F_orig,(-2,0),(2,2*pi),20,20,Spline);

  draw(surf_o2, lightgray+opacity(0.05),meshpen=black+opacity(0.2),nolight);

  triple F_plane(pair uv) {
    real t=uv.x;
    real s=uv.y;
    return (t+1, s, -t+2);
  }

  surface surf_p=surface(F_plane,(-0.5,-2),(1.5,2),Spline);
  draw(surf_p, green+opacity(0.1),meshpen=black+opacity(0.1),nolight);

  triple F_plane2(pair uv) {
    real t=uv.x;
    real s=uv.y;
    return (t, s, 1);
  }

  surface surf_p2=surface(F_plane2,(-2,-2),(2,2),Spline);
  draw(surf_p2, blue+opacity(0.1),meshpen=black+opacity(0.1),nolight);

  real x(real t) {return 2*(1-t)*(1-t)+2*t*(1-t)+2*t*t ;}
  real y(real t) {return -sqrt(3)*(1-t)*(1-t)+sqrt(3)*t*t;}
  real z(real t) {return (1-t)*(1-t)+4*t*(1-t)+t*t;}

  path3 p=graph(x,y,z,0,1);
  draw(p, rgb(0,0.2,0));

  draw((2,-sqrt(3),1) -- (1,0,2), rgb(0,0.2,0)+dashed);
  draw((2,sqrt(3),1) -- (1,0,2), rgb(0,0.2,0)+dashed);

  dot((2,-sqrt(3),1),  rgb(0,0.2,0));
  dot((2,sqrt(3),1),  rgb(0,0.2,0));
  dot((1,0,2),  rgb(0,0.2,0));

  real x2(real t) {return (2-2*t+2*t*t)/(1+2*t-2*t*t);}
  real y2(real t) {return (-sqrt(3)*(2*t-1))/(1+2*t-2*t*t);}
  real z2(real t) {return 1;}

  path3 p2=graph(x2,y2,z2,0,1);
  draw(p2, rgb(0,0.0,0.6));

  for (int i=0; i<=10; ++i)
  {
    real t=i/10.;
    draw((0,0,0)--((2-2*t+2*t*t)/(1+2*t-2*t*t),(-sqrt(3)*(2*t-1))/(1+2*t-2*t*t),1), black+opacity(0.1));
  }
  A.add();
  save();
}
A.movie(loops=3,delay=300);
Link al pdf navigabile (visualizzabile con Acrobat Reader)