![]() |
|
(Compiled with Asymptote version 2.14svn-r5318) |
size(4cm,0); //Return Circle AB diameter path circle(pair A, pair B) { return shift(midpoint(A--B))*scale(abs(A-B)/2)*unitcircle; } pair A=(0,0), B=(1,0); draw(circle(A,B)); dot(A--B);
Compétitivité-Qualité-Fiabilité-Disponibilité
![]() |
|
(Compiled with Asymptote version 2.14svn-r5318) |
size(4cm,0); //Return Circle AB diameter path circle(pair A, pair B) { return shift(midpoint(A--B))*scale(abs(A-B)/2)*unitcircle; } pair A=(0,0), B=(1,0); draw(circle(A,B)); dot(A--B);
![]() |
|
(Compiled with Asymptote version 2.14svn-r5318) |
size(6cm,0); //Return Circle AB diameter path circle(pair A, pair B) { return shift(midpoint(A--B))*scale(abs(A-B)/2)*unitcircle; } pair A=(0,0), B=(3,0), C=(2,1); draw(A--B,.8blue); draw(A--C,.8red); draw(B--C,.8green); draw(circle(A,B),.8blue); draw(circle(A,C),.8red); draw(circle(B,C),.8green);
![]() |
|
(Compiled with Asymptote version 2.14svn-r5318) |
size(4cm,0); //Return Circle AB diameter path circle(pair A, pair B) { return shift(midpoint(A--B))*scale(abs(A-B)/2)*unitcircle; } pair A=(0,0), B=(1,0), C=(2,0); path cleAB=circle(A,B); path cleAC=circle(A,C); for(real t=0; t<length(cleAB); t+=0.01) fill(circle(point(cleAB,t),point(cleAC,t)));
![]() |
|
(Compiled with Asymptote version 2.14svn-r5318) |
size(4cm,0); pair A=0, B=(1,0), C=(.7,1); void fillangle(picture pic=currentpicture, pair O=0, pair A, pair B, real radius=10, pen p=grey) { picture tpic; int n=sgn(radius); real a1=degrees(shift(-O)*A,false); real a2=degrees(shift(-O)*B,false); fill(tpic,(0,0)--arc((0,0), -radius, max(a1,a2), min(a1,a2),true)--cycle, p=p); add(pic,tpic,O); } draw(A--B--C--cycle); real r1=15, r2=20; fillangle(A,B,C,r1,.8red); fillangle(A,B,C,-r2); fillangle(B,A,C,r1,.8red); fillangle(B,A,C,-r2); fillangle(C,B,A,r1,.8red); fillangle(C,B,A,-r2);
![]() |
|
(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);
![]() |
|
(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] )); }
![]() |
|
(Compiled with Asymptote version 2.14svn-r5318) |
size(6cm,0); pair A=2expi(pi/2); pair homography(pair z) { return (z^2+A)/(z+2); } guide image; pair tpt; draw(unitcircle); for(real t=0; t<length(unitcircle);t+=.05) { tpt=homography(point(unitcircle,t)); image=image..tpt; draw(point(unitcircle,t)--tpt,dotted); } draw(image..cycle,red);
![]() |
|
(Compiled with Asymptote version 2.14svn-r5318) |
size(10cm,0); path apath=(0,0)..(1,1)..(2,.5){dir(0)}; real l=arclength(apath); real step=l/15; path arcpath(path apath, real t1, real t2) { return subpath(apath, arctime(apath,t1), arctime(apath,t2)); } for(real i=0; i<l-step; i+=step) draw(arcpath(apath,i,i+step),4bp+(i/l*red+(l-i)/l*blue),PenMargins); draw(apath);
![]() |
|
(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); }
![]() |
|
(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);
![]() |
|
(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);
![]() |
|
(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);
![]() |
|
(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);
![]() |
|
(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));
![]() |
|
(Compiled with Asymptote version 1.87svn-r4652) |
size(10cm,0); picture pavehexagonal(int depth=1) { picture opic; path hexa=polygon(6); 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)); filldraw(opic, shift(center)*hexa, j/depth*.8red+(1-j/depth)*.8*blue); //Uncomment to see centers of hexagons dot(opic, shift(center)*midpoint(point(hexa,0)--point(hexa,3))); //Uncomment to see circles passing by centers //draw(opic, scale(r)*unitcircle, j/depth*red+(1-j/depth)*blue); 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)); filldraw(opic, shift(center)*hexa, j/depth*.8*red+(1-j/depth)*.8*blue); //Uncomment to see the centers of hexagons //dot(opic, shift(center)*midpoint(point(hexa,0)--point(hexa,3))); rp=r; //Uncomment to see circles passing by centers //draw(opic, scale(r)*unitcircle, j/depth*red+(1-j/depth)*blue); } } } return opic; } add(pavehexagonal(7));
![]() |
|
(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); add(pic,ta*branch); add(pic,tb*branch); return pic; } add(Pythagorean(12));
![]() |
|
(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);
![]() |
|
(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); add(opic,branch); add(opic,ta*branch); add(opic,tb*branch); add(opic,tc*branch); return opic; } add(fern(6));
![]() |
|
(Compiled with Asymptote version 1.87svn-r4652) |
//From documentation of Asymptote size(10cm); // Draw Sierpinski triangle with top vertex A, side s, and depth q. void Sierpinski(pair A, real s, int q, bool top=true, bool randcolor=false) { pair B=A-(1,sqrt(2))*s/2; pair C=B+s; if(top) draw(A--B--C--cycle); if (randcolor) { filldraw((A+B)/2--(B+C)/2--(A+C)/2--cycle, (.33*rand()/randMax*red+.33*rand()/randMax*green+.33*rand()/randMax*blue)); } else draw((A+B)/2--(B+C)/2--(A+C)/2--cycle); if(q > 0) { Sierpinski(A,s/2,q-1,false,randcolor); Sierpinski((A+B)/2,s/2,q-1,false,randcolor); Sierpinski((A+C)/2,s/2,q-1,false,randcolor); } } Sierpinski((0,1), 1, 5, randcolor=true);
![]() |
|
(Compiled with Asymptote version 1.84svn-r4619) |
import three; settings.render=0; // The available directions of steps triple[] dirs={X,-X,Y,-Y,Z,-Z}; dirs.cyclic=true; // Return the nodes of the path triple[] randWalk(real Srnd(), int n) { triple[] randPath; triple camera=1e10*currentprojection.camera; triple pos=O, tpos; int R; for (int i=0; i < n; ++i) { R=round(Srnd()); tpos=pos+dirs[R]; randPath.push(tpos); pos=tpos; } return randPath; } triple[] randWalk(int Srnd(), int n) { real R(){ return Srnd();} return randWalk(R,n); } void drawWalk(triple[] nodes, pen p=white) { triple camera=currentprojection.camera; if(currentprojection.infinity) camera *= max(abs(minbound(nodes)),abs(maxbound(nodes))); real[][] depth; for(int i=0; i < nodes.length-1; ++i) { real d=abs(camera-0.5*(nodes[i]+nodes[i+1])); depth.push(new real[] {d,i}); } depth=sort(depth); triple M=nodes[round(depth[0][1])]; triple m=nodes[round(depth[depth.length-1][1]+1)]; // Draw from farthest to nearest while(depth.length > 0) { real[] a=depth.pop(); int i=round(a[1]); draw(nodes[i]--nodes[i+1],abs(nodes[i]-m)/abs(M-m)*p); } } size(18cm); currentprojection=orthographic((1,1,1)); drawWalk(randWalk(rand,50000),cyan); shipout(bbox(3mm,Fill));
![]() |
|
(Compiled with Asymptote version 2.14svn-r5318) |
/* This code comes from The Official Asymptote Gallery */ pair crease(pair z1, pair z2, bool left) { pair dz = z2 - z1; if (left) return z1 + dz * (0.5, 0.5); else return z1 + dz * (0.5, -0.5); } pair[] fold(pair[] oldz) { int n = oldz.length; pair[] newz = new pair[2n-1]; for (int i = 0; i < n-1; ++i) { newz[2i] = oldz[i]; newz[2i+1] = crease(oldz[i], oldz[i+1], i%2==0); } newz[2(n-1)] = oldz[n-1]; return newz; } pair[] dragon(int n, pair[] base={}) { if (base.length == 0) if (n%2 == 0) base = new pair[] {(0,0), (1,1) }; else base = new pair[] {(0,0), (1,0) }; pair[] z = base; for (int i = 1; i < n; ++i) z = fold(z); return z; } void drawtris(pair[] z, pen p = currentpen) { int n = z.length; for (int i = 0; i < n-2; i+=2) fill(z[i]--z[i+1]--z[i+2]--cycle, p); } void drawtris(pair[] z, pen p1, pen p2) { int n = z.length; for (int i = 0; i < n-2; i+=2) fill(z[i]--z[i+1]--z[i+2]--cycle, 2i < n-1 ? p1 : p2); } size(500,0); int n = 10; drawtris(dragon(n, new pair[] {(0,0), (1,0)}), black); drawtris(dragon(n, new pair[] {(0,0), (0,-1)}), blue); drawtris(dragon(n, new pair[] {(0,0), (-1,0)}), red); drawtris(dragon(n, new pair[] {(0,0), (0,1)}), green);
![]() |
|
(Compiled with Asymptote version 2.14svn-r5318) |
/* This code comes from The Official Asymptote Gallery */ import graph; size(30,30,IgnoreAspect); real f(real t) {return t < 0 ? -1/t : -0.5/t;} picture logo(pair s=0, pen q) { picture pic; pen p=linewidth(3)+q; real a=-0.5; real b=1; real eps=0.1; draw(pic,shift((eps,-f(a)))*graph(f,a,-eps),p); real c=0.5*a; pair z=(0,f(c)-f(a)); draw(pic,z+c+eps--z,p); yaxis(pic,p); return shift(s)*pic; } add(logo(red));
![]() |
|
(Compiled with Asymptote version 2.14svn-r5318) |
/* This code comes from The Official Asymptote Gallery */ void testline(real y) { draw((0,y)--(100,y),currentpen+solid); draw((0,y-10)--(100,y-10),currentpen+dotted); draw((0,y-20)--(100,y-20),currentpen+dashed); draw((0,y-30)--(100,y-30),currentpen+longdashed); draw((0,y-40)--(100,y-40),currentpen+dashdotted); draw((0,y-50)--(100,y-50),currentpen+longdashdotted); draw((0,y-60)--(100,y-60),currentpen+Dotted); } currentpen=linewidth(0.5); testline(100);
![]() |
|
(Compiled with Asymptote version 2.14svn-r5318) |
/* This code comes from The Official Asymptote Gallery */ import graph; size(200,0); real f(real x) {return (x != 0) ? sin(1/x) : 0;} real T(real x) {return 2/(x*pi);} real a=-4/pi, b=4/pi; int n=150,m=5; xaxis("$x$",red); yaxis(red); draw(graph(f,a,-T(m),n)--graph(f,-m,-(m+n),n,T)--(0,f(0))--graph(f,m+n,m,n,T)-- graph(f,T(m),b,n)); label("$\sin\frac{1}{x}$",(b,f(b)),SW);