diff options
Diffstat (limited to 'Master/texmf/doc')
18 files changed, 866 insertions, 539 deletions
diff --git a/Master/texmf/doc/asymptote/CAD.pdf b/Master/texmf/doc/asymptote/CAD.pdf Binary files differindex 7076ef94893..327f2ff3b0b 100644 --- a/Master/texmf/doc/asymptote/CAD.pdf +++ b/Master/texmf/doc/asymptote/CAD.pdf diff --git a/Master/texmf/doc/asymptote/asymptote.pdf b/Master/texmf/doc/asymptote/asymptote.pdf Binary files differindex f21cc658464..d4a834d8dde 100644 --- a/Master/texmf/doc/asymptote/asymptote.pdf +++ b/Master/texmf/doc/asymptote/asymptote.pdf diff --git a/Master/texmf/doc/asymptote/examples/arrows3.asy b/Master/texmf/doc/asymptote/examples/arrows3.asy index 12ad43463ee..57fc4b3d338 100644 --- a/Master/texmf/doc/asymptote/examples/arrows3.asy +++ b/Master/texmf/doc/asymptote/examples/arrows3.asy @@ -2,6 +2,8 @@ import three; size(15cm); +defaultrender.merge=true; + currentprojection=perspective(24,14,13); currentlight=light(gray(0.5),specularfactor=3,viewport=false, (0.5,-0.5,-0.25),(0.5,0.5,0.25),(0.5,0.5,1),(-0.5,-0.5,-1)); diff --git a/Master/texmf/doc/asymptote/examples/basealign.asy b/Master/texmf/doc/asymptote/examples/basealign.asy index 4bf83c94033..d653ec3c043 100644 --- a/Master/texmf/doc/asymptote/examples/basealign.asy +++ b/Master/texmf/doc/asymptote/examples/basealign.asy @@ -2,6 +2,7 @@ import fontsize; import three; settings.autobillboard=false; +settings.embed=false; currentprojection=orthographic(Z); defaultpen(fontsize(100pt)); diff --git a/Master/texmf/doc/asymptote/examples/billboard.asy b/Master/texmf/doc/asymptote/examples/billboard.asy index e126c1c5157..6e5df871007 100644 --- a/Master/texmf/doc/asymptote/examples/billboard.asy +++ b/Master/texmf/doc/asymptote/examples/billboard.asy @@ -2,6 +2,8 @@ import three; size(100); +currentprojection=perspective(1,-2,1); + draw(unitbox); label("Billboard",X,red,Billboard); diff --git a/Master/texmf/doc/asymptote/examples/intro.asy b/Master/texmf/doc/asymptote/examples/intro.asy index 4234b8cee8e..20b03c578dc 100644 --- a/Master/texmf/doc/asymptote/examples/intro.asy +++ b/Master/texmf/doc/asymptote/examples/intro.asy @@ -1,5 +1,3 @@ -// Introduction to Asymptote - orientation=Landscape; settings.tex="pdflatex"; @@ -8,6 +6,10 @@ import slide; import three; import animate; +bool long=true; + +usepackage("mflogo"); + usersetting(); viewportsize=pagewidth-2pagemargin; @@ -18,23 +20,39 @@ viewportsize=pagewidth-2pagemargin; bibliographystyle("alpha"); itempen=fontsize(22pt); - -titlepage("Asymptote: The Vector Graphics Language", - "Andy Hammerlindl and John Bowman", - "University of Toronto and University of Alberta","August 16, 2007", - "http://asymptote.sf.net"); +defaultpen(itempen); +viewportmargin=(2,2); + +titlepage(long ? "Asymptote: The Vector Graphics Language" : + "Interactive TeX-Aware 3D Vector Graphics", + "John Bowman and Andy Hammerlindl", +"Department of Mathematical and Statistical Sciences\\ + University of Alberta\\ +%and Instituto Nacional de Matem\'atica Pura e Aplicada (IMPA) +\medskip\Green{Collaborators: Orest Shardt, Michail Vidiassov}", +"June 30, 2010", +"http://asymptote.sf.net/intro.pdf"); title("History"); -item("\TeX\ and METAFONT (Knuth, 1979)"); -item("MetaPost (Hobby, 1989): 2D Bezier Control Point Selection"); -item("Asymptote (Hammerlindl, Bowman, Prince, 2004): 2D \& 3D Graphics"); - -title("Statistics (as of April, 2007)"); -item("Runs on Windows, Mac OS X, Linux, etc."); -item("1800 downloads a month from {\tt asymptote.sourceforge.net}."); -item("33\ 000 lines of C++ code."); -item("18\ 000 lines of Asymptote code."); - +item("1979: \TeX\ and \MF\ (Knuth)"); +item("1986: 2D B\'ezier control point selection (Hobby)"); +item("1989: MetaPost (Hobby)"); +item("2004: Asymptote"); +subitem("2004: initial public release (Hammerlindl, Bowman, \& Prince)"); +subitem("2005: 3D B\'ezier control point selection (Bowman)"); +subitem("2008: 3D interactive \TeX\ within PDF files (Shardt \& Bowman)"); +subitem("2009: 3D billboard labels that always face camera (Bowman)"); +subitem("2010: 3D PDF enhancements (Vidiassov \& Bowman)"); + +title("Statistics (as of June, 2010)"); +item("Runs under Linux/UNIX, Mac OS X, Microsoft Windows."); +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"); item("Raster graphics assign colors to a grid of pixels."); figure("pixel.pdf"); @@ -61,17 +79,24 @@ add(zoom(100), (0,0)); add(zoom(10), (200,0)); add(zoom(1), (400,0)); ")); +} title("Cartesian Coordinates"); + +item("Asymptote's graphical capabilities are based on four primitive + commands: {\tt draw}, {\tt label}, {\tt fill}, {\tt clip} \cite{Bowman08}"); + asyfilecode("diagonal"); item("units are {\tt PostScript} {\it big points\/} (1 {\tt bp} = 1/72 {\tt inch})"); item("{\tt --} means join the points with a linear segment to create a {\it path}"); -item("cyclic path:"); +item("{\it cyclic\/} path:"); -asyfilecode("square"); +asycode(" +draw((0,0)--(100,0)--(100,100)--(0,100)--cycle); +"); title("Scaling to a Given Size"); @@ -79,11 +104,7 @@ item("{\tt PostScript} units are often inconvenient."); item("Instead, scale user coordinates to a specified final size:"); -code(" -size(101,101); -draw((0,0)--(1,0)--(1,1)--(0,1)--cycle); -"); -asyfigure("square"); +asyfilecode("square"); item("One can also specify the size in {\tt cm}:"); @@ -96,18 +117,36 @@ title("Labels"); item("Adding and aligning \LaTeX\ labels is easy:"); -asyfilecode("labelsquare","height=6cm"); - +asycode(preamble="defaultpen(fontsize("+string(fontsize(itempen))+"));", +"size(6cm); +draw(unitsquare); +label(\"$A$\",(0,0),SW); +label(\"$B$\",(1,0),SE); +label(\"$C$\",(1,1),NE); +label(\"$D$\",(0,1),NW); +"); -title("2D Bezier Splines"); +title("2D B\'ezier Splines"); -item("Using {\tt ..} instead of {\tt --} specifies a {\it Bezier cubic +item("Using {\tt ..} instead of {\tt --} specifies a {\it B\'ezier cubic spline}:"); code(" draw(z0 .. controls c0 and c1 .. z1,blue); "); -asyfigure("beziercurve","height=7cm"); +asyfigure(asywrite("defaultpen(fontsize("+string(fontsize(itempen))+")); +size(0,7cm); +pair z0=(0,0); +pair c0=(1,1); +pair c1=(2,1); +pair z1=(3,0); +draw(z0..controls c0 and c1 .. z1,blue); +draw(z0--c0--c1--z1,dashed); +dot(\"$z_0$\",z0,W,red); +dot(\"$c_0$\",c0,NW,red); +dot(\"$c_1$\",c1,NE,red); +dot(\"$z_1$\",z1,red); +")); equation("(1-t)^3 z_0+3t(1-t)^2 c_0+3t^2(1-t) c_1+t^3 z_1, \qquad t\in [0,1]."); @@ -139,7 +178,7 @@ dot(z); picture output; save(); -for (int i=0; i<length(p); ++i) { +for(int i=0; i<length(p); ++i) { pair z=point(p,i), dir=dir(p,i); draw((z-0.3dir)--(z+0.3dir), Arrow); } @@ -148,7 +187,7 @@ restore(); save(); guide g; -for (int i=0; i<length(p); ++i) { +for(int i=0; i<length(p); ++i) { dot(precontrol(p,i)); dot(postcontrol(p,i)); g=g--precontrol(p,i)--point(p,i)--postcontrol(p,i); @@ -161,16 +200,18 @@ shipout(output); ")); title("Filling"); -item("Use {\tt fill} to fill the inside of a path:"); +item("The {\tt fill} primitive to fill the inside of a path:"); asycode(preamble="size(0,200);"," path star; -for (int i=0; i<5; ++i) +for(int i=0; i < 5; ++i) star=star--dir(90+144i); star=star--cycle; -fill(shift(-1,0)*star,orange+zerowinding); -draw(shift(-1,0)*star,linewidth(3)); -fill(shift(1,0)*star,blue+evenodd); -draw(shift(1,0)*star,linewidth(3)); + +fill(star,orange+zerowinding); +draw(star,linewidth(3)); + +fill(shift(2,0)*star,blue+evenodd); +draw(shift(2,0)*star,linewidth(3)); "); title("Filling"); @@ -181,29 +222,23 @@ fill(p,green+zerowinding); "); title("Clipping"); -item("Pictures can be clipped to lie inside a path:"); +item("Pictures can be clipped to a path:"); asycode(preamble=" size(0,200); guide star; -for (int i=0; i<5; ++i) +for(int i=0; i<5; ++i) star=star--dir(90+144i); star=star--cycle;"," fill(star,orange+zerowinding); clip(scale(0.7)*unitcircle); draw(scale(0.7)*unitcircle); "); -item("All of Asymptote's graphical capabilities are based on four primitive - commands: {\tt draw}, {\tt fill}, {\tt clip}, and {\tt label}."); title("Affine Transforms"); -item("Affine transformations: shifts, rotations, reflections, and scalings."); -code(" -transform t=rotate(90); -write(t*(1,0)); // Writes (0,1). -"); +item("Affine transformations: shifts, rotations, reflections, and scalings + can be applied to pairs, paths, pens, strings, and even whole pictures:"); -item("Pairs, paths, pens, strings, and whole pictures can be transformed."); code(" fill(P,blue); fill(shift(2,0)*reflect((0,0),(0,1))*P, red); @@ -231,6 +266,7 @@ fill(shift(4,0)*rotate(30)*P, yellow); fill(shift(6,0)*yscale(0.7)*xscale(2)*P, green); ")); +if(long) { title("C++/Java-like Programming Syntax"); code("// Declaration: Declare x to be real: @@ -250,287 +286,11 @@ if(x == 1.0) { for(int i=0; i < 10; ++i) { write(i); }"); - -title("Helpful Math Notation"); - -item("Integer division returns a {\tt real}. Use {\tt quotient} for an integer - result:"); -code("3/4==0.75 quotient(3,4)==0"); - -item("Caret for real and integer exponentiation:"); -code("2^3 2.7^3 2.7^3.2"); - -item("Many expressions can be implicitly scaled by a numeric constant:"); -code("2pi 10cm 2x^2 3sin(x) 2(a+b)"); - -item("Pairs are complex numbers:"); -code("(0,1)*(0,1)==(-1,0)"); - -title("Function Calls"); - -item("Functions can take default arguments in any position. Arguments are - matched to the first possible location:"); -string unitsize="unitsize(0.65cm);"; -string preamble="void drawEllipse(real xsize=1, real ysize=xsize, pen p=blue) { - draw(xscale(xsize)*yscale(ysize)*unitcircle, p); -} -"; - -asycode(preamble=unitsize,preamble+" -drawEllipse(2); -drawEllipse(red); -"); - -item("Arguments can be given by name:"); -asycode(preamble=unitsize+preamble," -drawEllipse(xsize=2, ysize=1); -drawEllipse(ysize=2, xsize=3, green); -"); - -title("Rest Arguments"); -item("Rest arguments allow one to write a function that takes an arbitrary - number of arguments:"); -code(" -int sum(... int[] nums) { - int total=0; - for (int i=0; i < nums.length; ++i) - total += nums[i]; - return total; -} - -sum(1,2,3,4); // returns 10 -sum(); // returns 0 -sum(1,2,3 ... new int[] {4,5,6}); // returns 21 - -int subtract(int start ... int[] subs) { - return start - sum(... subs); -} -"); - -title("Higher-Order Functions"); - -item("Functions are first-class values. They can be passed to other - functions:"); -code("real f(real x) { - return x*sin(10x); -} -draw(graph(f,-3,3,300),red);"); -asyfigure(asywrite(" -import graph; -size(300,0); -real f(real x) { - return x*sin(10x); -} -draw(graph(f,-3,3,300),red); -")); - -title("Higher-Order Functions"); -item("Functions can return functions:"); -equation("f_n(x)=n\sin\left(\frac{x}{n}\right)."); -skip(); -string preamble=" -import graph; -size(300,0); -"; -string graphfunc2=" -typedef real func(real); -func f(int n) { - real fn(real x) { - return n*sin(x/n); - } - return fn; -} - -func f1=f(1); -real y=f1(pi); - -for (int i=1; i<=5; ++i) - draw(graph(f(i),-10,10),red); -"; -code(graphfunc2); -string name=asywrite(graphfunc2,preamble=preamble); -asy(nativeformat(),name+".asy"); -label(graphic(name+"."+nativeformat()),(0.5,0), - Fill(figureborder,figuremattpen)); - -title("Anonymous Functions"); - -item("Create new functions with {\tt new}:"); -code(" -path p=graph(new real (real x) { return x*sin(10x); },-3,3,red); - -func f(int n) { - return new real (real x) { return n*sin(x/n); }; -}"); - -item("Function definitions are just syntactic sugar for assigning function -objects to variables."); -code(" -real square(real x) { - return x^2; -} -"); - -remark("is equivalent to"); -code(" -real square(real x); -square=new real (real x) { - return x^2; -}; -"); - -title("Structures"); - -item("As in other languages, structures group together data."); -code(" -struct Person { - string firstname, lastname; - int age; -} -Person bob=new Person; -bob.firstname=\"Bob\"; -bob.lastname=\"Chesterton\"; -bob.age=24; -"); - -item("Any code in the structure body will be executed every time a new structure - is allocated..."); -code(" -struct Person { - write(\"Making a person.\"); - string firstname, lastname; - int age=18; -} -Person eve=new Person; // Writes \"Making a person.\" -write(eve.age); // Writes 18. -"); - -title("Object-Oriented Programming"); -item("Functions are defined for each instance of a structure."); -code(" -struct Quadratic { - real a,b,c; - real discriminant() { - return b^2-4*a*c; - } - real eval(real x) { - return a*x^2 + b*x + c; - } -} -"); - -item("This allows us to construct ``methods'' which are just normal functions - declared in the environment of a particular object:"); -code(" -Quadratic poly=new Quadratic; -poly.a=-1; poly.b=1; poly.c=2; - -real f(real x)=poly.eval; -real y=f(2); -draw(graph(poly.eval, -5, 5)); -"); - -title("Specialization"); - -item("Can create specialized objects just by redefining methods:"); -code(" -struct Shape { - void draw(); - real area(); -} - -Shape rectangle(real w, real h) { - Shape s=new Shape; - s.draw = new void () { - fill((0,0)--(w,0)--(w,h)--(0,h)--cycle); }; - s.area = new real () { return w*h; }; - return s; -} - -Shape circle(real radius) { - Shape s=new Shape; - s.draw = new void () { fill(scale(radius)*unitcircle); }; - s.area = new real () { return pi*radius^2; } - return s; -} -"); - -title("Overloading"); -item("Consider the code:"); -code(" -int x1=2; -int x2() { - return 7; -} -int x3(int y) { - return 2y; -} - -write(x1+x2()); // Writes 9. -write(x3(x1)+x2()); // Writes 11. -"); - -title("Overloading"); -item("{\tt x1}, {\tt x2}, and {\tt x3} are never used in the same context, so - they can all be renamed {\tt x} without ambiguity:"); -code(" -int x=2; -int x() { - return 7; -} -int x(int y) { - return 2y; } -write(x+x()); // Writes 9. -write(x(x)+x()); // Writes 11. -"); - -item("Function definitions are just variable definitions, but variables are - distinguished by their signatures to allow overloading."); - -title("Operators"); -item("Operators are just syntactic sugar for functions, and can be addressed or - defined as functions with the {\tt operator} keyword."); -code(" -int add(int x, int y)=operator +; -write(add(2,3)); // Writes 5. - -// Don't try this at home. -int operator +(int x, int y) { - return add(2x,y); -} -write(2+3); // Writes 7. -"); -item("This allows operators to be defined for new types."); - -title("Operators"); -item("Operators for constructing paths are also functions:"); -code("a.. controls b and c .. d--e"); -remark("is equivalent to"); -code( - "operator --(operator ..(a, operator controls(b,c), d), e)"); -item("This allowed us to redefine all of the path operators for 3D paths."); -asyfigure("helix","height=10cm"); - -title("Packages"); - -item("Function and structure definitions can be grouped into packages:"); -code(" -// powers.asy -real square(real x) { return x^2; } -real cube(real x) { return x^3; } -"); -remark("and imported:"); -code(" -import powers; -real eight=cube(2.0); -draw(graph(powers.square, -1, 1)); -"); - -title("Packages"); +title("Modules"); -item("There are packages for Feynman diagrams,"); +item("There are modules for Feynman diagrams,"); asyfigure("eetomumu","height=6cm"); remark("data structures,"); asyfigure(asywrite(" @@ -547,6 +307,7 @@ equations("\Phi\Phi(x_1,x_2,x_3,x_4,x_5) + &\rho_{4a}(x_1,x_2+x_3,x_4,x_5) - \rho_{4b}(x_1,x_2,x_3,x_4+x_5) \\ - &\rho_{4a}(x_1+x_2,x_3,x_4,x_5) - \rho_{4a}(x_1,x_2,x_4,x_5)."); +if(long) { title("Textbook Graph"); asy(nativeformat(),"exp"); filecode("exp.asy"); @@ -564,18 +325,20 @@ asyfilecode("filegraph","height=15cm",newslide=true); title("Logarithmic Graph"); asyfilecode("loggraph","height=15cm",newslide=true); - title("Secondary Axis"); +} else +title("Scientific Graph"); + asyfigure("secondaryaxis","height=15cm"); -title("Images"); +title("Images and Contours"); asyfigure("imagecontour","height=17cm"); title("Multiple Graphs"); asyfigure("diatom","height=17cm"); title("Hobby's 2D Direction Algorithm"); -item("A tridiagonal system of linear equations is solved to determine any unspecified directions $\theta_k$ and $\phi_k$ through each knot $z_k$:"); +item("A tridiagonal system of linear equations is solved to determine any unspecified directions $\phi_k$ and $\theta_k$ through each knot $z_k$:"); equation("\frac{\theta_{k-1}-2\phi_k}{\ell_k}= \frac{\phi_{k+1}-2\theta_k}{\ell_{k+1}}."); @@ -584,39 +347,43 @@ asyfigure("Hobbydir","height=9cm"); item("The resulting shape may be adjusted by modifying optional {\it tension\/} parameters and {\it curl\/} boundary conditions."); -//involving the curvature - title("Hobby's 2D Control Point Algorithm"); item("Having prescribed outgoing and incoming path directions $e^{i\theta}$ at node~$z_0$ and $e^{i\phi}$ at node $z_1$ relative to the vector $z_1-z_0$, the control points are determined as:"); +skip(-3); + equations("u&=&z_0+e^{i\theta}(z_1-z_0)f(\theta,-\phi),\nonumber\\ v&=&z_1-e^{i\phi}(z_1-z_0)f(-\phi,\theta),"); +skip(-3); + remark("where the relative distance function $f(\theta,\phi)$ is given by Hobby [1986]."); asyfigure("Hobbycontrol","height=9cm"); -title("Bezier Curves in 3D"); +if(long) { +title("B\'ezier Curves in 3D"); item("Apply an affine transformation"); equation("x'_i=A_{ij} x_j+C_i"); -remark("to a Bezier curve:"); +remark("to a B\'ezier curve:"); -equation("x(t)=\sum_{k=0}^3 B_k(t) P_k, \qquad t\in [0,1]."); +equation("\displaystyle x(t)=\sum_{k=0}^3 B_k(t) P_k, \qquad t\in [0,1]."); -item("The resulting curve is also a Bezier curve:"); +item("The resulting curve is also a B\'ezier curve:"); equations("x'_i(t)&=&\sum_{k=0}^3 B_k(t) A_{ij}(P_k)_j+C_i\nonumber\\ &=&\sum_{k=0}^3 B_k(t) P'_k,"); remark("where $P'_k$ is the transformed $k^{\rm th}$ control point, noting $\displaystyle\sum_{k=0}^3 B_k(t)=1.$"); +} -title("3D Generalization of Hobby's algorithm"); +title("3D Generalization of Direction Algorithm"); item("Must reduce to 2D algorithm in planar case."); @@ -625,12 +392,12 @@ item("Determine directions by applying Hobby's algorithm in the plane containing // Reformulate Hobby's equations in terms of the angle $\psi_k=$ item("The only ambiguity that can arise is the overall sign of the angles, which relates to viewing each 2D plane from opposing normal directions."); -item("A reference vector based on the mean unit normal of successive segments can be used to resolve such ambiguities."); +item("A reference vector based on the mean unit normal of successive segments can be used to resolve such ambiguities \cite{Bowman07,Bowman09}"); title("3D Control Point Algorithm"); -item("Hobby's control point algorithm can be generalized to 3D by expressing it in terms of the absolute directions $\omega_0$ and $\omega_1$:"); - +item("Express Hobby's algorithm in terms of the absolute directions $\omega_0$ and~$\omega_1$:"); +skip(-1); equation("u=z_0+\omega_0\left|z_1-z_0\right|f(\theta,-\phi),"); equation("v=z_1-\omega_1\left|z_1-z_0\right|f(-\phi,\theta),"); @@ -638,29 +405,46 @@ asyfigure("Hobbycontrol"); remark("interpreting $\theta$ and $\phi$ as the angle between the corresponding path direction vector and $z_1-z_0$."); -item("In this case there is an unambiguous reference vector for determining the relative sign of the angles $\phi$ and $\theta$."); +item("Here there is an unambiguous reference vector for determining the relative sign of the angles $\phi$ and $\theta$."); -viewportmargin=(0,0.5cm); -defaultpen(1.0); +viewportmargin=(2,0.5cm); +//defaultpen(1.0); title("Interactive 3D Saddle"); -item("A unit circle in the $X$--$Y$ plane may be filled and drawn with: -(1,0,0)..(0,1,0)..(-1,0,0)..(0,-1,0)..cycle"); +item("A unit circle in the $X$--$Y$ plane may be constructed with: +{\tt (1,0,0)..(0,1,0)..(-1,0,0)..(0,-1,0)..cycle}:"); asyinclude("unitcircle3",8cm); -remark("and then distorted into a saddle:\\ (1,0,0)..(0,1,1)..(-1,0,0)..(0,-1,1)..cycle"); +remark("and then distorted into the saddle\\ +{\tt (1,0,0)..(0,1,1)..(-1,0,0)..(0,-1,1)..cycle}:"); asyinclude("saddle",8cm); +//defaultpen(0.5); + +title("Lifting TeX to 3D"); +item("Glyphs are first split into simply connected regions and then decomposed into planar B\'ezier surface patches \cite{Bowman09,Shardt10}:"); +asyfigure("../examples/partitionExample"); + +viewportmargin=(2,1cm); +title("Label Manipulation"); +item("They can then be extruded and/or arbitrarily transformed:"); +asyinclude("../examples/label3solid"); + +title("Billboard Labels"); +defaultpen(fontsize(36pt)); +asyinclude("../examples/billboard",15cm); +defaultpen(itempen); -viewportmargin=(0,2cm); title("Smooth 3D surfaces"); -asyinclude("GaussianSurface",15cm); -defaultpen(0.5); +asyinclude("../examples/sinc",25cm); + +title("Curved 3D Arrows"); +asyinclude("../examples/arrows3",20cm); title("Slide Presentations"); -item("Asymptote has a package for preparing slides."); +item("Asymptote has a module for preparing slides."); item("It even supports embedded high-resolution PDF movies."); code(' title("Slide Presentations"); -item("Asymptote has a package for preparing slides."); +item("Asymptote has a module for preparing slides."); item("It even supports embedded high-resolution PDF movies."); '); remark("\quad\ldots"); @@ -729,8 +513,8 @@ frame cardsize(real w=0, real h=0, bool keepAspect=Aspect) { guide g=polargraph(f,0,2pi,operator ..)--cycle; filldraw(pic,g,pink); - xaxis(pic,\"$x$\"); - yaxis(pic,\"$y$\"); + xaxis(pic,\"$x$\",above=true); + yaxis(pic,\"$y$\",above=true); dot(pic,\"$(a,0)$\",(1,0),N); dot(pic,\"$(2a,0)$\",(2,0),N+E); @@ -748,7 +532,7 @@ add(cardsize(0,200), (540,0)); title("Deferred Drawing"); item("We can't draw a graphical object until we know the scaling factors for the user coordinates."); -item("Instead, store a function that when given the scaling information, draws +item("Instead, store a function that, given the scaling information, draws the scaled object."); code(" void draw(picture pic=currentpicture, path g, pen p=currentpen) { @@ -791,7 +575,7 @@ pic.addPoint(max(g),max(p));"); item("Filling ignores the pen width:"); code("pic.addPoint(min(g),(0,0)); pic.addPoint(max(g),(0,0));"); -item("Communicate with \LaTeX\ to determine label sizes:"); +item("Communicate with \LaTeX\ {\it via\/} a pipe to determine label sizes:"); asyfigure(asywrite(" size(0,100); @@ -807,14 +591,16 @@ title("Sizing"); item("When scaling the final figure to a given size $S$, we first need to determine a scaling factor $a>0$ and a shift $b$ so that all of the - coordinates when transformed will lie in the interval $[0,S]$. That is, if - $u$ and $t$ are the user and truesize components:"); + coordinates when transformed will lie in the interval $[0,S]$."); + +item("That is, if $u$ and $t$ are the user and truesize components:"); equation("0\le au+t+b \le S."); -item("We are maximizing the variable $a$ subject to a number of inequalities. - This is a linear programming problem that can be solved by the simplex - method."); +item("Maximize the variable $a$ subject to a number of inequalities."); +item("Use the simplex method to solve the resulting linear programming problem."); + +if(long) { title("Sizing"); item("Every addition of a coordinate $(t,u)$ adds two restrictions"); equation("au+t+b\ge 0,"); @@ -829,7 +615,7 @@ asyfigure(asywrite(" import palette; size(160,0); pen[] p=Rainbow(NColors=11); -for (int i=1; i<10; ++i) { +for(int i=1; i<10; ++i) { draw(scale(i)*unitcircle, p[i]+linewidth(2)); } ")); @@ -845,6 +631,7 @@ item("This defines a partial ordering on coordinates. When sizing a picture, item("In practice, the linear programming problem will have less than a dozen restraints."); item("All picture sizing is implemented in Asymptote code."); +} title("Infinite Lines"); item("Deferred drawing allows us to draw infinite lines."); @@ -852,59 +639,321 @@ code("drawline(P, Q);"); asyfigure("elliptic","height=12cm"); -title("A Final Example: Quilting"); +title("Helpful Math Notation"); + +item("Integer division returns a {\tt real}. Use {\tt quotient} for an integer + result:"); +code("3/4 == 0.75 quotient(3,4) == 0"); + +item("Caret for real and integer exponentiation:"); +code("2^3 2.7^3 2.7^3.2"); + +item("Many expressions can be implicitly scaled by a numeric constant:"); +code("2pi 10cm 2x^2 3sin(x) 2(a+b)"); + +item("Pairs are complex numbers:"); +code("(0,1)*(0,1) == (-1,0)"); + +title("Function Calls"); + +item("Functions can take default arguments in any position. Arguments are + matched to the first possible location:"); +string unitsize="unitsize(0.65cm);"; +string preamble="void drawEllipse(real xsize=1, real ysize=xsize, pen p=blue) { + draw(xscale(xsize)*yscale(ysize)*unitcircle, p); +} +"; + +asycode(preamble=unitsize,preamble+" +drawEllipse(2); +drawEllipse(red); +"); + +item("Arguments can be given by name:"); +asycode(preamble=unitsize+preamble," +drawEllipse(xsize=2, ysize=1); +drawEllipse(ysize=2, xsize=3, green); +"); + +if(long) { +title("Rest Arguments"); +item("Rest arguments allow one to write a function that takes an arbitrary + number of arguments:"); +code(" +int sum(... int[] nums) { + int total=0; + for(int i=0; i < nums.length; ++i) + total += nums[i]; + return total; +} + +sum(1,2,3,4); // returns 10 +sum(); // returns 0 +sum(1,2,3 ... new int[] {4,5,6}); // returns 21 + +int subtract(int start ... int[] subs) { + return start - sum(... subs); +} +"); +} + +title("High-Order Functions"); + +item("Functions are first-class values. They can be passed to other + functions:"); +code("import graph; +real f(real x) { + return x*sin(10x); +} +draw(graph(f,-3,3,300),red);"); asyfigure(asywrite(" -import math; +import graph; +size(300,0); +real f(real x) { + return x*sin(10x); +} +draw(graph(f,-3,3,300),red); +")); -int n=8, skip=3; +if(long) { +title("Higher-Order Functions"); +item("Functions can return functions:"); +equation("f_n(x)=n\sin\left(\frac{x}{n}\right)."); +skip(); +string preamble=" +import graph; +size(300,0); +"; +string graphfunc2=" +typedef real func(real); +func f(int n) { + real fn(real x) { + return n*sin(x/n); + } + return fn; +} -pair r(int k) { return unityroot(n,k); } +func f1=f(1); +real y=f1(pi); + +for(int i=1; i<=5; ++i) + draw(graph(f(i),-10,10),red); +"; +code(graphfunc2); +string name=asywrite(graphfunc2,preamble=preamble); +asy(nativeformat(),name+".asy"); +label(graphic(name+"."+nativeformat()),(0.5,0), + Fill(figureborder,figuremattpen)); -pen col=blue, col2=purple; +title("Anonymous Functions"); -guide square=box((1,1),(-1,-1)); +item("Create new functions with {\tt new}:"); +code(" +path p=graph(new real (real x) { return x*sin(10x); },-3,3,red); -guide step(int mult) -{ - guide g; - for (int k=0; k<n; ++k) - g=g--r(mult*k); - g=g--cycle; - return g; +func f(int n) { + return new real (real x) { return n*sin(x/n); }; +}"); + +item("Function definitions are just syntactic sugar for assigning function +objects to variables."); +code(" +real square(real x) { + return x^2; } +"); -guide oct=step(1), star=step(skip); +remark("is equivalent to"); +code(" +real square(real x); +square=new real (real x) { + return x^2; +}; +"); -guide wedge(pair z, pair v, real r, real a) -{ - pair w=expi(a/2.0); - v=unit(v)*r; - return shift(z)*((0,0)--v*w--v*conj(w)--cycle); +title("Structures"); + +item("As in other languages, structures group together data."); +code(" +struct Person { + string firstname, lastname; + int age; } +Person bob=new Person; +bob.firstname=\"Bob\"; +bob.lastname=\"Chesterton\"; +bob.age=24; +"); -filldraw(square, col); -filldraw(oct, yellow); +item("Any code in the structure body will be executed every time a new structure + is allocated..."); +code(" +struct Person { + write(\"Making a person.\"); + string firstname, lastname; + int age=18; +} +Person eve=new Person; // Writes \"Making a person.\" +write(eve.age); // Writes 18. +"); -// The interior angle of the points of the star. -real intang=pi*(1-((real)2skip)/((real)n)); +title("Modules"); -for (int k=0; k<n; ++k) { - pair z=midpoint(r(k)--r(k+1)); - guide g=wedge(z,-z,1,intang); - filldraw(g,col2); +item("Function and structure definitions can be grouped into modules:"); +code(" +// powers.asy +real square(real x) { return x^2; } +real cube(real x) { return x^3; } +"); +remark("and imported:"); +code(" +import powers; +real eight=cube(2.0); +draw(graph(powers.square, -1, 1)); +"); } -fill(star,yellow); -filldraw(star,evenodd+col); +title("Object-Oriented Programming"); +item("Functions are defined for each instance of a structure."); +code(" +struct Quadratic { + real a,b,c; + real discriminant() { + return b^2-4*a*c; + } + real eval(real x) { + return a*x^2 + b*x + c; + } +} +"); -size(5inch,0); -")); +item("This allows us to construct ``methods'' which are just normal functions + declared in the environment of a particular object:"); +code(" +Quadratic poly=new Quadratic; +poly.a=-1; poly.b=1; poly.c=2; + +real f(real x)=poly.eval; +real y=f(2); +draw(graph(poly.eval, -5, 5)); +"); + +title("Specialization"); + +item("Can create specialized objects just by redefining methods:"); +code(" +struct Shape { + void draw(); + real area(); +} + +Shape rectangle(real w, real h) { + Shape s=new Shape; + s.draw = new void () { + fill((0,0)--(w,0)--(w,h)--(0,h)--cycle); }; + s.area = new real () { return w*h; }; + return s; +} + +Shape circle(real radius) { + Shape s=new Shape; + s.draw = new void () { fill(scale(radius)*unitcircle); }; + s.area = new real () { return pi*radius^2; } + return s; +} +"); + +title("Overloading"); +item("Consider the code:"); +code(" +int x1=2; +int x2() { + return 7; +} +int x3(int y) { + return 2y; +} + +write(x1+x2()); // Writes 9. +write(x3(x1)+x2()); // Writes 11. +"); + +title("Overloading"); +item("{\tt x1}, {\tt x2}, and {\tt x3} are never used in the same context, so + they can all be renamed {\tt x} without ambiguity:"); +code(" +int x=2; +int x() { + return 7; +} +int x(int y) { + return 2y; +} + +write(x+x()); // Writes 9. +write(x(x)+x()); // Writes 11. +"); + +item("Function definitions are just variable definitions, but variables are + distinguished by their signatures to allow overloading."); + +title("Operators"); +item("Operators are just syntactic sugar for functions, and can be addressed or + defined as functions with the {\tt operator} keyword."); +code(" +int add(int x, int y)=operator +; +write(add(2,3)); // Writes 5. + +// Don't try this at home. +int operator +(int x, int y) { + return add(2x,y); +} +write(2+3); // Writes 7. +"); +item("This allows operators to be defined for new types."); + +title("Operators"); +item("Operators for constructing paths are also functions:"); +code("a.. controls b and c .. d--e"); +remark("is equivalent to"); +code( + "operator --(operator ..(a, operator controls(b,c), d), e)"); +item("This allowed us to redefine all of the path operators for 3D paths."); + +title("Summary"); + +item("Asymptote:"); +subitem("uses IEEE floating point numerics;"); +subitem("uses C++/Java-like syntax;"); +subitem("supports deferred drawing for automatic picture sizing;"); +subitem("supports Grayscale, RGB, CMYK, and HSV colour spaces;"); +subitem("supports PostScript shading, pattern fills, and function shading;"); +subitem("can fill nonsimply connected regions;"); +subitem("generalizes MetaPost path construction algorithms to 3D;"); +subitem("lifts \TeX\ to 3D;"); +subitem("supports 3D billboard labels and PDF grouping."); bibliography("refs"); -viewportsize=viewportmargin=0; +viewportmargin=(2,2); +viewportsize=0; +defaultpen(0.5); title("\mbox{Asymptote: 2D \& 3D Vector Graphics Language}"); asyinclude("../examples/logo3"); skip(); center("\tt http://asymptote.sf.net"); -center("(freely available under the GNU public license)"); +center("(freely available under the LGPL license)"); + +// LocalWords: pdflatex mflogo viewportsize pagewidth pagemargin goysr bibtex +// LocalWords: itempen defaultrender medskip Orest Shardt Vidiassov MF ezier +// LocalWords: Hammerlindl MetaPost PDF hfill LGPL pdf asywrite zoombox LaTeX +// LocalWords: asyfilecode PostScript asycode unitsquare beziercurve grey bw +// LocalWords: lightgrey zerowinding evenodd sw unitsize drawEllipse nums fn +// LocalWords: frac graphfunc func nativeformat figureborder figuremattpen bt +// LocalWords: firstname lastname eval eetomumu binarytree filecode datagraph +// LocalWords: lineargraph filegraph loggraph secondaryaxis imagecontour ij +// LocalWords: tridiagonal Hobbydir nonumber Hobbycontrol th viewportmargin +// LocalWords: asyinclude dotpen wheelpoint yequals xaxis yaxis cardsize mc +// LocalWords: polargraph filldraw addPoint lightblue truesize le au NColors +// LocalWords: drawline unityroot mult oct intang IEEE numerics HSV colour +// LocalWords: nonsimply 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..7f0d6a2b3aa --- /dev/null +++ b/Master/texmf/doc/asymptote/examples/latexusage-1.asy @@ -0,0 +1,55 @@ +if(!settings.multipleView) + settings.batchView=false; +defaultfilename="latexusage-1"; +if(settings.render < 0) settings.render=4; +settings.inlineimage=true; +settings.embed=true; +settings.outformat=""; +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..b91be72419f --- /dev/null +++ b/Master/texmf/doc/asymptote/examples/latexusage-2.asy @@ -0,0 +1,23 @@ +if(!settings.multipleView) + settings.batchView=false; +defaultfilename="latexusage-2"; +if(settings.render < 0) settings.render=4; +settings.inlineimage=true; +settings.embed=true; +settings.outformat=""; +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,4cm); +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..d3990c9cbfb --- /dev/null +++ b/Master/texmf/doc/asymptote/examples/latexusage-3.asy @@ -0,0 +1,38 @@ +if(!settings.multipleView) + settings.batchView=false; +defaultfilename="latexusage-3"; +if(settings.render < 0) settings.render=4; +settings.inlineimage=true; +settings.embed=true; +settings.outformat=""; +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); +viewportsize=(390.0pt,0); diff --git a/Master/texmf/doc/asymptote/examples/latexusage.tex b/Master/texmf/doc/asymptote/examples/latexusage.tex index bc0638098c2..6324238f1a2 100644 --- a/Master/texmf/doc/asymptote/examples/latexusage.tex +++ b/Master/texmf/doc/asymptote/examples/latexusage.tex @@ -16,6 +16,7 @@ \begin{asydef} // 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: @@ -80,8 +81,6 @@ this requires the optional \verb+\usepackage{attachfile2}+ package and 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/mergeExample.asy b/Master/texmf/doc/asymptote/examples/mergeExample.asy new file mode 100644 index 00000000000..e0fdcd0f6c7 --- /dev/null +++ b/Master/texmf/doc/asymptote/examples/mergeExample.asy @@ -0,0 +1,77 @@ +size(16cm); +import bezulate; + +pen edgepen=linewidth(1)+blue; +pen dotpen=deepgreen; +pen labelpen=fontsize(8pt); + +path outer = (0.5,5){E}..(5,-1){S}..{W}(4,-4)..{W}(2.5,-1.5){W}..(-0.3,-2.5){W}..(-3,0)..cycle; +outer = subdivide(outer); +path[] p = {outer,shift(-0.5,1.0)*rotate(-22)*scale(1.5,2.4)*subdivide(unitcircle),shift(2.3,0.3)*scale(0.7)*unitcircle}; + +// a +filldraw(p,lightgrey+evenodd); + +real w = 1.1*(max(p).x-min(p).x); + +// b +p = shift(w)*p; +draw(p); +path l = point(p[1],2)--point(p[0],4); +draw(l,red); +for(int i = 0; i < p.length; ++i) +{ + real[][] ts = intersections(l,p[i]); + for(real[] t:ts) + dot(point(l,t[0])); +} +path l2 = point(l,intersections(l,p[0])[0][0])--point(l,intersections(l,p[2])[1][0]); +real to = intersections(l,p[0])[0][1]; +real ti = intersections(l,p[2])[1][1]; +draw(l2,edgepen); +label("$A$",point(l2,1),2E,labelpen); +label("$B$",point(l2,0),1.5E,labelpen); + +// c +p = shift(w)*p; +l2 = shift(w)*l2; +draw(p); +real timeoffset=2; +path t1=subpath(p[0],to,to+timeoffset); +t1=t1--point(p[2],ti)--cycle; +fill(t1,lightgrey); +draw(point(p[2],ti)--point(p[0],to+4),red); +dot(Label("$A$",labelpen),point(p[2],ti),2E,dotpen); +dot(Label("$B$",labelpen),point(p[0],to),1.5E,dotpen); +dot(Label("$C$",labelpen),point(p[0],to+timeoffset),1.5S,dotpen); +draw(t1,edgepen); +dot(point(p[0],to+4)); +draw(shift(-0.5,-0.5)*subpath(p[0],to+4,to+timeoffset+0.5),Arrow(4)); + +// d +p = shift(w)*p; +p[0] = subpath(p[0],to+timeoffset,to+length(p[0]))--uncycle(p[2],ti)--cycle; +p.delete(2); +draw(p); + +// e +p = shift(w)*p; +path q=point(p[1],0)--subpath(p[0],15.4,16)--cycle; +p[0] = subpath(p[0],16,15.4+length(p[0]))--uncycle(p[1],0)--cycle; +p.delete(1); +filldraw(p,lightgrey); + +// f +p = shift(w)*p; +filldraw(bezulate(p),lightgrey); +filldraw(shift(3w)*t1,lightgrey); +filldraw(shift(w)*q,lightgrey); + + +real x = min(p).x - 4.5w; +string l = "abcdef"; +for(int i = 0; i < 6; ++i) +{ + label("("+substr(l,i,1)+")",(x,min(p).y),3S,fontsize(10pt)); + x += w; +} diff --git a/Master/texmf/doc/asymptote/examples/partitionExample.asy b/Master/texmf/doc/asymptote/examples/partitionExample.asy new file mode 100644 index 00000000000..4974d99d9ca --- /dev/null +++ b/Master/texmf/doc/asymptote/examples/partitionExample.asy @@ -0,0 +1,27 @@ +size(15cm); +import bezulate; + +path[] p = texpath("$\sigma \Theta$"); +pair m = min(p); +pair M = max(p); +real midy = 0.5(M.y+m.y); + +path[] alpha = p[0:2]; +path[] theta = p[2:5]; +filldraw(p,lightgrey,black); + +draw("{\tt partition}",(M.x+1mm,midy)--(M.x+5mm,midy),Arrow); +draw((M.x+1mm,midy+1mm)--(M.x+5mm,midy+2mm),Arrow); +draw((M.x+1mm,midy-1mm)--(M.x+5mm,midy-2mm),Arrow); + +filldraw(shift((M.x+8.5mm,midy+3.5mm))*alpha,lightgrey,black); +filldraw(shift((M.x+5.5mm,0))*theta[0:2],lightgrey,black); +filldraw(shift(M.x+5.5mm,midy-2.5mm)*theta[2:3],lightgrey,black); + +draw("{\tt merge}, {\tt bezulate}",(M.x+9mm,midy+3mm)--(M.x+15mm,midy+3mm),Arrow); +draw("{\tt merge}, {\tt bezulate}",(M.x+9mm,midy)--(M.x+15mm,midy),Arrow); +draw("{\tt bezulate}",(M.x+9mm,midy-2.5mm)--(M.x+15mm,midy-2.5mm),Arrow); + +filldraw(shift(M.x+16mm-min(alpha).x,midy+3.5mm)*bezulate(alpha),lightgrey,black); +filldraw(shift(M.x+16mm-min(theta[0:2]).x,0)*bezulate(theta[0:2]),lightgrey,black); +filldraw(shift(M.x+16mm-min(theta[0:2]).x,midy-2.5mm)*bezulate(theta[2:3]),lightgrey,black); diff --git a/Master/texmf/doc/asymptote/examples/quilt.asy b/Master/texmf/doc/asymptote/examples/quilt.asy new file mode 100644 index 00000000000..7a84017762c --- /dev/null +++ b/Master/texmf/doc/asymptote/examples/quilt.asy @@ -0,0 +1,44 @@ +import math; + +int n=8, skip=3; + +pair r(int k) { return unityroot(n,k); } + +pen col=blue, col2=purple; + +guide square=box((1,1),(-1,-1)); + +guide step(int mult) +{ + guide g; + for(int k=0; k<n; ++k) + g=g--r(mult*k); + g=g--cycle; + return g; +} + +guide oct=step(1), star=step(skip); + +guide wedge(pair z, pair v, real r, real a) +{ + pair w=expi(a/2.0); + v=unit(v)*r; + return shift(z)*((0,0)--v*w--v*conj(w)--cycle); +} + +filldraw(square, col); +filldraw(oct, yellow); + +// The interior angle of the points of the star. +real intang=pi*(1-((real)2skip)/((real)n)); + +for(int k=0; k<n; ++k) { + pair z=midpoint(r(k)--r(k+1)); + guide g=wedge(z,-z,1,intang); + filldraw(g,col2); +} + +fill(star,yellow); +filldraw(star,evenodd+col); + +size(5inch,0); diff --git a/Master/texmf/doc/asymptote/examples/workcone.asy b/Master/texmf/doc/asymptote/examples/workcone.asy index 37efb5cc86b..5d102d86214 100644 --- a/Master/texmf/doc/asymptote/examples/workcone.asy +++ b/Master/texmf/doc/asymptote/examples/workcone.asy @@ -16,22 +16,22 @@ real x1=r*s1/h; real s2=sr+0.2; real x2=r*s2/h; -//render render=render(compression=Low,merge=true); +render render=render(compression=0,merge=true); path3 p=(0,0,0)--(x,0,s); revolution a=revolution(p,Z); -draw(surface(a,4),lightblue+opacity(0.5)); +draw(surface(a,4),lightblue+opacity(0.5),render); path3 q=(x,0,s)--(r,0,h); revolution b=revolution(q,Z); -draw(surface(b),white+opacity(0.5)); +draw(surface(b),white+opacity(0.5),render); draw((-r-1,0,0)--(r+1,0,0)); draw((0,0,0)--(0,0,h+1),dashed); path3 w=(x1,0,s1)--(x2,0,s2)--(0,0,s2); revolution b=revolution(w,Z); -draw(surface(b),blue+opacity(0.5)); +draw(surface(b),blue+opacity(0.5),render); draw(circle((0,0,s2),x2)); draw(circle((0,0,s1),x1)); diff --git a/Master/texmf/doc/asymptote/examples/xstitch.asy b/Master/texmf/doc/asymptote/examples/xstitch.asy index 6e692643ae1..5f332881733 100644 --- a/Master/texmf/doc/asymptote/examples/xstitch.asy +++ b/Master/texmf/doc/asymptote/examples/xstitch.asy @@ -155,11 +155,12 @@ void drawSection(int xmin, int xmax, int ymin, int ymax) { write("stitch count: ",stitchCount); - shipout("xstitch"+string(shipoutNumber),pic); + // shipout("xstitch"+string(shipoutNumber),pic); + shipout(pic); ++shipoutNumber; } -drawSection(-1,width+1,-1,height+1); +//drawSection(-1,width+1,-1,height+1); //drawSection(-1,80,height-80,height+1); diff --git a/Master/texmf/doc/info/asy-faq.info b/Master/texmf/doc/info/asy-faq.info index 4741db226ae..64d6def87ce 100644 --- a/Master/texmf/doc/info/asy-faq.info +++ b/Master/texmf/doc/info/asy-faq.info @@ -9,7 +9,7 @@ END-INFO-DIR-ENTRY File: $prefix.info, Node: Top, Next: Question 1.1, Up: (dir) ASYMPTOTE FREQUENTLY ASKED QUESTIONS - 25 Jun 2010 + 05 Jul 2010 This is the list of Frequently Asked Questions about Asymptote (asy). diff --git a/Master/texmf/doc/info/asymptote.info b/Master/texmf/doc/info/asymptote.info index 45ab814b89a..af0f271a9d2 100644 --- a/Master/texmf/doc/info/asymptote.info +++ b/Master/texmf/doc/info/asymptote.info @@ -1,7 +1,7 @@ This is asymptote.info, produced by makeinfo version 4.13 from ../asymptote.texi. -This file documents `Asymptote', version 2.00. +This file documents `Asymptote', version 2.01. `http://asymptote.sourceforge.net' @@ -23,7 +23,7 @@ File: asymptote.info, Node: Top, Next: Description, Up: (dir) Asymptote ********* -This file documents `Asymptote', version 2.00. +This file documents `Asymptote', version 2.01. `http://asymptote.sourceforge.net' @@ -89,7 +89,7 @@ Programming * Functions:: Traditional and high-order functions * Arrays:: Dynamic vectors * Casts:: Implicit and explicit casts -* Import:: Importing external `Asymptote' packages +* Import:: Importing external `Asymptote' modules * Static:: Where to allocate your variable? Operators @@ -1382,7 +1382,7 @@ languages. * Functions:: Traditional and high-order functions * Arrays:: Dynamic vectors * Casts:: Implicit and explicit casts -* Import:: Importing external `Asymptote' packages +* Import:: Importing external `Asymptote' modules * Static:: Where to allocate your variable? @@ -2322,10 +2322,10 @@ number, until it saturates with one or more color components equal to 1. lineskip=1.2*size)'. The default font size, 12pt, may be changed with `defaultpen(pen)'. Nonstandard font sizes may require inserting import fontsize; - at the beginning of the file (this requires the `fix-cm' package + at the beginning of the file (this requires the `type1cm' package available from - `http://www.ctan.org/tex-archive/help/Catalogue/entries/fix-cm' + `http://www.ctan.org/tex-archive/help/Catalogue/entries/type1cm' and included in recent `LaTeX' distributions). The font size and line skip of a pen can be examined with the routines `real fontsize(pen p=currentpen)' and `real lineskip(pen p=currentpen)', @@ -3083,6 +3083,12 @@ int x=5; real y=4.3; pen reddash=red+dashed; + `var' may also be used with the extended `for' loop syntax. + +int[] a = {1,2,3}; +for (var x : a) + write(x); + File: asymptote.info, Node: Structures, Next: Operators, Prev: Variable initializers, Up: Programming @@ -4658,7 +4664,11 @@ pdflatex latexusage To switch between using `latex' and `pdflatex' you may first need to remove the files `latexusage-*', `latexusage_.pre', and -`latexusage.aux'. +`latexusage.aux'. Version 1.13 of `Asymptote.sty' supports processing +each figure separately: `asy latexusage' is equivalent to `asy +latexusage-*.asy'. For example, one may wish to reduce memory usage by +generating each figure in a separate `UNIX' process: +/bin/ls latexusage-*.asy | xargs --replace=% asy % One can specify `width', `height', `viewportwidth', `viewportheight', and `attach' `keyval'-style options to the `asy' @@ -4707,6 +4717,7 @@ and `LaTeX' is available at `http://dario.dse.nl/projects/asylatex/'. \begin{asydef} // 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: @@ -4771,8 +4782,6 @@ this requires the optional \verb+\usepackage{attachfile2}+ package and 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)); @@ -8519,7 +8528,7 @@ Index (line 6) * atleast: Bezier curves. (line 56) * attach <1>: graph. (line 415) -* attach: LaTeX usage. (line 31) +* attach: LaTeX usage. (line 35) * autoadjust: three. (line 354) * autoimport: Options. (line 110) * automatic scaling: graph. (line 682) @@ -8867,7 +8876,6 @@ Index * firstcut: Paths and guides. (line 247) * fit: Frames and pictures. (line 103) * fit3: three. (line 269) -* fix-cm: Pens. (line 178) * fixedscaling: Frames and pictures. (line 74) * floor: Mathematical functions. (line 26) @@ -8934,7 +8942,7 @@ Index * guide: Paths and guides. (line 300) * guide3: three. (line 6) * hatch: Pens. (line 267) -* height: LaTeX usage. (line 31) +* height: LaTeX usage. (line 35) * help <1>: Debugger. (line 30) * help <2>: Help. (line 6) * help: Interactive mode. (line 44) @@ -9561,6 +9569,7 @@ Index * tube <1>: tube. (line 6) * tube: three. (line 110) * tutorial: Tutorial. (line 6) +* type1cm: Pens. (line 178) * typedef <1>: Functions. (line 36) * typedef: Data types. (line 344) * undefined: Paths and guides. (line 268) @@ -9603,10 +9612,10 @@ Index * verbatim: Frames and pictures. (line 271) * vertex-dependent colors: three. (line 81) * Vertical: flowchart. (line 81) -* viewportheight: LaTeX usage. (line 31) +* viewportheight: LaTeX usage. (line 35) * viewportmargin: three. (line 262) * viewportsize: three. (line 262) -* viewportwidth: LaTeX usage. (line 31) +* viewportwidth: LaTeX usage. (line 35) * views: three. (line 231) * vim: Editing modes. (line 33) * virtual functions: Structures. (line 181) @@ -9617,7 +9626,7 @@ Index * wheel mouse: GUI. (line 6) * while: Programming. (line 29) * white-space string delimiter mode: Arrays. (line 359) -* width: LaTeX usage. (line 31) +* width: LaTeX usage. (line 35) * windingnumber: Paths and guides. (line 268) * word: Arrays. (line 359) * write <1>: Arrays. (line 399) @@ -9688,41 +9697,41 @@ Index Tag Table: Node: Top574 -Node: Description6833 -Node: Installation10334 -Node: UNIX binary distributions11387 -Node: MacOS X binary distributions12493 -Node: Microsoft Windows13377 -Ref: psview14087 -Node: Configuring15008 -Node: Search paths19229 -Node: Compiling from UNIX source20026 -Ref: multisampling20615 -Node: Editing modes23025 -Node: Subversion25457 -Node: Uninstall25920 -Node: Tutorial26270 -Ref: unitcircle30496 -Node: Drawing commands32432 -Node: draw34143 -Ref: arrows35291 -Node: fill40534 -Ref: gradient shading41578 -Node: clip45806 -Node: label46398 -Ref: Label47097 -Node: Bezier curves52822 -Node: Programming56399 -Ref: array iteration57213 -Node: Data types58295 -Ref: format67303 -Node: Paths and guides70906 -Ref: circle71160 -Ref: arctime76648 -Ref: extension80503 -Node: Pens87186 -Ref: fillrule94552 -Ref: basealign95449 +Node: Description6832 +Node: Installation10333 +Node: UNIX binary distributions11386 +Node: MacOS X binary distributions12492 +Node: Microsoft Windows13376 +Ref: psview14086 +Node: Configuring15007 +Node: Search paths19228 +Node: Compiling from UNIX source20025 +Ref: multisampling20614 +Node: Editing modes23024 +Node: Subversion25456 +Node: Uninstall25919 +Node: Tutorial26269 +Ref: unitcircle30495 +Node: Drawing commands32431 +Node: draw34142 +Ref: arrows35290 +Node: fill40533 +Ref: gradient shading41577 +Node: clip45805 +Node: label46397 +Ref: Label47096 +Node: Bezier curves52821 +Node: Programming56398 +Ref: array iteration57212 +Node: Data types58293 +Ref: format67301 +Node: Paths and guides70904 +Ref: circle71158 +Ref: arctime76646 +Ref: extension80501 +Node: Pens87184 +Ref: fillrule94550 +Ref: basealign95447 Ref: transparency98274 Ref: makepen101717 Ref: overwrite102555 @@ -9740,93 +9749,93 @@ Node: Files120055 Ref: cd121020 Ref: scroll125452 Node: Variable initializers128525 -Node: Structures131138 -Node: Operators138582 -Node: Arithmetic & logical138896 -Node: Self & prefix operators140870 -Node: User-defined operators141658 -Node: Implicit scaling142569 -Node: Functions143132 -Ref: stack overflow145885 -Node: Default arguments146449 -Node: Named arguments147188 -Node: Rest arguments149350 -Node: Mathematical functions152160 -Node: Arrays156767 -Ref: sort163817 -Ref: tridiagonal166221 -Ref: solve167449 -Node: Slices171642 -Node: Casts175532 -Node: Import177497 -Node: Static182724 -Node: LaTeX usage185618 -Node: Base modules191092 -Node: plain193592 -Node: simplex194244 -Node: math194517 -Node: interpolate197222 -Node: geometry197501 -Node: trembling198095 -Node: stats198446 -Node: patterns198706 -Node: markers198942 -Node: tree200725 -Node: binarytree200913 -Node: drawtree201502 -Node: syzygy201706 -Node: feynman201980 -Node: roundedpath202255 -Node: animation202538 -Ref: animate202955 -Node: embed204094 -Node: slide205883 -Node: MetaPost206223 -Node: unicode206939 -Node: latin1207827 -Node: babel208195 -Node: labelpath208424 -Node: labelpath3209244 -Node: annotate209555 -Node: CAD210026 -Node: graph210336 -Ref: ticks217465 -Ref: pathmarkers230744 -Ref: marker231209 -Ref: markuniform231560 -Ref: errorbars233351 -Ref: automatic scaling237407 -Node: palette248053 -Ref: images248171 -Ref: image252342 -Ref: logimage252820 -Ref: penimage253626 -Node: three254070 -Ref: PostScript3D278612 -Node: obj280304 -Node: graph3280556 -Ref: GaussianSurface285681 -Node: grid3286785 -Node: solids287525 -Node: tube288473 -Node: flowchart290708 -Node: contour295277 -Node: contour3300402 -Node: slopefield300709 -Node: ode302146 -Node: Options302406 -Ref: configuration file308251 -Ref: settings308251 -Ref: convert309452 -Node: Interactive mode312419 -Ref: history314572 -Node: GUI315877 -Node: GUI installation316380 -Node: GUI usage317510 -Node: PostScript to Asymptote318413 -Node: Help319169 -Node: Debugger320905 -Node: Credits322690 -Node: Index323622 +Node: Structures131250 +Node: Operators138694 +Node: Arithmetic & logical139008 +Node: Self & prefix operators140982 +Node: User-defined operators141770 +Node: Implicit scaling142681 +Node: Functions143244 +Ref: stack overflow145997 +Node: Default arguments146561 +Node: Named arguments147300 +Node: Rest arguments149462 +Node: Mathematical functions152272 +Node: Arrays156879 +Ref: sort163929 +Ref: tridiagonal166333 +Ref: solve167561 +Node: Slices171754 +Node: Casts175644 +Node: Import177609 +Node: Static182836 +Node: LaTeX usage185730 +Node: Base modules191468 +Node: plain193968 +Node: simplex194620 +Node: math194893 +Node: interpolate197598 +Node: geometry197877 +Node: trembling198471 +Node: stats198822 +Node: patterns199082 +Node: markers199318 +Node: tree201101 +Node: binarytree201289 +Node: drawtree201878 +Node: syzygy202082 +Node: feynman202356 +Node: roundedpath202631 +Node: animation202914 +Ref: animate203331 +Node: embed204470 +Node: slide206259 +Node: MetaPost206599 +Node: unicode207315 +Node: latin1208203 +Node: babel208571 +Node: labelpath208800 +Node: labelpath3209620 +Node: annotate209931 +Node: CAD210402 +Node: graph210712 +Ref: ticks217841 +Ref: pathmarkers231120 +Ref: marker231585 +Ref: markuniform231936 +Ref: errorbars233727 +Ref: automatic scaling237783 +Node: palette248429 +Ref: images248547 +Ref: image252718 +Ref: logimage253196 +Ref: penimage254002 +Node: three254446 +Ref: PostScript3D278988 +Node: obj280680 +Node: graph3280932 +Ref: GaussianSurface286057 +Node: grid3287161 +Node: solids287901 +Node: tube288849 +Node: flowchart291084 +Node: contour295653 +Node: contour3300778 +Node: slopefield301085 +Node: ode302522 +Node: Options302782 +Ref: configuration file308627 +Ref: settings308627 +Ref: convert309828 +Node: Interactive mode312795 +Ref: history314948 +Node: GUI316253 +Node: GUI installation316756 +Node: GUI usage317886 +Node: PostScript to Asymptote318789 +Node: Help319545 +Node: Debugger321281 +Node: Credits323066 +Node: Index323998 End Tag Table diff --git a/Master/texmf/doc/man/man1/asy.man1.pdf b/Master/texmf/doc/man/man1/asy.man1.pdf Binary files differindex 80ae55c122b..964a9724a2a 100644 --- a/Master/texmf/doc/man/man1/asy.man1.pdf +++ b/Master/texmf/doc/man/man1/asy.man1.pdf |