Asymptote Generalities – fig1860

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

 (Compiled with Asymptote version 2.14svn-r5318)
```
// Venn diagram // Diagramme de Venn
// Edwards' construction // Construction d'Edwards
import roundedpath;
size(10cm,0);
path [] EdVenn(int n)
{
path [] opath;
if (n>=1)
opath.push(shift(-1.4,-.9)*roundedpath(xscale(2.8)*yscale(.9)*unitsquare,.1));
if (n>=2)
opath.push(shift(0,-.9)*roundedpath(xscale(1.4)*yscale(1.8)*unitsquare,.1));
if (n>=3)
opath.push(scale(.5)*unitcircle);
for (int i=1; i<=n-3; ++i)
{
pair pcle=point(opath[2],1/(2^i)),
ccle=intersectionpoint(pcle--(pcle-dir(opath[2],1/(2^i))), (0,0)--(1,0));
path cle=shift(ccle)*scale(abs(pcle-ccle))*unitcircle;
real[] p1=intersect(cle, opath[2]);
path ocle=subpath(cle,-p1[0],p1[0]);
guide tpath;
real step=360/(2^i), a=0;
for (int j=0; j<2^i; ++j)
{
tpath=tpath..rotate(a)*ocle;
a+=step;
}
opath.push(tpath..cycle);
}
return opath;
}

draw(EdVenn(6));

```

Étiquettes : , , ,

Unofficial package edvenn_pi.asy – fig0100

Category: Asymptote,edvenn_pi.asy,Unofficial packagesPh. Ivaldi @ 3 h 52 min

 (Compiled with Asymptote version 2.14svn-r5318)
```
import edvenn_pi;

size(10cm,0);
draw(EdVenn(6));

```

Étiquettes :

Official Asymptote example – venn

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

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

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);
fill(c1,colour1);
fill(c2,colour2);

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

draw(c1);
draw(c2);

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

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

shipout(bbox(0.25cm));
currentpicture.uptodate=true;

```

Étiquettes : , ,