## Asymptote Generalities – fig0200

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

 (Compiled with Asymptote version 2.14svn-r5318)

unitsize(cm);
pair A=(0,0), B=(1,0), C=(0,1);
path trig;
trig=A--B--C--cycle;
draw(trig);
dot(trig,linewidth(4bp));
dot(shift(3,0)*trig,red+4bp);



Étiquettes : , , , , ,

## Asymptote Generalities – fig0570

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

 (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);

draw(pa--pb, dashed);



Étiquettes : , , ,

## Asymptote Generalities – fig0580

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

 (Compiled with Asymptote version 2.14svn-r5318)

// Author: John Bowman
size(10cm,0);

real r=1;
real R=3.8;

int step=30;
path p=arc(0,r,0,step);
path P=arc(0,R,step,0);
for(int h=0; h < 360; h += step) {
transform t=rotate(90-h);
new pen[] {white,white,hsv(h-step,1,1),hsv(h,1,1)});
}

for(int h=0; h < 360; h += 30) {
pair v=R*dir(90-h);
draw(Label(string(h)+"$^\circ$",EndPoint),(v--1.05v));
}

draw(circle(0,r));
draw(circle(0,R));



Étiquettes : , , , , ,

## Asymptote Generalities – fig0620

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

 (Compiled with Asymptote version 2.14svn-r5318)

size(10cm,0);

path cle=unitcircle;

draw((-1.5,0)--(2.5,0),linewidth(10mm));
filldraw(cle,red+opacity(.5));
filldraw(shift((1,0))*cle,blue+opacity(.5));

shipout(format="pdf");
/*Others examples here.*/



Étiquettes : , , , ,

## Asymptote Generalities – fig0660

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

 (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 – fig0750

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

 (Compiled with Asymptote version 2.14svn-r5318)

label(rotate(45)*"\textbf{Hello}");



Étiquettes : , ,

## Asymptote Generalities – fig0760

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

 (Compiled with Asymptote version 2.14svn-r5318)

frame f;
label(f,"\textbf{Hello}",yellow,Fill(black));



Étiquettes : , , ,

## Asymptote Generalities – fig0770

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

 (Compiled with Asymptote version 2.14svn-r5318)

frame f;
filldraw(scale(3cm)*unitsquare,black);
label(f,"Hello",.8red,Fill(white));



Étiquettes : , , ,

## Asymptote Generalities – fig0820

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

 (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

 (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

 (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 – fig0880

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

 (Compiled with Asymptote version 2.14svn-r5318)

size(0,0);
pair A=(0,0), B=(4cm,0);
path line=A--B;
transform TD=shift(0,-cm);
transform TR=shift(2.5cm,0);

defaultpen(linewidth(3bp));

draw("$AB$",line,.8red,Arrows(3mm));
draw("$A$",A,N); draw("$B$",B,N);

draw("$AB$",TD*line,.8red,Arrows(3mm),PenMargins);
draw("$A$",TD*A,N); draw("$B$",TD*B,N);

draw("$AB$",TD^2*line,.8red,Arrows(3mm),DotMargins);
dot("$A$",TD^2*A,dotfactor*NW); dot("$B$",TD^2*B,dotfactor*NE);

margin BigMargins=Margin(2,2);
draw("$AB$",TD^3*line,.8red,Arrows(3mm),BigMargins);
draw("$A$",TD^3*A,N); draw("$B$",TD^3*B,N);



Étiquettes : , , , , ,

## Asymptote Generalities – fig0950

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

 (Compiled with Asymptote version 2.14svn-r5318)

size(0,0);

real R=2cm;

draw(scale(R)*unitcircle);
dot((0,0),linewidth(4bp));
dot((R*cos(pi/6),R*sin(pi/6)),red+8bp);



Étiquettes : , , , ,

## Asymptote Generalities – fig1010

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

 (Compiled with Asymptote version 2.14svn-r5318)

size(6cm,0);

picture pic;
pen [] P={.8red,.7green,blue+.5grey,yellow+.6grey};

fill(scale(10)*unitcircle,.2blue);

for (int i = 0; i <= 3; ++i)
draw(pic, arc((0,0),10,i*90,(i+1)*90), P[i]);

for (real i = 1; i <= 10; i+=.05)



Étiquettes : , , , ,

## Asymptote Generalities – fig1100

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

 (Compiled with Asymptote version 2.14svn-r5318)

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

draw(A--B--C--cycle);
filldraw(shift(A)*scale(4bp)*unitcircle, white);
filldraw(shift(B)*scale(4bp)*unitcircle, white);
filldraw(shift(C)*scale(4bp)*unitcircle, white);



Étiquettes : , ,

## Asymptote Generalities – fig1360

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

 (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)
{
dot(point(cle,i));
draw((0,0)--point(cle,i),dotted);
}



Étiquettes : , , , , ,

## Asymptote Generalities – fig1460

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

 (Compiled with Asymptote version 2.14svn-r5318)

size(0,0);

pair O=(2cm,2cm);
path cle=shift(O)*scale(2cm)*unitcircle;
pair M=point(cle,.6);

dot("$O$",O,SW);
dot("$M$",M,unit(M-O));

draw(cle);
draw((0,0)--(0,4cm),Arrow);
draw((0,0)--(4cm,0),Arrow);

draw(Label("$X_M$",position=EndPoint),M--(xpart(M),0),dotted);
draw(Label("$Y_M$",position=EndPoint),M--(0,ypart(M)),dotted);



Étiquettes : , , , , ,

## Asymptote Generalities – fig1470

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

 (Compiled with Asymptote version 2.14svn-r5318)

size(0,0);

path p= scale(1cm)*unitcircle;

draw(p,red+1mm);
draw(shift(1mm,2mm)*p);
draw(shift(2*(1mm,2mm))*p);
draw(shift(3*(1mm,2mm))*p);
draw(shift(4*(1mm,2mm))*p);
draw(shift(5*(1mm,2mm))*p);



Étiquettes : , ,

## Asymptote Generalities – fig1480

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

 (Compiled with Asymptote version 2.14svn-r5318)

size(0,0);

path p= (5mm,-5mm){right} .. (2cm,0);

for(int i=10; i<360; i+=10)
draw(rotate(i)*p);

draw(p,red+1mm);



Étiquettes : , , ,

## Asymptote Generalities – fig1490

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

 (Compiled with Asymptote version 2.14svn-r5318)

size(4cm,0);

path p= (1,-1){right} .. (4,0);
pair O=(3,.25);

for(int i=10; i<360; i+=10)
draw(rotate(i,O)*p);

dot(O,blue);
draw(p,red+1mm);



Étiquettes : , , ,

## Asymptote Generalities – fig1500

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

 (Compiled with Asymptote version 2.14svn-r5318)

size(6cm,0);

path curv=(0,0)..(1,1)..(1.5,-1)..(3,0);
pair A=(0,-1), B=(3,.75);

defaultpen(1mm);
draw(curv);
draw(reflect(A,B)*curv,.8red);
draw(A--B,grey);



Étiquettes : , ,

## Asymptote Generalities – fig1510

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

 (Compiled with Asymptote version 2.14svn-r5318)

size(4cm,0);

path cle=unitcircle;

draw(cle,red);
draw(xscale(2)*cle);
draw(yscale(2)*cle);
draw(scale(2)*cle,blue);



Étiquettes : , , ,

## Asymptote Generalities – fig1520

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

 (Compiled with Asymptote version 2.14svn-r5318)

size(8cm,0);

transform scale(pair center, real k)
{
return shift(center)*scale(k)*shift(-center);
}

path cle=unitcircle;
pair A=(4,0);
draw(cle);

draw(scale(A,.5)*cle,red);
draw(scale(A,-.75)*cle,blue);

for (real t; t<length(cle); t+=1)
draw(point(cle,t)--point(scale(A,-.75)*cle,t),dotted);

dot("$A$",A,N);



Étiquettes : , , , ,

## Asymptote Generalities – fig1530

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

 (Compiled with Asymptote version 2.14svn-r5318)

//Translate from http://zoonek.free.fr/LaTeX/Metapost/metapost.html

size(0,0);

pair inversion(pair O, real k, pair M)
{
return (O + k*unit(M-O)/abs(M-O));
}

guide inversion(pair O, real k, path M)
{
guide opath=inversion(O,k,point(M,0));
for (real i=0; i<=length(M); i+=length(M)/100)
opath = opath .. inversion(O,k,point(M,i));
return opath .. cycle;
}

real u=8cm;
path [] p;
path A = scale(u)*unitcircle;
path B = scale(3)*A;
pair z = rotate(10)*(5u,0);

draw(inversion( z, 2*u^2, A ),linewidth(1pt));
draw(inversion( z, 2*u^2, B ),linewidth(1pt));

p[0] = shift(2u,0)*scale(u)*unitcircle;

for (int i=0; i<=5; ++i)
{
if (i!=0) p[i] = rotate(360/6)*p[i-1];
draw(inversion( z, 2 (u^2), p[i] ));
}



Étiquettes : , , ,

## Asymptote Generalities – fig1890

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

 (Compiled with Asymptote version 2.14svn-r5318)

size(6cm,0);
path [] c;

c[1] = xscale(2)*unitcircle;
c[2] = shift((0,1))*c[1];
draw(c[1]^^c[2]);
draw(buildcycle(c[1],c[2]), .8red+4bp);



Étiquettes : , , , , , ,

## Asymptote Generalities – fig1900

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

 (Compiled with Asymptote version 2.14svn-r5318)

//Translate from http://zoonek.free.fr/LaTeX/Metapost/metapost.html
size(6cm,0);

path a,b,c,d;
a = (-1,-.2){up} .. tension 1.2 .. (1,-.2){down};
transform r90=rotate(90);
b = r90*a;
c = r90*b;
d = r90*c;
path bound=buildcycle(a,b,c,d);
fill(bound, lightgrey);
draw(a^^b^^c^^d,grey);
draw(bound);



Étiquettes : , , , , , ,

## Asymptote Generalities – fig1910

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

 (Compiled with Asymptote version 2.14svn-r5318)

size(6cm,0);

path a,b,c;
a = shift(1,0)*scale(2)*unitcircle;
b = rotate(120)*a;
c = rotate(120)*b;

fill(a, red);
fill(b, green);
fill(c, blue);
fill(buildcycle(a,b), red + green);
fill(buildcycle(b,c), green + blue);
fill(buildcycle(c,a), blue + red);
fill(buildcycle(a,b,c), white);

draw(a^^b^^c);



Étiquettes : , , , , , ,

## Asymptote Generalities – fig1930

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

 (Compiled with Asymptote version 2.14svn-r5318)

size(0,0);

path pt1=scale(2cm)*unitcircle;
path pt2=scale(1cm)*unitcircle;

filldraw(pt1^^pt2,evenodd+yellow+.9white);



Étiquettes : , , , , ,

## Asymptote Generalities – fig1940

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

 (Compiled with Asymptote version 2.14svn-r5318)

size(0,0);

path pt1=scale(2cm)*unitcircle;
path pt2=scale(1cm)*unitcircle;
path pt3=shift(0,.5cm)*pt2;

filldraw(pt1^^pt2^^pt3,evenodd+yellow+.9white);



Étiquettes : , , , , ,

## Asymptote Generalities – fig1950

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

 (Compiled with Asymptote version 2.14svn-r5318)

size(0,0);

path pt1=scale(2cm)*unitcircle;
path pt2=scale(1cm)*unitcircle;
path pt3=shift(0,1.5cm)*pt2;

filldraw(pt1^^pt2^^pt3,evenodd+yellow+.9white);



Étiquettes : , , , , ,

## Asymptote using geometry.asy – fig0060

Category: Asymptote,Examples 2D,geometry.asyPh. Ivaldi @ 11 h 02 min

 (Compiled with Asymptote version 2.14svn-r5318)

import geometry;
size(12cm,0);

currentcoordsys=cartesiansystem((1.25,0.75),i=(1,0.5),j=(-1,1));
coordsys Rp=currentcoordsys;
coordsys R=defaultcoordsys;

show(Label("$O$",align=SE), "$\vec{\imath}$", Label("$\vec{\jmath}$",align=E), R);
show("$O'$", "$\vec{u}$", "$\vec{v}$", Rp, xpen=invisible);

vector w=(0.25,0.5);
point P=(1,0.5);

dot("$P$",P,W);
show("$\overrightarrow{w}$", w);

/* View the definition of transform rotateO(real) */
point Pp=rotateO(90)*P;

dot("Pp=rotateO(90)*P", Pp, W);

dot("rotate(90,Pp)*P", rotate(90,Pp)*P, W);
/* View the definition of transform scale(real,point) */
dot("scale(-2,Pp)*P", scale(-2,Pp)*P, NE);

/* View the definition of transform scaleO(real) */
dot("scaleO(2)*P", scaleO(2)*P,red);
/* View the definition of transform xscaleO(real) */
dot("xscaleO(2)*P", xscaleO(2)*P);
/* View the definition of transform yscaleO(real) */
dot("yscaleO(2)*P", yscaleO(2)*P,W);

vector wp=rotateO(90)*w;

show("$\overrightarrow{w'}$", wp);

draw("$\overrightarrow{w}$", (0,0)--locate(w), W, Arrow);
draw("$\overrightarrow{w'}$", (0,0)--locate(wp), S, Arrow);



Étiquettes : , , ,

## Asymptote using geometry.asy – fig0070

Category: Asymptote,Examples 2D,geometry.asyPh. Ivaldi @ 12 h 02 min

 (Compiled with Asymptote version 2.14svn-r5318)

import geometry;
size(15cm);

currentcoordsys=cartesiansystem((0,0),i=(1,0.5),j=(-1,0.5));
coordsys R=currentcoordsys;
show(R, xpen=invisible);

point A=(2,2);
dot("A",A,SE);

point B=(3,1.5);
dot("B",B,SE);

point C=A+(4,2);
dot("C",C);

drawline(A,B,red);
drawline(A,C,blue);

/* View the definition of transform scale(real,point,point,point,point,bool) */
transform t=scale(2,A,B,A,C);
/* View the definition of transform projection(point,point,point,point,bool) */
transform proj=projection(A,B,A,C);

point M=(2,4);
point Mh=proj*M;
dot("$H_M$",Mh,SE);
dot("$M$",M);
point Mp=t*M;
dot("\small$scale(2,A,B,A,C)*M=M'$",Mp,W);
drawline(M,Mh);

point P=(1,-1);
point Ph=proj*P;
dot("$H_P$",Ph,NW);
drawline(P,Ph);
dot("$P$",P);

transform t=scale(-1,A,B,A,C);
point Pp=t*P;
dot("\small$P'=scale(-1,A,B,A,C)*P$",Pp);
draw(P--Pp);



Étiquettes : , , , ,

## Asymptote using geometry.asy – fig0180

Category: Asymptote,Examples 2D,geometry.asyPh. Ivaldi @ 23 h 02 min

 (Compiled with Asymptote version 2.14svn-r5318)

unitsize(1cm);
import geometry;
dotfactor*=1.5;

currentcoordsys=cartesiansystem((0,0),i=expi(pi/8)*(1.5,0),j=expi(pi/8)*(0,1));
show(currentcoordsys);

point A=(-1,-3), B=(5,2);
line l1=line(A,B);

draw(l1,red);
dot("$A$",A,SE);
dot("$B$",B,NW);

point M=(3,-3);
dot("$M$",M);

/* View the definition of transform projection(line) */
point P=projection(l1)*M;
dot("$P$",P,2W);
draw(M--P);
markrightangle(l1.A,P,M);

/* View the definition of transform vprojection(line,bool) */
point Q=vprojection(l1)*M;
dot("$Q$",Q,2W);
draw(M--Q);

/* View the definition of transform hprojection(line,bool) */
point R=hprojection(l1)*M;
dot("$R$",R,2W);
draw(M--R);

/* View the definition of transform projection(line,line,bool) */
point S=projection(l1,line((0,0),(0,1)))*M;
dot("$S$",S,2W);
draw(M--S,red);

draw(box((-1,-4),(7,5)),invisible);



Étiquettes : , , , , , ,

## Asymptote using geometry.asy – fig0190

Category: Asymptote,Examples 2D,geometry.asyPh. Ivaldi @ 0 h 02 min

 (Compiled with Asymptote version 2.14svn-r5318)

unitsize(1cm);
import geometry;
dotfactor*=1.5;
linemargin=5mm;

// currentcoordsys=cartesiansystem((2,1),i=(1,0.5),j=(-1,1));
show(currentcoordsys);

point A=(-3,-3), B=(3,4), C=(1,-2);

line l1=line(A,B);
draw(l1,red);
dot("$A$",A,SE);
dot("$B$",B,NW);

/* View the definition of line line(real,point) */
line l2=line(100,C);
draw(l2,blue);
dot("$C$",C);

point M=relpoint(A--C,0.6);
dot("$M$",M);

/* View the definition of transform projection(line,line,bool) */
point P=projection(l1,l2)*M;
dot("$P$",P,2W);
draw(line(M,P),blue+dashed);

draw(box((-5,-5),(5,5)),invisible);



Étiquettes : , , , ,

## Asymptote using geometry.asy – fig0290

Category: Asymptote,Examples 2D,geometry.asyPh. Ivaldi @ 10 h 02 min

 (Compiled with Asymptote version 2.14svn-r5318)

import geometry;
size(8cm,0);

currentcoordsys=cartesiansystem((2,1),i=(1,0.5),j=(-0.25,.75));
show(currentcoordsys);

point A=(1,1);
dot("$A$",A,S,red);

real R=2;
circle C=circle(A,R);
draw(C,Arrow);

/* View the definition of ellipse *(transform,circle) */
ellipse el=xscale(2)*C;
draw(el,blue,Arrow);

// /* View the definition of transform xscale(real,point) */
ellipse el=xscale(2,A)*C;
draw(el,red,Arrow);



Étiquettes : , , , ,

## Asymptote using geometry.asy – fig0300

Category: Asymptote,Examples 2D,geometry.asyPh. Ivaldi @ 11 h 02 min

 (Compiled with Asymptote version 2.14svn-r5318)

import geometry;
size(8cm,0);

currentcoordsys=cartesiansystem((2,1),i=(1,0.5),j=(-0.25,.75));
show(currentcoordsys);

point A=(1,1);
dot("$A$",A,S,red);

real R=2;
circle C=circle(A,R);
draw(C,Arrow);

/* View the definition of ellipse *(transform,circle) */
draw(scale(0.5)*C,red,Arrow);

draw(scale(0.5,A)*C,2mm+0.8*blue);

/* View the definition of circle /(explicit circle,real) */
draw(C/2,0.75mm+green,Arrow(4mm));

// Note that the point 'point(C,0)' is always at the same place relatively to 'C'.
draw(rotateO(180)*C/2,0.8*yellow,Arrow);



Étiquettes : , , , ,

## Asymptote using geometry.asy – fig0310

Category: Asymptote,Examples 2D,geometry.asyPh. Ivaldi @ 12 h 02 min

 (Compiled with Asymptote version 2.14svn-r5318)

import geometry;
size(10cm,0);

currentcoordsys=cartesiansystem((2,1),i=(1,0.5),j=(-0.25,.75));
show(currentcoordsys);

point A=(1,1);
dot("$A$",A,S,red);

real a=3, b=2;
ellipse el=ellipse(A,a,b,0);
draw(el,Arrow);

/* View the definition of ellipse *(transform,ellipse) */
draw(scale(0.5)*el,red,Arrow);

draw(scale(0.5,A)*el,2mm+0.8*blue);

/* View the definition of ellipse /(ellipse,real) */
draw(el/2,0.75mm+green,Arrow(4mm));

// Note that the point 'point(el,0)' is always at the same place relatively to 'el'.
draw(rotateO(135)*el/2,0.8*yellow,Arrow);



Étiquettes : , , , ,

## Asymptote using geometry.asy – fig0800

Category: Asymptote,Examples 2D,geometry.asyPh. Ivaldi @ 13 h 02 min

 (Compiled with Asymptote version 2.14svn-r5318)

import geometry;
size(8cm,0);

// currentcoordsys=cartesiansystem((1,2),i=(1,0.5),j=(-0.5,.75));
show(currentcoordsys, xpen=invisible);

point A=(1,1);
dot("$A$",A,S,0.8red);

real R=2;
/* View the definition of struct arc */
arc C=arc(circle(A,R),45,180);/* View the definition of arc arc(ellipse,real,real,polarconicroutine,bool) */
draw(C,Arrow);

/* View the definition of arc complementary(arc) */
draw(complementary(C),dashed+grey,Arrow(position=Relative(0.75)));

/* View the definition of arc *(transform,explicit arc) */
arc Cp=scale(0.5,A)*C;
draw(Cp,0.8red,Arrow);

arc Cp=scale(-0.5,A)*C;
draw(Cp,0.8blue,Arrow);

arc Cp=scale(1.1,A)*C;
/* View the definition of arc reverse(arc) */
draw(reverse(Cp),0.8*yellow,Arrow);

arc Cp=scale(0.9,A)*C;
draw(rotate(225,A)*Cp,0.8green,Arrow);



Étiquettes : , , , ,

## Asymptote using geometry.asy – fig0810

Category: Asymptote,Examples 2D,geometry.asyPh. Ivaldi @ 14 h 02 min

 (Compiled with Asymptote version 2.14svn-r5318)

import geometry;
size(8cm,0);

// currentcoordsys=cartesiansystem((1,2),i=(1,0.5),j=(-0.5,.75));
show(currentcoordsys, xpen=invisible);

point A=(1,1);
dot("$A$",A,S,0.8red);

real R=2;
/* View the definition of struct arc */
arc C=arc(ellipse(A,2R,R),45,180,fromCenter);
draw(C,Arrow);

/* View the definition of arc complementary(arc) */
draw(complementary(C),dashed+grey,Arrow(position=Relative(0.75)));

/* View the definition of arc *(transform,explicit arc) */
arc Cp=scale(0.5,A)*C;
draw(Cp,0.8red,Arrow);

arc Cp=scale(-0.5,A)*C;
draw(Cp,0.8blue,Arrow);

arc Cp=scale(1.1,A)*C;
/* View the definition of arc reverse(arc) */
draw(reverse(Cp),0.8*yellow,Arrow);

arc Cp=scale(0.9,A)*C;
draw(rotate(225,A)*Cp,0.8green,Arrow);



Étiquettes : , , , ,

## Asymptote using geometry.asy – fig0820

Category: Asymptote,Examples 2D,geometry.asyPh. Ivaldi @ 15 h 02 min

 (Compiled with Asymptote version 2.14svn-r5318)

import geometry;
size(8cm,0);

// currentcoordsys=cartesiansystem((1,2),i=(1,0.5),j=(-0.5,.75));
show(currentcoordsys, xpen=invisible);

point A=(1,1);
dot("$A$",A,S,red);

real R=2;
arc C=arc(circle(A,R), 45, 210);
draw(C,linewidth(4mm));

/* View the definition of void markarc(picture,Label,int,real,real,arc,arrowbar,pen,pen,margin,marker) */
markarc(format("%0g",degrees(C)), C, Arrow);

/* View the definition of arc *(real, explicit arc) */
draw(0.5*C,2mm+yellow);

arc Cp=C/3;
draw(Cp,1mm+blue);



Étiquettes : , , , ,

## Asymptote using geometry.asy – fig0830

Category: Asymptote,Examples 2D,geometry.asyPh. Ivaldi @ 16 h 02 min

 (Compiled with Asymptote version 2.14svn-r5318)

import geometry;
size(8cm,0);

// currentcoordsys=cartesiansystem((1,2),i=(1,0.5),j=(-0.5,.75));
show(currentcoordsys, xpen=invisible);

point A=(1,1);
dot("$A$", A, NW, red);

real R=2;
arc C=arc(circle(A,R), 45, 210, CW);
draw(C,linewidth(4mm));

/* View the definition of void markarc(picture,Label,int,real,real,arc,arrowbar,pen,pen,margin,marker) */

/* View the definition of arc *(real, explicit arc) */
draw(0.5*C, 2mm+yellow);

arc Cp=C/3;
draw(Cp, 1mm+blue);



Étiquettes : , , , ,

## Asymptote using geometry.asy – fig0840

Category: Asymptote,Examples 2D,geometry.asyPh. Ivaldi @ 17 h 02 min

 (Compiled with Asymptote version 2.14svn-r5318)

import geometry;
size(8cm,0);

// currentcoordsys=cartesiansystem((1,2),i=(1,0.5),j=(-0.5,.75));
// show(currentcoordsys, xpen=invisible);

point C=(1,1);
dot("$C$", C, NE, red);

real R=2;
arc a=arc(ellipse(C,R,R/2), 90, 0, fromCenter);
draw(a, linewidth(4mm));

/* View the definition of void markarc(picture,Label,int,real,real,arc,arrowbar,pen,pen,margin,marker) */

/* View the definition of arc *(real, explicit arc) */
draw(0.5*a, 2mm+yellow);

arc ap=a/3;
draw(ap, 1mm+blue);



Étiquettes : , , , ,

## Asymptote using geometry.asy – fig0850

Category: Asymptote,Examples 2D,geometry.asyPh. Ivaldi @ 18 h 02 min

 (Compiled with Asymptote version 2.14svn-r5318)

import geometry;
size(8cm,0);

// currentcoordsys=cartesiansystem((1,2),i=(1,0.5),j=(-0.5,.75));
// show(currentcoordsys, xpen=invisible);

point C=(1,1);
dot("$C$", C, dir(30), red);

arc a=arc(ellipse(C,2,1,30), -45, 45);
draw(a, linewidth(4mm));
dot("$F_1$", a.el.F1, dir(210), red);

/* View the definition of void markarc(picture,Label,int,real,real,arc,arrowbar,pen,pen,margin,marker) */

/* View the definition of arc *(real, explicit arc) */
draw(0.5*a, 2mm+yellow);

arc ap=a/3;
draw(ap, 1mm+blue);



Étiquettes : , , , ,

## Asymptote using geometry.asy – fig1130

Category: Asymptote,Examples 2D,geometry.asyPh. Ivaldi @ 22 h 02 min

 (Compiled with Asymptote version 2.14svn-r5318)

import geometry;
size(8cm,0);

// currentcoordsys=cartesiansystem((2,1),i=(1,0.5),j=(-0.25,0.75));
// show(currentcoordsys);

triangle t=rotate(-20)*triangle((-1,0), (2,0), (0,2));
drawline(t, linewidth(bp));
label(t,alignFactor=4);

line bab=bisector(t.AB);
draw(bab, blue);
perpendicularmark(t.AB,bab,quarter=4);

line bac=bisector(t.AC);
draw(bac, blue);
perpendicularmark(t.AC,bac,quarter=4);

line bbc=bisector(t.BC);
draw(bbc, blue);
perpendicularmark(t.BC,bbc,quarter=4);



Étiquettes : , , , , ,

## Asymptote using graph.asy – fig0350

Category: Asymptote,Examples 2D,graph.asyPh. Ivaldi @ 12 h 10 min

 (Compiled with Asymptote version 2.14svn-r5318)

// From Asymptote's FAQ
import graph;

real width=15cm;
real aspect=0.3;

picture pic1,pic2;

size(pic1,width,aspect*width,IgnoreAspect);
size(pic2,width,aspect*width,IgnoreAspect);

scale(pic1,false);
scale(pic2,false);

real xmin1=6;
real xmax1=9;
real xmin2=8;
real xmax2=16;

real a1=1;
real a2=0.001;

real f1(real x) {return a1*sin(x/2*pi);}
real f2(real x) {return a2*sin(x/4*pi);}

draw(pic1,graph(pic1,f1,xmin1,xmax1));
draw(pic2,graph(pic2,f2,xmin2,xmax2));

xaxis(pic1,Bottom,LeftTicks());
yaxis(pic1,"$f_1(x)$",Left,RightTicks);

xaxis(pic2,Bottom,LeftTicks(Step=4));
yaxis(pic2,"$f_2(x)$",Left,RightTicks);

yequals(pic1,0,Dotted);
yequals(pic2,0,Dotted);

pair min1=point(pic1,SW);
pair max1=point(pic1,NE);

pair min2=point(pic2,SW);
pair max2=point(pic2,NE);

real scale=(max1.x-min1.x)/(max2.x-min2.x);
real shift=min1.x/scale-min2.x;

transform t1 = pic1.calculateTransform();
transform t2 = pic2.calculateTransform();
transform T=xscale(scale*t1.xx)*yscale(t2.yy);

real height=truepoint(N).y-truepoint(S).y;



Étiquettes : , , , ,

## Tiling with Asymptote – fig0070

Category: Asymptote,Examples 2D,TilingPh. Ivaldi @ 18 h 06 min

 (Compiled with Asymptote version 1.87svn-r4652)

/*Author: Guillaume Connan */
size(10cm,0);

void zigzag(int k)
{
real t=180/k;
pair o=(0,0), m=dir(t),
n=rotate(180-2*t,m)*o,
b=rotate(4*t-180,n)*m,
c=rotate(180-6*t,b)*n,
nn=reflect(o,b)*n;

path lo=m--n--b--nn--cycle,
p=o--m--n--b--c--cycle,
pp=reflect(o,b)*p;

for (int i=0; i <= k; ++i){
filldraw(rotate(2*t*i,o)*p,.5*(red+blue));
filldraw(rotate(2*t*i,o)*pp,0.25(red+blue));
filldraw(rotate(2*t*i,o)*lo,(red+blue));
}
}

zigzag(25);
shipout(bbox(3mm,2mm+miterjoin+black,FillDraw(0.5*blue)));



Étiquettes : , , ,

## Fractals with Asymptote – fig0010

Category: Asymptote,Examples 2D,FractalsPh. Ivaldi @ 21 h 53 min

 (Compiled with Asymptote version 1.87svn-r4652)

// From documentation of Asymptote
size(250);

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

transform ta=shift(c,c)*rotate(-aCos(a/c))*scale(a/c)*shift(-c);
transform tb=shift(0,c)*rotate(aCos(b/c))*scale(b/c);

picture Pythagorean(int n) {
picture pic;
fill(pic,scale(c)*unitsquare,1/(n+1)*green+n/(n+1)*brown);
if(n == 0) return pic;
picture branch=Pythagorean(--n);
return pic;
}



Étiquettes : , , , ,

## Fractals with Asymptote – fig0020

Category: Asymptote,Examples 2D,FractalsPh. Ivaldi @ 22 h 53 min

 (Compiled with Asymptote version 1.87svn-r4652)

size(10cm,0);

transform scale(pair center, real k) {
return shift(center)*scale(k)*shift(-center);
}

path trk=(0,0)--(0,1);

void tree(path p, int n, real a=30, real b=40, real r=.75) {
if (n!=0) {
pair h=point(p,length(p));
transform tb=rotate(180-b,h)*scale(h,r);
transform ta=rotate(-180+a,h)*scale(h,r);
draw(p,n/3+1/(n+1)*green+n/(n+1)*brown);
tree(tb*reverse(p),n-1,a,b,r);
tree(ta*reverse(p),n-1,a,b,r);
}
}

tree(trk,12,a=25,b=40,r=.75);



Étiquettes : , , ,

## Fractals with Asymptote – fig0030

Category: Asymptote,Examples 2D,FractalsPh. Ivaldi @ 23 h 53 min

 (Compiled with Asymptote version 1.87svn-r4652)

// Barnsley's fern
// Fougère de Barnsley
size(5cm,0);

real ab=85, ac=-5;
real rc=.85, rb=-.31;
path trk=(0,0)--(0,1);

transform ta=shift(0,1)*rotate(ab)*scale(rb);
transform tb=shift(0,1)*rotate(-ab)*scale(rb);
transform tc=shift(0,1)*rotate(ac)*scale(rc);

picture fern(int n) {
picture opic;
draw(opic,trk^^ta*trk^^tb*trk^^tc*trk);
if (n==0) return opic;
picture branch=fern(n-1);
return opic;
}



Étiquettes : , , , ,

## Fractals with Asymptote – fig0040

Category: Asymptote,Examples 2D,FractalsPh. Ivaldi @ 0 h 53 min

 (Compiled with Asymptote version 1.87svn-r4652)

// Barnsley's fern
// Fougère de Barnsley
size(10cm,0);

real ab=72, ac=-7;
real rc=0.85, rb=0.35;
path trk=(0,0)--(0,1);

transform ta=shift(0,1)*rotate(ab)*scale(rb);
transform tb=shift(0,1)*rotate(-ab)*scale(rb);
transform tc=shift(0,1)*rotate(ac)*scale(rc);
transform td=shift(0,1)*rotate((ab+ac)/2)*scale(rb);
transform te=shift(0,1)*rotate(-(ab+ac)/2)*scale(rb);

picture pic;
draw(pic,trk,red+.8green);

//Construct a fern branch as atractor
int nbit=7;
for(int i=1; i<=nbit; ++i) {
picture pict;
draw(pict,(0,0)--(0,1), (2*(i/nbit)^2)*bp+((1-i/nbit)*green+i/nbit*brown));
pic=pict;
}

//Use the fern branch to construct... a fern branch
picture pict;

pair x=(0,1);
nbit=23;
for(int i=1; i<=nbit; ++i) {
draw(tc^i*((0,0)--(0,1)), 2*(1.5-i/nbit)^2*bp+brown);
x=tc*x;
}

shipout(bbox(3mm, 2mm+black, FillDraw(paleyellow)));



Étiquettes : , ,

## Fractals with Asymptote – fig0050

Category: Asymptote,Examples 2D,FractalsPh. Ivaldi @ 1 h 53 min

 (Compiled with Asymptote version 1.87svn-r4652)

// Barnsley's fern
// Fougère de Barnsley
size(5cm,0);

real ab=85, ac=-5;
real rc=0.8, rb=0.3;
path trk=(0,0)--(0,1);

transform [] t;
t[1] =shift(0,1)*rotate(ab)*scale(rb);
t[2] =shift(0,1)*rotate(-ab)*scale(rb);
t[3] =shift(0,1)*rotate(ac)*scale(rc);
real sum=0;

for(int i=0; i<100; ++i) sum+=(rc*cos(ac*pi/180))^i;
t[4] =xscale(0.01)*yscale(1/sum);

picture pic;
draw(pic,trk);
pair pt=(0,0);

for(int i=0; i < 1000; ++i) {
pt=t[ 1+floor((3.0*rand()/randMax)) ]*pt;
}

int nbt;
for(int i=0; i < 200000; ++i) {
nbt=1+floor((4.0*rand()/randMax));
pt=t[nbt]*pt;
draw(pt);
}



Étiquettes : , ,

## Fractals with Asymptote – fig0090

Category: Asymptote,Examples 2D,FractalsPh. Ivaldi @ 5 h 53 min

 (Compiled with Asymptote version 1.87svn-r4652)

size(10cm,0);

real a=-1.5, b=2a/3;

picture H(pen p=currentpen) {
picture H;
draw(H,(-a,0)--(a,0)^^(-a,-b)--(-a,b)^^(a,-b)--(a,b),p);
return H;
}

transform sc=scale(0.5);
transform[] t={identity(),
shift(-a,b)*sc, shift(-a,-b)*sc,
shift(a,b)*sc,  shift(a,-b)*sc};

picture Hfractal(int n, pen p=currentpen)
{
picture pic;
if(n == 0) return H(p);
picture Ht=Hfractal(n-1,p);
for (int i=0; i < 5; ++i) add(pic,t[i]*Ht);
return pic;
}



Étiquettes : , , , ,

## Fractals with Asymptote – fig0100

Category: Asymptote,Examples 2D,FractalsPh. Ivaldi @ 6 h 53 min

 (Compiled with Asymptote version 1.87svn-r4652)

size(10cm,0);

real a=-1.5, b=2a/3;

path[] H=(-a,0)--(a,0)^^(-a,-b)--(-a,b)^^(a,-b)--(a,b);

transform sc=scale(0.5);
transform[] t={shift(-a,b)*sc, shift(-a,-b)*sc,
shift(a,b)*sc,  shift(a,-b)*sc};

void Hfractal(path[] g, int n, pen[] p=new pen[]{currentpen})
{
p.cyclic=true;
if(n == 0) draw(H,p[0]); else {
for (int i=0; i < 4; ++i) {
draw(t[i]*g,p[n]);
Hfractal(t[i]*g,n-1,p);
}
}
}

Hfractal(H, 5, new pen[] {0.8*red, 0.8*green, 0.8*blue, black, blue+red});



Étiquettes : , , , ,

## Official Asymptote example – triangle

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

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

size(0,100);
import geometry;

triangle t=triangle(b=3,alpha=90,c=4);

dot((0,0));

draw(t);
draw(rotate(90)*t,red);
draw(shift((-4,0))*t,blue);
draw(reflect((0,0),(1,0))*t,green);
draw(slant(2)*t,magenta);



Étiquettes : , , ,

## Various code with Asymptote – fig0100

Category: Asymptote,MiscellaneousPh. Ivaldi @ 21 h 11 min

 (Compiled with Asymptote version 1.87svn-r4652)

size(10cm);

path g=box((-1,-1),(1,1));
pen [] col= new pen[]{gray,yellow};
real k=sqrt(10)/4;
transform T=scale(k)*rotate(degrees(acos(17/(16*k*sqrt(2)))));
int nb=10;

for (int i=0; i<nb; ++i) filldraw(T^i*g,col[i%2]);



Étiquettes : , ,