aboutsummaryrefslogtreecommitdiffstats
path: root/buch/chapters/95-homologie/images/approx.m
diff options
context:
space:
mode:
authorAndreas Müller <andreas.mueller@ost.ch>2021-08-24 17:21:53 +0200
committerAndreas Müller <andreas.mueller@ost.ch>2021-08-24 17:21:53 +0200
commit13304c02851094180b714d71451f279966fb582f (patch)
tree13950212fb6623bf948c2fcabb6ee88ca6e459ee /buch/chapters/95-homologie/images/approx.m
parentsymmetry fix (diff)
downloadSeminarMatrizen-13304c02851094180b714d71451f279966fb582f.tar.gz
SeminarMatrizen-13304c02851094180b714d71451f279966fb582f.zip
simpliziale Approximation
Diffstat (limited to 'buch/chapters/95-homologie/images/approx.m')
-rw-r--r--buch/chapters/95-homologie/images/approx.m77
1 files changed, 77 insertions, 0 deletions
diff --git a/buch/chapters/95-homologie/images/approx.m b/buch/chapters/95-homologie/images/approx.m
new file mode 100644
index 0000000..0db41c2
--- /dev/null
+++ b/buch/chapters/95-homologie/images/approx.m
@@ -0,0 +1,77 @@
+#
+# approx.m
+#
+# (c) 2021 Prof Dr Andreas Müller, OST Ostschweizer Fachhochschule
+#
+x = zeros(7,7);
+y = zeros(7,7);
+
+s = 1.05;
+
+for i = (1:7)
+ winkel = (i-1) * 8.333333 + 20;
+ for j = (1:7)
+ radius = (j-1) * 0.5 + 3;
+ x(i,j) = 1.05 * radius * cosd(winkel);
+ y(i,j) = 1.05 * radius * sind(winkel);
+ endfor
+endfor
+
+X = x;
+Y = y;
+for i = (1:7)
+ for j = (1:7)
+ X(i,j) = round(2 * x(i,j)) / 2;
+ Y(i,j) = round(2 * y(i,j)) / 2;
+ endfor
+endfor
+
+fn = fopen("approx.tex", "w");
+
+
+for i = (1:6)
+ for j = (1:6)
+ winkel = (i-1+0.6666) * 8.33333 + 20;
+ radius = (j-1+0.3333) * 0.5 + 3;
+ fprintf(fn, "\\definecolor{mycolor}{rgb}{%.2f,%.2f,%.2f};\n",
+ (winkel - 20) / 50, 0.8, (radius-3)/3);
+ fprintf(fn, "\\fill[color=mycolor] (%.3f,%.3f) -- (%.3f,%.3f) -- (%.3f,%.3f) -- cycle;\n",
+ X(i,j), Y(i,j),
+ X(i+1,j+1), Y(i+1,j+1),
+ X(i+1,j), Y(i+1,j));
+ winkel = (i-1+0.3333) * 8.33333 + 20;
+ radius = (j-1+0.6666) * 0.5 + 3;
+ fprintf(fn, "\\definecolor{mycolor}{rgb}{%.2f,%.2f,%.2f};\n",
+ (winkel - 20) / 50, 0.8, (radius-3)/3);
+ fprintf(fn, "\\fill[color=mycolor] (%.3f,%.3f) -- (%.3f,%.3f) -- (%.3f,%.3f) -- cycle;\n",
+ X(i,j), Y(i,j),
+ X(i,j+1), Y(i,j+1),
+ X(i+1,j+1), Y(i+1,j+1));
+ endfor
+endfor
+
+linewidth = 0.4;
+
+fprintf(fn, "\\gitter\n");
+
+for i = (1:7)
+ for j = (1:6)
+ fprintf(fn, "\\draw[color=darkred,line width=%.1fpt] (%.3f,%.3f) -- (%.3f,%.3f);\n", linewidth,
+ X(i,j), Y(i,j), X(i,j+1), Y(i,j+1));
+ endfor
+endfor
+for i = (1:6)
+ for j = (1:7)
+ fprintf(fn, "\\draw[color=darkred,line width=%.1fpt] (%.3f,%.3f) -- (%.3f,%.3f);\n", linewidth,
+ X(i,j), Y(i,j), X(i+1,j), Y(i+1,j));
+ endfor
+endfor
+for i = (1:6)
+ for j = (1:6)
+ fprintf(fn, "\\draw[color=darkred,line width=%.1fpt] (%.3f,%.3f) -- (%.3f,%.3f);\n", linewidth,
+ X(i,j), Y(i,j), X(i+1,j+1), Y(i+1,j+1));
+ endfor
+endfor
+
+fclose(fn)
+