diff options
Diffstat (limited to '')
-rw-r--r-- | buch/chapters/090-pde/membran/Makefile | 15 | ||||
-rw-r--r-- | buch/chapters/090-pde/membran/membran.m | 109 | ||||
-rw-r--r-- | buch/chapters/090-pde/membran/membran.png | bin | 0 -> 2527711 bytes | |||
-rw-r--r-- | buch/chapters/090-pde/membran/membran.pov | 163 |
4 files changed, 287 insertions, 0 deletions
diff --git a/buch/chapters/090-pde/membran/Makefile b/buch/chapters/090-pde/membran/Makefile new file mode 100644 index 0000000..35dfd14 --- /dev/null +++ b/buch/chapters/090-pde/membran/Makefile @@ -0,0 +1,15 @@ +# +# Makefile +# +# (c) 2022 Prof Dr Andreas Müller, OST Ostschweizer Fachhochschule +# +all: membran.png + +membran.inc: membran.m + octave membran.m + +size="+W1920 +H540" +size="+W3840 +H1080" + +membran.png: membran.pov membran.inc + povray +A0.1 +UA $(size) -Omembran.png membran.pov diff --git a/buch/chapters/090-pde/membran/membran.m b/buch/chapters/090-pde/membran/membran.m new file mode 100644 index 0000000..acc45b9 --- /dev/null +++ b/buch/chapters/090-pde/membran/membran.m @@ -0,0 +1,109 @@ +# +# membran.m +# +# (c) 2022 Prof Dr Andreas Müller, OST Ostschweizer Fachhochschule +# +global n; +n = 3; +global A; +A = 0.2; +global nullstelle; +nullstelle = 13.0152; +global skala; +skala = 1 / nullstelle; +phisteps = 628; +phistep = 2 * pi / phisteps; +rsteps = 200; +rstep = 1 / rsteps; + +fn = fopen("membran.inc", "w"); +fprintf(fn, "#macro flaeche()\n"); + +function retval = punkt(fn, phi, r, n) + global nullstelle; + global skala; + global A; + fprintf(fn, "\n\t <%.4f, %.4f, %.4f>", + r * cos(phi), + A * besselj(n, nullstelle * r) * cos(n * phi), + r * sin(phi) + ); +endfunction + +for i = (0:phisteps) + phi = i * phistep; + r = rstep; + fprintf(fn, "\ttriangle {"); + punkt(fn, 0, 0, n); fprintf(fn, ","); + punkt(fn, phi, rstep, n); fprintf(fn, ","); + punkt(fn, phi+phistep, rstep, n); + fprintf(fn, "\n\t}\n"); + + for j = (1:rsteps-1) + r = j * rstep; + fprintf(fn, "\ttriangle {"); + punkt(fn, phi, r, n); fprintf(fn, ","); + punkt(fn, phi+phistep, r, n); fprintf(fn, ","); + punkt(fn, phi+phistep, r+rstep, n); + fprintf(fn, "\n\t}\n"); + fprintf(fn, "\ttriangle {"); + punkt(fn, phi, r, n); fprintf(fn, ","); + punkt(fn, phi+phistep, r+rstep, n); fprintf(fn, ","); + punkt(fn, phi, r+rstep, n); + fprintf(fn, "\n\t}\n"); + end +end + +fprintf(fn, "#end\n"); + +function retval = ring(fn, r, n) + phisteps = 100; + phistep = 2 * pi / phisteps; + for i = (1:phisteps) + phi = phistep * i; + fprintf(fn, "\tcylinder {"); + punkt(fn, phi - phistep, r, n); fprintf(fn, ","); + punkt(fn, phi, r, n); fprintf(fn, ","); + fprintf(fn, "\n\t r"); + fprintf(fn, "\n\t}\n") + fprintf(fn, "\tsphere {"); + punkt(fn, phi - phistep, r, n); fprintf(fn, ","); + fprintf(fn, "\n\t r"); + fprintf(fn, "\n\t}\n") + end +end + +function retval = radius(fn, phi, n) + rsteps = 100; + rstep = 1 / rsteps; + for i = (0:rsteps-1) + r = i * rstep; + fprintf(fn, "\tcylinder {"); + punkt(fn, phi, r, n); fprintf(fn, ","); + punkt(fn, phi, r+rstep, n); fprintf(fn, ","); + fprintf(fn, "\n\t r"); + fprintf(fn, "\n\t}\n") + fprintf(fn, "\tsphere {"); + punkt(fn, phi, r, n); fprintf(fn, ","); + fprintf(fn, "\n\t r"); + fprintf(fn, "\n\t}\n") + end +end + +fprintf(fn, "#macro phigitter()\n"); +rsteps = 20; +rstep = 1 / rsteps; +for j = (1:rsteps-1) + ring(fn, rstep * j, n); +end +fprintf(fn, "#end\n"); + +fprintf(fn, "#macro rgitter()\n"); +phisteps = 72; +phistep = 2 * pi / phisteps; +for i = (0:phisteps-1) + radius(fn, phistep * i, n); +end +fprintf(fn, "#end\n"); + +fclose(fn); diff --git a/buch/chapters/090-pde/membran/membran.png b/buch/chapters/090-pde/membran/membran.png Binary files differnew file mode 100644 index 0000000..154a4a7 --- /dev/null +++ b/buch/chapters/090-pde/membran/membran.png diff --git a/buch/chapters/090-pde/membran/membran.pov b/buch/chapters/090-pde/membran/membran.pov new file mode 100644 index 0000000..d64294f --- /dev/null +++ b/buch/chapters/090-pde/membran/membran.pov @@ -0,0 +1,163 @@ +// +// membran.pov +// +// (c) 2022 Prof Dr Andreas Müller, OST Ostschweizer Fachhochschule +// +#version 3.7; +#include "colors.inc" +#include "math.inc" +#include "membran.inc" + +global_settings { + assumed_gamma 1 +} + +#declare imagescale = 0.037; + +camera { + location <-33, 20, 50> + look_at <0, -0.005, 0> + right x * imagescale + up (9/32) * y * imagescale +} + +background { color rgbt <0,0,0,1> } + +light_source { + <10, 15, 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(<-1.1,0,0>, <1.1,0,0>, 0.01, White) +//arrow(<0,-1.1,0>, <0,1.1,0>, 0.01, White) +//arrow(<0,0,-1.1>, <0,0,1.1>, 0.01, White) + +mesh { + flaeche() + pigment { + color rgb<0.8,0.8,0.8> * 1.2 + } + finish { + specular 0.95 + metallic + } +} + +#declare randr = 0.01; + +#macro zylinder(k,n,r) + cylinder { + < cos((2*k+1)*pi/(2*n)), 0, sin((2*k+1)*pi/(2*n)) >, + < -cos((2*k+1)*pi/(2*n)), 0, -sin((2*k+1)*pi/(2*n)) >, + r + } +#end + +#macro ring(R,r) + #declare phisteps = 100; + #declare phistep = 2 * pi / 100; + #declare phimin = 0; + #declare phimax = 2 * pi; + #declare phi = phimin; + #while (phi < phimax - phistep/2) + cylinder { + <R*cos(phi), 0, R*sin(phi)>, + <R*cos(phi+phistep), 0, R*sin(phi+phistep)>, + r + } + sphere { + <R*cos(phi), 0, R*sin(phi)>, r + } + #declare phi = phi + phistep; + #end +#end + +#declare nullstelle = 13.0152; + +union { + ring(1, randr) + pigment { + color rgb<1.0,0.8,0.6> + } + finish { + specular 0.95 + metallic + } +} + +union { + zylinder(0, 3, 0.5*randr) + zylinder(1, 3, 0.5*randr) + zylinder(2, 3, 0.5*randr) + ring(6.3802/nullstelle, 0.5*randr) + ring(9.7610/nullstelle, 0.5*randr) + pigment { + color rgb<1.0,0.8,0.6> + } + finish { + specular 0.95 + metallic + } +} + +#declare r = 0.2*randr; +union { + phigitter() + pigment { + color rgb<0.2,0.6,1.0> + } + finish { + specular 0.95 + metallic + } +} +union { + rgitter() + pigment { + color rgb<1.0,0.4,0.6> + } + finish { + specular 0.95 + metallic + } +} |