summaryrefslogtreecommitdiff
path: root/graphics/asymptote/examples/genusthree.asy
diff options
context:
space:
mode:
authorNorbert Preining <norbert@preining.info>2019-09-02 13:46:59 +0900
committerNorbert Preining <norbert@preining.info>2019-09-02 13:46:59 +0900
commite0c6872cf40896c7be36b11dcc744620f10adf1d (patch)
tree60335e10d2f4354b0674ec22d7b53f0f8abee672 /graphics/asymptote/examples/genusthree.asy
Initial commit
Diffstat (limited to 'graphics/asymptote/examples/genusthree.asy')
-rw-r--r--graphics/asymptote/examples/genusthree.asy23
1 files changed, 23 insertions, 0 deletions
diff --git a/graphics/asymptote/examples/genusthree.asy b/graphics/asymptote/examples/genusthree.asy
new file mode 100644
index 0000000000..b3b7eb7f2b
--- /dev/null
+++ b/graphics/asymptote/examples/genusthree.asy
@@ -0,0 +1,23 @@
+size(8cm);
+
+import smoothcontour3;
+
+// Erdos lemniscate of order n:
+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)));