"Fossies" - the Fresh Open Source Software Archive

Member "asymptote-2.60/examples/xxsq01x-1.asy" (6 Nov 2019, 868 Bytes) of package /linux/misc/asymptote-2.60.src.tgz:


As a special service "Fossies" has tried to format the requested text file into HTML format (style: standard) with prefixed line numbers. Alternatively you can here view or download the uninterpreted source code file.

    1 import graph3;
    2 import solids;
    3 size(300);
    4 currentprojection=perspective(0,2,10,up=Y);
    5 currentlight=Viewport;
    6 
    7 pen color=green;
    8 
    9 real f(real x) {return x^2;}
   10 pair F(real x) {return (x,f(x));}
   11 triple F3(real x) {return (x,f(x),0);}
   12 
   13 path p=graph(F,0,1,n=10,operator ..)--cycle;
   14 path3 p3=path3(p);
   15 
   16 revolution a=revolution(-X,p3,Y,0,180);
   17 render render=render(merge=true);
   18 draw(surface(a),color);
   19 surface s=surface(p);
   20 draw(s,color);
   21 transform3 t=shift(-2X)*rotate(180,Y);
   22 draw(t*s,color);
   23 draw(p3);
   24 draw(t*p3);
   25 
   26 draw((-1,0,0)--(-1,1,0),dashed);
   27 xaxis3(Label("$x$",1),Arrow3);
   28 yaxis3(Label("$y$",1),Arrow3);
   29 dot(Label("$(1,1)$"),(1,1,0));
   30 dot(Label("$(-1,1)$"),(-1,1,0),W);
   31 arrow("$y=x^{2}$",F3(0.7),X,1cm,red); 
   32 arrow("$y=x$",(0.3,0.3,0),X,1.5cm,red); 
   33 draw(circle((-1,1,0),2,Y),dashed);
   34 draw((-1,1,0)--(1,1,0),dashed);
   35 draw(shift(-X)*arc(0.02Y,0.3,90,0,0,0,CW),Arrow3);