diff options
author | Karl Berry <karl@freefriends.org> | 2010-04-19 23:59:33 +0000 |
---|---|---|
committer | Karl Berry <karl@freefriends.org> | 2010-04-19 23:59:33 +0000 |
commit | dddce3148a2bc785603576b18ffcf72d39adbe47 (patch) | |
tree | 14f4c79ef11bcf0820a8d4ff2ab0c5ac009c365c /Build/source/utils/asymptote/examples | |
parent | a01e51b01f5819b6091af48cdca581e9f2a9282e (diff) |
asy 1.93
git-svn-id: svn://tug.org/texlive/trunk@17934 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Build/source/utils/asymptote/examples')
34 files changed, 485 insertions, 124 deletions
diff --git a/Build/source/utils/asymptote/examples/1overx.asy b/Build/source/utils/asymptote/examples/1overx.asy new file mode 100644 index 00000000000..5d9775d44dc --- /dev/null +++ b/Build/source/utils/asymptote/examples/1overx.asy @@ -0,0 +1,17 @@ +import graph; +size(200,IgnoreAspect); + +real f(real x) {return 1/x;}; + +bool3 branch(real x) +{ + static int lastsign=0; + if(x == 0) return false; + int sign=sgn(x); + bool b=lastsign == 0 || sign == lastsign; + lastsign=sign; + return b ? true : default; +} + +draw(graph(f,-1,1,branch)); +axes("$x$","$y$",red); diff --git a/Build/source/utils/asymptote/examples/Klein.asy b/Build/source/utils/asymptote/examples/Klein.asy index 4c8089dd86a..0d31c495f01 100644 --- a/Build/source/utils/asymptote/examples/Klein.asy +++ b/Build/source/utils/asymptote/examples/Klein.asy @@ -39,6 +39,6 @@ draw(surface(xscale(0.26)*yscale(0.1)*rotate(90)*hi,s,4.9,1.4,h,bottom=false)); draw(s.uequals(0),blue+dashed); draw(s.uequals(pi),blue+dashed); -currentpicture.add(new void(frame f, transform3 t, picture pic, projection P) { +add(new void(frame f, transform3 t, picture pic, projection P) { draw(f,invert(box(min(f,P),max(f,P)),P)); }); diff --git a/Build/source/utils/asymptote/examples/NURBScurve.asy b/Build/source/utils/asymptote/examples/NURBScurve.asy new file mode 100644 index 00000000000..b3b8c393b9e --- /dev/null +++ b/Build/source/utils/asymptote/examples/NURBScurve.asy @@ -0,0 +1,33 @@ +import three; + +size(10cm); + +currentprojection=perspective(50,80,50); + +// Nonrational curve: +// udegree=3, nu=6; +real[] knot={0,0,0,0,0.4,0.6,1,1,1,1}; + +triple[] P={ + (-31.2061,12.001,6.45082), + (-31.3952,14.7353,6.53707), + (-31.5909,21.277,6.70051), + (-31.4284,25.4933,6.76745), + (-31.5413,30.3485,6.68777), + (-31.4896,32.2839,6.58385), + }; + +draw(P,knot,green); + +// Rational Bezier curve: +// udegree=3, nu=4; +real[] knot={0,0,0,0,1,1,1,1}; +path3 g=scale3(20)*(X{Y}..{-X}Y); +triple[] P={point(g,0),postcontrol(g,0),precontrol(g,1),point(g,1)}; + +// Optional weights: +real[] weights=array(P.length,1.0); +weights[2]=5; + +draw(P,knot,weights,red); + diff --git a/Build/source/utils/asymptote/examples/NURBSsphere.asy b/Build/source/utils/asymptote/examples/NURBSsphere.asy new file mode 100644 index 00000000000..d7f0e77321d --- /dev/null +++ b/Build/source/utils/asymptote/examples/NURBSsphere.asy @@ -0,0 +1,32 @@ +import three; +size(400); + +currentprojection=perspective(5,4,2,autoadjust=false); + +real[] uknot={0,0,0,1,1,2,2,3,3,4,4,4}; + +real[] vknot={0,0,0,1,1,2,2,2}; + +triple[][] P={{(0,0,1),(1,0,1),(1,0,0),(1,0,-1),(0,0,-1)}, + {(0,0,1),(1,1,1),(1,1,0),(1,1,-1),(0,0,-1)}, + {(0,0,1),(0,1,1),(0,1,0),(0,1,-1),(0,0,-1)}, + {(0,0,1),(-1,1,1),(-1,1,0),(-1,1,-1),(0,0,-1)}, + {(0,0,1),(-1,0,1),(-1,0,0),(-1,0,-1),(0,0,-1)}, + {(0,0,1),(-1,-1,1),(-1,-1,0),(-1,-1,-1),(0,0,-1)}, + {(0,0,1),(0,-1,1),(0,-1,0),(0,-1,-1),(0,0,-1)}, + {(0,0,1),(1,-1,1),(1,-1,0),(1,-1,-1),(0,0,-1)}, + {(0,0,1),(1,0,1),(1,0,0),(1,0,-1),(0,0,-1)}}; + +real[][] weights={ + {1,1,2,1,1}, + {1,1,2,1,1}, + {2,2,4,2,2}, + {1,1,2,1,1}, + {1,1,2,1,1}, + {1,1,2,1,1}, + {2,2,4,2,2}, + {1,1,2,1,1}, + {1,1,2,1,1} +}; + +draw(P,uknot,vknot,weights,yellow); diff --git a/Build/source/utils/asymptote/examples/NURBSsurface.asy b/Build/source/utils/asymptote/examples/NURBSsurface.asy index 3fcea79dbbd..878fd956393 100644 --- a/Build/source/utils/asymptote/examples/NURBSsurface.asy +++ b/Build/source/utils/asymptote/examples/NURBSsurface.asy @@ -2,7 +2,7 @@ import three; size(10cm); -currentprojection=perspective(40,40,50); +currentprojection=perspective(50,80,50); // Nonrational surface: // udegree=3, vdegree=3, nu=5, nv=6; @@ -56,6 +56,6 @@ triple[][] P=scale3(20)*octant1.P; // Optional weights: real[][] weights=array(P.length,array(P[0].length,1.0)); -weights[1][2]=0.5; +weights[0][2]=5.0; draw(P,uknot,vknot,weights,blue); diff --git a/Build/source/utils/asymptote/examples/SierpinskiGasket.asy b/Build/source/utils/asymptote/examples/SierpinskiGasket.asy new file mode 100644 index 00000000000..57251735db8 --- /dev/null +++ b/Build/source/utils/asymptote/examples/SierpinskiGasket.asy @@ -0,0 +1,31 @@ +size(200); +import palette; +import three; +currentprojection=perspective(8,2,1); + +triple[] M={(0,0,1),1/3*(sqrt(8),0,-1), + 1/3*((sqrt(8))*Cos(120),(sqrt(8))*Sin(120),-1), + 1/3*((sqrt(8))*Cos(240),(sqrt(8))*Sin(240),-1)}; + +int level=5; + +surface s; + +void recur(triple p, real u, int l) { + if(l < level) + for(triple V : M) + recur(p+u*V,u/2,l+1); + else + for(triple V : M) { + s.append(surface((p+u*(V+M[0]))--(p+u*(V+M[1]))--(p+u*(V+M[2]))--cycle)); + s.append(surface((p+u*(V+M[0]))--(p+u*(V+M[2]))--(p+u*(V+M[3]))--cycle)); + s.append(surface((p+u*(V+M[0]))--(p+u*(V+M[3]))--(p+u*(V+M[1]))--cycle)); + s.append(surface((p+u*(V+M[3]))--(p+u*(V+M[2]))--(p+u*(V+M[1]))--cycle)); + } +} + +recur(O,0.5,1); + +s.colors(palette(s.map(zpart),Rainbow())); + +draw(s); diff --git a/Build/source/utils/asymptote/examples/SierpinskiSponge.asy b/Build/source/utils/asymptote/examples/SierpinskiSponge.asy new file mode 100644 index 00000000000..209c3d182ed --- /dev/null +++ b/Build/source/utils/asymptote/examples/SierpinskiSponge.asy @@ -0,0 +1,42 @@ +size(200); +import palette; +import three; + +triple[] M={ + (-1,-1,-1),(0,-1,-1),(1,-1,-1),(1,0,-1), + (1,1,-1),(0,1,-1),(-1,1,-1),(-1,0,-1), + (-1,-1,0),(1,-1,0),(1,1,0),(-1,1,0), + (-1,-1,1),(0,-1,1),(1,-1,1),(1,0,1), + (1,1,1),(0,1,1),(-1,1,1),(-1,0,1) +}; + +triple[] K={ + (1,-1,-1),(1,0,-1),(1,1,-1),(1,1,0), + (1,1,1),(1,0,1),(1,-1,1),(1,-1,0), + (0,0,-1),(0,0,1),(0,-1,0),(0,1,0) +}; + +surface s; + +void recur(triple p, real u, int level) { + if(level > 1 ) + for(triple V : M) + recur(p+u*V,u/3,level-1); + else + for(triple V : K) { + transform3 T=shift(p)*scale3(u)*shift(V)*scale3(0.5); + surface t=T*surface((1,-1,-1)--(1,1,-1)--(1,1,1)--(1,-1,1)--cycle); + s.append(t); + s.append(scale3(-1)*t); + } +} + +recur((0,0,0),1/3,3); + +surface sf; +sf.append(s); +sf.append(rotate(90,Y)*s); +sf.append(rotate(90,Z)*s); +sf.colors(palette(sf.map(abs),Rainbow())); + +draw(sf); diff --git a/Build/source/utils/asymptote/examples/alignbox.asy b/Build/source/utils/asymptote/examples/alignbox.asy index 8f216c6a10c..67083b1e2e0 100644 --- a/Build/source/utils/asymptote/examples/alignbox.asy +++ b/Build/source/utils/asymptote/examples/alignbox.asy @@ -4,6 +4,6 @@ object left=align(object("$x^2$",ellipse,margin),W); add(left); object right=align(object("$\sin x$",ellipse,margin),4E); add(right); -currentpicture.add(new void(frame f, transform t) { +add(new void(frame f, transform t) { draw(f,point(left,NE,t)--point(right,W,t)); }); diff --git a/Build/source/utils/asymptote/examples/animations/inlinemovie.tex b/Build/source/utils/asymptote/examples/animations/inlinemovie.tex index 3fa61b6673b..f3d9f5b0893 100644 --- a/Build/source/utils/asymptote/examples/animations/inlinemovie.tex +++ b/Build/source/utils/asymptote/examples/animations/inlinemovie.tex @@ -26,7 +26,7 @@ for(int i=0; i < 10; ++i) { label(A.pdf("controls",delay=50,keep=!settings.inlinetex)); \end{asy} %Uncomment the following line when not using the [inline] package option: -%\ASYanimategraphics[controls,loop]{20}{movie1}{}{} +%\ASYanimategraphics[controls]{50}{movie1}{}{} \end{center} And here is another one, clickable but without the control panel: @@ -45,7 +45,7 @@ for(int i=0; i < 10; ++i) { label(A.pdf(keep=!settings.inlinetex)); \end{asy} %Uncomment the following line when not using the [inline] package option: -%\ASYanimategraphics[controls,loop]{10}{movie2}{}{} +%\ASYanimategraphics[controls]{10}{movie2}{}{} \end{center} \end{document} diff --git a/Build/source/utils/asymptote/examples/animations/inlinemovie3.tex b/Build/source/utils/asymptote/examples/animations/inlinemovie3.tex index 4cd9cce3150..46779e85b28 100644 --- a/Build/source/utils/asymptote/examples/animations/inlinemovie3.tex +++ b/Build/source/utils/asymptote/examples/animations/inlinemovie3.tex @@ -6,9 +6,9 @@ Here is an inline 3D PDF movie, generated with the commands \begin{verbatim} -pdflatex inlinemovie -asy inlinemovie -pdflatex inlinemovie +pdflatex inlinemovie3 +asy inlinemovie3 +pdflatex inlinemovie3 \end{verbatim} \begin{center} diff --git a/Build/source/utils/asymptote/examples/clockarray.asy b/Build/source/utils/asymptote/examples/clockarray.asy new file mode 100644 index 00000000000..be7fd899a0e --- /dev/null +++ b/Build/source/utils/asymptote/examples/clockarray.asy @@ -0,0 +1,39 @@ +int nx=3; +int ny=4; +real xmargin=1cm; +real ymargin=xmargin; + +size(settings.paperwidth,settings.paperheight); + +picture pic; +real width=settings.paperwidth/nx-xmargin; +real height=settings.paperheight/ny-ymargin; +if(width <= 0 || height <= 0) abort("margin too big"); +size(pic,width,height); + +pen p=linewidth(0.5mm); +draw(pic,unitcircle,p); + +real h=0.08; +real m=0.05; + +for(int hour=1; hour <= 12; ++hour) { + pair z=dir((12-hour+3)*30); + label(pic,string(hour),z,z); + draw(pic,z--(1-h)*z,p); +} + +for(int minutes=0; minutes < 60; ++minutes) { + pair z=dir(6*minutes); + draw(pic,z--(1-m)*z); +} + +dot(pic,(0,0)); + +frame f=pic.fit(); +pair size=size(f)+(xmargin,ymargin); + +for(int i=0; i < nx; ++i) + for(int j=0; j < ny; ++j) + add(shift(realmult(size,(i,j)))*f); + diff --git a/Build/source/utils/asymptote/examples/controlsystem.asy b/Build/source/utils/asymptote/examples/controlsystem.asy index 0829bc90d51..bfd8336f1f6 100644 --- a/Build/source/utils/asymptote/examples/controlsystem.asy +++ b/Build/source/utils/asymptote/examples/controlsystem.asy @@ -15,25 +15,11 @@ draw(sum1); draw(junction1); add(new void(picture pic, transform t) { - draw(pic,Label("$u$",0.5,N),path(new pair[]{t*(0,0),sum1.left(t)}, - Horizontal),Arrow,PenMargin); + blockconnector operator --=blockconnector(pic,t); + + block(0,0)--Label("$u$",align=N)--Arrow--sum1--Arrow--delay--Arrow-- + system--junction1--Label("$y$",align=N)--Arrow--block(1,0); - draw(pic,path(new pair[]{sum1.right(t),delay.left(t)},Horizontal),Arrow, - PenMargin); - label(pic,"-",sum1.bottom(t),ESE); - - draw(pic,path(new pair[]{delay.right(t),system.left(t)},Horizontal),Arrow, - PenMargin); - - draw(pic,path(new pair[]{system.right(t),junction1.left(t)},Horizontal), - PenMargin); - - draw(pic,Label("$y$",0.5,N),path(new pair[]{junction1.right(t),t*(0.9,0)}, - Horizontal),Arrow,PenMargin); - - draw(pic,path(new pair[]{junction1.bottom(t),controller.right(t)},Vertical), - Arrow,PenMargin); - - draw(pic,path(new pair[]{controller.left(t),sum1.bottom(t)},Horizontal), - Arrow,PenMargin); + junction1--Down--Left--Arrow--controller--Left--Up-- + Label("$-$",position=3,align=ESE)--Arrow--sum1; }); diff --git a/Build/source/utils/asymptote/examples/cos3.asy b/Build/source/utils/asymptote/examples/cos3.asy new file mode 100644 index 00000000000..fa9c8f49550 --- /dev/null +++ b/Build/source/utils/asymptote/examples/cos3.asy @@ -0,0 +1,25 @@ +import graph3; +import palette; + +size(12cm,IgnoreAspect); +currentprojection=orthographic(1,-2,1); + +real f(pair z) {return abs(cos(z));} + +real Arg(triple v) +{ + return degrees(cos((v.x,v.y)),warn=false); +} + +surface s=surface(f,(-pi,-2),(pi,2),20,Spline); + +s.colors(palette(s.map(Arg),Wheel())); +draw(s); + +real xmin=point((-1,-1,-1)).x; +real xmax=point((1,1,1)).x; +draw((xmin,0,0)--(xmax,0,0),dashed); + +xaxis3("$\mathop{\rm Re} z$",Bounds,InTicks); +yaxis3("$\mathop{\rm Im} z$",Bounds,InTicks(beginlabel=false)); +zaxis3("$|\cos(z)|$",Bounds,InTicks); diff --git a/Build/source/utils/asymptote/examples/cyclohexane.asy b/Build/source/utils/asymptote/examples/cyclohexane.asy index d0121d8ea7e..8e1ff466b9d 100644 --- a/Build/source/utils/asymptote/examples/cyclohexane.asy +++ b/Build/source/utils/asymptote/examples/cyclohexane.asy @@ -1,61 +1,66 @@ import three; -currentprojection = perspective(300,-650,500); - -surface carbon = scale3(70)*unitsphere; // 70 pm -surface hydrogen = scale3(25)*unitsphere; // 25 pm - -real alpha = 90+aSin(1/3); - -real CCbond = 156; // 156 pm -real CHbond = 110; // 110 pm - -triple c1 = (0,0,0); -triple h1 = c1+CHbond*Z; -triple c2 = rotate(alpha,c1,c1+Y)*(CCbond*Z); -triple h2 = rotate(120,c1,c2)*h1; -triple h3 = c2-CHbond*Z; -triple h4 = rotate(120,c2,c1)*h3; - -triple c3 = rotate(120,c2,h3)*c1; -triple h5 = c3+CHbond*Z; -triple h6 = rotate(-120,c3,c2)*h5; - -triple c4 = rotate(-120,c3,h5)*c2; -triple h7 = c4-CHbond*Z; -triple h8 = rotate(120,c4,c3)*h7; - -triple c5 = rotate(120,c4,h7)*c3; -triple h9 = c5+CHbond*Z; -triple h10 = rotate(-120,c5,c4)*h9; - -triple c6 = rotate(-120,c5,h9)*c4; -triple h11 = c6-CHbond*Z; -triple h12 = rotate(120,c6,c5)*h11; - -draw(shift(c1)*carbon,black); -draw(shift(c2)*carbon,black); -draw(shift(c3)*carbon,black); -draw(shift(c4)*carbon,black); -draw(shift(c5)*carbon,black); -draw(shift(c6)*carbon,black); - - -draw(shift(h1)*hydrogen,lightgray); -draw(shift(h2)*hydrogen,lightgray); -draw(shift(h3)*hydrogen,lightgray); -draw(shift(h4)*hydrogen,lightgray); -draw(shift(h5)*hydrogen,lightgray); -draw(shift(h6)*hydrogen,lightgray); -draw(shift(h7)*hydrogen,lightgray); -draw(shift(h8)*hydrogen,lightgray); -draw(shift(h9)*hydrogen,lightgray); -draw(shift(h10)*hydrogen,lightgray); -draw(shift(h11)*hydrogen,lightgray); -draw(shift(h12)*hydrogen,lightgray); - - -pen thick = linewidth(10); +currentprojection=perspective(300,-650,500); +currentlight.background=palecyan; + +surface carbon=scale3(70)*unitsphere; // 70 pm +surface hydrogen=scale3(25)*unitsphere; // 25 pm + +real alpha=90+aSin(1/3); + +real CCbond=156; // 156 pm +real CHbond=110; // 110 pm + +triple c1=(0,0,0); +triple h1=c1+CHbond*Z; +triple c2=rotate(alpha,c1,c1+Y)*(CCbond*Z); +triple h2=rotate(120,c1,c2)*h1; +triple h3=c2-CHbond*Z; +triple h4=rotate(120,c2,c1)*h3; + +triple c3=rotate(120,c2,h3)*c1; +triple h5=c3+CHbond*Z; +triple h6=rotate(-120,c3,c2)*h5; + +triple c4=rotate(-120,c3,h5)*c2; +triple h7=c4-CHbond*Z; +triple h8=rotate(120,c4,c3)*h7; + +triple c5=rotate(120,c4,h7)*c3; +triple h9=c5+CHbond*Z; +triple h10=rotate(-120,c5,c4)*h9; + +triple c6=rotate(-120,c5,h9)*c4; +triple h11=c6-CHbond*Z; +triple h12=rotate(120,c6,c5)*h11; + +pen Black=gray(0.4); + +draw(shift(c1)*carbon,Black); +draw(shift(c2)*carbon,Black); +draw(shift(c3)*carbon,Black); +draw(shift(c4)*carbon,Black); +draw(shift(c5)*carbon,Black); +draw(shift(c6)*carbon,Black); + + +material White=material(diffusepen=gray(0.4),emissivepen=gray(0.6)); + +draw(shift(h1)*hydrogen,White); +draw(shift(h2)*hydrogen,White); +draw(shift(h3)*hydrogen,White); +draw(shift(h4)*hydrogen,White); +draw(shift(h5)*hydrogen,White); +draw(shift(h6)*hydrogen,White); +draw(shift(h7)*hydrogen,White); +draw(shift(h8)*hydrogen,White); +draw(shift(h9)*hydrogen,White); +draw(shift(h10)*hydrogen,White); +draw(shift(h11)*hydrogen,White); +draw(shift(h12)*hydrogen,White); + + +pen thick=linewidth(10); draw(c1--c2--c3--c4--c5--c6--cycle,thick); diff --git a/Build/source/utils/asymptote/examples/exp3.asy b/Build/source/utils/asymptote/examples/exp3.asy new file mode 100644 index 00000000000..e7508a29297 --- /dev/null +++ b/Build/source/utils/asymptote/examples/exp3.asy @@ -0,0 +1,25 @@ +import graph3; +import palette; + +size(12cm,IgnoreAspect); +currentprojection=orthographic(1,-2,1); + +real f(pair z) {return abs(exp(z));} + +real Arg(triple v) +{ + return degrees(exp((v.x,v.y)),warn=false); +} + +surface s=surface(f,(-2,-pi),(2,pi),20,Spline); + +s.colors(palette(s.map(Arg),Wheel())); +draw(s); + +real xmin=point((-1,-1,-1)).x; +real xmax=point((1,1,1)).x; +draw((xmin,0,0)--(xmax,0,0),dashed); + +xaxis3("$\mathop{\rm Re} z$",Bounds,InTicks); +yaxis3("$\mathop{\rm Im} z$",Bounds,InTicks(beginlabel=false)); +zaxis3("$|\exp(z)|$",Bounds,InTicks); diff --git a/Build/source/utils/asymptote/examples/fequlogo.asy b/Build/source/utils/asymptote/examples/fequlogo.asy index 29cae0be720..e53e1831419 100644 --- a/Build/source/utils/asymptote/examples/fequlogo.asy +++ b/Build/source/utils/asymptote/examples/fequlogo.asy @@ -33,7 +33,7 @@ real h=0.0125; draw(surface(rotate(2)*xscale(0.32)*yscale(0.6)*lo,s,-pi/4-1.5*pi/20,0.5,h)); draw(surface(rotate(0)*xscale(-0.45)*yscale(0.3)*hi,s,0.8*pi,0.25,h),blue); -currentpicture.add(new void(frame f, transform3 t, picture pic, projection P) { +add(new void(frame f, transform3 t, picture pic, projection P) { draw(f,surface(invert(box(min(f,P),max(f,P)),min3(f),P), new pen[] {orange,red,yellow,brown})); } diff --git a/Build/source/utils/asymptote/examples/fillcontour.asy b/Build/source/utils/asymptote/examples/fillcontour.asy index 1b93e002fff..311192fb7f8 100644 --- a/Build/source/utils/asymptote/examples/fillcontour.asy +++ b/Build/source/utils/asymptote/examples/fillcontour.asy @@ -5,7 +5,7 @@ import contour; size(12cm,IgnoreAspect); pair a=(pi/2,0); -pair b=(1.5*pi+epsilon,2pi); +pair b=(3pi/2,2pi); real f(real x, real y) {return cos(x)*sin(y);} diff --git a/Build/source/utils/asymptote/examples/gamma3.asy b/Build/source/utils/asymptote/examples/gamma3.asy index 1e400152a93..e7fdde015e0 100644 --- a/Build/source/utils/asymptote/examples/gamma3.asy +++ b/Build/source/utils/asymptote/examples/gamma3.asy @@ -24,6 +24,10 @@ real Arg(triple v) s.colors(palette(s.map(Arg),Wheel())); draw(s); +real xmin=point((-1,-1,-1)).x; +real xmax=point((1,1,1)).x; +draw((xmin,0,0)--(xmax,0,0),dashed); + xaxis3("$\mathop{\rm Re} z$",Bounds,InTicks); yaxis3("$\mathop{\rm Im} z$",Bounds,InTicks(beginlabel=false)); zaxis3("$|\Gamma(z)|$",Bounds,InTicks); diff --git a/Build/source/utils/asymptote/examples/label3.asy b/Build/source/utils/asymptote/examples/label3.asy index fdf8d512e39..f8d5e07049f 100644 --- a/Build/source/utils/asymptote/examples/label3.asy +++ b/Build/source/utils/asymptote/examples/label3.asy @@ -1,7 +1,7 @@ import three; -currentprojection=perspective(1,1,1,up=Y); +currentprojection=perspective(0,0,1,up=Y); label(scale(4)*"$\displaystyle\int_{-\infty}^{+\infty} e^{-\alpha x^2}\,dx= -\sqrt{\frac{\pi}{\alpha}}$",O,blue); +\sqrt{\frac{\pi}{\alpha}}$",O,blue,Embedded); diff --git a/Build/source/utils/asymptote/examples/labelbox.asy b/Build/source/utils/asymptote/examples/labelbox.asy index cd61a9da69c..38153b856e5 100644 --- a/Build/source/utils/asymptote/examples/labelbox.asy +++ b/Build/source/utils/asymptote/examples/labelbox.asy @@ -3,9 +3,9 @@ real margin=2mm; pair z1=(0,1); pair z0=(0,0); -object label1=draw("small box",box,z1,margin); -object label0=draw("LARGE ELLIPSE",ellipse,z0,margin); +object Box=draw("small box",box,z1,margin); +object Ellipse=draw("LARGE ELLIPSE",ellipse,z0,margin); add(new void(frame f, transform t) { - draw(f,point(label1,SW,t){SW}..{SW}point(label0,NNE,t)); + draw(f,point(Box,SW,t){SW}..{SW}point(Ellipse,NNE,t)); }); diff --git a/Build/source/utils/asymptote/examples/logo3.asy b/Build/source/utils/asymptote/examples/logo3.asy index 932efaca410..93b5a331e9e 100644 --- a/Build/source/utils/asymptote/examples/logo3.asy +++ b/Build/source/utils/asymptote/examples/logo3.asy @@ -2,32 +2,40 @@ import three; size(560,320,IgnoreAspect); size3(140,80,15); -currentprojection=perspective(-3,20,10,up=Y); +currentprojection=perspective(-2,20,10,up=Y); currentlight=White; -path[] outline; - real a=-0.4; real b=0.95; real y1=-5; real y2=-3y1/2; path A=(a,0){dir(10)}::{dir(89.5)}(0,y2); -outline.push(A); -outline.push((0,y1){dir(88.3)}::{dir(20)}(b,0)); +path B=(0,y1){dir(88.3)}::{dir(20)}(b,0); real c=0.5*a; pair z=(0,2.5); -path[] text = shift(0,2)*scale(0.01,0.15)* +transform t=scale(1,15); +transform T=inverse(scale(t.yy,t.xx)); +path[] g=shift(0,1.979)*scale(0.01)*t* texpath(Label("{\it symptote}",z,0.25*E+0.169S,fontsize(24pt))); -outline.append(text); pair w=(0,1.7); -outline.push(intersectionpoint(A,w-1--w)--w); -outline.push((0,y1)--(0,y2)); -outline.push((a,0)--(b,0)); +pair u=intersectionpoint(A,w-1--w); + +real h=0.25*linewidth(); +real hy=(T*(h,h)).x; +g.push(t*((a,hy)--(b,hy)..(b+hy,0)..(b,-hy)--(a,-hy)..(a-hy,0)..cycle)); +g.push(T*((h,y1)--(h,y2)..(0,y2+h)..(-h,y2)--(-h,y1)..(0,y1-h)..cycle)); +g.push(shift(0,w.y)*t*((u.x,hy)--(w.x,hy)..(w.x+hy,0)..(w.x,-hy)--(u.x,-hy)..(u.x-hy,0)..cycle)); +real f=0.75; +g.push(point(A,0)--shift(-f*hy,f*h)*A--point(A,1)--shift(f*hy,-f*h)*reverse(A)--cycle); +g.push(point(B,0)--shift(f*hy,-f*h)*B--point(B,1)--shift(-f*hy,f*h)*reverse(B)--cycle); -for(path p : outline) - draw(extrude(p,-0.1Z),material(lightgray,shininess=1.0)); +triple H=-0.1Z; +material m=material(lightgray,shininess=1.0); -draw(path3(outline),red+linewidth(0)); +for(path p : g) + draw(extrude(p,H),m); -draw(surface(text),red,nolight); +surface s=surface(g); +draw(s,red,nolight); +draw(shift(H)*s,m); diff --git a/Build/source/utils/asymptote/examples/odetest.asy b/Build/source/utils/asymptote/examples/odetest.asy index 68a7a2eca67..69f8ea3fd07 100644 --- a/Build/source/utils/asymptote/examples/odetest.asy +++ b/Build/source/utils/asymptote/examples/odetest.asy @@ -8,7 +8,7 @@ write(); write("system integration test"); real[] f(real t, real[] x) {return new real[] {x[1],1.5*x[0]^2};} write(integrate(new real[] {4,-8},f,0,1,n=100,dynamic=true,tolmin=0.0002, - tolmax=0.0004,RK3BS,verbose=true)); + tolmax=0.0004,RK3BS,verbose=false)); write(); write("simultaneous newton test"); @@ -29,16 +29,15 @@ real[] initial(real[] x) { } real[] discrepancy(real[] x) { - write("Error: ",x[0]-1); - return new real[] {x[0]-1}; + real error=x[0]-1; + write("Error: ",error); + return new real[] {error}; } -write(solveBVP(f,0,1,n=10,initial,discrepancy,guess=new real[] {-30},RK4, - iterations=10)); +real[] w0=solveBVP(f,0,1,n=10,dynamic=true,tolmin=0.0002,tolmax=0.0004,RK3BS, + initial,discrepancy,guess=new real[] {-30},iterations=10); +write(w0); write(); -write(solveBVP(f,0,1,n=100,initial,discrepancy,guess=new real[] {-30},RK4, - iterations=10)); -write(); -write(solveBVP(f,0,1,n=10000,initial,discrepancy,guess=new real[] {-30},RK4, - iterations=10)); +write(integrate(w0,f,0,1,n=10,dynamic=true,tolmin=0.0002,tolmax=0.0004,RK3BS, + verbose=false)); write(); diff --git a/Build/source/utils/asymptote/examples/polardatagraph.asy b/Build/source/utils/asymptote/examples/polardatagraph.asy new file mode 100644 index 00000000000..6bd646e8aa4 --- /dev/null +++ b/Build/source/utils/asymptote/examples/polardatagraph.asy @@ -0,0 +1,17 @@ +import graph; + +size(100); + +int n=30; +real minRadius=0.2; +real angles[]=uniform(0,2pi,n); +angles.delete(angles.length-1); + +real[] r=new real[n]; +for(int i=0; i < n; ++i) + r[i]=unitrand()*(1-minRadius)+minRadius; + +interpolate join=operator ..(operator tension(10,true)); +draw(join(polargraph(r,angles,join),cycle),dot(red)); + + diff --git a/Build/source/utils/asymptote/examples/poster.asy b/Build/source/utils/asymptote/examples/poster.asy index cfe4ad855e3..cbcefc4bf69 100644 --- a/Build/source/utils/asymptote/examples/poster.asy +++ b/Build/source/utils/asymptote/examples/poster.asy @@ -3,6 +3,7 @@ import slide; import graph; defaultpen(deepblue); +pagenumberpen=invisible; real f(real x) {return (x != 0) ? x*sin(1/x) : 0;} pair F(real x) {return (x,f(x));} @@ -28,5 +29,5 @@ for graduate students, by graduate students.",fontsize(32pt)); label("Registration and abstract submission online.",(0,-0.5)); -label("\tt http://www.pims.math.ca/science/2006/06yrc/",point(SW),NE, +label("\tt http://www.pims.math.ca/science/2006/06yrc/",point(SW),2NE, black+fontsize(18pt)); diff --git a/Build/source/utils/asymptote/examples/ring.asy b/Build/source/utils/asymptote/examples/ring.asy index 54e0e25d489..6963d42d23f 100644 --- a/Build/source/utils/asymptote/examples/ring.asy +++ b/Build/source/utils/asymptote/examples/ring.asy @@ -1,5 +1,5 @@ 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); - diff --git a/Build/source/utils/asymptote/examples/sin3.asy b/Build/source/utils/asymptote/examples/sin3.asy new file mode 100644 index 00000000000..d35cd271808 --- /dev/null +++ b/Build/source/utils/asymptote/examples/sin3.asy @@ -0,0 +1,25 @@ +import graph3; +import palette; + +size(12cm,IgnoreAspect); +currentprojection=orthographic(1,-2,1); + +real f(pair z) {return abs(sin(z));} + +real Arg(triple v) +{ + return degrees(sin((v.x,v.y)),warn=false); +} + +surface s=surface(f,(-pi,-2),(pi,2),20,Spline); + +s.colors(palette(s.map(Arg),Wheel())); +draw(s); + +real xmin=point((-1,-1,-1)).x; +real xmax=point((1,1,1)).x; +draw((xmin,0,0)--(xmax,0,0),dashed); + +xaxis3("$\mathop{\rm Re} z$",Bounds,InTicks); +yaxis3("$\mathop{\rm Im} z$",Bounds,InTicks(beginlabel=false)); +zaxis3("$|\sin(z)|$",Bounds,InTicks); diff --git a/Build/source/utils/asymptote/examples/strokepath.asy b/Build/source/utils/asymptote/examples/strokepath.asy index ee18b1c9bfe..c857150ec58 100644 --- a/Build/source/utils/asymptote/examples/strokepath.asy +++ b/Build/source/utils/asymptote/examples/strokepath.asy @@ -10,7 +10,7 @@ shipped=false; size(400); // Equivalent to draw(g,p): -currentpicture.add(new void(frame f, transform t) { +add(new void(frame f, transform t) { fill(f,strokepath(t*g,p),red); }); currentpicture.addPath(g,p); diff --git a/Build/source/utils/asymptote/examples/tensor.asy b/Build/source/utils/asymptote/examples/tensor.asy index aa633c4087b..19b1e087658 100644 --- a/Build/source/utils/asymptote/examples/tensor.asy +++ b/Build/source/utils/asymptote/examples/tensor.asy @@ -1,6 +1,5 @@ size(200); -//pen[][] p={{red,green,blue,cyan},{green,blue,rgb(black),magenta}}; 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}; diff --git a/Build/source/utils/asymptote/examples/transparency.asy b/Build/source/utils/asymptote/examples/transparency.asy index 02196a02ee9..36e741d294d 100644 --- a/Build/source/utils/asymptote/examples/transparency.asy +++ b/Build/source/utils/asymptote/examples/transparency.asy @@ -1,6 +1,7 @@ size(0,150); -settings.outformat="pdf"; +if(settings.outformat == "") + settings.outformat="pdf"; begingroup(); fill(shift(1.5dir(120))*unitcircle,green+opacity(0.75)); diff --git a/Build/source/utils/asymptote/examples/triceratops.asy b/Build/source/utils/asymptote/examples/triceratops.asy index e640a6b37f9..a9e6e93cd52 100644 --- a/Build/source/utils/asymptote/examples/triceratops.asy +++ b/Build/source/utils/asymptote/examples/triceratops.asy @@ -4,6 +4,6 @@ size(15cm); currentprojection=orthographic(0,2,5,up=Y); // A compressed version of the required data file may be obtained from: -// http://www.cs.technion.ac.il/~irit/data/Viewpoint/galleon.obj.gz +// http://www.cs.technion.ac.il/~irit/data/Viewpoint/triceratops.obj.gz draw(obj("triceratops.obj",brown)); diff --git a/Build/source/utils/asymptote/examples/venn3.asy b/Build/source/utils/asymptote/examples/venn3.asy new file mode 100644 index 00000000000..6118fab6e9a --- /dev/null +++ b/Build/source/utils/asymptote/examples/venn3.asy @@ -0,0 +1,50 @@ +size(0,150); + +pen colour1=red; +pen colour2=green; +pen colour3=blue; + +real r=sqrt(3); + +pair z0=(0,0); +pair z1=(-1,0); +pair z2=(1,0); +pair z3=(0,r); + +path c1=circle(z1,r); +path c2=circle(z2,r); +path c3=circle(z3,r); + +fill(c1,colour1); +fill(c2,colour2); +fill(c3,colour3); + +picture intersection12; +fill(intersection12,c1,colour1+colour2); +clip(intersection12,c2); + +picture intersection13; +fill(intersection13,c1,colour1+colour3); +clip(intersection13,c3); + +picture intersection23; +fill(intersection23,c2,colour2+colour3); +clip(intersection23,c3); + +picture intersection123; +fill(intersection123,c1,colour1+colour2+colour3); +clip(intersection123,c2); +clip(intersection123,c3); + +add(intersection12); +add(intersection13); +add(intersection23); +add(intersection123); + +draw(c1); +draw(c2); +draw(c3); + +label("$A$",z1); +label("$B$",z2); +label("$C$",z3); diff --git a/Build/source/utils/asymptote/examples/washer.asy b/Build/source/utils/asymptote/examples/washer.asy new file mode 100644 index 00000000000..083039e55a3 --- /dev/null +++ b/Build/source/utils/asymptote/examples/washer.asy @@ -0,0 +1,13 @@ +import three; +size(10cm); + +path3[] p=reverse(unitcircle3)^^scale3(0.5)*unitcircle3; +path[] g=reverse(unitcircle)^^scale(0.5)*unitcircle; +triple H=-0.4Z; + +draw(surface(p,planar=true)); +draw(surface(shift(H)*p,planar=true)); +material m=material(lightgray,shininess=1.0); +for(path pp : g) + draw(extrude(pp,H),m); + diff --git a/Build/source/utils/asymptote/examples/worksheet.asy b/Build/source/utils/asymptote/examples/worksheet.asy index b3aa2dba8a0..f26797acabb 100644 --- a/Build/source/utils/asymptote/examples/worksheet.asy +++ b/Build/source/utils/asymptote/examples/worksheet.asy @@ -22,7 +22,7 @@ z += step; for(int i=1; i <= 14; ++i) { draw(pic,z--z+length); z += step; - draw(pic,z--z+length,dashed); + draw(pic,z--z+length,dashed+gray); z += step; void label(int i) { label(pic,string(i)+".",z,0.2NE,fontsize(0.8*1.5*2*height*mm)+gray); @@ -41,5 +41,8 @@ draw(pic,z--z+length); add(pic.fit(),(0,0),W); add(pic.fit(),(0,0),E); +newpage(); +add(pic.fit(),(0,0),W); +add(pic.fit(),(0,0),E); diff --git a/Build/source/utils/asymptote/examples/xsin1x.asy b/Build/source/utils/asymptote/examples/xsin1x.asy index e419ba19a69..cf394efb1a6 100644 --- a/Build/source/utils/asymptote/examples/xsin1x.asy +++ b/Build/source/utils/asymptote/examples/xsin1x.asy @@ -14,5 +14,11 @@ size(pic,50,IgnoreAspect); xaxis(pic,red); yaxis(pic,red); draw(pic,graph(pic,f,-0.1/pi,0.1/pi,1000)); -attach(bbox(pic,blue),point(N+0.85W),10SE); + +add(new void(frame f, transform t) { + frame G=shift(point(f,N+0.85W))*align(bbox(pic,blue),10SE); + add(f,G); + draw(f,t*box(min(pic,user=true),max(pic,user=true)),blue); + draw(f,point(G,E)--t*point(pic,W),blue); + }); |