## Asymptote Generalities – fig0900

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

 (Compiled with Asymptote version 2.14svn-r5318)

// Author: John Bowman
size(0,100);
real margin=2mm;
pair z1=(0,1);
pair z0=(0,0);

object label1=draw("small box",box,z1,margin);
object label0=draw("LARGE ELLIPSE",ellipse,z0,margin);

add(new void(frame f, transform t) {
draw(f,point(label1,S,t)--point(label0,N,t));
});



Étiquettes : , ,

## Asymptote Generalities – fig1980

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

 (Compiled with Asymptote version 2.14svn-r5318)

void enclose(picture pic=currentpicture, envelope e,
Label[] L=new Label[],
real xmargin=0, real ymargin=xmargin, pen p=currentpen,
filltype filltype=NoFill, bool above=true)
{

real H;
real[] h;
pic.add(new void (frame f, transform t) {
frame[] d=new frame[];
for (int i=0; i<L.length; ++i) {
d[i]=newframe;
Label LL=L[i].copy();
h[i]=ypart(max(d[i])-min(d[i]));
if(H < h[i]) H=h[i];
}
for (int i=0; i<L.length; ++i) {
real emy=(H-h[i])/2;
e(f,d[i],xmargin,ymargin+emy,p,filltype,above);
}
});
}

void box(picture pic=currentpicture, Label[] L=new Label[],
real xmargin=0, real ymargin=xmargin, pen p=currentpen,
filltype filltype=NoFill, bool above=true)
{
enclose(pic,box,L,xmargin,ymargin,p,filltype,above);
}

box(new Label[] {
Label("\begin{minipage}{3cm}Some text some text some text.\end{minipage}",(2.2cm,0)),
Label("Hello.",0),
Label("\begin{minipage}{3cm}Some text some text some
text some text some text some text some text.\end{minipage}",(5.4cm,0)),
Label("Bye.\rule{0pt}{1.5cm}",(1cm,-3cm))
});



Étiquettes : , ,

## Official Asymptote example – advection

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

 (Compiled with Asymptote version 2.14svn-r5318)
/* This code comes from The Official Asymptote Gallery */

size(0,22cm);

texpreamble("
\usepackage{bm}
\def\v{\bm}
\def\cross{{\v\times}}
\def\del{\nabla}
");

defaultpen(fontsize(10pt));

real margin=1.5mm;

object IC=draw("initial condition $\v U_0$",box,(0,1),
margin,black,FillDraw(palegray));
object Adv0=draw("Lagrangian state $\v U(t)$",ellipse,(1,1),
margin,red,FillDraw(palered));
object Adv=draw("Lagrangian prediction $\v U(t+\tau)$",ellipse,(1,0),
margin,red,FillDraw(palered));
margin,red,FillDraw(palered));
object Ur=draw("rearranged $\v \widetilde U$",box,(0,0),
margin,orange+gray,FillDraw(paleyellow));
object Ui=draw("interpolated $\v \widetilde U$",box,(1,-1),
margin,blue,FillDraw(paleblue));
object Crank=draw("${\cal L}^{-1}(-\tau){\cal L}(\tau)\v \widetilde U$",
box,(0.5,-1),margin,blue,FillDraw(paleblue));
object CrankR=draw("${\cal L}^{-1}(-\tau){\cal L}(\tau)\v \widetilde U$",
box,(0,-1),margin,orange+gray,FillDraw(paleyellow));
object Urout=draw(minipage("\center{Lagrangian rearranged solution~$\v U_R$}",
100pt),box,(0,-2),margin,orange+gray,
FillDraw(paleyellow));
object Diff=draw("$\v D\del^2 \v \widetilde U$",box,(0.75,-1.5),
margin,blue,FillDraw(paleblue));
object UIout=draw(minipage("\center{semi-Lagrangian solution~$\v U_I$}",80pt),
box,(0.5,-2),margin,FillDraw(palered+paleyellow));
object psi=draw("$\psi=\del^{-2}\omega$",box,(1.6,-1),
margin,darkgreen,FillDraw(palegreen));
object vel=draw("$\v v=\v{\hat z} \cross\grad\psi$",box,(1.6,-0.5),
margin,darkgreen,FillDraw(palegreen));

add(new void(frame f, transform t) {
picture pic;
PenMargin);
draw(pic,Label("Lagrange $\rightarrow$ Euler",0.45),
Arrow,PenMargin);
draw(pic,"Lagrange $\rightarrow$ Euler",point(Adv,S,t)--point(Ui,N,t),
RightSide,blue,Arrow,PenMargin);
Arrow(Relative(0.7)),PenMargin);
draw(pic,minipage("\flushleft{diffuse: multigrid Crank--Nicholson}",80pt),
point(Ui,W,t)--point(Crank,E,t),5N,blue,MidArrow,PenMargin);
draw(pic,minipage("\flushleft{diffuse: multigrid Crank--Nicholson}",80pt),
point(Ur,S,t)--point(CrankR,N,t),LeftSide,orange+gray,Arrow,PenMargin);
draw(pic,"output",point(CrankR,S,t)--point(Urout,N,t),RightSide,
orange+gray,Arrow,PenMargin);
draw(pic,point(Ui,S,t)--point(Diff,N,t),blue,MidArrow,PenMargin);
draw(pic,point(Crank,S,t)--point(Diff,N,t),blue,MidArrow,PenMargin);
label(pic,"subtract",point(Diff,N,t),12N,blue);
draw(pic,Label("Euler $\rightarrow$ Lagrange",0.5),
Arrow(position=1.5),PenMargin);
PenMargin);
draw(pic,"output",point(Crank,S,t)--point(UIout,N,t),RightSide,brown,Arrow,
PenMargin);
draw(pic,Label("$t+\tau\rightarrow t$",0.45),
draw(pic,point(psi,N,t)--point(vel,S,t),darkgreen,Arrow,PenMargin);
draw(pic,Label("multigrid",0.5,S),point(Ui,E,t)--point(psi,W,t),darkgreen,
Arrow,PenMargin);

});



Étiquettes :

## Official Asymptote example – alignbox

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

 (Compiled with Asymptote version 2.14svn-r5318)
/* This code comes from The Official Asymptote Gallery */

real margin=1.5mm;

object left=align(object("$x^2$",ellipse,margin),W);
object right=align(object("$\sin x$",ellipse,margin),4E);
add(new void(frame f, transform t) {
draw(f,point(left,NE,t)--point(right,W,t));
});



Étiquettes : ,

## Official Asymptote example – labelbox

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

 (Compiled with Asymptote version 2.14svn-r5318)
/* This code comes from The Official Asymptote Gallery */

size(0,100);
real margin=2mm;
pair z1=(0,1);
pair z0=(0,0);

object Box=draw("small box",box,z1,margin);
object Ellipse=draw("LARGE ELLIPSE",ellipse,z0,margin);

add(new void(frame f, transform t) {
draw(f,point(Box,SW,t){SW}..{SW}point(Ellipse,NNE,t));
});



Étiquettes :