Asymptote Generalities – fig0820

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

Figure 0082
(Compiled with Asymptote version 2.14svn-r5318)
    
size(0,0);
path line=(0,0)--(3cm,0);
transform T=shift(0,-cm);

draw("$A$",line);  
draw("$B$",T*line,dir(0));
draw("$C$",T^2*line,N);
draw(Label("$D$",fontsize(14pt)),T^3*line);

Étiquettes : , , , ,


Asymptote Generalities – fig0830

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

Figure 0083
(Compiled with Asymptote version 2.14svn-r5318)
    
size(0,0);
path line=(0,0)--(3cm,0);
transform T=shift(0,-cm);

draw(Label("A",align=Center,filltype=UnFill), line);
draw(Label("B",UnFill), T*line, Center);
draw(Label("C",align=Center,position=Relative(.75),UnFill), T^2*line);
draw(Label("D",position=Relative(.25),UnFill), align=Center, T^3*line);

Étiquettes : , , , , ,


Asymptote Generalities – fig0840

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

Figure 0084
(Compiled with Asymptote version 2.14svn-r5318)
    
pair c=0;
label("abc xyz ijk",c,Align,basealign);
label("abc xyz ijk",c,Align,red);
draw(c--(c+(2cm,0))); // This is the baseline.

shipout((scale(3)*currentpicture.fit()));

Étiquettes : , , , ,


Asymptote Generalities – fig1680

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

Figure 0167
(Compiled with Asymptote version 2.14svn-r5318)
    
unitsize(5cm);

string text="A text along a curve";
path p=(0,0)..(1,1)..(2,0.5){dir(0)};
int n=length(text);
real at=0;
real step=arclength(p)/n;

for (int i=0; i<n; ++i){
  real t=arctime(p,at);
  label(rotate(degrees(angle(dir(p,t),false)))*scale(3)*baseline(substr(text,i,1)),point(p,t));
  at += step;
 }

draw(p,lightgrey);

Étiquettes : , , ,


Asymptote Generalities – fig1690

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

Figure 0168
(Compiled with Asymptote version 2.14svn-r5318)
    
import labelpath;

unitsize(5cm);
string text="\Huge A text along a curve";
path p=(0,0)..(1,1)..(2,0.5){dir(0)};

labelpath(text,p);
draw(p, lightgrey);

Étiquettes : , , , ,


Official Asymptote example – Pythagoras

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

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

real a=3;
real b=4;
real c=hypot(a,b);

pair z1=(0,b);
pair z2=(a,0);
pair z3=(a+b,0);
perpendicular(z1,NE,z1--z2,blue);
perpendicular(z3,NW,blue);
draw(square((0,0),z3));
draw(square(z1,z2));

real d=0.3;
pair v=unit(z2-z1);
draw(baseline("$a$"),-d*I--z2-d*I,red,Bars,Arrows,PenMargins);
draw(baseline("$b$"),z2-d*I--z3-d*I,red,Arrows,Bars,PenMargins);
draw("$c$",z3+z2*I-d*v--z2-d*v,red,Arrows,PenMargins);
draw("$a$",z3+d--z3+z2*I+d,red,Arrows,Bars,PenMargins);
draw("$b$",z3+z2*I+d--z3+z3*I+d,red,Arrows,Bars,PenMargins);

Étiquettes : , , , , ,


Official Asymptote example – basealign

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

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

settings.autobillboard=false;
settings.embed=false;
currentprojection=orthographic(Z);

defaultpen(fontsize(100pt));

dot(O);

label("acg",O,align=N,basealign);
label("ace",O,align=N,red);
label("acg",O,align=S,basealign);
label("ace",O,align=S,red);
label("acg",O,align=E,basealign);
label("ace",O,align=E,red);
label("acg",O,align=W,basealign);
label("ace",O,align=W,red);

picture pic;
dot(pic,(labelmargin(),0,0),blue);
dot(pic,(-labelmargin(),0,0),blue);
dot(pic,(0,labelmargin(),0),blue);
dot(pic,(0,-labelmargin(),0),blue);
add(pic,O);

dot((0,0));

label("acg",(0,0),align=N,basealign);
label("ace",(0,0),align=N,red);
label("acg",(0,0),align=S,basealign);
label("ace",(0,0),align=S,red);
label("acg",(0,0),align=E,basealign);
label("ace",(0,0),align=E,red);
label("acg",(0,0),align=W,basealign);
label("ace",(0,0),align=W,red);

picture pic;
dot(pic,(labelmargin(),0),blue);
dot(pic,(-labelmargin(),0),blue);
dot(pic,(0,labelmargin()),blue);
dot(pic,(0,-labelmargin()),blue);
add(pic,(0,0));

Étiquettes : , , , ,


Official Asymptote example – fjortoft

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

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

pair d=(1.5,1);
real s=d.x+1;

picture box(string s) {
  picture pic;
  draw(pic,box(0,d));
  label(pic,s,d/2);
  return pic;
}

add(box("$k_1$"));
add(shift(s)*box("$k_2$"));
add(shift(s)^2*box("$k_3$"));

path g=(d.x,d.y/2)--(s,d.y/2);
path G=(d.x/2,-(s-d.x))--(d.x/2,0);

draw(Label(baseline("$\ldots$")),shift(-s)*g,BeginArrow,BeginPenMargin);
draw(Label("$Z_1$"),g,BeginArrow,BeginPenMargin);
draw(Label("$E_1$",LeftSide),g,Blank);
draw(Label("$Z_3$"),shift(s)*g,Arrow,PenMargin);
draw(Label("$E_3$",LeftSide),shift(s)*g,Blank);
draw(Label("$Z_2$"),shift(s)*G,Arrow,PenMargin);
draw(Label("$E_2$",LeftSide),shift(s)*G,Blank);
draw(Label(baseline("$\ldots$")),shift(s)^2*g,Arrow,PenMargin);

Étiquettes : ,