Asymptote Generalities – fig1700

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

Figure 0169
(Compiled with Asymptote version 2.14svn-r5318)
    
size(6cm,0);

path pth1=(0,-0.5)--(2,1);
path pth2=(0,0.5)--(2,-1);

draw(pth1^^pth2);

dot(intersectionpoint(pth1,pth2),red);

Étiquettes : , ,


Asymptote Generalities – fig1710

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

Figure 0170
(Compiled with Asymptote version 2.14svn-r5318)
    
size(6cm,0);

path p = (0,0){up} .. (2cm,0){up};
path q = (0,1cm){dir(-60)}..(1cm,-1cm)..{dir(60)}(2cm,1cm);

draw(p^^q);
dot(intersectionpoint(p,q) , red);
dot(intersectionpoint(p,reverse(q)) , blue);

Étiquettes : , ,


Asymptote Generalities – fig1720

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

Figure 0171
(Compiled with Asymptote version 2.14svn-r5318)
    
size(6cm,0);
import math;

pair A=(0,-.5), B=A+dir(45);
pair C=(0,1), D=C+5dir(20);

pair I=extension(A,B,C,D);

path AB=A--B;
path CD=C--D;

draw(AB^^CD);
dot("$I$",I,N,red);
draw(B--I,1pt+dotted);
dot("$A$",A,SE);
dot("$B$",B,SE);
dot("$C$",C,N);
dot("$D$",D,N);

Étiquettes : , ,


Asymptote Generalities – fig1730

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

Figure 0172
(Compiled with Asymptote version 2.14svn-r5318)
    
size(6cm,0);
import math;

pair A=(0,-.5), B=A+dir(45);
pair C=(0,1)+2dir(20);
path cle=shift(C)*scale(1)*unitcircle;

pair I1=intersectionpoint(A--interp(A,B,2),cle);
pair I2=intersectionpoint(A--interp(A,B,10),cle);

path AB=A--B;

draw(AB^^cle);
dot(I1^^I2,red);
draw(B--I2,1pt+dotted);

Étiquettes : , ,


Asymptote Generalities – fig1740

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

Figure 0173
(Compiled with Asymptote version 2.14svn-r5318)
    
size(6cm,0);

path Line(pair A, pair B)
{
  return interp(A,B,-100000/arclength(A--B))--interp(A,B,100000/arclength(A--B));
}

path Parallel(pair A, pair dir)
{
  return Line(A,A+dir);
}

pair A=0, B=(1,0), C=(.7,.7);
draw(A--B, .8red);
draw(A--C, .8green);
draw(B--C, .8blue);

label("$A$",A,SW);
label("$B$",B,SE);
label("$C$",C,N);

pair Ap=intersectionpoint(Parallel(B, A-C), Parallel(C, A-B));
pair Bp=intersectionpoint(Parallel(A, B-C), Parallel(C, A-B));
pair Cp=intersectionpoint(Parallel(A, B-C), Parallel(B, A-C));

draw(Ap--Bp, .8red);
draw(Ap--Cp, .8green);
draw(Bp--Cp, .8blue);

label("$A'$",Ap,NE);
label("$B'$",Bp,NW);
label("$C'$",Cp,S);

Étiquettes : , ,


Asymptote Generalities – fig1750

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

Figure 0174
(Compiled with Asymptote version 2.14svn-r5318)
    
size(6cm,0);

path p = (0,0){up} .. (2cm,0){up};
path q = (0,1cm){dir(-60)}..(1cm,-1cm)..{dir(60)}(2cm,1cm);

draw(p, red);
draw(q, blue);
dot(intersectionpoint(p,q));
draw(point(p, intersect(p,q)[0])--postcontrol(p, intersect(p,q)[0]), .8red,Arrow);
draw(point(q, intersect(p,q)[1])--postcontrol(q, intersect(p,q)[1]), .8blue,Arrow);

Étiquettes : , , ,


Asymptote Generalities – fig1770

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

Figure 0176
(Compiled with Asymptote version 2.14svn-r5318)
    
size(6cm,0);

import math;

pair A=(0,0), B=(1,.5);
path cle=shift(1.75,2.5)*unitcircle;
pair pt, ptp;

pair project(pair pt, pair A, pair B)
  {
    return extension(pt,pt-dir(90+degrees(A-B,false)),A,B);
  }

draw(A--B);
draw(cle);

for (real t=0; t<=4; t+=.01)
  {
    pt=point(cle,t);
    ptp=project(pt,A,B);
    dot(ptp, red);
    draw(pt--ptp,dotted);

  }

Étiquettes : , , , ,


Asymptote Generalities – fig1780

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

Figure 0177
(Compiled with Asymptote version 2.14svn-r5318)
    
size(6cm,0);

import math;

pair A=(0,0), B=(1,.5), C=(.25,1);

pair project(pair pt, pair A, pair B)
  {
    return extension(pt,pt-dir(90+degrees(A-B,false)),A,B);
  }

pair ocenter(pair A, pair B, pair C)
  {
    return extension(A, project(A,B,C), B, project(B,A,C));
  }

draw(A--B--C--cycle);

pair orth=ocenter(A,B,C);
pair Ap=project(A,B,C);
pair Bp=project(B,A,C);
pair Cp=project(C,A,B);

dot(orth, red);
dot(Ap^^Bp^^Cp);
drawline(A, orth, dotted);
drawline(B, orth, dotted);
drawline(C, orth, dotted);

Étiquettes : , , ,


Asymptote Generalities – fig1790

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

Figure 0178
(Compiled with Asymptote version 2.14svn-r5318)
    
size(6cm,0);

import math;

pair A=(0,0), B=(1,.5), C=(.25,1);

pair ccenter(pair A, pair B, pair C)
  {
    pair mAB=midpoint(A--B);
    pair mAC=midpoint(A--C);
    return extension(mAB, rotate(90,mAB)*A, mAC, rotate(90,mAC)*A);
  }

draw(A--B--C--cycle);

pair circ=ccenter(A,B,C);
pair mAB=midpoint(A--B);
pair mAC=midpoint(A--C);
pair mBC=midpoint(B--C);

dot(circ, red);
dot(mAB^^mAC^^mBC);
drawline(mAB, circ, dotted);
drawline(mAC, circ, dotted);
drawline(mBC, circ, dotted);
draw(shift(circ)*scale(abs(circ-A))*unitcircle);

Étiquettes : , , , ,


Asymptote Generalities – fig1800

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

Figure 0179
(Compiled with Asymptote version 2.14svn-r5318)
    
size(6cm,0);

import math;

pair A=(0,0), B=(1,.5), C=(.25,1);

pair project(pair pt, pair A, pair B)
  {
    return extension(pt,pt-dir(90+degrees(A-B,false)),A,B);
  }

pair icenter(pair A, pair B, pair C)
  {
    return extension(A, A+dir(A--B,A--C), B, B+dir(B--A,B--C));
  }

draw(A--B--C--cycle);

pair ins=icenter(A,B,C);
pair iAB=project(ins,A,B);
pair iAC=project(ins,A,C);
pair iBC=project(ins,B,C);

dot(ins, red);
dot(iAB^^iAC^^iBC);
drawline(A, ins, dotted);
drawline(B, ins, dotted);
drawline(C, ins, dotted);
draw(shift(ins)*scale(abs(ins-iAB))*unitcircle);

Étiquettes : , , , ,


Asymptote Generalities – fig1810

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

Figure 0180
(Compiled with Asymptote version 2.14svn-r5318)
    
size(6cm,0);
import math;

pair project(pair pt, pair A, pair B)
  {
    return extension(pt,pt-dir(90+degrees(A-B,false)),A,B);
  }


pair ecenter(pair A, pair B, pair C)
  {
    return extension(A, A+rotate(90)*dir(A--B,A--C), B, B+rotate(90)*dir(B--A,B--C));
  }

path ecircle(pair A, pair B, pair C)
  {
    return shift(ecenter(A,B,C))*scale(abs(ecenter(A,B,C)-project(ecenter(A,B,C),B,C)))*unitcircle;
  }

pair A=(0,0), B=(3,0), C=(3,4);
path tr=A--B--C--cycle;

draw(ecircle(A,B,C));
draw(ecircle(B,C,A));

pen p=linewidth(1pt);
drawline(A,B, p);
drawline(A,C, p);
drawline(B,C, p);

Étiquettes : , , , , ,


Asymptote Generalities – fig1830

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

Figure 0181
(Compiled with Asymptote version 2.14svn-r5318)
    
size(6cm,0);
defaultpen(2mm+linecap(0));

path p = (0,0){up} .. (2cm,0){up};
path q = (0,1cm){dir(-60)}..(1cm,-1cm)..{dir(60)}(2cm,1cm);


draw(firstcut(p,q).before, .8red);
draw(firstcut(p,q).after, .8blue);

draw(lastcut(q,p).before, .8green);
draw(lastcut(q,p).after, .8yellow);


Étiquettes : , ,


Asymptote Generalities – fig1840

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

Figure 0182
(Compiled with Asymptote version 2.14svn-r5318)
    
size(6cm,0);

defaultpen(2mm+linecap(0));

path p = (0,0){up} .. (2cm,0){up};
path q = (0,1cm){dir(-60)}..(1cm,-1cm)..{dir(60)}(2cm,1cm);

real[] ipq=intersect(p,q);
real[] iprq=intersect(p,reverse(q));

draw(subpath(p, 0, ipq[0]), .8red);
draw(subpath(p, ipq[0], iprq[0]), .5red);
draw(subpath(p, iprq[0], length(p)), .3red);

draw(subpath(reverse(q), 0, iprq[1]), .8green);
draw(subpath(reverse(q), iprq[1], length(q)-ipq[1]), .5green);
draw(subpath(reverse(q), length(q)-ipq[1], length(q)), .3green);

Étiquettes : , ,


Asymptote Generalities – fig1850

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

Figure 0183
(Compiled with Asymptote version 2.14svn-r5318)
    
//Translate from http://zoonek.free.fr/LaTeX/Metapost/metapost.html
size(0,0);

defaultpen(linewidth(1bp));
real u=3cm;
pair A, B, C, D, E;
path p, q, r;

A = u*up;
p = interp(A, rotate(72)*A, -.2) -- interp(A, rotate(72)*A,1.2);
for(int i=0; i<=5; ++i)
  draw(rotate(72i)*p);

B = midpoint(A--rotate(72)*A );
C = .8*B;

p = B --- C .. (rotate(2*72)*C){right};
// On allonge le chemin p
p = (point(p,0) - 4mm*dir(p,0.001))
  --
  point(p,0)
  & p &
  point(p,2)
  --
  (point(p,2) + 4mm*dir(p,2));

E = intersectionpoint(p, rotate(72)*p);
q = firstcut(p,shift(E)*scale(2mm)*unitcircle).before;
r = lastcut(p,shift(E)*scale(2mm)*unitcircle).after;

for(int i=0; i<=4; ++i)
  {
    draw(rotate(72i)*q);
    draw( rotate(72i)*r);
    draw(rotate(72i)*A,linewidth(4bp));
    draw(rotate(72i)*B,linewidth(4bp));
    draw(rotate(72i)*C,linewidth(4bp));
  }

Étiquettes : ,


Asymptote Generalities – fig1870

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

Figure 0185
(Compiled with Asymptote version 2.14svn-r5318)
    
size(15cm,0);

srand(rand());
path p1 = randompath(9);
path p2 = randompath(8);
real Minx=min(min(p1).x,min(p2).x);
real Maxx=max(max(p1).x,max(p2).x);
real Miny=min(min(p1).y,min(p2).y);

pair[] inter=intersectionpoints(p1,p2);
int nb=inter.length;
for (int i=0 ; i<nb; ++i)
  {
    dot(inter[i]);
    label("$" + (string) i +"$", inter[i],N);
  }

draw(p1,.8red);
draw(p2,.8green);
label("I found " + (string) nb + " points of intersection.",((Maxx+Minx)/2,Miny),2S);

Étiquettes : , , ,


Asymptote Generalities – fig1880

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

Figure 0186
(Compiled with Asymptote version 2.14svn-r5318)
    
size(8cm,0);

pair[] self_intersection(path p, int n=100)
{
  pair[] rpair=new pair[];
  path tpath;
  real [] tpoint;
  real l=length(p);
  int i=1;
  for (real t1=0; t1<l ; t1+=l/n)
    {
      for (real t2=t1+2*l/n; t2<l; t2+=l/n)
        {
          tpoint=intersect(subpath(p,t1,t1+l/n),
                           subpath(p,t2,t2+l/n));
          if (tpoint.length == 2)
            {
              rpair[i]=point(subpath(p,t1,t1+l/n),tpoint[0]);
              ++i;
            }
        }
    }
  return rpair;
}

void dott(pair[] pt, pen p)
{
  for (int i=1 ; i<pt.length; ++i)
    {
      dot(pt[i], p);
    }
}

srand(rand());
path p = randompath(15);

pair[] inter=self_intersection(p);
dott(inter, .8red);
draw(p);


Étiquettes : , ,


Asymptote Generalities – fig1890

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

Figure 0187
(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

Figure 0188
(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

Figure 0189
(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

Figure 0191
(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

Figure 0192
(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

Figure 0193
(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 – fig0130

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

Figure 0013
(Compiled with Asymptote version 2.14svn-r5318)
    
import geometry;
size(10cm,0);

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

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

pair a=(0.5,0.5);
pair b=(-0.5,-1);

point A=point(R,a), B=point(R,b);
dot("$A$",A,S); dot("$B$",B,S);
line l=line(A,B);

point Ap=a, Bp=b;
dot("$A'$",Ap); dot("$B'$",Bp,SE);
line lp=line(Ap,Bp);

point As=point(Rs,a), Bs=point(Rs,b);
dot("$A''$",As,S); dot("$B''$",Bs,SE);
line ls=line(As,Bs);

draw(l^^lp^^ls);

dot(intersectionpoint(l,lp),2mm+red);
dot(intersectionpoint(l,ls),2mm+red);
dot(intersectionpoint(lp,ls),2mm+red);

Étiquettes : , , , , ,


Asymptote using geometry.asy – fig0140

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

Figure 0014
(Compiled with Asymptote version 2.14svn-r5318)
    
include fig0130;

point w=l.A+1.5*l.v;
draw(Label("$w$",EndPoint),l.A--w,Arrow);

point wp=lp.A+1.5*lp.v;
draw(Label("$w'$",EndPoint),lp.A--wp,Arrow);

point ws=ls.A+1.5*ls.v;
draw(Label("$w''$",EndPoint),ls.A--ws,Arrow);

int n=64;
real step=2pi/n;

for (int i=0; i<n; ++i) {
  point p=B+point(R,R.polar(1,step*i));
  dot(p,sameside(p,w,l) ? black : blue);
  
  point p=Ap+point(Rp,Rp.polar(1,step*i));
  dot(p,sameside(p,wp,lp) ? black : blue);

  point p=As+point(Rs,Rs.polar(1,step*i));
  dot(p,sameside(p,ws,ls) ? black : blue);
}

Étiquettes : , , , , ,


Asymptote using geometry.asy – fig0150

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

Figure 0015
(Compiled with Asymptote version 2.14svn-r5318)
    
size(12cm,0);
import geometry;
import base_pi;
dotfactor*=2;

currentcoordsys=cartesiansystem((0,0),i=(1,0.5),j=(-1,1));
coordsys Rp=currentcoordsys;
show("$O'$","$\vec{u}$","$\vec{v}$", Rp, xpen=invisible);

path cle=randompath(20);
draw(cle);

point A=(0,1.5), B=(1,-0.5);

line l=line(A,B);
draw(l);

/* View the definition of pair[] intersectionpoints(line,path) */
dot(intersectionpoints(l,cle));

Étiquettes : , , ,


Asymptote using geometry.asy – fig0170

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

Figure 0017
(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,-1), B=(3,4);
line l1=line(A,B);

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

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

/* View the definition of line parallel(point,line) */
draw(parallel(M,l1),red);

/* View the definition of line perpendicular(point,line) */
line perp=perpendicular(M,l1);
draw(perp);

/* View the definition of point intersectionpoint(line,line) */
point interp=intersectionpoint(l1,perp);
dot(interp,green);

/* View the definition of void markrightangle(picture,point,point,point,real,pen,margin,filltype) */
markrightangle(l1.A,interp,rotate(180,interp)*M,size=5mm);

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

Étiquettes : , , , , , , ,


Asymptote using geometry.asy – fig0220

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

Figure 0022
(Compiled with Asymptote version 2.14svn-r5318)
    
unitsize(2cm);
import geometry;

currentcoordsys=cartesiansystem((2,1),i=(1,0.25),j=(-0.25,.75));
show(lo=Label("$O$",align=SE+0.5E), currentcoordsys);

pair A=(1,1), B=(2,2);
line l1=line(A,B);
draw("$(l_1)$",l1);

line l2=rotate(100,(3,3))*l1;
draw("$(l_2)$",l2);
write(locate(intersectionpoint(l1,l2)));
/* View the definition of line bisector(line,line,real,bool) */
line bis=bisector(l1,l2);
draw(bis);

line Bis=bisector(l1,l2,90);
draw(Bis,0.8*red);
markangleradiusfactor*=5;

/* View the definition of void markangle(picture,Label,int,real,real,line,line,arrowbar,pen,filltype,margin,marker) */
markangle(2, l1, l2, StickIntervalMarker(2,2,true));
markangle(2, reverse(l2), l1, radius=1.25*markangleradius(), StickIntervalMarker(2,1,true));

/* View the definition of bool concurrent(...line[]) */
if (concurrent(bis,l1,l2,Bis)) label("Concurrent",(3,3), dir(135));

draw(box(locate((-1,0)),locate((5,5))),invisible);

Étiquettes : , , , ,


Asymptote using geometry.asy – fig0230

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

Figure 0023
(Compiled with Asymptote version 2.14svn-r5318)
    
import geometry;
size(12cm,0);

currentcoordsys=cartesiansystem((2,1),i=expi(pi/18)*(1,0),j=expi(pi/18)*(0,1));
show(currentcoordsys,xpen=invisible);

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

dot("$A$", A, 2W);
dot("$B$", B, 2E);

line l1=hline()+C;
draw("$(l_1)$", l1, blue);
dot("$C$", C, NE);

line l2=line(A, B, false);
draw(Label("$(AB]$",Relative(.25),SE), l2, green);

/* View the definition of line complementary(explicit line) */
draw("Complementary of $(AB]$", complementary(l2), dotted+roundcap);

point p=intersectionpoint(l1,l2);

/* View the definition of bool defined(pair) */
string s="$(l_1)$" + (defined(p) ? " intersects " : " does not intersect ") + "$(AB]$";
label(s, A+1.75*l2.u,W);

draw(box(locate((-2,-2)),locate((2,2))), invisible);

Étiquettes : , , ,


Asymptote using geometry.asy – fig0350

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

Figure 0035
(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, xpen=invisible);

point A=(-1,0);
point B=(0.5,-3sin(2));
dot("$A$",A,S,red);
dot("$B$",B,N,red);

line l=line(A,B);
circle c=circle((point)(0,-sqrt(2)/2),exp(1));
draw(l);
draw(c);

/* View the definition of point[] intersectionpoints(line,circle) */
point[] inter=intersectionpoints(l,c);
dot("$M$", inter[0], 2S, red);
dot("$N$", inter[1], 2N+0.5W, red);

Étiquettes : , , ,


Asymptote using geometry.asy – fig0360

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

Figure 0036
(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,0);
point B=(0.5,-3sin(2));
dot("$A$",A,S,red);
dot("$B$",B,N,red);

line l=line(A,B);
ellipse el=ellipse((0,-sqrt(2)/2),3,2,90);
draw(l);
draw(el,Arrow);

/* View the definition of point[] intersectionpoints(line,ellipse) */
point[] inter=intersectionpoints(l,el);
dot("$M$", inter[0], 4N+2W, red);
dot("$N$", inter[1], 2S+0.5E, red);

Étiquettes : , , ,


Asymptote using geometry.asy – fig0370

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

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

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

point A=(-1,-1);
point B=(2,1);
dot("$A$",A,S,red);
dot("$B$",B,N,red);

line l=line(A,B);
draw(l);

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

parabola p=parabola(F,0.2,110);
draw(p);

/* View the definition of point[] intersectionpoints(line,parabola) */
point[] inter=intersectionpoints(l,p);
dot("$M$", inter[0], 2N+E, red);
dot("$N$", inter[1], S+2E, red);

Étiquettes : , , ,


Asymptote using geometry.asy – fig0380

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

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

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

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

point A=(-2,-2);
point B=(2,-3);
dot("$A$",A,N,red);
dot("$B$",B,S,red);

line l=line(A,B);
draw(l);

point C=(2,-1.5);
dot("$C$",C,N);

hyperbola h=hyperbola(C,sqrt(2),sqrt(2)/2,0);
draw(h);

/* View the definition of point[] intersectionpoints(line,hyperbola) */
point[] inter=intersectionpoints(l,h);
dot("$M$", inter[0], 2N+E, red);
dot("$N$", inter[1], 2S+E, red);

Étiquettes : , , ,


Asymptote using geometry.asy – fig0390

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

Figure 0039
(Compiled with Asymptote version 2.14svn-r5318)
    
import geometry;

size(8cm,0);

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

point A=(-0.5,.75);
point B=(1,1);
dot("$A$",A,SE);
dot("$B$",B,NW);

line l=line(A,B,false);
line ll=hline()+B;

circle c=circle((point)(0.5,0.5),2);
draw(l^^ll);
draw(complementary(l),dashed+grey);
draw(c);

dotfactor*=2;

/* View the definition of point[] intersectionpoints(line,circle) */
dot(intersectionpoints(l,c),red);
dot(intersectionpoints(ll,c),red);

Étiquettes : , , ,


Asymptote using geometry.asy – fig0400

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

Figure 0040
(Compiled with Asymptote version 2.14svn-r5318)
    
import geometry;

size(8cm,0);

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

point A=(-0.5,.75);
point B=(1,1);
dot("$A$",A,SE);
dot("$B$",B,NW);

line l=line(A,B,false);
line ll=hline()+B;

ellipse el=ellipse((point)(0.5,0.5),3,2);
draw(l^^ll);
draw(complementary(l),dashed+grey);
draw(el);

dotfactor*=2;

/* View the definition of point[] intersectionpoints(line,ellipse) */
dot(intersectionpoints(l,el),red);
dot(intersectionpoints(ll,el),red);

Étiquettes : , , ,


Asymptote using geometry.asy – fig0410

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

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

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

point A=(-1,-1);
point B=(2,1);
dot("$A$",A,S,red);
dot("$B$",B,NW,red);

line l=line(A,B,false);
line ll=hline()+0.5*B;
draw(l^^ll);
draw(complementary(l),dashed+grey);

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

parabola p=parabola(F,0.2,110);
draw(p);

dotfactor*=2;

/* View the definition of point[] intersectionpoints(line,parabola) */
dot(intersectionpoints(l,p), red);
dot(intersectionpoints(ll,p), red);

Étiquettes : , , ,


Asymptote using geometry.asy – fig0420

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

Figure 0042
(Compiled with Asymptote version 2.14svn-r5318)
    
import geometry;
size(10cm,0);

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

point A=(-1,-1);
point B=(0.75,0.5);
dot("$A$",A,NW,red);
dot("$B$",B,N,red);

circle c1=circle(A,1.5);
circle c2=circle(B,2);
draw(c1^^c2);

/* View the definition of line radicalline(circle,circle) */
draw(radicalline(c1,c2));
/* View the definition of point radicalcenter(circle,circle) */
dot(radicalcenter(c1,c2));

dotfactor*=2;

/* View the definition of point[] intersectionpoints(circle,circle) */
point[] inter=intersectionpoints(c1,c2);
dot("$M$", inter[0], 2SW, red);
dot("$N$", inter[1], 2NE, red);

Étiquettes : , , ,


Asymptote using geometry.asy – fig0430

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

Figure 0043
(Compiled with Asymptote version 2.14svn-r5318)
    
import geometry;
size(10cm,0);

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

point C=(0,0);
point Cp=(0.5,0.5);
dot("$C$",C,NW,red);
dot("$C'$",Cp,N,red);

ellipse el1=ellipse(C,2,1);
ellipse el2=ellipse(Cp,3,1,40);
draw(el1^^el2);

dotfactor*=2;

/* View the definition of point[] intersectionpoints(ellipse,ellipse) */
point[] inter=intersectionpoints(el1,el2);
dot(inter);

Étiquettes : , ,


Asymptote using geometry.asy – fig0440

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

Figure 0044
(Compiled with Asymptote version 2.14svn-r5318)
    
import geometry;
size(10cm,0);

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

point A=(-1,-1);
point B=(0.75,0.5);
dot("$A$",A,NW,red);
dot("$B$",B,N,red);

circle c1=circle(A,1.5);
circle c2=circle(B,2);
draw(c1^^c2);

point[] inter=intersectionpoints(c1,c2);
dot("$M$", inter[0], 2NW, red);

/* View the definition of line tangent(circle,point) */
draw(tangent(c1,inter[0]), grey);
draw(tangent(c2,inter[0]), grey);

/* View the definition of line tangent(circle,abscissa) */
draw(tangent(c2,angabscissa(135)), grey);


Étiquettes : , , , ,


Asymptote using geometry.asy – fig0450

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

Figure 0045
(Compiled with Asymptote version 2.14svn-r5318)
    
import geometry;
size(10cm,0);

point c2=(13,5);
real r=4, R=abs(c2)-r;

circle[] C={circle(origin, 4), circle(c2,R)};
draw(C[0]^^C[1], blue);

segment s=segment(origin, c2);
draw(s, red, dot);

/* View the definition of point curpoint(line,real) */
point T=curpoint(s,r/(r-R)*abs(c2));
dot(T);
/* View the definition of line tangents(circle,point) */
line[] tgt=tangents(C[1], T);
draw(tgt);

point[][] t= new point[2][2];
for (int i=0; i < 2 ; ++i)
  for (int j=0; j < 2; ++j) {
    /* View the definition of point[] intersectionpoints(line,circle) */
    t[i][j]=intersectionpoints(C[i],tgt[j])[0];
    draw(C[i].C--t[i][j], dot);
    markrightangle(T, t[i][j], C[i].C, size=(i == 0 ? 2mm : 0));
  }

addMargins(cm/2,cm/2);

Étiquettes : , , , , ,


Asymptote using geometry.asy – fig0460

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

Figure 0046
(Compiled with Asymptote version 2.14svn-r5318)
    
import geometry;
size(10cm,0);

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

point A=(-1,-1);
point B=(0.75,0.5);
dot("$A$",A,NW,red);
dot("$B$",B,N,red);

ellipse el1=ellipse(A,2,1.5);
ellipse el2=ellipse(B,3,2);
draw(el1);
draw(el2,Arrow);

point[] inter=intersectionpoints(el1,el2);
dot("$M$", inter[0], 2NW, red);

/* View the definition of line[] tangents(ellipse,point) */
draw(tangents(el1,inter[0]), grey);
draw(tangents(el2,inter[0]), grey);

/* View the definition of line tangent(ellipse,abscissa) */
draw(tangent(el2,angabscissa(90)), grey);


Étiquettes : , , , , , ,


Asymptote using geometry.asy – fig0470

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

Figure 0047
(Compiled with Asymptote version 2.14svn-r5318)
    
import geometry;
size(12cm);

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

point F1=(0,0);
dot("$F1$",F1,NW);
point F2=(-0.25,0.5);
dot("$F2$",F2,SE);

parabola p=parabola(F1, 0.1, 120);
draw(p, bp+red);

parabola pp=parabola(F2, 0.06, 280);
draw(pp, bp+blue);

abscissa x=angabscissa(180);
dot(point(p,x));
/* View the definition of line tangent(parabola,abscissa) */
draw(tangent(p,x), 0.8*red);

point[] P=intersectionpoints(p,pp);
dot(P);

/* View the definition of line[] tangents(parabola,point) */
draw(tangents(p,P[0]), 0.8*red);
draw(tangents(pp,P[0]), 0.8*blue);

// Enlarge the bounding box
draw(box((-1,-0.4), (0.5,0.6)),invisible);

Étiquettes : , , , , , ,


Asymptote using geometry.asy – fig0480

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

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

point C=(4,2);
dot("$C$",C,E+NE,red);

hyperbola h=hyperbola(C,1.5,1,-20);
draw(h, linewidth(bp));

/* View the definition of line tangent(hyperbola,abscissa) */
line l=tangent(h,angabscissa(85));
draw(l, grey);
dot(intersectionpoints(h,l));

l=tangent(h,angabscissa(0,fromCenter));
draw(l, grey);
dot(intersectionpoints(h,l));

// Enlarge the bounding box of the current picture.
draw(box((-1,-0.5), (9,4)), invisible);

Étiquettes : , , , , , ,


Asymptote using geometry.asy – fig0490

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

Figure 0049
(Compiled with Asymptote version 2.14svn-r5318)
    
import geometry;
size(12cm);

point C=(0,0);
dot(C);

hyperbola[] h;
h[0]=hyperbola(C,2,2);
h[1]=hyperbola(C,1.5,1);

draw(h[0], 2bp+0.8*red);
draw(h[1], 2bp+0.8*blue);

point[] P=intersectionpoints(h[0],h[1]);

line[] l;
for (int i=0; i < P.length; ++i) {
  for (int j=0; j < 2; ++j) {
    /* View the definition of line[] tangents(hyperbola,point) */
    l=tangents(h[j],P[i]);
    draw(l[0], j == 0 ? red : blue);
  }
}

dot(P, yellow);

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

Étiquettes : , , , , ,


Asymptote using geometry.asy – fig0500

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

Figure 0050
(Compiled with Asymptote version 2.14svn-r5318)
    
import geometry;
size(10cm,0);

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

point A=(2.5,-1);
point B=A+(3,1);
dot("$A$",A,SW);
dot("$B$",B,2N+0.5W);

circle c1=circle(A,1.5);
draw(c1);

/* View the definition of line[] tangents(circle,point) */
line[] tgt=tangents(c1,B);
draw(tgt,red);
/* View the definition of circle circle(point,point) */
draw(circle(B,A),grey);

// dot(intersectionpoints(c1,circle(B,A)),red);
for (int i=0; i<tgt.length; ++i) {
  dot(intersectionpoints(c1,tgt[i]),2mm+red);
}

Étiquettes : , , , , ,


Asymptote using geometry.asy – fig0510

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

Figure 0051
(Compiled with Asymptote version 2.14svn-r5318)
    
import geometry;
size(12cm,0);

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

point A=(2.5,-1);
dot("$A$",A,SW);
ellipse el1=ellipse(A,2,1,10);
draw(el1);

circle C=circle(A,3);
draw(C);
for (int i=0; i < 360; i+=90) {

  point B=point(C,angabscissa(i));
  dot("$B$",B,locate(unit(B-A)));


  line[] tgt=tangents(el1,B);
  draw(tgt,0.8*red);

  for (int i=0; i < tgt.length; ++i) {
    dot(intersectionpoints(el1,tgt[i]),blue);
  }

}

Étiquettes : , , , , , ,


Asymptote using geometry.asy – fig0520

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

Figure 0052
(Compiled with Asymptote version 2.14svn-r5318)
    
import geometry;
size(12cm,0);

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

point F=(0,0);
dot("$F$", F, SW);
parabola p=parabola(F, 0.1, 30);
draw(p);

point C=shift(2*(p.V-p.F))*p.V;
circle cle=circle(C, 0.2);
draw(cle);
for (int i=0; i < 360; i+=90) {

  point M=point(cle, angabscissa(i));
  dot("$M$", M, locate(unit(M-C)));

  line[] tgt=tangents(p, M);
  draw(tgt, 0.8*red);

  for (int i=0; i < tgt.length; ++i) {
    dot(intersectionpoints(p, tgt[i]), blue);
  }
}

Étiquettes : , , , , , ,


Asymptote using geometry.asy – fig0760

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

Figure 0076
(Compiled with Asymptote version 2.14svn-r5318)
    
import geometry;
size(12cm);

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

conic co[];
co[0]=circle((point)(0,0),1);
/* View the definition of void draw(picture,Label,explicit conic,align,pen,arrowbar,arrowbar,margin,Label,marker) */
draw(co[0]);

co[1]=ellipse((point)(0,0),4,1);
draw(co[1]);

co[2]=parabola((0,0),1,90);
draw(co[2]);

hyperbola h=hyperbola((-1,0),(1,0),1.2,byvertices);
co[3]=h;
draw(co[3]);
draw(h.A1,grey);
draw(h.A2,grey);

dotfactor *= 1;

for (int i=0; i < 4; ++i) {
  dot(intersectionpoints(h.A1,co[i]),blue);
  dot(intersectionpoints(h.A2,co[i]),blue);
  for (int j=i+1; j < 4; ++j)
    /* View the definition of point[] intersectionpoints(conic,conic) */
    dot(intersectionpoints(co[i],co[j]), red);
}

Étiquettes : , , , , , , ,


Asymptote using geometry.asy – fig0960

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

Figure 0096
(Compiled with Asymptote version 2.14svn-r5318)
    
import geometry;
size(8cm);

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

point A=(-1,0) ; dot("$A$",A,S);
point B=(1,1)  ; dot("$B$",B,S);
point C=(0,0)  ;
point D=(1,-1) ; dot("$D$",D,SW);

arc c=arc(circle(C,2), 0, 270);
draw(complementary(c),dashed+grey);

line l1=line(A,B); draw(l1);
line l2=line(C,D); draw(l2);

point[] J=intersectionpoints(l1,c);
point[] K=intersectionpoints(l2,c);

/* View the definition of arc arc(explicit arc,point,point) */
draw(arc(c,K[0],J[0]),2mm+0.8yellow);
draw(arc(c,J[1],K[0]),2mm+0.8red);
/* View the definition of arc arc(explicit arc,abscissa,abscissa) */
draw(arc(c,relabscissa(c,J[0]),relabscissa(1)),2mm+0.8green);
draw(arc(c,relabscissa(0),relabscissa(c,J[1])),2mm+0.8blue);

dot("$J_0$",J[0],2NW);
dot("$J_1$",J[1],2N);
dot("$K_0$",K[0],2W);

draw(c, 1mm+white);

Étiquettes : , , , , , ,


Asymptote using geometry.asy – fig0970

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

Figure 0097
(Compiled with Asymptote version 2.14svn-r5318)
    
import geometry;
size(8cm);

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

point A=(-1,0) ; dot("$A$",A,S);
point B=(1,1)  ; dot("$B$",B,S);
point C=(0,0)  ;
point D=(1,-1) ; dot("$D$",D,SW);

arc c=arc(ellipse(C,2,1,20), 0, 270);
draw(complementary(c),dashed+grey);

line l1=line(A,B); draw(l1);
line l2=line(C,D); draw(l2);

point[] J=intersectionpoints(l1,c);
point[] K=intersectionpoints(l2,c);

/* View the definition of arc arc(explicit arc,point,point) */
draw(arc(c,J[0],K[0]),2mm+0.8yellow);
draw(arc(c,K[0],J[1]),2mm+0.8red);
/* View the definition of arc arc(explicit arc,abscissa,abscissa) */
draw(arc(c,relabscissa(c,J[1]),relabscissa(1)),2mm+0.8green);
draw(arc(c,relabscissa(0),relabscissa(c,J[0])),2mm+0.8blue);

dot("$J_0$",J[0],2N);
dot("$J_1$",J[1],N+2W);
dot("$K_0$",K[0],2N);

draw(c, 1mm+white);

Étiquettes : , , , , , ,


Asymptote using geometry.asy – fig1010

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

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

real R=2;

point A=(1,1);
dot("$A$", A, S, red);
point B=A+(2,1);
dot("$B$", B, N, blue);

arc a=arc(circle(A,R), -40, 180);
arc b=arc(circle(B,R), -45, 220);
line l=line(A,B);

draw(a,red);
draw(b,blue);
draw(l);

/* View the definition of point[] intersectionpoints(arc,arc) */
point[] inter=intersectionpoints(a,b);
dot(inter);

/* View the definition of point[] intersectionpoints(line,arc) */
point[] inter=intersectionpoints(l,a);
dot(inter);

point[] inter=intersectionpoints(l,b);
dot(inter);

Étiquettes : , , , , ,


Asymptote using geometry.asy – fig1020

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

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

real R=2;

point A=(1,1);
dot("$A$", A, S, red);
point B=A+(2,1);
dot("$B$", B, N, blue);

arc a=arc(ellipse(A,R,R/2), -40, 180);
arc b=arc(ellipse(B,R,R/2), -45, 220);

line l=line(A,B);

draw(a,red);
draw(b,blue);
draw(l);

/* View the definition of point[] intersectionpoints(arc,arc) */
point[] inter=intersectionpoints(a,b);
dot(inter);

/* View the definition of point[] intersectionpoints(line,arc) */
point[] inter=intersectionpoints(l,a);
dot(inter);

point[] inter=intersectionpoints(l,b);
dot(inter);

Étiquettes : , , , , ,


Asymptote using geometry.asy – fig1030

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

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

real R=2;

point A=(1,1.5);
dot("$A$",A,S,red);
point B=A+(2,1);
dot("$B$",B,S,blue);

arc a=arc(circle(A,R),-40,180);
arc b=arc(circle(B,R),-45,220);

draw(a,red);
draw(b,blue);

point M=intersectionpoints(a,b)[0];
dot(M);

/* View the definition of line tangent(explicit arc,point) */
draw(tangent(a,M), grey);
draw(tangent(b,M), grey);

/* View the definition of line tangent(explicit arc,abscissa) */
draw(tangent(a,angabscissa(45)), grey);

Étiquettes : , , , , , ,


Asymptote using geometry.asy – fig1040

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

Figure 0104
(Compiled with Asymptote version 2.14svn-r5318)
    
import geometry;
size(10cm,0);

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

real R=2;

point A=(1,1.5);
dot("$A$",A,S,red);
point B=A+(2.5,1);
dot("$B$",B,E,blue);

arc a=arc(ellipse(A,R,R/2,30),-40,180);
// ellispenodesnumberfactor=400;
arc b=arc(ellipse(B,2R,R/2,-10),-30,180);

draw(a,red);
draw(b,blue);

point M=intersectionpoints(a,b)[0];
dot(M);

/* View the definition of line tangent(explicit arc,point) */
draw(tangent(a,M), grey);
draw(tangent(b,M), grey);

/* View the definition of line tangent(explicit arc,abscissa) */
draw(tangent(a,angabscissa(45)), grey);

Étiquettes : , , , , , ,


Asymptote using geometry.asy – fig1050

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

Figure 0105
(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=(0.25,0.25);
point B=A+(1,0.25);
dot("$A$",A,S,red);
dot("$B$",B,N,red);

segment s=segment(A,B);
line bis=bisector(s);

draw(s,StickIntervalMarker(2,2));
draw(bis);

/* View the definition of path compassmark(pair,pair,real,real) */
draw(compassmark(A, point(bis,0.75), position=0.25,angle=25), grey);
draw(compassmark(B, point(bis,0.75), position=0.75,angle=25), grey);

/* View the definition of point point(line,real) */
draw(compassmark(A, point(bis,0.25), position=0.5,angle=15), grey);
draw(compassmark(B, point(bis,0.25), position=0.5,angle=15), grey);

Étiquettes : , , , , ,


Asymptote using geometry.asy – fig1150

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

Figure 0115
(Compiled with Asymptote version 2.14svn-r5318)
    
import geometry;
size(8cm);

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

dotfactor *=1.5;
triangle t=triangleabc(3,4,5);
drawline(t, linewidth(bp));
label(t, alignFactor=3);

line l=line((-1,-2), (1,0.5));
draw(l, 0.8*red);
/* View the definition of point[] intersectionpoints(triangle,line,bool) */
dot(intersectionpoints(t,l), 0.8*red);

circle C=2*circle(t);
draw(C, 0.8*blue);
/* View the definition of point[] intersectionpoints(triangle,conic,bool) */
dot(intersectionpoints(t,C, true), 0.8*blue);

Étiquettes : , , , ,


Asymptote using trembling.asy – fig0110

Category: Asymptote,Examples 2D,trembling.asyPh. Ivaldi @ 12 h 24 min

Figure 0011

With magnetizePoints=false.

(Compiled with Asymptote version 1.87svn-r4652)
    
import trembling;
startTrembling(magnetizePoints=false);

size(12cm,0);

point A=(0,0), B=(5,2), C=(3,4);

triangle t=triangle(A,B,C),
et1=triangle(A,B,rotate(-60,A)*B),
et2=triangle(B,C,rotate(-60,B)*C),
et3=triangle(C,A,rotate(-60,C)*A);

draw(et1^^et2^^et3, 0.8*red);
dot(et1.Path()^^et2.Path()^^et3.Path());
draw(t); label(t, alignFactor=2.5);

point[] F=fermat(t);
dot("$F_1$",F[0], S, red);
dot("$F_2$",F[1], W, purple);

draw(circle(et1)^^circle(et2)^^circle(et3), 0.8*green);

draw(line(C,et1.C)^^line(A,et2.C)^^line(B,et3.C), 0.8*blue);
label("$N_1$",et1.VC);
label("$N_2$",et2.VC);
label("$N_3$",et3.VC);

Étiquettes : , , , , , ,


Asymptote using trembling.asy – fig0120

Category: Asymptote,Examples 2D,trembling.asyPh. Ivaldi @ 13 h 24 min

Figure 0012

The same code with magnetizePoints=true.

(Compiled with Asymptote version 1.87svn-r4652)
    
import trembling;
startTrembling();

size(12cm,0);

point A=(0,0), B=(5,2), C=(3,4);

triangle t=triangle(A,B,C),
et1=triangle(A,B,rotate(-60,A)*B),
et2=triangle(B,C,rotate(-60,B)*C),
et3=triangle(C,A,rotate(-60,C)*A);

draw(et1^^et2^^et3, 0.8*red);
dot(et1.Path()^^et2.Path()^^et3.Path());
draw(t); label(t, alignFactor=2.5);

point[] F=fermat(t);
dot("$F_1$",F[0], S, red);
dot("$F_2$",F[1], W, purple);

draw(circle(et1)^^circle(et2)^^circle(et3), 0.8*green);

draw(line(C,et1.C)^^line(A,et2.C)^^line(B,et3.C), 0.8*blue);
label("$N_1$",et1.VC);
label("$N_2$",et2.VC);
label("$N_3$",et3.VC);

Étiquettes : , , , , , ,


Asymptote using trembling.asy – fig0130

Category: Asymptote,Examples 2D,trembling.asyPh. Ivaldi @ 14 h 24 min

Figure 0013
(Compiled with Asymptote version 1.87svn-r4652)
    
import trembling;
size(12cm);

startTrembling();

conic co[];
co[0]=circle((0,0),1);
draw(co[0]);

co[1]=ellipse((0,0),4,1);
draw(co[1]);

co[2]=parabola((0,0),1,90);
draw(co[2]);

hyperbola h=hyperbola((-1,0),(1,0),1.2,byvertices);
co[3]=h;
draw(co[3]);
draw(h.A1,grey);

draw(h.A2,grey);

dotfactor *= 1;

for (int i=0; i < 4; ++i) {
  dot(intersectionpoints(h.A1,co[i]),blue);
  dot(intersectionpoints(h.A2,co[i]),blue);
  for (int j=i+1; j < 4; ++j)
    dot(intersectionpoints(co[i],co[j]), red);
}

Étiquettes : , , , , , , , , , ,


Asymptote using three.asy – fig0050

Category: Asymptote,Examples 3D,three.asyPh. Ivaldi @ 18 h 50 min

Figure 0005
(Compiled with Asymptote version 2.14svn-r5318)
    
import three; import math;
size(8cm,0);
currentprojection=obliqueX;

real h=2;
triple A =(0,0,h), B=(h,0,0), C=(0,h,0), D=(0,0,0);
triple Ip=midpoint(A--C), J=midpoint(A--B);
triple K=shift((0,0,-0.25*h))*A;

triple M=interp(K,J,intersect(K,J,normal(new triple[]{B,C,D}),D));
triple Np=interp(K,Ip,intersect(K,Ip,normal(new triple[]{B,C,D}),D));

dot("$A$", A, align=Z);  dot("$B$", B, align=S);
dot("$C$", C, align=S);  dot("$D$", D, align=W);
dot("$I$", Ip, align=N); dot("$J$", J, align=W);
dot("$K$", K, align=NE); dot("$M$", M, align=SE);
dot("$N$", Np, align=S);

draw(A--B--C--cycle^^B--M^^C--Np^^J--M^^Ip--Np);
draw(A--D--C^^D--B^^J--K^^K--Ip, dashed);

Étiquettes : , , , ,


Asymptote using solids.asy – fig0120

Category: Asymptote,Examples 3D,solids.asyPh. Ivaldi @ 13 h 56 min

Figure 0012
(Compiled with Asymptote version 2.14svn-r5318)
    
import solids;

size(10cm,0);
currentprojection=orthographic(-50,100,40);

//Draw right angle (MA,MB) in 3D
void drawrightangle(picture pic=currentpicture,
                    triple M, triple A, triple B,
                    real radius=0,
                    pen p=currentpen,
                    pen fillpen=nullpen,
                    projection P=currentprojection)
{
  p=linejoin(0)+linecap(0)+p;
  if (radius==0) radius=arrowfactor*sqrt(2);
  transform3 T=shift(-M);
  triple OA=radius/sqrt(2)*unit(T*A),
    OB=radius/sqrt(2)*unit(T*B),
    OC=OA+OB;
  path3 _p=OA--OC--OB;
  picture pic_;
    draw(pic_, _p, p=p);
    if (fillpen!=nullpen) draw(pic_, surface(O--_p--cycle), fillpen);
  add(pic,pic_,M);
}

// *...............Construction starts here................*

real r=1, h=.75;
real gle=60;
real gleA=20;
transform3 tR=rotate(gle,Z);
transform3 tT=shift((0,0,-h));

triple H=(0,0,h),//the label is O in the picture.
  A=rotate(gleA,Z)*(0,r,h),
  F=tR*A,
  B=tR*F,
  D=tT*A,
  C=tT*B,
  Ei=intersectionpoint(H--F,A--B);

revolution r=cylinder(O,r,h,Z);
// draw(surface(r));
draw(r);

draw(O--H, dashed);
draw(O--D--C--cycle^^O--H^^B--C, dashed);

drawrightangle(Ei,H,B,fillpen=black);

dot(Label("$O'$",align=invert(NE+E,O)), O);
// layer();
draw(surface(A--B--C--D--cycle),lightgrey+opacity(.5));

dot(Label("$A$",align=NW), A);
dot(Label("$B$",align=N),B);
dot(Label("$C$",align=S), C);
dot(Label("$D$",align=NW), D);
dot(Label("$E$",align=S), Ei);
dot(Label("$F$",align=S), F);
dot(Label("$O$",align=N), H);

draw(H--B--F--A--cycle^^H--F^^A--B^^A--D);

Étiquettes : , , , ,


Unofficial package base_pi.asy – fig0120

Category: Asymptote,base_pi.asy,Unofficial packagesPh. Ivaldi @ 16 h 47 min

Figure 0003
(Compiled with Asymptote version 2.14svn-r5318)
    
import base_pi;
import stats;
size(8cm,0);

path cle=randompath(6);
draw(cle);
real x=.75;

/* View the definition of pair[] intersectionpointsv(path,real) */
pair[] pta = intersectionpointsv(cle,x);
draw(pta[0]--pta[pta.length-1]);
dot(pta,red);

real y=0;
/* View the definition of pair[] intersectionpointsh(path,real) */
pair[] ptb = intersectionpointsh(cle,y);
draw(ptb[0]--ptb[ptb.length-1]);
dot(ptb,blue);

Étiquettes :


Unofficial package base_pi.asy – fig0130

Category: Asymptote,base_pi.asy,Unofficial packagesPh. Ivaldi @ 17 h 47 min

Figure 0004
(Compiled with Asymptote version 2.14svn-r5318)
    
import base_pi;
import stats;
size(6cm,0);

path cle=randompath(7);
draw(cle);

pair a=(1,0), b=(0.75,.3);
dot("$A$",a);
dot("$B$",b);
/* View the definition of pair[] intersectionpoints(path,pair,pair) */
pair[] pta=intersectionpoints(cle,a,b);
/* View the definition of guide join(pair[],interpolate) */
draw(join(pta));
dot(pta,red);

Étiquettes :


Unofficial package base_pi.asy – fig0140

Category: Asymptote,base_pi.asy,Unofficial packagesPh. Ivaldi @ 18 h 47 min

Figure 0005
(Compiled with Asymptote version 2.14svn-r5318)
    
import base_pi;
import stats;
size(6cm,0);

path cle=randompath(7);
draw(cle);

pair a=(1,0), b=(0.75,.3);
dot("$A$",a);
dot("$B$",b);
/* View the definition of pair[] intersectionpointsd(path,pair,pair) */
pair[] pta=intersectionpointsd(cle,a,b);
draw(join(pta));
dot(pta,red);

Étiquettes :


Unofficial package base_pi.asy – fig0150

Category: Asymptote,base_pi.asy,Unofficial packagesPh. Ivaldi @ 19 h 47 min

Figure 0006
(Compiled with Asymptote version 2.14svn-r5318)
    
import base_pi;
size(8cm,0);

path cle=yscale(3)*((0,0){N}..(1,0){N}..cycle);
draw(cle);

real x=.75;
/* View the definition of real[] intersectsv(path,real) */
real[] it=intersectsv(cle,x);
draw(subpath(cle,it[0],it[1]), 1mm+blue);
dot(intersectionpointsv(cle,x),red);
drawline((x,0),(x,1));

Étiquettes :


Unofficial package base_pi.asy – fig0160

Category: Asymptote,base_pi.asy,Unofficial packagesPh. Ivaldi @ 20 h 47 min

Figure 0007
(Compiled with Asymptote version 2.14svn-r5318)
    
import base_pi;
size(8cm,0);

path cle=yscale(3)*((0,0){N}..(1,0){N}..cycle);
draw(cle);

real y=0.1;
/* View the definition of real[] intersectsh(path,real) */
real[] it=intersectsh(cle,y);
draw(subpath(cle,it[0],it[1]), 1mm+blue);
draw(subpath(cle,it[1],it[2]), 1mm+.8green);
dot(intersectionpointsh(cle,y),red);
drawline((0,y),(1,y));

Étiquettes :


Unofficial package base_pi.asy – fig0170

Category: Asymptote,base_pi.asy,Unofficial packagesPh. Ivaldi @ 21 h 47 min

Figure 0008
(Compiled with Asymptote version 2.14svn-r5318)
    
import base_pi;
size(8cm,0);

path cle=yscale(3)*((0,0){N}..(1,0){N}..cycle);
draw(cle);

pair a=(0.2,.3), b=(.75,-.1);
dot("$A$",a,S);
dot("$B$",b,S);
draw(a--b);

real[] itd=intersections(cle,a,b);
draw(subpath(cle,itd[0],itd[2]), 1mm+.8blue);
draw(subpath(cle,itd[1],itd[2]), 1mm+.8green);
draw(subpath(cle,itd[2],length(cle)+itd[0]), 1mm+.8yellow);

/* View the definition of pair[] intersectionpoints(path,pair,pair) */
pair[] pta=intersectionpoints(cle,a,b);
dot(pta,red);
draw(pta[0]--a^^b--pta[2],red+dotted);

Étiquettes :


Unofficial package base_pi.asy – fig0180

Category: Asymptote,base_pi.asy,Unofficial packagesPh. Ivaldi @ 22 h 47 min

Figure 0009
(Compiled with Asymptote version 2.14svn-r5318)
    
import base_pi;
size(8cm,0);

path cle=yscale(3)*((0,0){N}..(1,0){N}..cycle);
draw(cle);

pair a=(0.2,.3), b=(.75,-.1);
dot("$A$",a,S);
dot("$B$",b,S);
draw(a--b);

real[] itd=intersections(cle,a,b);
draw(subpath(cle,itd[0],itd[2]), 1mm+.8blue);
draw(subpath(cle,itd[1],itd[2]), 1mm+.8green);
draw(subpath(cle,itd[2],length(cle)+itd[0]), 1mm+.8yellow);

/* View the definition of pair[] intersectionpointsd(path,pair,pair) */
pair[] pta=intersectionpointsd(cle,a,b);
dot(pta,red);
draw(pta[0]--a^^b--pta[1],red+dotted);

Étiquettes :


Official Asymptote example – buildcycle

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

Figure 0018
(Compiled with Asymptote version 2.14svn-r5318)
/* This code comes from The Official Asymptote Gallery */
    
size(200);

real w=1.35;

path[] p;
for(int k=0; k < 2; ++k) {
  int i=2+2*k;
  int ii=i^2;
  p[k]=(w/ii,1){1,-ii}::(w/i,1/i)::(w,1/ii){ii,-1};
}

path q0=(0,0)--(w,0.5);
path q1=(0,0)--(w,1.5);
draw(q0); draw(p[0]); draw(q1); draw(p[1]);
path s=buildcycle(q0,p[0],q1,p[1]);
fill(s,mediumgrey);

label("$P$",intersectionpoint(p[0],q0),N);
label("$Q$",intersectionpoint(p[0],q1),E);
label("$R$",intersectionpoint(p[1],q1),W);
label("$S$",intersectionpoint(p[1],q0),S);
label("$f > 0$",0.5*(min(s)+max(s)),UnFill);

Étiquettes : ,


Official Asymptote example – equilateral

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

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

pair b=(0,0), c=(1,0);
pair a=extension(b,b+dir(60),c,c+dir(120));
pair d=extension(b,b+dir(30),a,a+dir(270));

draw(a--b--c--a--d--b^^d--c);
label("$A$",a,N);
label("$B$",b,W);
label("$C$",c,E);
label("$D$",d,S);

Étiquettes : , ,


Official Asymptote example – fano

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

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

size(100,0);

pair z4=(0,0);
pair z7=(2,0);
pair z1=point(rotate(60)*(z4--z7),1);

pair z5=interp(z4,z7,0.5);
pair z3=interp(z7,z1,0.5);
pair z2=interp(z1,z4,0.5);
pair z6=extension(z4,z3,z7,z2);

draw(z4--z7--z1--cycle);
draw(z4--z3);
draw(z7--z2);
draw(z1--z5);
draw(circle(z6,abs(z3-z6)));

label("1",z1,dir(z5--z1));
label("2",z2,dir(z7--z2));
label("3",z3,dir(z4--z3));
label("4",z4,dir(z3--z4));
label("5",z5,dir(z1--z5));
label("6",z6,2.5E+0.1*N);
label("7",z7,dir(z2--z7));



Étiquettes : , , , ,


Official Asymptote example – impact

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

Figure 0099
(Compiled with Asymptote version 2.14svn-r5318)
/* This code comes from The Official Asymptote Gallery */
    
// Contributed by Philippe Ivaldi.
// http://www.piprime.fr/

import graph3 ;
import contour;
size (6cm,0);
currentprojection=orthographic(1,1,1) ;

real rc=1, hc=2, c=rc/hc;
draw(shift(hc*Z)*scale(rc,rc,-hc)*unitcone,blue);

triple Os=(0.5,0.5,1);
real r=0.5;
draw(shift(Os)*scale3(r)*unitsphere,red);

real a=1+1/c^2;
real b=abs(Os)^2-r^2;

real f(pair z)
{
  real x=z.x, y=z.y;
  return a*x^2-2*Os.x*x+a*y^2-2*Os.y*y-2*Os.z*sqrt(x^2+y^2)/c+b;
}

real g(pair z){return (sqrt(z.x^2+z.y^2))/c;}

draw(lift(g,contour(f,(-rc,-rc),(rc,rc),new real[]{0})),linewidth(2bp)+yellow);

axes3("$x$","$y$","$z$",Arrow3);

Étiquettes : , , , ,


Official Asymptote example – layers

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

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

add(intersection);

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 : , , ,


Official Asymptote example – orthocenter

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

Figure 0154
(Compiled with Asymptote version 2.14svn-r5318)
/* This code comes from The Official Asymptote Gallery */
    
import geometry;
import math;

size(7cm,0);

real theta=degrees(asin(0.5/sqrt(7)));

pair B=(0,sqrt(7));
pair A=B+2sqrt(3)*dir(270-theta);
pair C=A+sqrt(21);
pair O=0;

pair Ap=extension(A,O,B,C);
pair Bp=extension(B,O,C,A);
pair Cp=extension(C,O,A,B);

perpendicular(Ap,NE,Ap--O,blue);
perpendicular(Bp,NE,Bp--C,blue);
perpendicular(Cp,NE,Cp--O,blue);

draw(A--B--C--cycle);

currentpen=black;

draw("1",A--O,-0.25*I*dir(A--O));
draw(O--Ap);
draw("$\sqrt{7}$",B--O,LeftSide);
draw(O--Bp);
draw("4",C--O);
draw(O--Cp);

dot("$O$",O,dir(B--Bp,Cp--C),red);
dot("$A$",A,dir(C--A,B--A),red);
dot("$B$",B,NW,red);
dot("$C$",C,dir(A--C,B--C),red);
dot("$A'$",Ap,dir(A--Ap),red);
dot("$B'$",Bp,dir(B--Bp),red);
dot("$C'$",Cp,dir(C--Cp),red);

label(graphic("piicon","width=2.5cm"),Ap,5ENE,red);

Étiquettes : , ,


Official Asymptote example – pathintersectsurface

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

Figure 0160
(Compiled with Asymptote version 2.14svn-r5318)
/* This code comes from The Official Asymptote Gallery */
    
size(500);
import graph3;

currentprojection=perspective(-5,-4,2);

path3 g=randompath3(10);

draw(g,red+thin());

triple[][] P={
  {(0,0,0),(1,0,0),(1,0,0),(2,0,0)},
  {(0,4/3,0),(2/3,4/3,2),(4/3,4/3,2),(2,4/3,0)},
  {(0,2/3,0),(2/3,2/3,0),(4/3,2/3,0),(2,2/3,0)},
  {(0,2,0),(2/3,2,0),(4/3,2,0),(2,2,0)}};

surface s=surface(patch(P));
s.append(unitplane);

draw(s,lightgray+opacity(0.9));
dot(intersectionpoints(g,s),blue);

Étiquettes : , , ,


Official Asymptote example – splitpatch

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

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

size(300);

currentprojection=orthographic(0,0,1);

triple[][] A={
  {(0,0,0),(1,0,0),(1,0,0),(2,0,0)},
  {(0,4/3,0),(2/3,4/3,2),(4/3,4/3,2),(2,4/3,0)},
  {(0,2/3,0),(2/3,2/3,0),(4/3,2/3,0),(2,2/3,0)},
  {(0,2,0),(2/3,2,0),(4/3,2,0),(2,2,0)}
};

triple[][] B={
  {(0.5,0,-1),(0.5,1,-1),(0.5,2,-1),(0.5,3,-1)},
  {(0.5,0,0),(0.5,1,0),(0.5,2,0),(0.5,3,0)},
  {(0.5,0,1),(0.5,1,1),(0.5,2,1),(0.5,3,1)},
  {(0.5,0,2),(0.5,1,2),(0.5,2,2),(0.5,3,2)}
};

split S=split(A,B,10);
//write(S.T.length);

defaultrender.merge=true;

for(int i=0; i < S.T.length; ++i)
  draw(surface(patch(S.T[i])),Pen(i));
draw(surface(patch(B)),blue);

Étiquettes : , ,


Official Asymptote example – venn

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

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

add(intersection);

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 : , ,