Asymptote using tube.asy – fig0180

Category: Asymptote,Examples 3D,tube.asyPh. Ivaldi @ 12 h 11 min

Figure 0018
(Compiled with Asymptote version 2.14svn-r5318)
    
import tube;
import graph3;
size(12cm,0);

currentprojection=perspective(1,-1,0);


path3 p=scale3(20)*randompath3(20,false,operator--)--cycle;

path section=scale(1,0.25)*polygon(4);
draw(tube(roundedpath(p,0.05),section, corner=10), purple);

Mots-clefs :


Asymptote using tube.asy – fig0170

Category: Asymptote,Examples 3D,tube.asyPh. Ivaldi @ 11 h 11 min

Figure 0017
(Compiled with Asymptote version 2.14svn-r5318)
    
import tube;
import graph3;
size(12cm,0);

currentprojection=perspective(1,-1,0);


path3 p=scale3(20)*randompath3(20,false,operator--)--cycle;

path section=scale(1,0.5)*unitcircle;
// path section=polygon(6);
// path section=scale(1,0.25)*polygon(4);
draw(tube(p,section), purple, bp+yellow);

Mots-clefs :


Asymptote using tube.asy – fig0160

Category: Asymptote,Examples 3D,tube.asyPh. Ivaldi @ 10 h 11 min

Figure 0016
(Compiled with Asymptote version 2.14svn-r5318)
    
import tube;
import graph3;
size(12cm,0);

currentprojection=perspective(1,-1,0);

real x(real t)
{
return 41*cos(t)-18*sin(t)-83*cos(2t)-83*sin(2t)-11*cos(3t)+27*sin(3t);
}

real y(real t)
{
  return 36*cos(t)+27*sin(t)-113*cos(2t)+30*sin(2t)+11*cos(3t)-27*sin(3t);
}

real z(real t)
{
  return 45*sin(t)-30*cos(2t)+113*sin(2t)-11*cos(3t)+27*sin(3t);
}

path3 p=scale3(0.05)*graph(x,y,z,-pi,pi,200,operator --)&cycle;

path section=scale(2,0.5)*unitcircle;
// path section=scale(2,0.5)*polygon(4);
// path section=scale(2)*polygon(6);
draw(tube(p,section), purple);

Mots-clefs :


Asymptote using tube.asy – fig0150

Category: Asymptote,Examples 3D,tube.asyPh. Ivaldi @ 9 h 11 min

Figure 0015
(Compiled with Asymptote version 2.14svn-r5318)
    
import tube;
import graph3;
size(12cm,0);
// currentprojection=perspective((2,1,6),-Z); real q=1;
currentprojection=perspective((-1,1,1)); real q=2;

real x(real t){return (1-cos(t))*cos(q*t);}
real y(real t){return (1-cos(t))*sin(q*t);}
real z(real t){return cos(3t);}

path3 p=graph(x,y,z,0,2pi,20,operator ..);
draw(tube(p,scale(0.4,0.1)*unitcircle), purple);

Mots-clefs :


Asymptote using tube.asy – fig0140

Category: Asymptote,Examples 3D,tube.asyPh. Ivaldi @ 8 h 11 min

Figure 0014
(Compiled with Asymptote version 2.14svn-r5318)
    
import tube;
import graph;
size(12cm,0);
currentprojection=perspective(0,3,6);

real f(real t) {return cos(2*t);}
path g=polargraph(f,0,2pi,10,operator --)&cycle;
path3 p=path3(scale(20)*g);

draw(tube(p,2W--2E), red, bp+black);
draw(tube(p,unitcircle), orange, bp+black);

Mots-clefs : , ,


Asymptote using tube.asy – fig0130

Category: Asymptote,Examples 3D,tube.asyPh. Ivaldi @ 7 h 11 min

Figure 0013
(Compiled with Asymptote version 2.14svn-r5318)
    
import tube;
import graph;
size(12cm,0);
currentprojection=perspective(4,3,6);

real f(real t) {return cos(2*t);}
path g=polargraph(f,0,2pi,10,operator ..)&cycle;
path3 p=path3(scale(20)*g);

draw(tube(p,rotate(60)*polygon(3)), 0.8*red);
draw(tube(shift(Z)*p,scale(0.25)*unitcircle), orange);
draw(shift(1.25*Z)*p);

Mots-clefs : , ,


Asymptote using tube.asy – fig0120

Category: Asymptote,Examples 3D,tube.asyPh. Ivaldi @ 6 h 11 min

Figure 0012
(Compiled with Asymptote version 2.14svn-r5318)
    
import tube;
import graph3;
size(12cm,0);
currentprojection=orthographic(1,0,6);

real x(real t) {return sin(t);}
real y(real t) {return 0.5*sin(2*t);}

path g=graph(x,y,0,2pi,50,operator ..);
path3 p=path3(scale(5)*g);

pen[] pens(real t){
  real tt=1-2*abs(t-0.5);
  return new pen[] {interp(red,blue,tt), interp(blue,red,tt)};
}

draw(tube(p,
          coloredpath(polygon(5),pens,colortype=coloredNodes)));
label("colortype=coloredNodes",8*X);

draw(tube(shift(10*Y)*p,
          coloredpath(polygon(5),pens,colortype=coloredSegments)));
label("colortype=coloredSegments",8*X+10Y);

Mots-clefs : ,


Asymptote using tube.asy – fig0110

Category: Asymptote,Examples 3D,tube.asyPh. Ivaldi @ 5 h 11 min

Figure 0011
(Compiled with Asymptote version 2.14svn-r5318)
    
import tube;
import graph3;
size(12cm,0);
currentprojection=orthographic(4,3,4);

real x(real t) {return sin(t);}
real y(real t) {return 0.5*sin(2*t);}

path g=graph(x,y,0,2pi,50,operator ..);
path3 p=path3(scale(5)*g);

pen pen(real t){
  return interp(red,blue,1-2*abs(t-0.5));
}

draw(tube(p,coloredpath(subpath(unitcircle,1,3),pen)));
draw(p);

Mots-clefs :


Asymptote using tube.asy – fig0100

Category: Asymptote,Examples 3D,tube.asyPh. Ivaldi @ 4 h 11 min

Figure 0010
(Compiled with Asymptote version 2.14svn-r5318)
    
import tube;
import graph3;
size(12cm,0);
currentprojection=orthographic(4,3,2);

real x(real t) {return sin(t);}
real y(real t) {return cos(t);}
real z(real t) {return sqrt(t);}

path3 p=graph(x,y,z,0,4pi,50,operator ..);

path section=subpath(unitcircle,0,2);

pen pens(real t){
  return interp(red,blue,t);
}

// Define a transformation wich will be applied to each section at reltime t.
transform T(real t){return scale(t^0.75/2);}

// Combination of pens and transform:
draw(tube(p,coloredpath(section,pens), T));
draw(p);

Mots-clefs : ,


Asymptote using tube.asy – fig0090

Category: Asymptote,Examples 3D,tube.asyPh. Ivaldi @ 3 h 11 min

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

size(10cm,0);
currentprojection=perspective(4,3,4);
real x(real t) {return (1/sqrt(1+0.5*t^2))*cos(2pi*t);}
real y(real t) {return (1/sqrt(1+0.5*t^2))*sin(2pi*t);}
real z(real t) {return t;}

path3 p=graph(x,y,z,0,2.7,operator ..);
path section=scale(0.2)*polygon(4);

// Define an array of pen wich depends of a real t. t represent the "reltime" of the path3 p.
pen[] pens(real t){
  return new pen[] {interp(blue,red,t),
      interp(orange,yellow,t),
      interp(green,orange,t),
      interp(red,purple,t)};
}

// "pen[] pens(real t)" allows to color each nodes or segments with a real parameter (the reltime)
// Note that all arrays of pens are convert to cyclical arrays.
draw(tube(p,coloredpath(section,
                        pens,
                        colortype=coloredNodes)));

Mots-clefs : , , ,