diff options
author | Karl Berry <karl@freefriends.org> | 2013-04-07 18:26:53 +0000 |
---|---|---|
committer | Karl Berry <karl@freefriends.org> | 2013-04-07 18:26:53 +0000 |
commit | b04c2e1a42573e9735547702356c7b9a769a6855 (patch) | |
tree | c0753443f39500a062d7698fe6b94359c813f871 /Master/texmf-dist/doc/asymptote/examples/shellmethod.asy | |
parent | fb0bf13304a356f197bfc1add17f98c07e96f17b (diff) |
texmf -> texmf-dist: doc
git-svn-id: svn://tug.org/texlive/trunk@29714 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/doc/asymptote/examples/shellmethod.asy')
-rw-r--r-- | Master/texmf-dist/doc/asymptote/examples/shellmethod.asy | 41 |
1 files changed, 41 insertions, 0 deletions
diff --git a/Master/texmf-dist/doc/asymptote/examples/shellmethod.asy b/Master/texmf-dist/doc/asymptote/examples/shellmethod.asy new file mode 100644 index 00000000000..c8e541f2a62 --- /dev/null +++ b/Master/texmf-dist/doc/asymptote/examples/shellmethod.asy @@ -0,0 +1,41 @@ +import graph3; +import solids; + +size(400); +currentprojection=perspective(0,-1,30,up=Y); +currentlight=light(gray(0.75),(0.25,-0.25,1),(0,1,0)); + +pen color=green; +real alpha=240; + +real f(real x) {return 2x^2-x^3;} +pair F(real x) {return (x,f(x));} +triple F3(real x) {return (x,f(x),0);} + +int n=10; +path3[] blocks=new path3[n]; +for(int i=1; i <= n; ++i) { + real height=f((i-0.5)*2/n); + real left=(i-1)*2/n; + real right=i*2/n; + blocks[i-1]= + (left,0,0)--(left,height,0)--(right,height,0)--(right,0,0)--cycle; +} + +path p=graph(F,0,2,n,operator ..)--cycle; +surface s=surface(p); +path3 p3=path3(p); + +render render=render(compression=0,merge=true); + +revolution a=revolution(p3,Y,0,alpha); +draw(surface(a),color,render); +draw(rotate(alpha,Y)*s,color,render); +for(int i=0; i < n; ++i) + draw(surface(blocks[i]),color+opacity(0.5),black,render); +draw(p3); + +xaxis3(Label("$x$",1,align=2X),Arrow3); +yaxis3(Label("$y$",1,align=2Y),ymax=1.4,dashed,Arrow3); +arrow("$y=2x^2-x^3$",XYplane(F(1.8)),X+Z,1.5cm,red,Arrow3(DefaultHead2)); +draw(arc(1.17Y,0.3,90,0,7.5,180),ArcArrow3); |