28 Oct 2007

Asymptote using tube.asy – fig0210

Figure 0021
(Compiled with Asymptote version 2.14svn-r5318)
    
import tube;
import graph3;
import palette;

size(12cm,0);
currentprojection=perspective(1,1,1);

int e=1;
real x(real t) {return cos(t)+2*cos(2t);}
real y(real t) {return sin(t)-2*sin(2t);}
real z(real t) {return 2*e*sin(3t);}

path3 p=scale3(2)*graph(x,y,z,0,2pi,50,operator ..)&cycle;

pen[] pens=Rainbow(15);
pens.push(black);
for (int i=pens.length-2; i >= 0 ; --i)
  pens.push(pens[i]);

path sec=subpath(Circle(0,1.5,2*pens.length),0,pens.length);
coloredpath colorsec=coloredpath(sec, pens,colortype=coloredNodes);
draw(tube(p,colorsec));

Étiquettes : , , ,