diff options
author | Karl Berry <karl@freefriends.org> | 2016-02-07 00:27:20 +0000 |
---|---|---|
committer | Karl Berry <karl@freefriends.org> | 2016-02-07 00:27:20 +0000 |
commit | 0f5e19a268f4d86c2897f590563f21c8277c18d1 (patch) | |
tree | 7e65891f29ccde62ed60cbcc94e7fb7631429ac2 /Build/source/utils/asymptote/examples | |
parent | 1b8f7f1bf982c75d77d85ac6855d48332cd41ca4 (diff) |
asy 2.36 sources
git-svn-id: svn://tug.org/texlive/trunk@39610 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Build/source/utils/asymptote/examples')
-rw-r--r-- | Build/source/utils/asymptote/examples/BezierTriangle.asy | 10 | ||||
-rw-r--r-- | Build/source/utils/asymptote/examples/fequlogo.asy | 2 | ||||
-rw-r--r-- | Build/source/utils/asymptote/examples/filesurface.asy | 2 | ||||
-rw-r--r-- | Build/source/utils/asymptote/examples/genusthree.asy (renamed from Build/source/utils/asymptote/examples/lemniscate.asy) | 7 | ||||
-rw-r--r-- | Build/source/utils/asymptote/examples/genustwo.asy | 36 | ||||
-rw-r--r-- | Build/source/utils/asymptote/examples/tetra.asy | 12 | ||||
-rw-r--r-- | Build/source/utils/asymptote/examples/threeviews.asy | 3 | ||||
-rw-r--r-- | Build/source/utils/asymptote/examples/vertexshading.asy | 5 |
8 files changed, 72 insertions, 5 deletions
diff --git a/Build/source/utils/asymptote/examples/BezierTriangle.asy b/Build/source/utils/asymptote/examples/BezierTriangle.asy new file mode 100644 index 00000000000..2942dbf042f --- /dev/null +++ b/Build/source/utils/asymptote/examples/BezierTriangle.asy @@ -0,0 +1,10 @@ +import three; +currentprojection=perspective(-2,5,1); + +size(10cm); + +surface s=surface((0,0,0)--(3,0,0)--(1.5,3*sqrt(3)/2,0)--cycle, + new triple[] {(1.5,sqrt(3)/2,2)}); + +draw(s,red); + diff --git a/Build/source/utils/asymptote/examples/fequlogo.asy b/Build/source/utils/asymptote/examples/fequlogo.asy index e53e1831419..b928e42197b 100644 --- a/Build/source/utils/asymptote/examples/fequlogo.asy +++ b/Build/source/utils/asymptote/examples/fequlogo.asy @@ -7,7 +7,7 @@ import obj; size(200,0); size3(200); -settings.render=8; +if(settings.render < 0) settings.render=8; texpreamble("\usepackage[T1]{fontenc}"); texpreamble("\usepackage{ccfonts,eulervm}"); diff --git a/Build/source/utils/asymptote/examples/filesurface.asy b/Build/source/utils/asymptote/examples/filesurface.asy index eef9d37f494..b4817a05863 100644 --- a/Build/source/utils/asymptote/examples/filesurface.asy +++ b/Build/source/utils/asymptote/examples/filesurface.asy @@ -7,7 +7,7 @@ file in=input("filesurface.dat").line(); real[] x=in; real[] y=in; -real[][] f=in.dimension(0,0); +real[][] f=in; triple f(pair t) { int i=round(t.x); diff --git a/Build/source/utils/asymptote/examples/lemniscate.asy b/Build/source/utils/asymptote/examples/genusthree.asy index b151e43c18b..b3b7eb7f2b2 100644 --- a/Build/source/utils/asymptote/examples/lemniscate.asy +++ b/Build/source/utils/asymptote/examples/genusthree.asy @@ -1,5 +1,3 @@ -settings.outformat = "png";; -settings.render = 16; size(8cm); import smoothcontour3; @@ -9,12 +7,17 @@ real erdos(pair z, int n) { return abs(z^n-1)^2 - 1; } real h = 0.12; +// Erdos lemniscate of order 3: real lemn3(real x, real y) { return erdos((x,y), 3); } +// "Inflate" the order 3 (planar) lemniscate into a +// smooth surface: real f(real x, real y, real z) { return lemn3(x,y)^2 + (16*abs((x,y))^4 + 1) * (z^2 - h^2); } +// Draw the implicit surface on a box with diagonally opposite +// corners at (-3,-3,-3), (3,3,3). draw(implicitsurface(f,a=(-3,-3,-3),b=(3,3,3),overlapedges=true), surfacepen=material(diffusepen=gray(0.5),emissivepen=gray(0.4), specularpen=gray(0.1))); diff --git a/Build/source/utils/asymptote/examples/genustwo.asy b/Build/source/utils/asymptote/examples/genustwo.asy new file mode 100644 index 00000000000..0d346481d04 --- /dev/null +++ b/Build/source/utils/asymptote/examples/genustwo.asy @@ -0,0 +1,36 @@ +size(10cm,0); +import smoothcontour3; +currentprojection=perspective((18,20,10)); +if(settings.render < 0) settings.render=8; + +real tuberadius = 0.69; + +// Convert to cylindrical coordinates to draw +// a circle revolved about the z axis. +real toruscontour(real x, real y, real z) { + real r = sqrt(x^2 + y^2); + return (r-2)^2 + z^2 - tuberadius^2; +} + +// Take the union of the two tangent tori (by taking +// the product of the functions defining them). Then +// add (or subtract) a bit of noise to smooth things +// out. +real f(real x, real y, real z) { + real f1 = toruscontour(x - 2 - tuberadius, y, z); + real f2 = toruscontour(x + 2 + tuberadius, y, z); + return f1 * f2 - 0.1; +} + +// The noisy function extends a bit farther than the union of +// the two tori, so include a bit of extra space in the box. +triple max = (2*(2+tuberadius), 2+tuberadius, tuberadius) + + (0.1, 0.1, 0.1); +triple min = -max; + +// Draw the implicit surface. +draw(implicitsurface(f, min, max, overlapedges=true, + nx=20, nz=5), + surfacepen=material(diffusepen=gray(0.6), + emissivepen=gray(0.3), + specularpen=gray(0.1))); diff --git a/Build/source/utils/asymptote/examples/tetra.asy b/Build/source/utils/asymptote/examples/tetra.asy new file mode 100644 index 00000000000..a20d27b8dbe --- /dev/null +++ b/Build/source/utils/asymptote/examples/tetra.asy @@ -0,0 +1,12 @@ +import graph3; +unitsize(1cm); +currentprojection=orthographic(10,5,5); +triple O=(0,0,0),N=(0,0,10),A=(8.66,0,-5), B=(-4.33,7.5,-5),C=(-4.33,-7.5,-5); +path3[] D=N--A--B--C--N--B^^A--C; +draw(surface(A--B--C--cycle),.5*blue+.5*white+opacity(.5)); +draw(surface(N--B--C--cycle),.5*green+.5*white+opacity(.5)); +draw(surface(N--C--A--cycle),.5*yellow+.5*white+opacity(.5)); +draw(surface(N--A--B--cycle),.5*red+.5*white+opacity(.5)); +draw(D,blue+1bp); +dot(D);dot(O); +label("$O$",O,E);label("$N$",N,N);label("$A$",A,SE);label("$B$",B,E);label("$C$",C,W+S); diff --git a/Build/source/utils/asymptote/examples/threeviews.asy b/Build/source/utils/asymptote/examples/threeviews.asy index 1bcc36ae8d7..c723abd452b 100644 --- a/Build/source/utils/asymptote/examples/threeviews.asy +++ b/Build/source/utils/asymptote/examples/threeviews.asy @@ -4,11 +4,12 @@ picture pic; unitsize(pic,5cm); currentlight.viewport=false; -settings.render=4; +if(settings.render < 0) settings.render=4; settings.toolbar=false; viewportmargin=(1cm,1cm); draw(pic,scale3(0.5)*unitsphere,green,render(compression=Low,merge=true)); + draw(pic,Label("$x$",1),O--X); draw(pic,Label("$y$",1),O--Y); draw(pic,Label("$z$",1),O--Z); diff --git a/Build/source/utils/asymptote/examples/vertexshading.asy b/Build/source/utils/asymptote/examples/vertexshading.asy index 13821ec0058..a5555d66f70 100644 --- a/Build/source/utils/asymptote/examples/vertexshading.asy +++ b/Build/source/utils/asymptote/examples/vertexshading.asy @@ -7,3 +7,8 @@ currentprojection=perspective(4,5,5); draw(surface(unitcircle3,new pen[] {red,green,blue,black})); draw(surface(shift(Z)*unitsquare3, new pen[] {red,green+opacity(0.5),blue,black})); +draw(surface(shift(X)*((0,0,0)..controls (1,0,0) and (2,0,0)..(3,0,0).. + controls (2.5,sqrt(3)/2,0) and (2,sqrt(3),0).. + (1.5,3*sqrt(3)/2,0).. + controls (1,sqrt(3),0) and (0.5,sqrt(3)/2,0)..cycle), + new triple[] {(1.5,sqrt(3)/2,2)},new pen[] {red,green,blue})); |