## Asymptote using geometry.asy – fig0280

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

 (Compiled with Asymptote version 2.14svn-r5318)
```
import geometry;
size(10cm);

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

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

draw(line(A,B), linewidth(bp));
draw(line(A,C), linewidth(bp));
draw(line(B,C), linewidth(bp));

/* View the definition of circle circle(point,point,point) */
circle cc=circle(A,B,C);
draw(cc, blue);
dot(cc.C, blue);

/* View the definition of circle incircle(point,point,point) */
circle ic=incircle(A,B,C);
draw(ic, red);
dot(ic.C, red);

/* View the definition of circle excircle(point,point,point) */
circle ec=excircle(A,B,C);
/* View the definition of void clipdraw(picture,Label,path,align,pen,arrowbar,arrowbar,real,real,Label,marker) */
clipdraw(ec, green);
dot(ec.C, green);

ec=excircle(A,C,B);
clipdraw(ec, green);
dot(ec.C, green);

ec=excircle(C,B,A);
clipdraw(ec, green);
dot(ec.C, green);

dot("G",centroid(A,B,C),NE);

// Enlarge the bounding box of the current picture
// draw(box((-2.5,-3), (3.5,3.5)));

```

Étiquettes : , , ,

## Asymptote using geometry.asy – fig0330

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

 (Compiled with Asymptote version 2.14svn-r5318)
```
import geometry;
size(10cm);

point F=(2,-1.5);
dot("\$F\$",F,N,red);

// Enlarge the bounding box of the current picture.
draw(box((-1,-1),(3,1.5)),dashed);//,invisible);

parabola p=parabola(F,0.2,90);

// Define the bounding box to draw the parabola.
// Try finalbounds(); to determine the final bounding box.
p.bmin=(-0.75,-0.4);
p.bmax=(2.75,0.75);

draw(box(p.bmin,p.bmax),red);

draw(p,dashed);/* Defered drawing to adjust the path to the final
bounding box.*/

draw((path)p,red); /* The path of 'p' is restricted to the box whose
the corners are p.bmin, p.bmax.*/

```

Étiquettes : , , , ,

## Asymptote using geometry.asy – fig0340

Category: Asymptote,Examples 2D,geometry.asyPh. Ivaldi @ 15 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 F1=(1,0);
point F2=(4,1);
dot("\$F_1\$",F1,W);
dot("\$F_2\$",F2);

// Enlarge the bounding box of the current picture
draw(box((0,-2), (5,4)), invisible);

/* View the definition of hyperbola hyperbola(point,point,real,bool) */
hyperbola h=hyperbola(F1, F2, 0.9);
draw(h, linewidth(3mm));
draw(h.A1, grey);
draw(h.A2, grey);
draw(h.D1);
draw(h.D2);

/* View the definition of hyperbola hyperbola(point,real,real,real) */
draw(hyperbola(h.C, h.a, h.b, h.angle), 2mm+green);

/* View the definition of hyperbola hyperbola(bqe) */
draw(hyperbola(equation(h)), 1mm+red);

/* View the definition of hyperbola conj(hyperbola) */
hyperbola ch=conj(h);
draw(ch, blue);
draw(ch.A1, 0.5blue);
draw(ch.A2, 0.5blue);
draw(ch.D1);
draw(ch.D2);
dot("\${V'}_1\$", ch.V1, NE);
dot("\${V'}_2\$", ch.V2, SW);
dot("\${F'}_1\$", ch.F1, S);
dot("\${F'}_2\$", ch.F2, N);

dot("\$V_1\$", h.V1, 2E, linewidth(2mm));
dot("\$V_2\$", h.V2, 2W, linewidth(2mm));

```

Étiquettes : , , , , ,

## Tiling with Asymptote – fig0020

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

 (Compiled with Asymptote version 1.87svn-r4652)
```
size(6cm,0);

//Circular paving with the unit hexagonal picture "hexa"
picture pavehexagonal(picture hexa, int depth=1)
{
picture opic;
pair center;
real a,ap,r,rp,r_d=180/pi;

for(int j=0; j<depth; ++j)
{
for (int i=1; i<=6; ++i)
{
a=i*60-30;
r=j*sqrt(3);
center=r*(rotate(a)*(1,0));
rp=r;
ap=0;
for (real k=0; k<j-1; ++k)
{
r=sqrt((1.5*(j-1 - k))^2 + 3/4*(j+1 + k)^2);
ap+=r_d*acos((rp^2 + r^2 - 3)/(2*r*rp));
center=r*(rotate(a + ap)*(1,0));
rp=r;
}
}
}
return opic;
}

picture hexa;
fill(hexa, polygon(6));
path inh=(0,0)--(.6,sqrt(3)/4)--(.5,sqrt(3)/2)--cycle;

for(int i=0; i<6; ++i)
{
fill(hexa, rotate(60*i)*inh,.5red);
}

draw(hexa, inh);
clip(scale(10)*shift(-.5,-.5)*unitsquare);

```

Étiquettes : ,

## Tiling with Asymptote – fig0060

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

 (Compiled with Asymptote version 1.87svn-r4652)
```
size(10cm,0);

transform r60=rotate(60);

pair A=(1,0);
pair B=r60*A, C=r60*B, D=r60*C, E=r60*D, F=r60*E;

real tensio=.25;
path BC=reverse(rotate(240,B)*AB);
path CD=reverse(rotate(240,C)*BC);
path DE=reverse(rotate(240,D)*CD);
path EF=reverse(rotate(240,E)*DE);
path FA=reverse(rotate(240,F)*EF);
path pth1=AB--BC--CD--DE--EF--FA;

real tensio=.5;
path BC=reverse(rotate(240,B)*AB);
path CD=reverse(rotate(240,C)*BC);
path DE=reverse(rotate(240,D)*CD);
path EF=reverse(rotate(240,E)*DE);
path FA=reverse(rotate(240,F)*EF);
path pth2=AB--BC--CD--DE--EF--FA;

//Circular paving with the unit hexagonal picture "hexa"
picture pavehexagonal(picture hexa, int depth=1)
{
picture opic;
pair center;
real a,ap,r,rp,r_d=180/pi;

for(int j=0; j<depth; ++j)
{
for (int i=1; i<=6; ++i)
{
a=i*60-30;
r=j*sqrt(3);
center=r*(rotate(a)*(1,0));
rp=r;
ap=0;
for (real k=0; k<j-1; ++k)
{
r=sqrt((1.5*(j-1 - k))^2 + 3/4*(j+1 + k)^2);
ap+=r_d*acos((rp^2 + r^2 - 3)/(2*r*rp));
center=r*(rotate(a + ap)*(1,0));
rp=r;
}
}
}
return opic;
}

picture hexa, hexat;

real lux=-.3, sq=sqrt(3);
lightgrey,(lux*sq/2,lux/2),0,
grey,(lux*sq/2,lux/2),1+abs(lux));

clip(hexat,pth2--cycle);
draw(hexat,pth2);

```

Étiquettes : ,

## Official Asymptote example – CDlabel

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

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

size(11.7cm,11.7cm);
asy(nativeformat(),"logo");
fill(unitcircle^^(scale(2/11.7)*unitcircle),
evenodd+rgb(124/255,205/255,124/255));
label(scale(1.1)*minipage(
"\centering\scriptsize \textbf{\LARGE {\tt Asymptote}\\
\smallskip
\small The Vector Graphics Language}\\
\smallskip
\textsc{Andy Hammerlindl, John Bowman, and Tom Prince}
http://asymptote.sourceforge.net\\
",8cm),(0,0.6));
label(graphic("logo."+nativeformat(),"height=7cm"),(0,-0.22));
clip(unitcircle^^(scale(2/11.7)*unitcircle),evenodd);

```

Étiquettes : , , ,

## Official Asymptote example – layers

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

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

usepackage("ocg");
settings.tex="pdflatex";

size(0,150);

pen colour1=red;
pen colour2=green;

pair z0=(0,0);
pair z1=(-1,0);
pair z2=(1,0);
real r=1.5;
path c1=circle(z1,r);
path c2=circle(z2,r);

begin("A");
fill(c1,colour1);
end();

fill(c2,colour2);

picture intersection;
fill(intersection,c1,colour1+colour2);
clip(intersection,c2);

draw(c1);
draw(c2);

label("\$A\$",z1);

begin("B");
label("\$B\$",z2);
end();

pair z=(0,-2);
real m=3;
margin BigMargin=Margin(0,m*dot(unit(z1-z),unit(z0-z)));

draw(Label("\$A\cap B\$",0),conj(z)--z0,Arrow,BigMargin);
draw(Label("\$A\cup B\$",0),z--z0,Arrow,BigMargin);
draw(z--z1,Arrow,Margin(0,m));
draw(z--z2,Arrow,Margin(0,m));

```

Étiquettes : , , ,