|
|
| Figure 0001: fig0050.asy |
import graph3; size(8cm,0); currentprojection=orthographic(1,1,1); bbox3 b=limits((-2,-2,0),(0,2,2)); xaxis("$x$", b, RightTicks()); yaxis("$y$", b, RightTicks()); zaxis("$z$", b, RightTicks());
|
|
| Figure 0002: fig0052.asy |
import graph3; size(8cm,0); currentprojection=orthographic(1,1,1); bbox3 b=limits((-2,-2,0), (0,2,2)); aspect(b,1,1,1); xaxis("$x$", b, RightTicks()); yaxis("$y$", b, RightTicks()); zaxis("$z$", b, RightTicks());
|
|
| Figure 0003: fig0055.asy |
import graph3; size(8cm,0); currentprojection=orthographic(1,1,1); defaultpen(overwrite(SuppressQuiet)); bbox3 b=limits((-2,-2,0),(0,2,2)); aspect(b,1,1,1); yaxis("$y$", b, RightTicks(rotate(Y)*Label)); xaxis("$x$", b, RightTicks(rotate(X)*Label)); zaxis("$z$", b, RightTicks, p=red, arrow=Arrow);
|
|
| Figure 0004: fig0060.asy |
import graph3; size(6cm,0); currentprojection=orthographic(1,1,1); bbox3 b=limits((-2,-2,0),(0,2,2)); aspect(b,1,1,1); xaxis("$x$",b,RightTicks()); yaxis("$y$",b.X(),b.XY(),LeftTicks()); zaxis("$z$",b,RightTicks());
|
|
| Figure 0005: fig0070.asy |
import graph3; usepackage("icomma"); size(8cm,0); currentprojection=orthographic(1.5,1,1); bbox3 b=limits((-2,-1,-.5), (0,1,1.5)); xaxis(rotate(X)*"$x$", b, RightTicks(rotate(X)*Label)); xaxis(b.Y(), b.XY(), LeftTicks(Label("%"))); yaxis(b, RightTicks(Label("%"),Step=.5,step=.25)); yaxis(rotate(Y)*"$y$", b.X(), b.XY(), LeftTicks(Step=.5,step=.25)); zaxis("$z$", b.Y(), b.YZ(), LeftTicks(), dir=b.Y()); draw((-1,0,-0.5),linewidth(1mm));
|
|
| Figure 0006: fig0080.asy |
import graph3; size(8cm,0); currentprojection=orthographic(.5,1,.5); defaultpen(overwrite(SuppressQuiet)); bbox3 b=limits((-2,-2,0),(0,2,2)); aspect(b,1,1,1); // yaxis("$y$", b, RightTicks(rotate(Y)*Label)); // xaxis("$x$", b, RightTicks(rotate(X)*Label)); // zaxis("$z$", b, RightTicks, p=red, arrow=Arrow); // xlimits(b, -2, 0); // ylimits(b, -2, 2); // zlimits(b, -2, 2); // Ticksize=20; xaxis( "$x$", b, RightTicks(Step=1, step=.5,Size=arclength(b.min--b.Y()))); yaxis( "$y$", all=true, b, RightTicks(pTick=.8red, ptick=lightgrey)); zaxis("$z$",all=true, b, RightTicks, p=red, arrow=Arrow);
|
|
| Figure 0007: fig2000.asy |
// From the documentation of Asymptote. import graph3; import contour; texpreamble("\usepackage{icomma}"); size(12cm,0); real sinc(pair z) { real r=2pi*abs(z); return r != 0 ? sin(r)/r : 1; } bbox3 b=limits((-2,-2,-0.2),(2,2,1.2)); currentprojection=orthographic(1,-2,1); currentlight=(-1,-2,1); aspect(b,1,1,1); xaxis(rotate(X)*"$x$",b,RightTicks(rotate(X)*Label)); yaxis(rotate(Y)*"$y$",b.X(),b.XY(),LeftTicks(rotate(Y)*Label)); zaxis("$z$",b,RightTicks()); layer(); draw(lift(sinc,contour(sinc,(-2,-2),(2,2),new real[] {0}))); add(surface(sinc,nsub=1,xypart(b.O()),xypart(b.XY()),50,lightgray+opacity(0.5)));
|
|
| Figure 0008: fig3000.asy |
size(12cm,0,false); import graph3; import contour; texpreamble("\usepackage{icomma}"); real f(pair z) { return z.x*z.y*exp(-z.x); } bbox3 b=limits((0,0,0),(5,10,4.5)); currentprojection=orthographic(-2.5,-5,1); currentlight=(1,-1,2); aspect(b,1,1,1); xaxis(rotate(X)*Label("$x$",align=project(-b.Y())),b,Ticks(), dir=-b.Y()); yaxis(Label("$y$",align=project(-b.X())),b,Ticks(Step=2), dir=-b.X()); zaxis(Label("$z=xye^{-x}$",align=2E,relative(1.1)),b.Y(),b.YZ(),LeftTicks()); layer(); pen p=rgb(0.2,0.5,0.7); add(surface(f,(0,0),(5,10),100,100,meshpen=nullpen)); layer(); add(surface(f,5,(0,0),(5,10),20,20,nullpen,meshpen=p)); real[] datumz={.5,1,1.5,2,2.5,3,3.5}; pen[] p=sequence(new pen(int i) { return datumz[i]/3.5*red; },7); Label [] L=sequence(new Label(int i) { return scale(0.75)*Label(format("$z=%g$",datumz[i]),align=E,BeginPoint); },7); Label [] legend=sequence(new Label(int i) { return format("$z=%g$",datumz[i]); },7); draw(L,lift(f,contour(f,(0,0),(5,10),datumz)),p,legend); attach(legend(),project((4,6,2)),2E,UnFill);
|
|
| Figure 0009: fig3050.asy |
// From documentation of Asymptote import graph; import palette; import contour; texpreamble("\usepackage{icomma}"); size(10cm,10cm,IgnoreAspect); pair a=(0,0); pair b=(5,10); real fz(pair z) { return z.x*z.y*exp(-z.x); } real f(real x, real y) {return fz((x,y));} int N=200; int Divs=10; int divs=2; defaultpen(1bp); pen Tickpen=black; pen tickpen=gray+0.5*linewidth(currentpen); pen[] Palette=BWRainbow(); scale(false); bounds range=image(f,Automatic,a,b,N,Palette); xaxis("$x$",BottomTop,LeftTicks(pTick=grey, ptick=lightgrey, extend=true),Above); yaxis("$y$",LeftRight,RightTicks(pTick=grey, ptick=lightgrey, extend=true),Above); // Major contours real[] Cvals; Cvals=sequence(11)/10 * (range.max-range.min) + range.min; draw(contour(f,a,b,Cvals,N,operator ..),Tickpen); // Minor contours real[] cvals; real[] sumarr=sequence(1,divs-1)/divs * (range.max-range.min)/Divs; for (int ival=0; ival < Cvals.length-1; ++ival) cvals.append(Cvals[ival]+sumarr); draw(contour(f,a,b,cvals,N,operator ..),tickpen); palette("$f(x,y)=xye^{-x}$",range,point(NW)+(0,1),point(NE)+(0,0.25),Top,Palette, PaletteTicks(N=Divs,n=divs,Tickpen,tickpen));
|
|
| Figure 0010: fig4000.asy |
/*From TeXgraph exemples*/ import graph3; size(10cm,0); currentprojection=orthographic(2,-2,2.5); real f(pair z) { real u=z.x, v=z.y; return (u/2+v)/(2+cos(u/2)*sin(v)); } int n=30; for (int i=0; i < n; ++i) { bool level(pair z) { real c=f(z); return c > interp(0.0,17.3,i/n) && c <= interp(0.0,17.3,(i+1)/n); } add(surface(f,O,(14,14),200,level,interp(yellow,red,i/(n-1)))); } shipout(bbox(3mm,Fill(black)));
|
|
| Figure 0011: fig5000.asy |
import math; import graph3; size(10cm); picture surface(triple[][] f, bool[][] cond={}, bool outward=false, pen surfacepen[][]={{lightgray}}, pen meshpen=nullpen, light light=currentlight, projection P=currentprojection) { picture pic; surfacepen.cyclic(true); if(!rectangular(f)) abort("matrix is not rectangular"); // Draw a mesh in the absence of lighting (override with meshpen=invisible). if(light.source == O && meshpen == nullpen) meshpen=currentpen; int nx=f.length-1; int ny=nx > 0 ? f[0].length-1 : 0; // calculate colors at each point pen color(int i, int j) { triple dfx,dfy; if(i == 0) dfx=f[1][j]-f[0][j]; else if(i == nx) dfx=f[nx][j]-f[nx-1][j]; else dfx=0.5(f[i+1][j]-f[i-1][j]); if(j == 0) dfy=f[i][1]-f[i][0]; else if(j == ny) dfy=f[i][ny]-f[i][ny-1]; else dfy=0.5(f[i][j+1]-f[i][j-1]); triple v=cross(dfx,dfy); if(!outward) v *= sgn(dot(v,P.camera-P.target)); return light.intensity(v)*surfacepen[i][j]; } int[] edges={0,0,0,2}; void drawcell(int i, int j) { path g=project(f[i][j],P)--project(f[i][j+1],P)--project(f[i+1][j+1],P)-- project(f[i+1][j],P)--cycle; if(surfacepen[i][j] != nullpen) { if(light.source == O) fill(pic,g,surfacepen[i][j]); else { pen[] pcell={color(i,j),color(i,j+1),color(i+1,j+1),color(i+1,j)}; gouraudshade(pic,g,pcell,edges); } } if(meshpen != nullpen) draw(pic,g,meshpen); } bool all=cond.length == 0; if(surfacepen.length == 0) { for(int i=0; i < nx; ++i) for(int j=0; j < ny; ++j) if(all || cond[i][j]) drawcell(i,j); } else { // Sort cells by distance from camera triple camera=P.camera; if(P.infinity) camera *= max(abs(minbound(f)),abs(maxbound(f))); real[][] depth; for(int i=0; i < nx; ++i) { for(int j=0; j < ny; ++j) { if(all || cond[i][j]) { real d=abs(camera-0.25(f[i][j]+f[i][j+1]+f[i+1][j]+f[i+1][j+1])); depth.push(new real[] {d,i,j}); } } } depth=sort(depth); // Draw from farthest to nearest while(depth.length > 0) { real[] a=depth.pop(); drawcell(round(a[1]),round(a[2])); } } return pic; } picture sphericalsurface(real r(real theta, real phi), pair a, pair b, int nu=nmesh, int nv=nu, bool cond(real theta, real phi)=null, bool outward=false, pen surfacepen(real theta, real phi)=null, pen meshpen=nullpen, light light=currentlight, projection P=currentprojection) { if(surfacepen == null) surfacepen=new pen(real t, real p){return lightgray;}; if(nu <= 0 || nv <= 0) return new picture; triple[][] v=new triple[nu+1][nv+1]; bool[][] active; pen [][] surfacepens=new pen[nu+1][nv+1]; bool all=cond == null; if(!all) active=new bool[nu+1][nv+1]; triple P(pair z) { real rt=r(z.x,z.y); return (rt*cos(z.x)*sin(z.y),rt*sin(z.x)*sin(z.y),rt*cos(z.y)); } real du=1/nu; real dv=1/nv; pair Idv=(0,dv); pair dz=(du,dv); for(int i=0; i <= nu; ++i) { real x=interp(a.x,b.x,i*du); for(int j=0; j <= nv; ++j) { pair z=(x,interp(a.y,b.y,j*dv)); v[i][j]=P(z); surfacepens[i][j]=surfacepen(z.x,z.y); if(!all) active[i][j]=cond(z.x,z.y) || cond(z.x+du,z.y) || cond(z.x,z.y+Idv.y) || cond(z.x+dz.x,z.y+dz.y); } } return surface(v,active,outward,surfacepens,meshpen,light,P); } currentprojection=orthographic(4,2,4); real r(real Theta, real Phi){return 1+0.5*(sin(2*Theta)*sin(2*Phi))^2;} pen pens(real t, real p) { // * 1 // return r(t,p) > 1+1e-3 ? lightgrey : nullpen; // 1 * // * 2 // return abs(sin(5*t)) > 0.1 ? lightgrey : red; // 2 * // * 3 return r(t,p) < 1+1e-3 ? black : interp(yellow, red, 2*(r(t,p)-1)); // 3 * } add(sphericalsurface(r,(0,0),(2pi,2pi), 180, pens)); shipout(bbox(3mm,Fill(black)));
|
|
| Figure 0012: fig5500.asy |
import graph3; import geometry_dev; picture surface(path g, real f(real z), pair a, pair b, int nu=nmesh, int nv=nu, bool cond(pair z)=null, bool outward=false, pen surfacepen=lightgray, pen meshpen=nullpen, light light=currentlight, projection P=currentprojection) { if(nu <= 0 || nv <= 0) return new picture; triple f(pair z, real h(real z), path g) { if(inside(g,z)) return (z.x,z.y,h(abs(z-attract(z,g,0.1)))); return (z.x,z.y,0); } triple[][] v=new triple[2*(nu+1)][nv+1]; bool[][] active; bool all=cond == null; if(!all) active=new bool[2*(nu+1)][nv+1]; real du=1/nu; real dv=1/nv; pair Idv=(0,dv); pair dz=(du,dv); for(int i=0; i <= nu; ++i) { real x=interp(a.x,b.x,i*du); for(int j=0; j <= nv; ++j) { pair z=(x,interp(a.y,b.y,j*dv)); v[i][j]=f(z,f,g); v[2*nu-i+1][j]=(v[i][j].x,v[i][j].y,-v[i][j].z); if(!all) { active[i][j]=cond(z) || cond(z+du) || cond(z+Idv) || cond(z+dz); active[2*nu-i+1][j]=active[i][j]; } } } return surface(v,active,outward,surfacepen,meshpen,light,P); } size(12cm); currentprojection=orthographic(-0.25,-1,0.65); currentlight=(-1000,-1000,1000); path g=(30,348)--(10,348)..controls (27,408) and (43,437)..(71,465) ..controls (100,493) and (119,500)..(173,500) --(523,500)--(523,411)--(397,411) ..controls (390,356) and (385,263)..(385,187) ..controls (385,154) and (388,138)..(397,120) ..controls (408,99) and (429,85)..(449,85) ..controls (482,85) and (501,110)..(506,158) --(530,158)..controls (527,108) and (523,89)..(509,61) ..controls (485,14) and (450,-13)..(411,-13) ..controls (350,-13) and (312,55)..(312,167) ..controls (312,224) and (321,332)..(333,411) --(224,411)--(212,282)..controls (203,181) and (189,79)..(180,53) ..controls (167,10) and (143,-13)..(112,-13) ..controls (81,-13) and (57,12)..(57,42) ..controls (57,64) and (66,80)..(97,108) ..controls (131,139) and (144,161)..(148,189) --(174,411)--(128,411)..controls (80,411) and (63,400)..(30,348) --cycle; pair a=min(g)-(50,50), b=max(g)+(10,10); bool cond(pair z){return inside(g,z);} real h(real z) { static real sq10=sqrt(10); return z < 10 ? sq10*sqrt(z) : z; } add(surface(g, h, a, b, 200, cond)); shipout(bbox(2mm,Fill(0.5*blue)));
Dernière modification/Last modified: Sun Jun 15 10:37:06 CEST 2008
Philippe Ivaldi