"Fossies" - the Fresh Open Source Software Archive

Member "asymptote-2.61/examples/torus.asy" (18 Nov 2019, 413 Bytes) of package /linux/misc/asymptote-2.61.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 size(200);
    2 import graph3;
    3 
    4 currentprojection=perspective(5,4,4);
    5 
    6 real R=3;
    7 real a=1;
    8 
    9 /*
   10 import solids;
   11 revolution torus=revolution(reverse(Circle(R*X,a,Y,32)),Z,90,345);
   12 surface s=surface(torus);
   13 */
   14 
   15 triple f(pair t) {
   16   return ((R+a*cos(t.y))*cos(t.x),(R+a*cos(t.y))*sin(t.x),a*sin(t.y));
   17 }
   18 
   19 surface s=surface(f,(radians(90),0),(radians(345),2pi),8,8,Spline);
   20 draw(s,green,render(compression=Low,merge=true));