summaryrefslogtreecommitdiff
path: root/Master/texmf/doc/asymptote/examples
diff options
context:
space:
mode:
authorKarl Berry <karl@freefriends.org>2010-06-09 23:27:17 +0000
committerKarl Berry <karl@freefriends.org>2010-06-09 23:27:17 +0000
commitfa8eb4b879ad12a28dfcc0fec3d229b345975b01 (patch)
tree51a9c98eae950aba97a7a1140489f4b08204b8f2 /Master/texmf/doc/asymptote/examples
parentf7d3e62739d22ea35204a4a65e8e6c96bb7aaaa9 (diff)
asymptote 1.96
git-svn-id: svn://tug.org/texlive/trunk@18854 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf/doc/asymptote/examples')
-rw-r--r--Master/texmf/doc/asymptote/examples/100d.views33
-rw-r--r--Master/texmf/doc/asymptote/examples/BezierSurface.asy9
-rw-r--r--Master/texmf/doc/asymptote/examples/Klein.asy15
-rw-r--r--Master/texmf/doc/asymptote/examples/NURBSsphere.asy70
-rw-r--r--Master/texmf/doc/asymptote/examples/cube.asy1
-rw-r--r--Master/texmf/doc/asymptote/examples/join3.asy5
-rw-r--r--Master/texmf/doc/asymptote/examples/label3zoom.asy16
-rw-r--r--Master/texmf/doc/asymptote/examples/latexusage.tex3
-rw-r--r--Master/texmf/doc/asymptote/examples/parametricsurface.asy4
-rw-r--r--Master/texmf/doc/asymptote/examples/pdb.asy15
-rw-r--r--Master/texmf/doc/asymptote/examples/pipeintersection.asy2
-rw-r--r--Master/texmf/doc/asymptote/examples/sphere.asy2
12 files changed, 124 insertions, 51 deletions
diff --git a/Master/texmf/doc/asymptote/examples/100d.views b/Master/texmf/doc/asymptote/examples/100d.views
index b3a1be12936..5e73cb0c8b9 100644
--- a/Master/texmf/doc/asymptote/examples/100d.views
+++ b/Master/texmf/doc/asymptote/examples/100d.views
@@ -1,3 +1,30 @@
-{0 0 -14.425469398498535}{0 0 1}{14.425469398498535}{}{27.905145957890003}
-{0.3336401879787445 -0.0024074832908809185 -14.015975952148438}{-0.7636404037475586 -0.17614173889160156 0.6211501359939575}{15.868016873340485}{-58.88738872302071}{27.905145957890003}
-[Arbitrary Label]{0.3336401879787445 -0.0024074832908809185 -14.015975952148438}{-0.8299760222434998 0.19688645005226135 -0.5218961238861084}{15.868016035928465}{-94.62674045286937}{27.905145957890003}
+VIEW%={View A}
+ COO=0.000001944790710695088 -0.000000199754154551 -303.740966796875
+ C2C=-0.43931567668914795 -0.011656288057565689 0.8982571363449097
+ ROO=367.52660744556164
+ ROLL=-75.86431813030065
+ AAC=34.903342413559436
+ BGCOLOR=1. 1. 1.
+ LIGHTS=Artwork
+ RENDERMODE=Solid
+END
+VIEW%={View B}
+ COO=-52.16141891479492 50.85958480834961 -249.23748779296875
+ C2C=-0.0608830563724041 0.722907543182373 -0.6882571578025818
+ ROO=117.10558117788756
+ ROLL=105.68252665017765
+ AAC=34.903342413559436
+ BGCOLOR=1. 1. 1.
+ LIGHTS=Artwork
+ RENDERMODE=Solid
+END
+VIEW%={View C}
+ COO=2.2545230388641357 2.9914066791534424 -300.3456115722656
+ C2C=0.8536049127578735 0.3032689690589905 -0.42354053258895874
+ ROO=303.7410359852936
+ ROLL=-126.08445879535664
+ AAC=34.903342413559436
+ BGCOLOR=1. 1. 1.
+ LIGHTS=Artwork
+ RENDERMODE=Solid
+END
diff --git a/Master/texmf/doc/asymptote/examples/BezierSurface.asy b/Master/texmf/doc/asymptote/examples/BezierSurface.asy
index bf386baf7e5..f8cbc458ca0 100644
--- a/Master/texmf/doc/asymptote/examples/BezierSurface.asy
+++ b/Master/texmf/doc/asymptote/examples/BezierSurface.asy
@@ -1,8 +1,13 @@
import three;
-string viewpoint="{-24.132780075073242 7.2992024421691895 7.695427417755127}{0.8244762420654297 -0.563306450843811 0.0540805421769619}{35.62141440580922}{17.392748820528627}{}";
+string viewpoint="
+COO=-684.0787963867188 206.90650939941406 218.13809204101562
+C2C=0.8244762420654297 -0.563306450843811 0.0540805421769619
+ROO=1009.7407942621448
+ROLL=17.39344555165265
+";
-//viewpoint=getstring("viewpoint",viewpoint);
+// viewpoint=getstring("viewpoint",viewpoint);
currentprojection=perspective(viewpoint);
triple[][][] P={
diff --git a/Master/texmf/doc/asymptote/examples/Klein.asy b/Master/texmf/doc/asymptote/examples/Klein.asy
index 0d31c495f01..b2f6d1b0e79 100644
--- a/Master/texmf/doc/asymptote/examples/Klein.asy
+++ b/Master/texmf/doc/asymptote/examples/Klein.asy
@@ -22,7 +22,7 @@ triple f(pair t) {
}
surface s=surface(f,(0,0),(2pi,2pi),8,8,Spline);
-draw(s,lightolive+white);
+draw(s,lightolive+white,"bottle");
string lo="$\displaystyle u\in[0,\pi]: \cases{x=3\cos u(1+\sin u)+(2-\cos u)\cos u\cos v,\cr
y=8\sin u+(2-\cos u)\sin u\cos v,\cr
@@ -34,11 +34,18 @@ z=(2-\cos u)\sin v.\cr}$";
real h=0.0125;
-draw(surface(xscale(-0.38)*yscale(-0.18)*lo,s,0,1.7,h,bottom=false));
-draw(surface(xscale(0.26)*yscale(0.1)*rotate(90)*hi,s,4.9,1.4,h,bottom=false));
+begingroup3("parametrization");
+draw(surface(xscale(-0.38)*yscale(-0.18)*lo,s,0,1.7,h,bottom=false),
+ "[0,pi]");
+draw(surface(xscale(0.26)*yscale(0.1)*rotate(90)*hi,s,4.9,1.4,h,bottom=false),
+ "[pi,2pi]");
+endgroup3();
+
+begingroup3("boundary");
draw(s.uequals(0),blue+dashed);
draw(s.uequals(pi),blue+dashed);
+endgroup3();
add(new void(frame f, transform3 t, picture pic, projection P) {
- draw(f,invert(box(min(f,P),max(f,P)),P));
+ draw(f,invert(box(min(f,P),max(f,P)),P),"frame");
});
diff --git a/Master/texmf/doc/asymptote/examples/NURBSsphere.asy b/Master/texmf/doc/asymptote/examples/NURBSsphere.asy
index d7f0e77321d..5258c9986de 100644
--- a/Master/texmf/doc/asymptote/examples/NURBSsphere.asy
+++ b/Master/texmf/doc/asymptote/examples/NURBSsphere.asy
@@ -1,32 +1,46 @@
import three;
-size(400);
+/* Reference:
+@article{Qin97,
+ title={{Representing quadric surfaces using NURBS surfaces}},
+ author={Qin, K.},
+ journal={Journal of Computer Science and Technology},
+ volume={12},
+ number={3},
+ pages={210--216},
+ year={1997},
+ publisher={Springer}
+}
+*/
+
+size(10cm);
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);
+// udegree=2, vdegree=3, nu=3, nv=4;
+
+real[] W={2/3,1/3,1};
+real[] w={1,1/3,1/3,1};
+
+// 10 distinct control points
+triple[][] P={{(0,0,1),(-2,-2,1),(-2,-2,-1),(0,0,-1)},
+ {(0,0,1),(2,-2,1),(2,-2,-1),(0,0,-1)},
+ {(0,0,1),(2,2,1),(2,2,-1),(0,0,-1)},
+ {(0,0,1),(-2,2,1),(-2,2,-1),(0,0,-1)}};
+
+P.cyclic=true;
+
+real[][] weights=new real[3][4];
+for(int i=0; i < 3; ++i)
+for(int j=0; j < 4; ++j)
+ weights[i][j]=W[i]*w[j];
+
+real[] uknot={0,0,1/3,1/2,1,1};
+real[] vknot={0,0,0,0,1,1,1,1};
+
+int N=1;
+
+for(int k=0; k < N; ++k)
+for(int i=0; i < 4; ++i)
+ draw(shift(k*Z)*P[i:i+3],uknot,vknot,weights,blue);
+
+// draw(unitsphere,red+opacity(0.1));
diff --git a/Master/texmf/doc/asymptote/examples/cube.asy b/Master/texmf/doc/asymptote/examples/cube.asy
index 436e1e2729f..acfecfdd7d4 100644
--- a/Master/texmf/doc/asymptote/examples/cube.asy
+++ b/Master/texmf/doc/asymptote/examples/cube.asy
@@ -1,5 +1,4 @@
import three;
-dotgranularity=0; // Render dots as spheres.
currentprojection=orthographic(5,4,2,center=true);
diff --git a/Master/texmf/doc/asymptote/examples/join3.asy b/Master/texmf/doc/asymptote/examples/join3.asy
index 62d5faaaee6..9513d522b4d 100644
--- a/Master/texmf/doc/asymptote/examples/join3.asy
+++ b/Master/texmf/doc/asymptote/examples/join3.asy
@@ -15,10 +15,7 @@ path3 p=z[0]..z[1]---z[2]::{Y}z[3]
&z[3]..z[4]--z[5]::{Y}z[6]
&z[6]::z[7]---z[8]..{Y}z[9];
-draw(p,grey+linewidth(4mm)+opacity(0.5));
+draw(p,grey+linewidth(4mm),currentlight);
xaxis3(Label(XY()*"$x$",align=-3Y),red,above=true);
yaxis3(Label(XY()*"$y$",align=-3X),red,above=true);
-
-dot(z);
-
diff --git a/Master/texmf/doc/asymptote/examples/label3zoom.asy b/Master/texmf/doc/asymptote/examples/label3zoom.asy
new file mode 100644
index 00000000000..7eafccd8fcd
--- /dev/null
+++ b/Master/texmf/doc/asymptote/examples/label3zoom.asy
@@ -0,0 +1,16 @@
+import three;
+
+currentlight=Headlamp;
+size(469.75499pt,0);
+
+currentprojection=perspective(
+camera=(160.119024441391,136.348802919248,253.822628496226),
+up=(-0.188035408976828,0.910392236102215,-0.368549401594584),
+target=(25.5462739598034,1.77605243766079,-9.93996244768584),
+zoom=5.59734733413271,
+angle=5.14449021168139,
+viewportshift=(0.813449720559684,-0.604674743165144),
+autoadjust=false);
+
+draw(scale3(4)*extrude("$\displaystyle\int\limits_{-\infty}^{+\infty}\!\! e^{-\alpha x^2}\!\!=\sqrt{\frac{\pi}{\alpha}}$",2Z),
+ material(blue,ambientpen=mediumgray));
diff --git a/Master/texmf/doc/asymptote/examples/latexusage.tex b/Master/texmf/doc/asymptote/examples/latexusage.tex
index f073f80258f..bc0638098c2 100644
--- a/Master/texmf/doc/asymptote/examples/latexusage.tex
+++ b/Master/texmf/doc/asymptote/examples/latexusage.tex
@@ -7,7 +7,7 @@
%\usepackage[inline]{asymptote}
% Enable this line to support PDF hyperlinks:
-%\usepackage[setpagesize=false]{hyperref}
+%\usepackage{hyperref}\hypersetup{setpagesize=false}
% Enable this line for PDF attachments with asy environment option attach=true:
%\usepackage[dvips]{attachfile2}
@@ -81,6 +81,7 @@ the \verb+{attach=true}+ option:
\begin{center}
\begin{asy}[height=4cm,attach=false]
import three;
+defaultrender.margin=3pt;
currentprojection=orthographic(5,4,2);
draw(unitcube,blue);
label("$V-E+F=2$",(0,1,0.5),3Y,blue+fontsize(17pt));
diff --git a/Master/texmf/doc/asymptote/examples/parametricsurface.asy b/Master/texmf/doc/asymptote/examples/parametricsurface.asy
index f78e8470658..de669b59faf 100644
--- a/Master/texmf/doc/asymptote/examples/parametricsurface.asy
+++ b/Master/texmf/doc/asymptote/examples/parametricsurface.asy
@@ -14,10 +14,10 @@ pen p=rgb(0.2,0.5,0.7);
surface s=surface(f,(0,0),(2pi,2pi),8,8,Spline);
// surface only
-draw(s,lightgray);
+//draw(s,lightgray);
// mesh only
// draw(s,nullpen,meshpen=p);
// surface & mesh
-// draw(s,lightgray,meshpen=p);
+draw(s,lightgray,meshpen=p);
diff --git a/Master/texmf/doc/asymptote/examples/pdb.asy b/Master/texmf/doc/asymptote/examples/pdb.asy
index e06b1241bce..b4f9175ae14 100644
--- a/Master/texmf/doc/asymptote/examples/pdb.asy
+++ b/Master/texmf/doc/asymptote/examples/pdb.asy
@@ -9,12 +9,12 @@ bool getviews=true;
currentlight=White;
//currentlight=nolight;
+defaultrender.merge=true; // Fast low-quality rendering
+//defaultrender.merge=false; // Slow high-quality rendering
+
size(200);
currentprojection=perspective(30,30,15);
-// Uncomment this line for more accurate (but slower) PDF rendering
-//dotgranularity=0;
-
pen chainpen=green;
pen hetpen=purple;
@@ -121,6 +121,7 @@ while(true) {
write("Number of atomic chains: ",chains.length);
int natoms;
+begingroup3("chained");
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);
@@ -128,25 +129,30 @@ for(chain c : chains) {
dot(a.v,color(a.name),currentlight);
natoms += c.a.length;
}
+endgroup3();
write("Number of chained atoms: ",natoms);
write("Number of hetero atoms: ",atoms.length);
+begingroup3("hetero");
for(atom h : atoms)
dot(h.v,color(h.name),currentlight);
+endgroup3();
write("Number of hetero bonds: ",bonds.length);
+begingroup3("bonds");
for(bond b : bonds) {
triple v(int i) {return atoms[find(serials == i)].v;}
draw(v(b.i)--v(b.j),hetpen,currentlight);
}
+endgroup3();
string options;
string viewfilename=prefix+".views";
if(!error(input(viewfilename,check=false)))
- options="3Dviews="+viewfilename;
+ options="3Dviews2="+viewfilename;
if(getviews) {
picture pic;
@@ -155,3 +161,4 @@ if(getviews) {
shipout(prefix,pic,options=options);
} else
shipout(prefix,options=options);
+
diff --git a/Master/texmf/doc/asymptote/examples/pipeintersection.asy b/Master/texmf/doc/asymptote/examples/pipeintersection.asy
index d65b8b562ea..5bf9cfbe6f3 100644
--- a/Master/texmf/doc/asymptote/examples/pipeintersection.asy
+++ b/Master/texmf/doc/asymptote/examples/pipeintersection.asy
@@ -9,4 +9,4 @@ real f(pair z) {return min(sqrt(1-z.x^2),sqrt(1-z.y^2));}
surface s=surface(f,(0,0),(1,1),40,Spline);
transform3 t=rotate(90,O,Z), t2=t*t, t3=t2*t, i=xscale3(-1)*zscale3(-1);
-draw(surface(s,t*s,t2*s,t3*s,i*s,i*t*s,i*t2*s,i*t3*s),blue);
+draw(surface(s,t*s,t2*s,t3*s,i*s,i*t*s,i*t2*s,i*t3*s),blue,render(merge=true));
diff --git a/Master/texmf/doc/asymptote/examples/sphere.asy b/Master/texmf/doc/asymptote/examples/sphere.asy
index 8c5a444d01a..41f3f548895 100644
--- a/Master/texmf/doc/asymptote/examples/sphere.asy
+++ b/Master/texmf/doc/asymptote/examples/sphere.asy
@@ -3,4 +3,4 @@ import three;
size(200);
currentprojection=orthographic(5,4,3);
-draw(unitsphere,green);
+draw(unitsphere,green,render(compression=Zero));