|
|
| (Compiled with Asymptote version 2.14svn-r5318) |
pen[][] p={{rgb(black)},
{rgb(.8red)}};
latticeshade((0,0)--(0,2cm)--(2cm,0)--cycle,p);
|
|
| (Compiled with Asymptote version 2.14svn-r5318) |
pen[][] p={{rgb(black)},
{rgb(.8red)}};
latticeshade((0,0)--(0,2cm)--(2cm,0)--cycle,p);
|
|
| (Compiled with Asymptote version 2.14svn-r5318) |
pen[][] p={{rgb(black),rgb(black)},
{rgb(red),rgb(green)}};
latticeshade((0,0)--(0,2cm)--(2cm,0)--cycle,p);
|
|
| (Compiled with Asymptote version 2.14svn-r5318) |
size(3cm,0);
pen[][] p={{rgb(white),rgb(grey),rgb(black)},
{red,green,blue},
{cyan,magenta,yellow}};
latticeshade(unitsquare,p);
|
|
| (Compiled with Asymptote version 2.14svn-r5318) |
size(3cm,0);
import palette;
real[][] v={{1,2},{3,4}};
pen[] Palette=Rainbow();
latticeshade(box((0,0),(1,1)),palette(v,Palette));
|
|
| (Compiled with Asymptote version 2.14svn-r5318) |
size(3cm,0);
pair A=(0.35,0.35), B=(0.6,0.6);
radialshade(unitsquare,black,A,0.15,lightgrey,B,.6);
dot(A,.8red);
dot(B,blue+grey);
draw(shift(A)*scale(.15)*unitcircle,dashed+.8red);
draw(shift(B)*scale(.6)*unitcircle,dashed+blue+grey);
clip(unitsquare);
|
|
| (Compiled with Asymptote version 2.14svn-r5318) |
size(3cm,0);
transform t=xscale(1.25);
pen p1=red, p2=yellow;
pair pa=t*dir(135), pb=t*dir(-45);
axialshade(t*unitcircle,p1,pa,p2,pb);
draw(pa--pb, dashed);
|
|
| (Compiled with Asymptote version 2.14svn-r5318) |
// Author: John Bowman
size(10cm,0);
real r=1;
real R=3.8;
int step=30;
path p=arc(0,r,0,step);
path P=arc(0,R,step,0);
for(int h=0; h < 360; h += step) {
transform t=rotate(90-h);
tensorshade(t*p--t*P--cycle,
new pen[] {white,white,hsv(h-step,1,1),hsv(h,1,1)});
}
for(int h=0; h < 360; h += 30) {
pair v=R*dir(90-h);
draw(Label(string(h)+"$^\circ$",EndPoint),(v--1.05v));
}
draw(circle(0,r));
draw(circle(0,R));
|
|
| (Compiled with Asymptote version 2.14svn-r5318) |
size(6cm,0);
path cle=scale(2)*unitcircle;
radialshade(scale(2)*cle,white+.1yellow,(0,0),2,yellow,(0,0),4);
radialshade(cle,white,(1,.5),0,.95yellow,(0,0),2);
for(real i=0; i<=length(cle); i+=.2)
draw(point(cle,i)--(-2*I*dir(cle,i)+point(cle,i)),p=2mm+yellow+linecap(0));
|
|
| (Compiled with Asymptote version 2.14svn-r5318) |
size(0,0);
pair [] P, Q, R, S;
real u=1cm;
for (int i=0; i<=4; ++i)
P[i] = rotate(i*360/5)*(0,-u);
P[5] = P[0];
for (int i=0; i<=4; ++i)
Q[i] = 3*midpoint(P[i]--P[i+1]);
Q[5] = Q[0];
for (int i=0; i<=4; ++i)
R[i] = 1/3*( Q[i] + Q[i+1] + P[i+1] );
R[5] = R[0];
for (int i=0; i<=5; ++i)
S[i] = 1.5*Q[i];
fill(shift(-abs(S[0]),-abs(S[0]))*scale(2*abs(S[0]))*unitsquare,.2grey);
radialshade(scale(abs(S[0]))*unitcircle,lightgrey,(0,0),abs(S[0]),
black,(0,0),abs(.85*midpoint(S[0]--S[1])));
P[6]=P[1];
for (int i=0; i<=4; ++i)
{
radialshade(S[i]--Q[i]--R[i]--Q[i+1]--S[i+1]--cycle,
lightgrey,(0,0),abs(R[i]),
black,(0,0),abs(S[i]));
radialshade(R[i]--Q[i+1]--R[i+1]--P[i+2]--P[i+1]--cycle,
.8red,(0,0),sqrt(1-(2-2cos(pi/5))/4)*u,
black,(0,0),abs(Q[i+1]));
}
for (real i=1; i>0; i-=.05)
fill(rotate(90*(1-i))*scale(i)*(P[0]--P[1]--P[2]--P[3]--P[4]--cycle),
(1-i)*red);
pen p=linewidth(1pt);
for (int i=0; i<=4; ++i)
{
draw(P[i] -- P[i+1],p);
draw(P[i+1] -- R[i],p);
draw(Q[i] -- R[i],p);
draw(R[i] -- Q[i+1],p);
draw(Q[i] -- S[i],p);
draw(S[i] -- S[i+1],p);
}
shipout(bbox(0,black+4mm));
|
|
| (Compiled with Asymptote version 2.14svn-r5318) |
import graph3;
import palette;
import contour;
size(14cm,0);
currentprojection=orthographic(-1,-1.5,0.75);
currentlight=(-1,0,5);
real a=1, b=1;
real f(pair z) { return a*(6+sin(z.x/b)+sin(z.y/b));}
real g(pair z){return f(z)-6a;}
// The axes
limits((0,0,4a),(14,14,8a));
xaxis3(Label("$x$",MidPoint),OutTicks());
yaxis3(Label("$y$",MidPoint),OutTicks(Step=2));
ticklabel relativelabel()
{
return new string(real x) {return (string)(x-6a);};
}
zaxis3(Label("$z$",Relative(1),align=2E),Bounds(Min,Max),OutTicks(relativelabel()));
// The surface
surface s=surface(f,(0,0),(14,14),100,Spline);
pen[] pens=mean(palette(s.map(zpart),Gradient(yellow,red)));
// Draw the surface
draw(s,pens);
// Project the surface onto the XY plane.
draw(planeproject(unitsquare3)*s,pens,nolight);
// Draw contour for "datumz"
real[] datumz={-1.5, -1, 0, 1, 1.5};
guide[][] pl=contour(g,(0,0),(14,14),datumz);
for (int i=0; i < pl.length; ++i)
for (int j=0; j < pl[i].length; ++j)
draw(path3(pl[i][j]));
// Draw the contours on the surface
draw(lift(f,pl));
if(!is3D())
shipout(bbox(3mm,Fill(black)));
|
|
| (Compiled with Asymptote version 1.87svn-r4652) |
size(4cm,0);
dotfactor*=5;
dot(scale(2)*"A",(0.5,1),5N);
layer();
dot(scale(2)*"B",(1.5,1),5N);
filldraw(scale(2)*unitsquare, lightgray+opacity(.5));
shipout(bbox(5mm,black,RadialShade(lightblue,darkblue)), "pdf");
|
|
| (Compiled with Asymptote version 1.87svn-r4652) |
size(10cm,0);
transform T=rotate(10)*xscale(1.1);
path c1=T*unitcircle, c2=T*scale(5)*unitcircle;
real l1=length(c1), l2=length(c2);
fill(scale(8)*shift(-0.5,-0.5)*unitsquare,blue);
int n=500;
real step=1/n;
for (int i=0; i < n; ++i) {
real t=i*step;
path g1=subpath(c1,t*l1,(t+step)*l1);
path g2=subpath(c2,t*l2,(t+step)*l2);
pair A=(relpoint(c1,t)+relpoint(c2,t))/2;
pair B=(relpoint(c1,t+step)+relpoint(c2,t+step))/2;
path sector=g1--reverse(g2)--cycle;
pen trans=opacity(((2-(2*i/n)^1.5))/2);
axialshade(sector,trans+i/n*white,A,trans+(i+1)/n*white,B);
}
shipout(bbox(lightblue+white,Fill),format="pdf");
|
|
| (Compiled with Asymptote version 2.14svn-r5318) |
/* This code comes from The Official Asymptote Gallery */ size(200); pen[] p={red,green,blue,magenta}; path g=(0,0){dir(45)}..(1,0)..(1,1)..(0,1)..cycle; tensorshade(g,p); dot(g);
|
|
| (Compiled with Asymptote version 2.14svn-r5318) |
/* This code comes from The Official Asymptote Gallery */ size(200); pen[] p={red,green,blue,magenta}; pair[] z={(-1,0),(0,0),(0,1),(1,0)}; int[] edges={0,0,0,1}; gouraudshade(z[0]--z[2]--z[3]--cycle,p,z,edges); draw(z[0]--z[1]--z[2]--cycle); draw(z[1]--z[3]--z[2],dashed); dot(Label,z[0],W); dot(Label,z[1],S); dot(Label,z[2],N); dot(Label,z[3],E); label("0",z[0]--z[1],S,red); label("1",z[1]--z[2],E,red); label("2",z[2]--z[0],NW,red);
|
|
| (Compiled with Asymptote version 2.14svn-r5318) |
/* This code comes from The Official Asymptote Gallery */ import graph; import palette; import contour; size(200); int n=100; real[] x=new real[n]; real[] y=new real[n]; real[] f=new real[n]; real F(real a, real b) {return a^2+b^2;} real r() {return 1.1*(rand()/randMax*2-1);} for(int i=0; i < n; ++i) { x[i]=r(); y[i]=r(); f[i]=F(x[i],y[i]); } pen Tickpen=black; pen tickpen=gray+0.5*linewidth(currentpen); pen[] Palette=BWRainbow(); bounds range=image(x,y,f,Range(0,2),Palette); draw(contour(pairs(x,y),f,new real[]{0.25,0.5,1},operator ..)); palette("$f(x,y)$",range,point(NW)+(0,0.5),point(NE)+(0,0.8),Top,Palette, PaletteTicks(Tickpen,tickpen));
|
|
| (Compiled with Asymptote version 2.14svn-r5318) |
/* This code comes from The Official Asymptote Gallery */ size(6cm,0); import bsp; real u=2.5; real v=1; currentprojection=oblique; path3 y=plane((2u,0,0),(0,2v,0),(-u,-v,0)); path3 l=rotate(90,Z)*rotate(90,Y)*y; path3 g=rotate(90,X)*rotate(90,Y)*y; face[] faces; pen[] p={red,green,blue,black}; int[] edges={0,0,0,2}; gouraudshade(faces.push(y),project(y),p,edges); gouraudshade(faces.push(l),project(l),p,edges); gouraudshade(faces.push(g),project(g),new pen[]{cyan,magenta,yellow,black}, edges); add(faces);
|
|
| (Compiled with Asymptote version 2.14svn-r5318) |
/* This code comes from The Official Asymptote Gallery */ size(200); settings.tex="pdflatex"; // PostScript Calculator routine to convert from [0,1]x[0,1] to RG: string redgreen="0"; // PostScript Calculator routine to convert from [0,1]x[0,1] to HS to RGB: // (http://www.texample.net/tikz/examples/hsv-shading): string hsv="0.5 sub exch 0.5 sub exch 2 copy 2 copy 0 eq exch 0 eq and { pop pop 0.0 } {atan 360.0 div} ifelse dup 360 eq { pop 0.0 }{} ifelse 3 1 roll dup mul exch dup mul add sqrt 2.5 mul 0.25 sub 1 1 index 1.0 eq { 3 1 roll pop pop dup dup } { 3 -1 roll 6.0 mul dup 4 1 roll floor dup 5 1 roll 3 index sub neg 1.0 3 index sub 2 index mul 6 1 roll dup 3 index mul neg 1.0 add 2 index mul 7 1 roll neg 1.0 add 2 index mul neg 1.0 add 1 index mul 7 2 roll pop pop dup 0 eq { pop exch pop } { dup 1 eq { pop exch 4 1 roll exch pop } { dup 2 eq { pop 4 1 roll pop } { dup 3 eq { pop exch 4 2 roll pop } { dup 4 eq { pop exch pop 3 -1 roll } { pop 3 1 roll exch pop } ifelse } ifelse } ifelse } ifelse } ifelse } ifelse cvr 3 1 roll cvr 3 1 roll cvr 3 1 roll"; path p=unitcircle; functionshade(p,rgb(zerowinding),redgreen); layer(); draw(p); path g=shift(2*dir(-45))*p; functionshade(g,rgb(zerowinding),hsv); layer(); draw(g);
|
|
| (Compiled with Asymptote version 2.14svn-r5318) |
/* This code comes from The Official Asymptote Gallery */ size(12cm,12cm); import graph; import palette; int n=256; real ninv=2pi/n; real[][] v=new real[n][n]; for(int i=0; i < n; ++i) for(int j=0; j < n; ++j) v[i][j]=sin(i*ninv)*cos(j*ninv); pen[] Palette=BWRainbow(); picture bar; bounds range=image(v,(0,0),(1,1),Palette); palette(bar,"$A$",range,(0,0),(0.5cm,8cm),Right,Palette, PaletteTicks("$%+#.1f$")); add(bar.fit(),point(E),30E);
|
|
| (Compiled with Asymptote version 2.14svn-r5318) |
/* This code comes from The Official Asymptote Gallery */ import graph; import palette; import contour; size(10cm,10cm,IgnoreAspect); pair a=(0,0); pair b=(2pi,2pi); real f(real x, real y) {return cos(x)*sin(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(); bounds range=image(f,Automatic,a,b,N,Palette); // Major contours real[] Cvals=uniform(range.min,range.max,Divs); draw(contour(f,a,b,Cvals,N,operator --),Tickpen); // Minor contours real[] cvals; for(int i=0; i < Cvals.length-1; ++i) cvals.append(uniform(Cvals[i],Cvals[i+1],divs)[1:divs]); draw(contour(f,a,b,cvals,N,operator --),tickpen); xaxis("$x$",BottomTop,LeftTicks,above=true); yaxis("$y$",LeftRight,RightTicks,above=true); palette("$f(x,y)$",range,point(NW)+(0,0.5),point(NE)+(0,1),Top,Palette, PaletteTicks(N=Divs,n=divs,Tickpen,tickpen));
|
|
| (Compiled with Asymptote version 2.14svn-r5318) |
/* This code comes from The Official Asymptote Gallery */ import graph; import palette; int n=256; pen[] Palette=BWRainbow(); real w(real w0, real z0, real z) {return w0*sqrt(1+(z/z0)^2);} real pot(real lambda, real w0, real r, real z) { real z0=pi*w0^2/lambda, kappa=2pi/lambda; return exp(-2*(r/w(w0,z0,z))^2)*cos(kappa*z)^2; } picture make_field(real lambda, real w0) { real[][] v=new real[n][n]; for(int i=0; i < n; ++i) for(int j=0; j < n; ++j) v[i][j]=pot(lambda,w0,i-n/2,abs(j-n/2)); picture p=new picture; size(p,250,250,IgnoreAspect); real xm=-n/lambda, ym=-n/(2*w0), xx=n/lambda, yx=n/(2*w0); image(p,v,(xm,ym),(xx,yx),Palette); xlimits(p,xm,xx); ylimits(p,ym,yx); xaxis(p,"{\Large $z/\frac{\lambda}{2}$}",BottomTop,LeftTicks); yaxis(p,"{\Large $r/w_0$}",LeftRight,RightTicks); label(p,format("{\LARGE $w_0/\lambda=%.2f$}",w0/lambda),point(p,NW),5N); return p; } picture p=make_field(160,80); picture q=make_field(80,80); picture r=make_field(16,80); picture s=make_field(2,80); real margin=1cm; add(p.fit(),(0,0),margin*NW); add(q.fit(),(0,0),margin*NE); add(r.fit(),(0,0),margin*SW); add(s.fit(),(0,0),margin*SE);
|
|
| (Compiled with Asymptote version 2.14svn-r5318) |
/* This code comes from The Official Asymptote Gallery */ size(200); pen[][] p={{white,grey,black}, {red,green,blue}, {cyan,magenta,yellow}}; latticeshade(unitsquare,p);
|
|
| (Compiled with Asymptote version 2.14svn-r5318) |
/* This code comes from The Official Asymptote Gallery */ import graph; import palette; size(10cm,10cm,IgnoreAspect); real f(real x, real y) { return 0.9*pow10(2*sin(x/5+2*y^0.25)) + 0.1*(1+cos(10*log(y))); } scale(Linear,Log,Log); pen[] Palette=BWRainbow(); bounds range=image(f,Automatic,(0,1),(100,100),nx=200,Palette); xaxis("$x$",BottomTop,LeftTicks,above=true); yaxis("$y$",LeftRight,RightTicks,above=true); palette("$f(x,y)$",range,(0,200),(100,250),Top,Palette, PaletteTicks(ptick=linewidth(0.5*linewidth())));
|
|
| (Compiled with Asymptote version 2.14svn-r5318) |
/* This code comes from The Official Asymptote Gallery */ size(200); import palette; int n=256; real ninv=2pi/n; pen[][] v=new pen[n][n]; for(int i=0; i < n; ++i) for(int j=0; j < n; ++j) v[i][j]=rgb(0.5*(1+sin(i*ninv)),0.5*(1+cos(j*ninv)),0); image(v,(0,0),(1,1));
|
|
| (Compiled with Asymptote version 2.14svn-r5318) |
/* This code comes from The Official Asymptote Gallery */ size(200); pen indigo=rgb(102/255,0,238/255); void rainbow(path g) { draw(new path[] {scale(1.3)*g,scale(1.2)*g,scale(1.1)*g,g, scale(0.9)*g,scale(0.8)*g,scale(0.7)*g}, new pen[] {red,orange,yellow,green,blue,indigo,purple}); } rainbow((1,0){N}..(0,1){W}..{S}(-1,0)); rainbow(scale(4)*shift(-0.5,-0.5)*unitsquare);
|
|
| (Compiled with Asymptote version 2.14svn-r5318) |
/* This code comes from The Official Asymptote Gallery */ size(0,100); path unitcircle=E..N..W..S..cycle; path g=scale(2)*unitcircle; label("$a \le r \le b$"); radialshade(unitcircle^^g,yellow+evenodd,(0,0),1.0,yellow+brown,(0,0),2);
|
|
| (Compiled with Asymptote version 2.14svn-r5318) |
/* This code comes from The Official Asymptote Gallery */ size(100,0); radialshade(unitsquare,yellow,(0,0),0,red,(0,0),1);
|
|
| (Compiled with Asymptote version 2.14svn-r5318) |
/* This code comes from The Official Asymptote Gallery */ size(0,100); import patterns; real d=4mm; picture tiling; path square=scale(d)*unitsquare; axialshade(tiling,square,white,(0,0),black,(d,d)); fill(tiling,shift(d,d)*square,blue); add("shadedtiling",tiling); filldraw(unitcircle,pattern("shadedtiling"));
|
|
| (Compiled with Asymptote version 2.14svn-r5318) |
/* This code comes from The Official Asymptote Gallery */ size(100); radialshade(W..N..E--(0,0),stroke=true, red+linewidth(30),(0,0),0.25,yellow,(0,0),1);
|
|
| (Compiled with Asymptote version 2.14svn-r5318) |
/* This code comes from The Official Asymptote Gallery */ import graph; usepackage("ocg"); settings.tex="pdflatex"; // Dan Bruton algorithm pen nm2rgb(real wl, real gamma=0.8, bool intensity=true) { triple rgb; if(wl >= 380 && wl <= 440) {rgb=((440-wl)/60,0,1);} if(wl > 440 && wl <= 490) {rgb=(0,(wl-440)/50,1);} if(wl > 490 && wl <= 510) {rgb=(0,1,(510-wl)/20);} if(wl > 510 && wl <= 580) {rgb=((wl-510)/70,1,0);} if(wl > 580 && wl <= 645) {rgb=(1,(645-wl)/65,0);} if(wl > 645 && wl <= 780) {rgb=(1,0,0);} real Intensity=1; if(intensity) { if(wl >= 700) {Intensity=0.3+0.7*(780-wl)/80;} else if(wl <= 420) {Intensity=0.3+0.7*(wl-380)/40;} } return rgb((Intensity*rgb.x)**gamma,(Intensity*rgb.y)**gamma, (Intensity*rgb.z)**gamma); } real width=1; real height=50; begin("spectrum"); for(real i=380 ; i <= 780 ; i += width) { draw((i,0)--(i,height),width+nm2rgb(wl=i,false)+squarecap); } begin("Extinction",false); // nested for(real i=380 ; i <= 780 ; i += width) { draw((i,0)--(i,height),width+nm2rgb(wl=i,true)+squarecap); } end(); end(); begin("Wavelength"); xaxis(scale(0.5)*"$\lambda$(nm)",BottomTop,380,780, RightTicks(scale(0.5)*rotate(90)*Label(),step=2,Step=10),above=true); end(); // From Astronomical Data Center(NASA) // Neutral only real[] Na={423.899, 424.208, 427.364, 427.679, 428.784, 429.101, 432.14, 432.462, 434.149, 434.474, 439.003, 439.334, 441.989, 442.325, 449.418, 449.766, 454.163, 454.519, 568.2633, 568.8204, 588.995, 589.5924}; begin("Na absorption"); for(int i=0; i < Na.length; ++i) { draw((Na[i],0)--(Na[i],height),0.1*width+squarecap); } end(); begin("Na emission"); for(int i=0; i < Na.length; ++i) { draw((Na[i],0)--(Na[i],-height),0.1*width+nm2rgb(Na[i],false)+squarecap); } end(); // Neutral only real[] Zn={388.334, 396.543, 411.321, 429.288, 429.833, 462.981, 468.014, 472.215, 481.053 , 506.866, 506.958, 518.198, 530.865, 531.024, 531.102, 577.21, 577.55, 577.711, 623.79, 623.917, 636.234, 647.918, 692.832, 693.847, 694.32, 779.936}; begin("Zn absorption",false); for(int i=0; i < Zn.length; ++i) { draw((Zn[i],0)--(Zn[i],height),width+squarecap); } end(); begin("Zn emission",false); for(int i=0; i < Zn.length; ++i) { draw((Zn[i],0)--(Zn[i],-height),width+nm2rgb(Zn[i],false)+squarecap); } end(); shipout(bbox(2mm,Fill(white)));
|
|
| (Compiled with Asymptote version 2.14svn-r5318) |
/* This code comes from The Official Asymptote Gallery */ size(100); guide g=(0,0)..controls(70,30) and (-40,30)..(30,0); latticeshade(g,stroke=true,linewidth(10), new pen[][] {{red,orange,yellow},{green,blue,purple}});
|
|
| (Compiled with Asymptote version 2.14svn-r5318) |
/* This code comes from The Official Asymptote Gallery */ size(200); pen[][] p={{red,green,blue,cyan},{blue,green,magenta,rgb(black)}}; path G=(0,0){dir(-120)}..(1,0)..(1,1)..(0,1)..cycle; path[] g={G,subpath(G,2,1)..(2,0)..(2,1)..cycle}; pair[][] z={{(0.5,0.5),(0.5,0.5),(0.5,0.5),(0.5,0.5)},{(2,0.5),(2,0.5),(1.5,0.5),(2,0.5)}}; tensorshade(g,p,z); dot(g);
|
|
| (Compiled with Asymptote version 1.43) |
import geometry;
import animate;
animation A;
size(15cm);
int nAnim=75;
int nCircle=6;
real astep=360/nAnim;
inversion inv=inversion((-1,-2),1);
line L1=line(N,S);
circle C=inv*L1;
point center=C.C;
for (int i=-nAnim; i < nAnim; ++i) {
real r;
r=0.001+4*(i/nAnim)^2;
line L2=shift(2*r*E)*L1;
transform T=shift(0,-2*r);
transform R=rotate(astep*i,center);
circle C0=circle(r*E+nCircle/2*sqrt(r)*N,r);
circle[] Ci=sequence(new circle(int i){return T^i*C0;}, nCircle);
fill(R*(path)C, 0.3*blue);
circle Cl=R*(inv*L2);
transform dsh=shift(Cl.r/3*unit(center-Cl.C));
radialshade((path)Cl,white,dsh*Cl.C,0,black,dsh*Cl.C,Cl.r);
for (int i=0; i < Ci.length; ++i) {
circle Ct=inv*Ci[i];
transform dsh=shift(Ct.r/3*unit(center-Ct.C));
radialshade(R*(path)Ct,red,dsh*R*Ct.C,0,black,dsh*R*Ct.C,Ct.r);
}
A.add();
erase();
}
A.movie(BBox(2mm,Fill(black)));
