summaryrefslogtreecommitdiff
path: root/Build/source/utils/asymptote/examples
diff options
context:
space:
mode:
authorKarl Berry <karl@freefriends.org>2011-05-28 02:18:52 +0000
committerKarl Berry <karl@freefriends.org>2011-05-28 02:18:52 +0000
commitc59fe5fe4739f0c61560f05d4e42b4e552219b27 (patch)
tree8cf79e85e394b3177a28d374415840a4e0a025ad /Build/source/utils/asymptote/examples
parent771db15706dbf3f4af8b630dcb15646a3e5fda00 (diff)
asy 2.10
git-svn-id: svn://tug.org/texlive/trunk@22633 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Build/source/utils/asymptote/examples')
-rw-r--r--Build/source/utils/asymptote/examples/NURBScurve.asy2
-rw-r--r--Build/source/utils/asymptote/examples/NURBSsurface.asy11
-rw-r--r--Build/source/utils/asymptote/examples/SierpinskiSponge.asy119
-rw-r--r--Build/source/utils/asymptote/examples/extrudedcontour.asy3
-rw-r--r--Build/source/utils/asymptote/examples/filesurface.asy4
-rw-r--r--Build/source/utils/asymptote/examples/floatingdisk.asy10
-rw-r--r--Build/source/utils/asymptote/examples/interpolate1.asy29
-rw-r--r--Build/source/utils/asymptote/examples/orthocenter.asy3
-rw-r--r--Build/source/utils/asymptote/examples/pdb.asy14
-rw-r--r--Build/source/utils/asymptote/examples/slidedemo.asy2
-rw-r--r--Build/source/utils/asymptote/examples/vertexshading.asy1
-rw-r--r--Build/source/utils/asymptote/examples/worksheet.asy3
-rw-r--r--Build/source/utils/asymptote/examples/worldmap.asy87
13 files changed, 229 insertions, 59 deletions
diff --git a/Build/source/utils/asymptote/examples/NURBScurve.asy b/Build/source/utils/asymptote/examples/NURBScurve.asy
index b3b8c393b9e..c4da5c2ff5f 100644
--- a/Build/source/utils/asymptote/examples/NURBScurve.asy
+++ b/Build/source/utils/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/Build/source/utils/asymptote/examples/NURBSsurface.asy b/Build/source/utils/asymptote/examples/NURBSsurface.asy
index 878fd956393..32df6ff98ea 100644
--- a/Build/source/utils/asymptote/examples/NURBSsurface.asy
+++ b/Build/source/utils/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/Build/source/utils/asymptote/examples/SierpinskiSponge.asy b/Build/source/utils/asymptote/examples/SierpinskiSponge.asy
index 328447d4ac4..c398aa511c6 100644
--- a/Build/source/utils/asymptote/examples/SierpinskiSponge.asy
+++ b/Build/source/utils/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/Build/source/utils/asymptote/examples/extrudedcontour.asy b/Build/source/utils/asymptote/examples/extrudedcontour.asy
index 7b2f67459ce..dabd56b9298 100644
--- a/Build/source/utils/asymptote/examples/extrudedcontour.asy
+++ b/Build/source/utils/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/Build/source/utils/asymptote/examples/filesurface.asy b/Build/source/utils/asymptote/examples/filesurface.asy
index 2a93c96ec19..eef9d37f494 100644
--- a/Build/source/utils/asymptote/examples/filesurface.asy
+++ b/Build/source/utils/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/Build/source/utils/asymptote/examples/floatingdisk.asy b/Build/source/utils/asymptote/examples/floatingdisk.asy
index 2e99ec9c2c1..be8b339767d 100644
--- a/Build/source/utils/asymptote/examples/floatingdisk.asy
+++ b/Build/source/utils/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/Build/source/utils/asymptote/examples/interpolate1.asy b/Build/source/utils/asymptote/examples/interpolate1.asy
index 9f8367a52a4..8845c8dd2f8 100644
--- a/Build/source/utils/asymptote/examples/interpolate1.asy
+++ b/Build/source/utils/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/Build/source/utils/asymptote/examples/orthocenter.asy b/Build/source/utils/asymptote/examples/orthocenter.asy
index 73dfde51954..5c6807b4f25 100644
--- a/Build/source/utils/asymptote/examples/orthocenter.asy
+++ b/Build/source/utils/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/Build/source/utils/asymptote/examples/pdb.asy b/Build/source/utils/asymptote/examples/pdb.asy
index b4f9175ae14..b3b954c8c6a 100644
--- a/Build/source/utils/asymptote/examples/pdb.asy
+++ b/Build/source/utils/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/Build/source/utils/asymptote/examples/slidedemo.asy b/Build/source/utils/asymptote/examples/slidedemo.asy
index 7a753a54d61..0cbd15af741 100644
--- a/Build/source/utils/asymptote/examples/slidedemo.asy
+++ b/Build/source/utils/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/Build/source/utils/asymptote/examples/vertexshading.asy b/Build/source/utils/asymptote/examples/vertexshading.asy
index 284ca3230de..ea97b98daf3 100644
--- a/Build/source/utils/asymptote/examples/vertexshading.asy
+++ b/Build/source/utils/asymptote/examples/vertexshading.asy
@@ -1,5 +1,4 @@
import three;
-//settings.prc=false;
size(200);
diff --git a/Build/source/utils/asymptote/examples/worksheet.asy b/Build/source/utils/asymptote/examples/worksheet.asy
index f26797acabb..9894e5802b8 100644
--- a/Build/source/utils/asymptote/examples/worksheet.asy
+++ b/Build/source/utils/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/Build/source/utils/asymptote/examples/worldmap.asy b/Build/source/utils/asymptote/examples/worldmap.asy
new file mode 100644
index 00000000000..59479fffbe2
--- /dev/null
+++ b/Build/source/utils/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);
+