"Fossies" - the Fresh Open Source Software Archive

Member "asymptote-2.61/examples/genusthree.asy" (18 Nov 2019, 679 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(8cm);
    2 
    3 import smoothcontour3;
    4 
    5 // Erdos lemniscate of order n:
    6 real erdos(pair z, int n) { return abs(z^n-1)^2 - 1; }
    7 
    8 real h = 0.12;
    9 
   10 // Erdos lemniscate of order 3:
   11 real lemn3(real x, real y) { return erdos((x,y), 3); }
   12 
   13 // "Inflate" the order 3 (planar) lemniscate into a
   14 // smooth surface:
   15 real f(real x, real y, real z) {
   16   return lemn3(x,y)^2 + (16*abs((x,y))^4 + 1) * (z^2 - h^2);
   17 }
   18 
   19 // Draw the implicit surface on a box with diagonally opposite
   20 // corners at (-3,-3,-3), (3,3,3).
   21 draw(implicitsurface(f,a=(-3,-3,-3),b=(3,3,3),overlapedges=true),
   22      surfacepen=material(diffusepen=gray(0.5),emissivepen=gray(0.4),
   23                          specularpen=gray(0.1)));