Asymptote Generalities – fig0570

Category: Asymptote,Examples 2D,GeneralitiesPh. Ivaldi @ 6 h 39 min

Figure 0057
(Compiled with Asymptote version 2.14svn-r5318)
    
size(3cm,0);

transform t=xscale(1.25);
pen p1=red, p2=yellow;
pair pa=t*dir(135), pb=t*dir(-45);

axialshade(t*unitcircle,p1,pa,p2,pb);
draw(pa--pb, dashed);

Étiquettes : , , ,


Asymptote Generalities – fig0630

Category: Asymptote,Examples 2D,GeneralitiesPh. Ivaldi @ 12 h 39 min

Figure 0063
(Compiled with Asymptote version 2.14svn-r5318)
    
pair O=0;
dot("N",O,N);
dot("S",O,S);
dot("E",O,E);
dot("W",O,W);

Étiquettes : , , ,


Asymptote Generalities – fig0640

Category: Asymptote,Examples 2D,GeneralitiesPh. Ivaldi @ 13 h 39 min

Figure 0064
(Compiled with Asymptote version 2.14svn-r5318)
    
pair O=0;
labelmargin=2;

dot("N",O,N);
dot("S",O,S);
dot("E",O,E);
dot("W",O,W);

Étiquettes : , , , ,


Asymptote Generalities – fig0650

Category: Asymptote,Examples 2D,GeneralitiesPh. Ivaldi @ 14 h 39 min

Figure 0065
(Compiled with Asymptote version 2.14svn-r5318)
    
size(4cm,0);

pair O=0;
dot("N",O,10N);
draw("S",O,10S);
draw("E",O,10E);
draw("W",O,10W);

draw("NE",O,5NE);
draw("SE",O,5SE);
draw("NW",O,5NW);
draw("SW",O,5SW);

Étiquettes : , , , ,


Asymptote Generalities – fig0660

Category: Asymptote,Examples 2D,GeneralitiesPh. Ivaldi @ 15 h 39 min

Figure 0066
(Compiled with Asymptote version 2.14svn-r5318)
    
pair O=0;
draw(scale(2)*Label("N",.8red),O,10*N,linewidth(3mm));
draw(scale(2)*Label("S",.8red),O,10*S);
draw(scale(2)*Label("E",.8red),O,10*E);
draw(scale(2)*Label("W",.8red),O,10*W);

draw(rotate(45)*Label("NE"),O,5NE);
draw(rotate(-45)*Label("SE"),O,5SE);
draw(rotate(-45)*Label("NW"),O,5NW);
draw(rotate(45)*Label("SW"),O,5SW);

Étiquettes : , , , , ,


Asymptote Generalities – fig0800

Category: Asymptote,Examples 2D,GeneralitiesPh. Ivaldi @ 5 h 39 min

Figure 0080
(Compiled with Asymptote version 2.14svn-r5318)
    
size(3cm,0);
path line1=(0,0)--(1,0);
path line2=(0,0)--(1,1);
pair bissec=dir(line1,line2);

draw(line1); draw(line2);
dot(bissec,linewidth(3bp));
draw(-.5bissec--bissec,dotted);
dot("$A$",(0,0),-bissec);  

Étiquettes : ,


Asymptote Generalities – fig0810

Category: Asymptote,Examples 2D,GeneralitiesPh. Ivaldi @ 6 h 39 min

Figure 0081
(Compiled with Asymptote version 2.14svn-r5318)
    
size(4cm,0);
pair A=0, B=(1,0), C=(2,2);;

draw(A--B--C--cycle);
dot("$A$",A,dir(C--A,B--A));  
dot("$B$",B,dir(C--B,A--B));  
dot("$C$",C,dir(A--C,B--C));

Étiquettes : , ,


Asymptote Generalities – fig0860

Category: Asymptote,Examples 2D,GeneralitiesPh. Ivaldi @ 11 h 39 min

Figure 0086
(Compiled with Asymptote version 2.14svn-r5318)
    
size(3cm,0);
pair A=0, B=(1,0), C=(1,1);

draw("$1$",A--B);
draw("$1$",B--C);

// draw(rotate(dir(C--A))*"$\sqrt{2}$",C--A);
draw(Label("$\sqrt{2}$",Rotate(-dir(C--A))),C--A);

Étiquettes : , , , , , ,


Asymptote Generalities – fig0870

Category: Asymptote,Examples 2D,GeneralitiesPh. Ivaldi @ 12 h 39 min

Figure 0087
(Compiled with Asymptote version 2.14svn-r5318)
    
size(3cm,0);
path g=(1,1)--(3,2);
draw(Label("a text",Rotate(dir(g))), g);
draw(Label("a text",red,Rotate(-dir(g)),align=I*dir(g)), g);

Étiquettes : , , , , ,


Asymptote Generalities – fig1320

Category: Asymptote,Examples 2D,GeneralitiesPh. Ivaldi @ 9 h 39 min

Figure 0131
(Compiled with Asymptote version 2.14svn-r5318)
    
size(0,0);

pair A=0, B=(3cm,5cm), C=(6cm,0);

pair ctrl_rgt_A, ctrl_lft_B, ctrl_rgt_B, ctrl_lft_C;
ctrl_rgt_A=A+2cm*E;
ctrl_lft_B=B+3cm*W;
ctrl_rgt_B=B+3cm*E;
ctrl_lft_C=C+2cm*W;

draw(A..B..C);
draw(A.. controls ctrl_rgt_A and ctrl_lft_B ..B.. controls ctrl_rgt_B and ctrl_lft_C ..C,1mm+grey);
dot(A--B--C,linewidth(6bp));
draw((A--ctrl_rgt_A),Arrow, p=grey);
draw((B--ctrl_rgt_B),Arrow, p=grey);
draw((B--ctrl_lft_B),Arrow, p=grey);
draw((C--ctrl_lft_C),Arrow, p=grey);

Étiquettes : , ,


Asymptote Generalities – fig1330

Category: Asymptote,Examples 2D,GeneralitiesPh. Ivaldi @ 10 h 39 min

Figure 0132
(Compiled with Asymptote version 2.14svn-r5318)
    
size(0,0);

pair A=0, B=(3cm,5cm), C=(6cm,0);

pair ctrl_rgt_A, ctrl_lft_B, ctrl_rgt_B, ctrl_lft_C;
ctrl_rgt_A=A+2cm*NE;
ctrl_lft_B=B+5cm*SW;
ctrl_rgt_B=B+2cm*SE;
ctrl_lft_C=C+5cm*NW;

draw(A..B..C);
draw(A.. controls ctrl_rgt_A and ctrl_lft_B ..B.. controls ctrl_rgt_B and ctrl_lft_C ..C,1mm+grey);
dot(A--B--C,linewidth(6bp));
draw((A--ctrl_rgt_A),Arrow, p=grey);
draw((B--ctrl_rgt_B),Arrow, p=grey);
draw((B--ctrl_lft_B),Arrow, p=grey);
draw((C--ctrl_lft_C),Arrow, p=grey);

Étiquettes : , ,


Asymptote Generalities – fig1340

Category: Asymptote,Examples 2D,GeneralitiesPh. Ivaldi @ 11 h 39 min

Figure 0133
(Compiled with Asymptote version 2.14svn-r5318)
    
size(8cm);
path p1 = (0,0){up}..(5,4)..(10,0){down};

pair post0=postcontrol(p1,0);
pair pre1=precontrol(p1,1);
pair post1=postcontrol(p1,1);
pair pre2=precontrol(p1,2);

dot(post0^^pre1^^post1^^pre2);
path p2 = (0,0)..controls post0 and pre1..(5,4)..controls post1 and pre2..(10,0); 

draw(p1,2mm+red);
draw(p2,linewidth(1mm));

Étiquettes : , ,


Asymptote Generalities – fig1370

Category: Asymptote,Examples 2D,GeneralitiesPh. Ivaldi @ 14 h 39 min

Figure 0136
(Compiled with Asymptote version 2.14svn-r5318)
    
size(0,0);

path cle=scale(2cm)*unitcircle;

draw(cle);

for(real i=0; i<=length(cle); i+=.2)
  draw(point(cle,i)--2cm*dir(cle,i)+point(cle,i),Arrow,p=i/length(cle)*red);

Étiquettes : , , , , ,


Asymptote Generalities – fig1380

Category: Asymptote,Examples 2D,GeneralitiesPh. Ivaldi @ 15 h 39 min

Figure 0137
(Compiled with Asymptote version 2.14svn-r5318)
    
size(0,0);

path cle=scale(2cm)*reverse(unitcircle);

draw(cle);

for(real i=0; i<=length(cle); i+=.2)
  draw(point(cle,i)--2cm*dir(cle,i)+point(cle,i),Arrow,p=i/length(cle)*red);

Étiquettes : , , , , ,


Asymptote Generalities – fig1390

Category: Asymptote,Examples 2D,GeneralitiesPh. Ivaldi @ 16 h 39 min

Figure 0138
(Compiled with Asymptote version 2.14svn-r5318)
    
size(8cm,0);
pair O=(0,0);
path p=(0,0){dir(0)}..{dir(45)}(2,2){dir(-45)}..{dir(0)}(4,0);

pair En1=dir(p, 1, -1);
pair En2=dir(p, 2, -1);
draw(p);
draw(Label("dir(p,1,-1)", EndPoint), point(p,1)--point(p,1)+En1, red, Arrow);
draw(Label("dir(p,2,-1)", EndPoint), point(p,2)--point(p,2)+En2, red, Arrow);

pair Ep0=dir(p, 0, 1);
pair Ep1=dir(p, 1, 1);
draw(Label("dir(p,0,1)", EndPoint), point(p,0)--point(p,0)+Ep0, blue, Arrow);
draw(Label("dir(p,1,1)", EndPoint, E), point(p,1)--point(p,1)+Ep1, blue, Arrow);

draw(p, dot);

Étiquettes : , , ,


Asymptote Generalities – fig1400

Category: Asymptote,Examples 2D,GeneralitiesPh. Ivaldi @ 17 h 39 min

Figure 0139
(Compiled with Asymptote version 2.14svn-r5318)
    
size(0,0);

path cle=scale(2cm)*reverse(unitcircle);

draw(cle);

for(real i=0; i<=length(cle); i+=.2)
  draw(point(cle,i)--(1cm*I*dir(cle,i))+point(cle,i),Arrow,p=i/length(cle)*red);

Étiquettes : , , , ,


Asymptote Generalities – fig1410

Category: Asymptote,Examples 2D,GeneralitiesPh. Ivaldi @ 18 h 39 min

Figure 0140
(Compiled with Asymptote version 2.14svn-r5318)
    
size(6cm,0);

path cle=scale(2)*unitcircle;

radialshade(scale(2)*cle,white+.1yellow,(0,0),2,yellow,(0,0),4);
radialshade(cle,white,(1,.5),0,.95yellow,(0,0),2);

for(real i=0; i<=length(cle); i+=.2)
  draw(point(cle,i)--(-2*I*dir(cle,i)+point(cle,i)),p=2mm+yellow+linecap(0));

Étiquettes : , ,


Asymptote Generalities – fig1420

Category: Asymptote,Examples 2D,GeneralitiesPh. Ivaldi @ 19 h 39 min

Figure 0141
(Compiled with Asymptote version 2.14svn-r5318)
    
size(6cm,0);

path curv=reverse((0,2){dir(-60)}..(1,0)..{dir(60)}(2,2));

draw(curv);

for(real i=0; i<=length(curv); i+=.1)
  draw(point(curv,i)--dir(curv,i)+point(curv,i),grey);

Étiquettes : , , , ,


Asymptote Generalities – fig1430

Category: Asymptote,Examples 2D,GeneralitiesPh. Ivaldi @ 20 h 39 min

Figure 0142
(Compiled with Asymptote version 2.14svn-r5318)
    
size(10cm,0);

path curv=reverse((0,2){dir(10)}..(1,0)..{dir(-50)}(3,2));
guide dirc;

draw(curv,linewidth(1mm)+grey);

for(real i=0; i<=length(curv); i+=.005)
  {
    draw(point(curv,i)--dir(curv,i)+point(curv,i),grey+yellow);
    dirc=dirc..dir(curv,i)+point(curv,i);
  }

draw(dirc,grey);

Étiquettes : , , ,


Asymptote Generalities – fig1440

Category: Asymptote,Examples 2D,GeneralitiesPh. Ivaldi @ 21 h 39 min

Figure 0143
(Compiled with Asymptote version 2.14svn-r5318)
    
// Author: John Bowman
pair[] z=new pair[10]; 
z[0]=(0,100); z[1]=(50,0); z[2]=(180,0); 
for(int n=3; n <= 9; ++n) 
  z[n]=z[n-3]+(200,0); 
path p=z[0]..z[1]---z[2]---z[3] 
&z[3]..z[4]--z[5]::{up}z[6] 
&z[6]::z[7]---z[8]..{up}z[9]; 
defaultpen(linewidth(1));
draw(p, grey); 
dot(p); 

real len=50;
for(int i = 0; i < z.length; ++i) {
  pair z=point(p,i);
  draw(z--z+len*dir(p,i,-1),red);
  draw(z--z+len*dir(p,i,1),blue+dashed);
  draw(z-len*dir(p,i)--z+len*dir(p,i),green+Dotted(defaultpen()));
}

Étiquettes : , ,


Asymptote Generalities – fig1450

Category: Asymptote,Examples 2D,GeneralitiesPh. Ivaldi @ 22 h 39 min

Figure 0144
(Compiled with Asymptote version 2.14svn-r5318)
    
size(10cm,0);
import math;

path cle=unitcircle;
path curv=reverse((1.5,2){dir(-60)}..(2.5,0)..{dir(60)}(3.5,2));

draw(cle);
draw(curv);

pair pt_cle=point(cle, 1.35);
pair pt_dir_cle=dir(cle, 1.35);

drawline((pt_cle - pt_dir_cle), (pt_cle + pt_dir_cle), red);

pair pt_curv=point(curv, dirtime(curv, pt_dir_cle));

drawline((pt_curv - pt_dir_cle), (pt_curv + pt_dir_cle), blue);

Étiquettes : , , ,


Asymptote Generalities – fig1550

Category: Asymptote,Examples 2D,GeneralitiesPh. Ivaldi @ 8 h 39 min

Figure 0154
(Compiled with Asymptote version 2.14svn-r5318)
    
//Translate from http://zoonek.free.fr/LaTeX/Metapost/metapost.html
size(0,0);

pair [] P, Q, R, S;
real u=1cm;

for (int i=0; i<=4; ++i)
  P[i] = rotate(i*360/5)*(0,-u);

P[5] = P[0];
for (int i=0; i<=4; ++i)
  Q[i] = 3*midpoint(P[i]--P[i+1]);

Q[5] = Q[0];
for (int i=0; i<=4; ++i)
  R[i] = 1/3*( Q[i] + Q[i+1] + P[i+1] );

R[5] = R[0];
for (int i=0; i<=5; ++i)
  S[i] = 1.5*Q[i];

for (int i=0; i<=4; ++i)
  {
    draw(P[i]   -- P[i+1]);
    draw(P[i+1] -- R[i]);
    draw(Q[i]   -- R[i]);
    draw(R[i]   -- Q[i+1]);
    draw(Q[i]   -- S[i]);
    draw(S[i]   -- S[i+1]);
    label(format("\small$P_%i$",i),P[i],-unit(P[i]));
    label(format("\small$Q_%i$",i),Q[i],rotate(60)*unit(Q[i]));
    label(format("\small$R_%i$",i),R[i],unit(R[i]));
    label(format("\small$S_%i$",i),S[i],unit(S[i]));
  }

Étiquettes : , , , ,


Asymptote Generalities – fig1750

Category: Asymptote,Examples 2D,GeneralitiesPh. Ivaldi @ 4 h 39 min

Figure 0174
(Compiled with Asymptote version 2.14svn-r5318)
    
size(6cm,0);

path p = (0,0){up} .. (2cm,0){up};
path q = (0,1cm){dir(-60)}..(1cm,-1cm)..{dir(60)}(2cm,1cm);

draw(p, red);
draw(q, blue);
dot(intersectionpoint(p,q));
draw(point(p, intersect(p,q)[0])--postcontrol(p, intersect(p,q)[0]), .8red,Arrow);
draw(point(q, intersect(p,q)[1])--postcontrol(q, intersect(p,q)[1]), .8blue,Arrow);

Étiquettes : , , ,


Asymptote Generalities – fig1760

Category: Asymptote,Examples 2D,GeneralitiesPh. Ivaldi @ 5 h 39 min

Figure 0175
(Compiled with Asymptote version 2.14svn-r5318)
    
import graph;
size(6cm,0);

path a = polargraph(new real(real t){return t;}, 0, 3pi, operator ..);
path b = polargraph(new real(real t){return 2t;}, 0, 3.75pi, operator ..);

real sharp=40;
path c=relpoint(a,1){relpoint(a,1)-postcontrol(a,length(a)-1)}..{dir(sharp)}relpoint(b,1);

fill(a..c..reverse(b)&cycle,0.8*red);
shipout(bbox(2mm, Fill(0.15*blue)));

Étiquettes : , , , , ,


Unofficial package graph_pi.asy – fig0200

Category: Asymptote,graph_pi.asy,Unofficial packagesPh. Ivaldi @ 0 h 50 min

Figure 0020
(Compiled with Asymptote version 2.14svn-r5318)
    
import graph_pi;

unitsize(x=2cm,y=4cm);
real f(real x){return abs(sin(x));};
real g(real x){return cos(x);};
real x;

xlimits(-.25, 8);
ylimits(-1.25, 1.25);
xaxis(LeftTicks);
yaxis(Ticks);
path Cf=graph(f, 0, 8,500);
path Cg=graph(g, 0, 8,500);
draw(Cf,bp+red);
draw(Cg,bp+blue);

x=pi/4;
/*MODgraph_pi.asy.html#addtangentMOD*/
addtangent(Cf, x, .5yellow, drawleft=false);
addtangent(Cg, x, .5yellow, drawright=false);
dot((x,f(x))^^(x,g(x)));

x=3*pi/4;
path tg=tangent(Cf, x);
draw(tg);
addtangent(Cg, x);
pair M=intersectionpoint(tg,Cg);
dot("$M$",M,E);
addtangent(Cg, M.x, size=3cm,p=red);
draw((x,f(x))--(x,g(x)),scale(2)*MarkFill[0]);

x=pi;
addtangent(Cg, x, size=2cm,.8(green+blue));
dot((x,g(x)));

x=5*pi/4;
addtangent(Cf, x, size=2cm, v=(1,.25/sin(x)),
            drawright=false, p=red, arrow=Arrow(5mm,NoFill));
addtangent(Cf, x, size=2cm, drawleft=false, red);
dot((x,f(x)));

x=2*pi;
addtangent(Cf, x, size=4cm,p=.8green,differentiable=false);
dot((x,f(x)));

Étiquettes : , ,


Official Asymptote example – Hobbycontrol

Category: Asymptote,Official Gallery One-PagerPh. Ivaldi @ 17 h 57 min

Figure 0091
(Compiled with Asymptote version 2.14svn-r5318)
/* This code comes from The Official Asymptote Gallery */
    
size(200);
pair z0=(0,0);
pair z1=(0.5,3);
pair z2=(2,1);

path g=z0..z1..z2;

pair d0=dir(g,0);
pair d1=dir(g,1);
draw(Label("$\omega_0$",1),z0-d0..z0+d0,blue+dashed,Arrow);
draw(Label("$\omega_1$",1),z1-d1..z1+1.5d1,blue+dashed,Arrow);
draw(z0--interp(z0,z1,1.5),dashed);
draw(subpath(g,0,1),blue);
draw("$\theta$",arc(z0,0.4,degrees(z1-z0),degrees(d0)),red,Arrow,
     EndPenMargin);
draw("$\phi$",arc(z1,1.05,degrees(z1-z0),degrees(d1)),red,Arrow,
     EndPenMargin);

dot("$z_0$",z0,SW,red);
dot("$z_1$",z1,SE,red);

Étiquettes : , , ,


Official Asymptote example – Hobbydir

Category: Asymptote,Official Gallery One-PagerPh. Ivaldi @ 18 h 57 min

Figure 0092
(Compiled with Asymptote version 2.14svn-r5318)
/* This code comes from The Official Asymptote Gallery */
    
size(200);
pair z0=(0,0);
pair z1=(1,2);
pair z2=(2,1);

path g=z0..z1..z2;

label("$\ell_k$",z0--z1);
draw("$\ell_{k+1}$",z1--z2,dashed);
draw(z0--interp(z0,z1,1.5),dashed);
pair d1=dir(g,1);
draw(z1-d1..z1+d1,blue+dashed);
draw(g,blue);
draw(Label("$\theta_k$",0.4),arc(z1,0.4,degrees(z2-z1),degrees(d1)),blue,Arrow,
     EndPenMargin);
draw("$\phi_k$",arc(z1,0.4,degrees(d1),degrees(z1-z0),CCW),Arrow,
     EndPenMargin);

dot("$z_{k-1}$",z0,red);
dot("$z_k$",z1,NW,red);
dot("$z_{k+1}$",z2,red);

Étiquettes : , , , ,


Official Asymptote example – bezier2

Category: Asymptote,Official Gallery One-PagerPh. Ivaldi @ 8 h 57 min

Figure 0009
(Compiled with Asymptote version 2.14svn-r5318)
/* This code comes from The Official Asymptote Gallery */
    
import beziercurve;

pair midpoint(pair a, pair b) {return interp(a,b,0.5);}

pair m0=midpoint(z0,c0);
pair m1=midpoint(c0,c1);
pair m2=midpoint(c1,z1);

draw(m0--m1--m2,dashed);
dot("$m_0$",m0,NW,red);
dot("$m_1$",m1,N,red);
dot("$m_2$",m2,red);

pair m3=midpoint(m0,m1);
pair m4=midpoint(m1,m2);
pair m5=midpoint(m3,m4);

draw(m3--m4,dashed);
dot("$m_3$",m3,NW,red);
dot("$m_4$",m4,NE,red);
dot("$m_5$",m5,N,red);

Étiquettes : , ,


Official Asymptote example – beziercurve

Category: Asymptote,Official Gallery One-PagerPh. Ivaldi @ 9 h 57 min

Figure 0010
(Compiled with Asymptote version 2.14svn-r5318)
/* This code comes from The Official Asymptote Gallery */
    
size(400);
pair z0=(0,0);
pair c0=(1,1);
pair c1=(2,1);
pair z1=(3,0);
draw(z0..controls c0 and c1 .. z1,blue);

draw(z0--c0--c1--z1,dashed);
dot("$z_0$",z0,W,red);
dot("$c_0$",c0,NW,red);
dot("$c_1$",c1,NE,red);
dot("$z_1$",z1,red);

Étiquettes : , ,


Official Asymptote example – fano

Category: Asymptote,Official Gallery One-PagerPh. Ivaldi @ 1 h 57 min

Figure 0062
(Compiled with Asymptote version 2.14svn-r5318)
/* This code comes from The Official Asymptote Gallery */
    
import math;

size(100,0);

pair z4=(0,0);
pair z7=(2,0);
pair z1=point(rotate(60)*(z4--z7),1);

pair z5=interp(z4,z7,0.5);
pair z3=interp(z7,z1,0.5);
pair z2=interp(z1,z4,0.5);
pair z6=extension(z4,z3,z7,z2);

draw(z4--z7--z1--cycle);
draw(z4--z3);
draw(z7--z2);
draw(z1--z5);
draw(circle(z6,abs(z3-z6)));

label("1",z1,dir(z5--z1));
label("2",z2,dir(z7--z2));
label("3",z3,dir(z4--z3));
label("4",z4,dir(z3--z4));
label("5",z5,dir(z1--z5));
label("6",z6,2.5E+0.1*N);
label("7",z7,dir(z2--z7));



Étiquettes : , , , ,


Official Asymptote example – transparency

Category: Asymptote,Official Gallery One-PagerPh. Ivaldi @ 4 h 57 min

Figure 0237
(Compiled with Asymptote version 2.14svn-r5318)
/* This code comes from The Official Asymptote Gallery */
    
size(0,150);

if(settings.outformat == "")
  settings.outformat="pdf";

begingroup();
fill(shift(1.5dir(120))*unitcircle,green+opacity(0.75));
fill(shift(1.5dir(60))*unitcircle,red+opacity(0.75));
fill(unitcircle,blue+opacity(0.75));
endgroup();

Étiquettes : , , ,