summaryrefslogtreecommitdiff
path: root/Master/texmf/doc/asymptote/examples
diff options
context:
space:
mode:
Diffstat (limited to 'Master/texmf/doc/asymptote/examples')
-rw-r--r--Master/texmf/doc/asymptote/examples/NURBScurve.asy2
-rw-r--r--Master/texmf/doc/asymptote/examples/NURBSsurface.asy11
-rw-r--r--Master/texmf/doc/asymptote/examples/SierpinskiSponge.asy119
-rw-r--r--Master/texmf/doc/asymptote/examples/diatom.asy2
-rw-r--r--Master/texmf/doc/asymptote/examples/extrudedcontour.asy3
-rw-r--r--Master/texmf/doc/asymptote/examples/filesurface.asy4
-rw-r--r--Master/texmf/doc/asymptote/examples/floatingdisk.asy10
-rw-r--r--Master/texmf/doc/asymptote/examples/interpolate1.asy29
-rw-r--r--Master/texmf/doc/asymptote/examples/intro.asy1
-rw-r--r--Master/texmf/doc/asymptote/examples/latexusage-1.asy54
-rw-r--r--Master/texmf/doc/asymptote/examples/latexusage-2.asy24
-rw-r--r--Master/texmf/doc/asymptote/examples/latexusage-3.asy39
-rw-r--r--Master/texmf/doc/asymptote/examples/latexusage.tex10
-rw-r--r--Master/texmf/doc/asymptote/examples/orthocenter.asy3
-rw-r--r--Master/texmf/doc/asymptote/examples/pdb.asy14
-rw-r--r--Master/texmf/doc/asymptote/examples/penfunctionimage.asy27
-rw-r--r--Master/texmf/doc/asymptote/examples/slidedemo.asy2
-rw-r--r--Master/texmf/doc/asymptote/examples/square.asy2
-rw-r--r--Master/texmf/doc/asymptote/examples/vertexshading.asy1
-rw-r--r--Master/texmf/doc/asymptote/examples/worksheet.asy3
-rw-r--r--Master/texmf/doc/asymptote/examples/worldmap.asy87
21 files changed, 380 insertions, 67 deletions
diff --git a/Master/texmf/doc/asymptote/examples/NURBScurve.asy b/Master/texmf/doc/asymptote/examples/NURBScurve.asy
index b3b8c393b9e..c4da5c2ff5f 100644
--- a/Master/texmf/doc/asymptote/examples/NURBScurve.asy
+++ b/Master/texmf/doc/asymptote/examples/NURBScurve.asy
@@ -14,7 +14,7 @@ triple[] P={
(-31.5909,21.277,6.70051),
(-31.4284,25.4933,6.76745),
(-31.5413,30.3485,6.68777),
- (-31.4896,32.2839,6.58385),
+ (-31.4896,32.2839,6.58385)
};
draw(P,knot,green);
diff --git a/Master/texmf/doc/asymptote/examples/NURBSsurface.asy b/Master/texmf/doc/asymptote/examples/NURBSsurface.asy
index 878fd956393..32df6ff98ea 100644
--- a/Master/texmf/doc/asymptote/examples/NURBSsurface.asy
+++ b/Master/texmf/doc/asymptote/examples/NURBSsurface.asy
@@ -15,28 +15,28 @@ triple[][] P={{
(-31.5909,21.277,6.70051),
(-31.4284,25.4933,6.76745),
(-31.5413,30.3485,6.68777),
- (-31.4896,32.2839,6.58385),
+ (-31.4896,32.2839,6.58385)
},{
(-28.279,12.001,7.89625),
(-28.4187,14.7353,8.00954),
(-28.5633,21.277,8.22422),
(-28.4433,25.4933,8.31214),
(-28.5266,30.3485,8.20749),
- (-28.4885,32.2839,8.07099),
+ (-28.4885,32.2839,8.07099)
},{
(-20,12.001,10.0379),
(-20,14.7353,10.2001),
(-20,21.277,10.5076),
(-20,25.4933,10.6335),
(-20,30.3485,10.4836),
- (-20,32.2839,10.2881),
+ (-20,32.2839,10.2881)
},{
(-11.721,12.001,7.84024),
(-11.5813,14.7353,7.95269),
(-11.4367,21.277,8.16575),
(-11.5567,25.4933,8.25302),
(-11.4734,30.3485,8.14915),
- (-11.5115,32.2839,8.01367),
+ (-11.5115,32.2839,8.01367)
},{
(-8.79391,12.001,6.39481),
(-8.60483,14.7353,6.48022),
@@ -44,7 +44,8 @@ triple[][] P={{
(-8.57158,25.4933,6.70832),
(-8.45874,30.3485,6.62943),
(-8.51041,32.2839,6.52653)
- }};
+ }
+};
draw(P,uknot,vknot,new pen[] {red,green,blue,magenta});
diff --git a/Master/texmf/doc/asymptote/examples/SierpinskiSponge.asy b/Master/texmf/doc/asymptote/examples/SierpinskiSponge.asy
index 328447d4ac4..c398aa511c6 100644
--- a/Master/texmf/doc/asymptote/examples/SierpinskiSponge.asy
+++ b/Master/texmf/doc/asymptote/examples/SierpinskiSponge.asy
@@ -1,42 +1,99 @@
size(200);
import palette;
import three;
-
+
+currentprojection=orthographic(1,1,1);
+
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)
+ (-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[] Squares={
+ surface((1,-1,-1)--(1,1,-1)--(1,1,1)--(1,-1,1)--cycle),
+ surface((-1,-1,-1)--(-1,1,-1)--(-1,1,1)--(-1,-1,1)--cycle),
+ surface((1,1,-1)--(-1,1,-1)--(-1,1,1)--(1,1,1)--cycle),
+ surface((1,-1,-1)--(-1,-1,-1)--(-1,-1,1)--(1,-1,1)--cycle),
+ surface((1,-1,1)--(1,1,1)--(-1,1,1)--(-1,-1,1)--cycle),
+ surface((1,-1,-1)--(1,1,-1)--(-1,1,-1)--(-1,-1,-1)--cycle),
};
-
-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);
+
+int[][] SquaresPoints={
+ {2,3,4,10,16,15,14,9},
+ {0,7,6,11,18,19,12,8},
+ {4,5,6,11,18,17,16,10},
+ {2,1,0,8,12,13,14,9},
+ {12,13,14,15,16,17,18,19},
+ {0,1,2,3,4,5,6,7}
+};
+
+int[][] index={
+ {0,2,4},{0,1},{1,2,4},{2,3},{1,3,4},{0,1},{0,3,4},{2,3},
+ {4,5},{4,5},{4,5},{4,5},
+ {0,2,5},{0,1},{1,2,5},{2,3},{1,3,5},{0,1},{0,3,5},{2,3}
+};
+
+int[] Sponge0=array(n=6,value=1);
+
+int[] eraseFaces(int n, int[] Sponge0) {
+ int[] temp=copy(Sponge0);
+ for(int k : index[n]) {
+ temp[k]=0;
+ }
+ return temp;
+}
+
+int[][] Sponge1=new int[20][];
+for(int n=0; n < 20; ++n) {
+ Sponge1[n]=eraseFaces(n,Sponge0);
+}
+
+int[][] eraseFaces(int n, int[][] Sponge1) {
+ int[][] temp=copy(Sponge1);
+ for(int k : index[n])
+ for(int n1 : SquaresPoints[k])
+ temp[n1][k]=0;
+ return temp;
+}
+
+int[][][] Sponge2=new int[20][][];
+for(int n=0; n < 20; ++n)
+ Sponge2[n]=eraseFaces(n,Sponge1);
+
+int[][][] eraseFaces(int n, int[][][] Sponge2) {
+ int[][][] temp=copy(Sponge2);
+ for(int k : index[n])
+ for(int n2: SquaresPoints[k])
+ for(int n1: SquaresPoints[k])
+ temp[n2][n1][k]=0;
+ return temp;
+}
+
+int[][][][] Sponge3=new int[20][][][];
+for(int n=0; n < 20; ++n)
+ Sponge3[n]=eraseFaces(n,Sponge2);
+
+surface s3;
+real u=2/3;
+for(int n3=0; n3 < 20; ++n3) {
+ surface s2;
+ for(int n2=0; n2 < 20; ++n2) {
+ surface s1;
+ for(int n1=0; n1 < 20; ++n1) {
+ for(int k=0; k < 6; ++k){
+ transform3 T=scale3(u)*shift(M[n1])*scale3(0.5);
+ if(Sponge3[n3][n2][n1][k] > 0) {
+ s1.append(T*Squares[k]);
+ }
+ }
}
+ transform3 T=scale3(u)*shift(M[n2])*scale3(0.5);
+ s2.append(T*s1);
+ }
+ transform3 T=scale3(u)*shift(M[n3])*scale3(0.5);
+ s3.append(T*s2);
}
-
-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,render(compression=Low,merge=true));
+s3.colors(palette(s3.map(abs),Rainbow()));
+draw(s3);
diff --git a/Master/texmf/doc/asymptote/examples/diatom.asy b/Master/texmf/doc/asymptote/examples/diatom.asy
index 2ded75bf0ea..23673dcadf5 100644
--- a/Master/texmf/doc/asymptote/examples/diatom.asy
+++ b/Master/texmf/doc/asymptote/examples/diatom.asy
@@ -115,7 +115,7 @@ for(int taxon=0; taxon < n; ++taxon) {
if(taxon == final) yaxis(pic,Right,LeftTicks("%",0,10),above=true);
add(shift(location,0)*pic);
- location += pic.userMax.x;
+ location += pic.userMax().x;
}
add(new void(frame f, transform) {
diff --git a/Master/texmf/doc/asymptote/examples/extrudedcontour.asy b/Master/texmf/doc/asymptote/examples/extrudedcontour.asy
index 7b2f67459ce..dabd56b9298 100644
--- a/Master/texmf/doc/asymptote/examples/extrudedcontour.asy
+++ b/Master/texmf/doc/asymptote/examples/extrudedcontour.asy
@@ -1,6 +1,9 @@
import contour;
import palette;
import graph3;
+
+defaultrender.merge=true;
+
currentprojection=orthographic(25,10,10);
size(0,12cm);
real a=3;
diff --git a/Master/texmf/doc/asymptote/examples/filesurface.asy b/Master/texmf/doc/asymptote/examples/filesurface.asy
index 2a93c96ec19..eef9d37f494 100644
--- a/Master/texmf/doc/asymptote/examples/filesurface.asy
+++ b/Master/texmf/doc/asymptote/examples/filesurface.asy
@@ -23,8 +23,8 @@ s.colors(palette(s.map(new real(triple v) {return find(level >= v.z);}),
draw(s,meshpen=thick(),render(merge=true));
-triple m=currentpicture.userMin;
-triple M=currentpicture.userMax;
+triple m=currentpicture.userMin();
+triple M=currentpicture.userMax();
triple target=0.5*(m+M);
xaxis3("$x$",Bounds,InTicks);
diff --git a/Master/texmf/doc/asymptote/examples/floatingdisk.asy b/Master/texmf/doc/asymptote/examples/floatingdisk.asy
index 2e99ec9c2c1..be8b339767d 100644
--- a/Master/texmf/doc/asymptote/examples/floatingdisk.asy
+++ b/Master/texmf/doc/asymptote/examples/floatingdisk.asy
@@ -9,9 +9,11 @@ real l=.7;
pair pA=(-l,0);
pair pB=(l,0);
-
-path waterline=tremble(addnodes(pA..pB,1),angle=10,frequency=0.1,random=50);
-path disk=shift(0,-d)*(scale(R)*unitcircle);
+
+tremble tr=tremble(angle=10,frequency=0.1,random=50,fuzz=1);
+path waterline=tr.deform(pA..pB);
+
+path disk=shift(0,-d)*scale(R)*unitcircle;
path water=waterline--(l,-h)--(-l,-h)--(-l,0)--cycle;
path container=(l,1/7)--(l,-h)--(-l,-h)--(-l,1/7);
@@ -21,4 +23,4 @@ draw(waterline);
draw(container,linewidth(1.5));
-shipout(bbox(2mm,Fill(white)));
+shipout(bbox(2mm));
diff --git a/Master/texmf/doc/asymptote/examples/interpolate1.asy b/Master/texmf/doc/asymptote/examples/interpolate1.asy
index 9f8367a52a4..8845c8dd2f8 100644
--- a/Master/texmf/doc/asymptote/examples/interpolate1.asy
+++ b/Master/texmf/doc/asymptote/examples/interpolate1.asy
@@ -7,8 +7,6 @@ import graph;
// Test 1: The Runge effect in the Lagrange interpolation of 1/(x^2+1).
unitsize(2cm);
-xlimits(-5,5);
-ylimits(-1,1,Crop);
real f(real x) {return(1/(x^2+1));}
real df(real x) {return(-2*x/(x^2+1)^2);}
@@ -26,9 +24,14 @@ fhorner p=fhorner(h);
draw(graph(p,a,b,n=500),"$x\longmapsto{}L_{"+string(n)+"}$");
draw(graph(f,a,b),red,"$x\longmapsto{}\frac{1}{x^2+1}$");
+xlimits(-5,5);
+ylimits(-1,1,Crop);
+
xaxis("$x$",BottomTop,LeftTicks);
yaxis("$y$",LeftRight,RightTicks);
+
attach(legend(),point(10S),30S);
+
shipout("runge1");
erase();
@@ -52,11 +55,13 @@ draw(graph(p,a,b,n=500),"$x\longmapsto{}H_{"+string(n)+"}$");
draw(graph(f,a,b),red,"$x\longmapsto{}\frac{1}{x^2+1}$");
unitsize(2cm);
+
xlimits(-5,5);
ylimits(-1,5,Crop);
xaxis("$x$",BottomTop,LeftTicks);
yaxis("$y$",LeftRight,RightTicks);
+
attach(legend(),point(10S),30S);
shipout("runge2");
@@ -86,7 +91,9 @@ draw(graph(f,a,b),red,"$x\longmapsto{}\cos(x)$");
xaxis("$x$",BottomTop,LeftTicks);
yaxis("$y$",LeftRight,RightTicks);
+
attach(legend(),point(10S),30S);
+
shipout("runge3");
erase();
@@ -110,9 +117,12 @@ fhorner p=fhorner(h);
draw(graph(p,a,b,n=500),"$x\longmapsto{}L_{"+string(n)+"}$");
draw(graph(f,a,b),red,"$x\longmapsto{}\cos(x)$");
+
ylimits(-1,5,Crop);
+
xaxis("$x$",BottomTop,LeftTicks);
yaxis("$y$",LeftRight,RightTicks);
+
attach(legend(),point(10S),30S);
shipout("runge4");
@@ -122,8 +132,6 @@ erase();
// Test 5: The situation is much better using Tchebychev points.
unitsize(2cm);
-xlimits(-5,5);
-ylimits(-1,2,Crop);
real f(real x) {return(1/(x^2+1));}
real df(real x) {return(-2*x/(x^2+1)^2);}
@@ -144,6 +152,9 @@ fhorner p=fhorner(h);
draw(graph(p,a,b,n=500),"$x\longmapsto{}T_{"+string(n)+"}$");
draw(graph(f,a,b),red,"$x\longmapsto{}\frac{1}{x^2+1}$");
+xlimits(-5,5);
+ylimits(-1,2,Crop);
+
xaxis("$x$",BottomTop,LeftTicks);
yaxis("$y$",LeftRight,RightTicks);
attach(legend(),point(10S),30S);
@@ -155,8 +166,6 @@ erase();
// Test 6: Adding a few more Tchebychev points yields a very good result.
unitsize(2cm);
-xlimits(-5,5);
-ylimits(-1,2,Crop);
real f(real x) {return(1/(x^2+1));}
real df(real x) {return(-2*x/(x^2+1)^2);}
@@ -175,6 +184,9 @@ fhorner p=fhorner(h);
draw(graph(p,a,b,n=500),"$x\longmapsto{}T_{"+string(n)+"}$");
draw(graph(f,a,b),red,"$x\longmapsto{}\frac{1}{x^2+1}$");
+xlimits(-5,5);
+ylimits(-1,2,Crop);
+
xaxis("$x$",BottomTop,LeftTicks);
yaxis("$y$",LeftRight,RightTicks);
attach(legend(),point(10S),30S);
@@ -187,8 +199,6 @@ erase();
// Test 7: Another Tchebychev example.
unitsize(2cm);
-xlimits(-2,2);
-ylimits(-0.5,2,Crop);
real f(real x) {return(sqrt(abs(x-1)));}
@@ -206,6 +216,9 @@ fhorner p=fhorner(h);
draw(graph(p,a,b,n=500),"$x\longmapsto{}T_{"+string(n)+"}$");
draw(graph(f,a,b),red,"$x\longmapsto{}\sqrt{|x-1|}$");
+xlimits(-2,2);
+ylimits(-0.5,2,Crop);
+
xaxis("$x$",BottomTop,LeftTicks);
yaxis("$y$",LeftRight,RightTicks);
attach(legend(),point(10S),30S);
diff --git a/Master/texmf/doc/asymptote/examples/intro.asy b/Master/texmf/doc/asymptote/examples/intro.asy
index 5d7ce12b184..fcafefb32a6 100644
--- a/Master/texmf/doc/asymptote/examples/intro.asy
+++ b/Master/texmf/doc/asymptote/examples/intro.asy
@@ -50,7 +50,6 @@ item("4000 downloads/month from primary\hfill\\
{\tt asymptote.sourceforge.net} site alone.");
item("80\ 000 lines of low-level C++ code.");
item("36\ 000 lines of high-level Asymptote code.");
-item("Latest stable release: Version 2.00 (LGPL).");
if(long) {
title("Vector Graphics");
diff --git a/Master/texmf/doc/asymptote/examples/latexusage-1.asy b/Master/texmf/doc/asymptote/examples/latexusage-1.asy
new file mode 100644
index 00000000000..b77279c6c47
--- /dev/null
+++ b/Master/texmf/doc/asymptote/examples/latexusage-1.asy
@@ -0,0 +1,54 @@
+if(!settings.multipleView) settings.batchView=false;
+defaultfilename="latexusage-1";
+if(settings.render < 0) settings.render=4;
+settings.outformat="";
+settings.inlineimage=true;
+settings.embed=true;
+settings.toolbar=false;
+viewportmargin=(2,2);
+
+// Global Asymptote definitions can be put here.
+import three;
+usepackage("bm");
+texpreamble("\def\V#1{\bm{#1}}");
+// One can globally override the default toolbar settings here:
+// settings.toolbar=true;
+
+size(4cm,0);
+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=new picture;
+fill(intersection,c1,colour1+colour2);
+clip(intersection,c2);
+
+add(intersection);
+
+draw(c1);
+draw(c2);
+
+//draw("$\A$",box,z1); // Requires [inline] package option.
+//draw(Label("$\B$","$B$"),box,z2); // Requires [inline] package option.
+draw("$A$",box,z1);
+draw("$\V{B}$",box,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));
+viewportsize=(390.0pt,0);
diff --git a/Master/texmf/doc/asymptote/examples/latexusage-2.asy b/Master/texmf/doc/asymptote/examples/latexusage-2.asy
new file mode 100644
index 00000000000..49c6458419c
--- /dev/null
+++ b/Master/texmf/doc/asymptote/examples/latexusage-2.asy
@@ -0,0 +1,24 @@
+if(!settings.multipleView) settings.batchView=false;
+settings.inlinetex=true;
+deletepreamble();
+defaultfilename="latexusage-2";
+if(settings.render < 0) settings.render=4;
+settings.outformat="";
+settings.inlineimage=true;
+settings.embed=true;
+settings.toolbar=false;
+viewportmargin=(2,2);
+
+// Global Asymptote definitions can be put here.
+import three;
+usepackage("bm");
+texpreamble("\def\V#1{\bm{#1}}");
+// One can globally override the default toolbar settings here:
+// settings.toolbar=true;
+
+
+currentprojection=orthographic(5,4,2);
+draw(unitcube,blue);
+label("$V-E+F=2$",(0,1,0.5),3Y,blue+fontsize(17pt));
+size(0,113.81102pt,keepAspect=true);
+viewportsize=(390.0pt,0);
diff --git a/Master/texmf/doc/asymptote/examples/latexusage-3.asy b/Master/texmf/doc/asymptote/examples/latexusage-3.asy
new file mode 100644
index 00000000000..00173cb17ef
--- /dev/null
+++ b/Master/texmf/doc/asymptote/examples/latexusage-3.asy
@@ -0,0 +1,39 @@
+if(!settings.multipleView) settings.batchView=false;
+settings.inlinetex=true;
+deletepreamble();
+defaultfilename="latexusage-3";
+if(settings.render < 0) settings.render=4;
+settings.outformat="";
+settings.inlineimage=true;
+settings.embed=true;
+settings.toolbar=false;
+viewportmargin=(2,2);
+
+// Global Asymptote definitions can be put here.
+import three;
+usepackage("bm");
+texpreamble("\def\V#1{\bm{#1}}");
+// One can globally override the default toolbar settings here:
+// settings.toolbar=true;
+
+
+pair z0=(0,0);
+pair z1=(2,0);
+pair z2=(5,0);
+pair zf=z1+0.75*(z2-z1);
+
+draw(z1--z2);
+dot(z1,red+0.15cm);
+dot(z2,darkgreen+0.3cm);
+label("$m$",z1,1.2N,red);
+label("$M$",z2,1.5N,darkgreen);
+label("$\hat{\ }$",zf,0.2*S,fontsize(24pt)+blue);
+
+pair s=-0.2*I;
+draw("$x$",z0+s--z1+s,N,red,Arrows,Bars,PenMargins);
+s=-0.5*I;
+draw("$\bar{x}$",z0+s--zf+s,blue,Arrows,Bars,PenMargins);
+s=-0.95*I;
+draw("$X$",z0+s--z2+s,darkgreen,Arrows,Bars,PenMargins);
+size(390.0pt,0,keepAspect=true);
+viewportsize=(390.0pt,0);
diff --git a/Master/texmf/doc/asymptote/examples/latexusage.tex b/Master/texmf/doc/asymptote/examples/latexusage.tex
index ae555a476bd..f3c858348b9 100644
--- a/Master/texmf/doc/asymptote/examples/latexusage.tex
+++ b/Master/texmf/doc/asymptote/examples/latexusage.tex
@@ -9,14 +9,14 @@
% Use this form with latex or pdflatex to create PDF attachments by default:
%\usepackage[attach]{asymptote}
-% Enable this line to support PDF hyperlinks:
-%\usepackage{hyperref}\hypersetup{setpagesize=false,unicode}
-
% Enable this line to support the attach option:
%\usepackage[dvips]{attachfile2}
\begin{document}
+% Optional subdirectory for asy files (no spaces):
+\def\asydir{}
+
\begin{asydef}
// Global Asymptote definitions can be put here.
import three;
@@ -81,8 +81,8 @@ and height to \LaTeX\ explicitly. This 3D example can be viewed
interactively either with Adobe Reader or Asymptote's fast OpenGL-based
renderer. To support {\tt latexmk}, 3D figures should specify
\verb+inline=true+. It is sometimes desirable to embed 3D files as annotated
-attachments; this requires the optional \verb+\usepackage{attachfile2}+
-package and the \verb+attach=true+ option:
+attachments; this requires the \verb+attach=true+ option as well as the
+\verb+attachfile2+ \LaTeX\ package.
\begin{center}
\begin{asy}[height=4cm,inline=true,attach=false]
currentprojection=orthographic(5,4,2);
diff --git a/Master/texmf/doc/asymptote/examples/orthocenter.asy b/Master/texmf/doc/asymptote/examples/orthocenter.asy
index 73dfde51954..5c6807b4f25 100644
--- a/Master/texmf/doc/asymptote/examples/orthocenter.asy
+++ b/Master/texmf/doc/asymptote/examples/orthocenter.asy
@@ -37,5 +37,4 @@ dot("$A'$",Ap,dir(A--Ap),red);
dot("$B'$",Bp,dir(B--Bp),red);
dot("$C'$",Cp,dir(C--Cp),red);
-label(graphic("piicon.eps","width=2.5cm"),Ap,5ENE,red);
-
+label(graphic("piicon","width=2.5cm"),Ap,5ENE,red);
diff --git a/Master/texmf/doc/asymptote/examples/pdb.asy b/Master/texmf/doc/asymptote/examples/pdb.asy
index b4f9175ae14..b3b954c8c6a 100644
--- a/Master/texmf/doc/asymptote/examples/pdb.asy
+++ b/Master/texmf/doc/asymptote/examples/pdb.asy
@@ -11,6 +11,8 @@ currentlight=White;
defaultrender.merge=true; // Fast low-quality rendering
//defaultrender.merge=false; // Slow high-quality rendering
+bool pixel=false; // Set to true to draw dots as pixels.
+real width=10*linewidth(currentpen);
size(200);
currentprojection=perspective(30,30,15);
@@ -126,7 +128,10 @@ for(chain c : chains) {
for(int i=0; i < c.a.length-1; ++i)
draw(c.a[i].v--c.a[i+1].v,chainpen,currentlight);
for(atom a : c.a)
- dot(a.v,color(a.name),currentlight);
+ if(pixel)
+ pixel(a.v,color(a.name),width);
+ else
+ dot(a.v,color(a.name),currentlight);
natoms += c.a.length;
}
endgroup3();
@@ -136,7 +141,10 @@ write("Number of hetero atoms: ",atoms.length);
begingroup3("hetero");
for(atom h : atoms)
- dot(h.v,color(h.name),currentlight);
+ if(pixel)
+ pixel(h.v,color(h.name),width);
+ else
+ dot(h.v,color(h.name),currentlight);
endgroup3();
write("Number of hetero bonds: ",bonds.length);
@@ -154,7 +162,7 @@ string viewfilename=prefix+".views";
if(!error(input(viewfilename,check=false)))
options="3Dviews2="+viewfilename;
-if(getviews) {
+if(getviews && prc()) {
picture pic;
add(pic,embed("label",currentpicture,options=options),(0,0),N);
label(pic,cameralink("label"),(0,0),S,fontsize(12pt));
diff --git a/Master/texmf/doc/asymptote/examples/penfunctionimage.asy b/Master/texmf/doc/asymptote/examples/penfunctionimage.asy
new file mode 100644
index 00000000000..38951e550d5
--- /dev/null
+++ b/Master/texmf/doc/asymptote/examples/penfunctionimage.asy
@@ -0,0 +1,27 @@
+import palette;
+
+size(200);
+
+real fracpart(real x) {return (x-floor(x));}
+
+pair pws(pair z) {
+ pair w=(z+exp(pi*I/5)/0.9)/(1+z/0.9*exp(-pi*I/5));
+ return exp(w)*(w^3-0.5*I);
+}
+
+int N=512;
+
+pair a=(-1,-1);
+pair b=(0.5,0.5);
+real dx=(b-a).x/N;
+real dy=(b-a).y/N;
+
+pen f(int u, int v) {
+ pair z=a+(u*dx,v*dy);
+ pair w=pws(z);
+ real phase=degrees(w,warn=false);
+ real modulus=w == 0 ? 0: fracpart(log(abs(w)));
+ return hsv(phase,1,sqrt(modulus));
+}
+
+image(f,N,N,(0,0),(300,300),antialias=true);
diff --git a/Master/texmf/doc/asymptote/examples/slidedemo.asy b/Master/texmf/doc/asymptote/examples/slidedemo.asy
index 7a753a54d61..0cbd15af741 100644
--- a/Master/texmf/doc/asymptote/examples/slidedemo.asy
+++ b/Master/texmf/doc/asymptote/examples/slidedemo.asy
@@ -1,6 +1,6 @@
// Slide demo.
// Command-line options to enable stepping and/or reverse video:
-// asy [-u stepping=true] [-u reverse=true] slidedemo
+// asy [-u stepping=true] [-u reverse=true] [-u itemstep=true] slidedemo
orientation=Landscape;
diff --git a/Master/texmf/doc/asymptote/examples/square.asy b/Master/texmf/doc/asymptote/examples/square.asy
index 1bff4e438f5..6fd9d2314d7 100644
--- a/Master/texmf/doc/asymptote/examples/square.asy
+++ b/Master/texmf/doc/asymptote/examples/square.asy
@@ -1,2 +1,2 @@
-size(100,100);
+size(3cm);
draw((0,0)--(1,0)--(1,1)--(0,1)--cycle);
diff --git a/Master/texmf/doc/asymptote/examples/vertexshading.asy b/Master/texmf/doc/asymptote/examples/vertexshading.asy
index 284ca3230de..ea97b98daf3 100644
--- a/Master/texmf/doc/asymptote/examples/vertexshading.asy
+++ b/Master/texmf/doc/asymptote/examples/vertexshading.asy
@@ -1,5 +1,4 @@
import three;
-//settings.prc=false;
size(200);
diff --git a/Master/texmf/doc/asymptote/examples/worksheet.asy b/Master/texmf/doc/asymptote/examples/worksheet.asy
index f26797acabb..9894e5802b8 100644
--- a/Master/texmf/doc/asymptote/examples/worksheet.asy
+++ b/Master/texmf/doc/asymptote/examples/worksheet.asy
@@ -19,7 +19,7 @@ draw(f,z0--z0+50mm);
add(pic,f,z,Align);
z += step;
-for(int i=1; i <= 14; ++i) {
+for(int i=1; i <= 15; ++i) {
draw(pic,z--z+length);
z += step;
draw(pic,z--z+length,dashed+gray);
@@ -36,6 +36,7 @@ for(int i=1; i <= 14; ++i) {
}
else if(i == 12) label(1);
else if(i == 13) label(2);
+ else if(i == 14) label(3);
}
draw(pic,z--z+length);
diff --git a/Master/texmf/doc/asymptote/examples/worldmap.asy b/Master/texmf/doc/asymptote/examples/worldmap.asy
new file mode 100644
index 00000000000..59479fffbe2
--- /dev/null
+++ b/Master/texmf/doc/asymptote/examples/worldmap.asy
@@ -0,0 +1,87 @@
+settings.outformat="pdf";
+size(20cm);
+
+// The required data file is available here:
+// http://www.uni-graz.at/~schwaige/asymptote/worldmap.dat
+// This data was originally obtained from
+// http://www.ngdc.noaa.gov/mgg_coastline/mapit.jsp
+
+real findtheta(real phi, real epsilon=realEpsilon) {
+ // Determine for given phi the unique solution -pi/2 <= theta <= pi/2 off
+ // 2*theta+sin(2*theta)=pi*sin(phi)
+ // in the non-trivial cases by Newton iteration;
+ // theoretically the initial guess pi*sin(phi)/4 always works.
+ real nwtn(real x, real y) {return x-(2x+sin(2x)-y)/(2+2*cos(2x));};
+ real y=pi*sin(phi);
+ if(y == 0) return 0.0;
+ if(abs(y) == 1) return pi/2;
+ real startv=y/4;
+ real endv=nwtn(startv,y);
+ if(epsilon < 500*realEpsilon) epsilon=500*realEpsilon;
+ while(abs(endv-startv) > epsilon) {startv=endv; endv=nwtn(startv,y);};
+ return endv;
+}
+
+pair mollweide(real lambda, real phi, real lambda0=0){
+ // calculate the Mollweide projection centered at lambda0 for the point
+ // with coordinates(phi,lambda)
+ static real c1=2*sqrt(2)/pi;
+ static real c2=sqrt(2);
+ real theta=findtheta(phi);
+ return(c1*(lambda-lambda0)*cos(theta), c2*sin(theta));
+}
+
+guide gfrompairs(pair[] data){
+ guide gtmp;
+ for(int i=0; i < data.length; ++i) {
+ pair tmp=mollweide(radians(data[i].y),radians(data[i].x));
+ gtmp=gtmp--tmp;
+ }
+ return gtmp;
+}
+
+string datafile="worldmap.dat";
+
+file in=input(datafile,comment="/").line();
+// new commentchar since "#" is contained in the file
+pair[][] arrarrpair=new pair[][] ;
+int cnt=-1;
+bool newseg=false;
+while(true) {
+ if(eof(in)) break;
+ string str=in;
+ string[] spstr=split(str,"");
+
+ if(spstr[0] == "#") {++cnt; arrarrpair[cnt]=new pair[] ; newseg=true;}
+ if(spstr[0] != "#" && newseg) {
+ string[] spstr1=split(str,'\t'); // separator is TAB not SPACE
+ pair tmp=((real) spstr1[1],(real) spstr1[0]);
+ arrarrpair[cnt].push(tmp);
+ }
+}
+
+for(int i=0; i < arrarrpair.length; ++i)
+ draw(gfrompairs(arrarrpair[i]),1bp+black);
+
+// lines of longitude and latitude
+pair[] constlong(real lambda, int np=100) {
+ pair[] tmp;
+ for(int i=0; i <= np; ++i) tmp.push((-90+i*180/np,lambda));
+ return tmp;
+}
+
+pair[] constlat(real phi, int np=100) {
+ pair[] tmp;
+ for(int i=0; i <= 2*np; ++i) tmp.push((phi,-180+i*180/np));
+ return tmp;
+}
+
+for(int j=1; j <= 5; ++j) draw(gfrompairs(constlong(-180+j/6*360)),white);
+draw(gfrompairs(constlong(-180)),1.5bp+white);
+draw(gfrompairs(constlong(180)),1.5bp+white);
+for(int j=0; j <= 12; ++j) draw(gfrompairs(constlat(-90+j/6*180)),white);
+//draw(gfrompairs(constlong(10)),dotted);
+
+close(in);
+shipout(bbox(1mm,darkblue,Fill(lightblue)), view=true);
+