aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--buch/papers/kugel/images/Makefile13
-rw-r--r--buch/papers/kugel/images/curvature.pov72
-rw-r--r--buch/papers/kugel/images/curvgraph.m83
3 files changed, 168 insertions, 0 deletions
diff --git a/buch/papers/kugel/images/Makefile b/buch/papers/kugel/images/Makefile
new file mode 100644
index 0000000..8efa228
--- /dev/null
+++ b/buch/papers/kugel/images/Makefile
@@ -0,0 +1,13 @@
+#
+# Makefile -- build images
+#
+# (c) 2022 Prof Dr Andreas Müller, OST Ostschweizer Fachhochschule
+#
+all: curvature.png
+
+curvature.inc: curvgraph.m
+ octave curvgraph.m
+
+curvature.png: curvature.pov curvature.inc
+ povray +A0.1 +W1920 +H1080 +Ocurvature.png curvature.pov
+
diff --git a/buch/papers/kugel/images/curvature.pov b/buch/papers/kugel/images/curvature.pov
new file mode 100644
index 0000000..3535488
--- /dev/null
+++ b/buch/papers/kugel/images/curvature.pov
@@ -0,0 +1,72 @@
+//
+// curvature.pov
+//
+// (c) 2022 Prof Dr Andreas Müller, OST Ostschweizer Fachhochschule
+//
+
+#version 3.7;
+#include "colors.inc"
+
+global_settings {
+ assumed_gamma 1
+}
+
+#declare imagescale = 0.1;
+
+camera {
+ location <40, 10, -20>
+ look_at <0, 0, 0>
+ right 16/9 * x * imagescale
+ up y * imagescale
+}
+
+light_source {
+ <10, 10, -40> color White
+ area_light <1,0,0> <0,0,1>, 10, 10
+ adaptive 1
+ jitter
+}
+
+sky_sphere {
+ pigment {
+ color rgb<1,1,1>
+ }
+}
+
+//
+// draw an arrow from <from> to <to> with thickness <arrowthickness> with
+// color <c>
+//
+#macro arrow(from, to, arrowthickness, c)
+#declare arrowdirection = vnormalize(to - from);
+#declare arrowlength = vlength(to - from);
+union {
+ sphere {
+ from, 1.1 * arrowthickness
+ }
+ cylinder {
+ from,
+ from + (arrowlength - 5 * arrowthickness) * arrowdirection,
+ arrowthickness
+ }
+ cone {
+ from + (arrowlength - 5 * arrowthickness) * arrowdirection,
+ 2 * arrowthickness,
+ to,
+ 0
+ }
+ pigment {
+ color c
+ }
+ finish {
+ specular 0.9
+ metallic
+ }
+}
+#end
+
+arrow(<-3.1,0,0>, <3.1,0,0>, 0.01, White)
+arrow(<0,-1,0>, <0,1,0>, 0.01, White)
+arrow(<0,0,-2.1>, <0,0,2.1>, 0.01, White)
+
+#include "curvature.inc"
diff --git a/buch/papers/kugel/images/curvgraph.m b/buch/papers/kugel/images/curvgraph.m
new file mode 100644
index 0000000..96ca4b1
--- /dev/null
+++ b/buch/papers/kugel/images/curvgraph.m
@@ -0,0 +1,83 @@
+#
+# curvature.m
+#
+# (c) 2022 Prof Dr Andreas Müller, OST Ostschweizer Fachhochschule
+#
+
+global N;
+N = 10;
+
+global sigma2;
+sigma2 = 1;
+
+global s;
+s = 1;
+
+xmin = -3;
+xmax = 3;
+xsteps = 1000;
+hx = (xmax - xmin) / xsteps;
+
+ymin = -2;
+ymax = 2;
+ysteps = 1000;
+hy = (ymax - ymin) / ysteps;
+
+function retval = f0(r)
+ global sigma2;
+ retval = exp(-r^2/sigma2)/sigma2 - exp(-r^2/(2*sigma2))/(sqrt(2)*sigma2);
+end
+
+global N0;
+N0 = f0(0);
+
+function retval = f1(x,y)
+ global N0;
+ retval = f0(hypot(x, y)) / N0;
+endfunction
+
+function retval = f(x, y)
+ global s;
+ retval = f1(x+s, y) - f1(x-s, y);
+endfunction
+
+function retval = curvature0(r)
+ global sigma2;
+ retval = (
+ (2*sigma2-r^2)*exp(-r^2/(2*sigma2))
+ +
+ 4*(r^2-sigma2)*exp(-r^2/sigma2)
+ ) / (sigma2^2);
+endfunction
+
+function retval = curvature1(x, y)
+ retval = curvature0(hypot(x, y));
+endfunction
+
+function retval = curvature(x, y)
+ global s;
+ retval = curvature1(x+s, y) + curvature1(x-s, y);
+endfunction
+
+function retval = farbe(x, y)
+ c = curvature(x, y);
+ retval = c * ones(1,3);
+endfunction
+
+fn = fopen("curvature.inc", "w");
+
+for ix = (0:xsteps)
+ x = xmin + ix * hx;
+ for iy = (0:ysteps)
+ y = ymin + iy * hy;
+ fprintf(fn, "sphere { <%.4f, %.4f, %.4f>, 0.01\n",
+ x, f(x, y), y);
+ color = farbe(x, y);
+ fprintf(fn, "pigment { color rgb<%.4f,%.4f,%.4f> }\n",
+ color(1,1), color(1,2), color(1,3));
+ fprintf(fn, "finish { metallic specular 0.5 }\n");
+ fprintf(fn, "}\n");
+ end
+end
+
+fclose(fn);