diff options
author | Andreas Müller <andreas.mueller@ost.ch> | 2021-09-26 20:03:41 +0200 |
---|---|---|
committer | Andreas Müller <andreas.mueller@ost.ch> | 2021-09-26 20:03:41 +0200 |
commit | 5388a7aad33813f7795d601ce7a2ae21fddd9590 (patch) | |
tree | ffd7d152b30635e42709fd2aae0ef5d72e0eee01 /buch/chapters/95-homologie/torus/torus.m | |
parent | add torus image (diff) | |
download | SeminarMatrizen-5388a7aad33813f7795d601ce7a2ae21fddd9590.tar.gz SeminarMatrizen-5388a7aad33813f7795d601ce7a2ae21fddd9590.zip |
torus perfektioniert
Diffstat (limited to 'buch/chapters/95-homologie/torus/torus.m')
-rw-r--r-- | buch/chapters/95-homologie/torus/torus.m | 25 |
1 files changed, 20 insertions, 5 deletions
diff --git a/buch/chapters/95-homologie/torus/torus.m b/buch/chapters/95-homologie/torus/torus.m index 00134d7..64a615e 100644 --- a/buch/chapters/95-homologie/torus/torus.m +++ b/buch/chapters/95-homologie/torus/torus.m @@ -5,9 +5,9 @@ # global n; -n = 24; +n = 32; global m; -m = 12; +m = 18; global R; R = 3; global r; @@ -51,10 +51,10 @@ coordinates function insert_edges(ll, lr, ul, ur) global edges; k = 3 * ll + 1; - edges(k,1) = ll; - edges(k,2) = lr; edges(k+1,1) = ll; - edges(k+1,2) = ur; + edges(k+1,2) = lr; + edges(k+0,1) = ll; + edges(k+0,2) = ur; edges(k+2,1) = ll; edges(k+2,2) = ul; endfunction @@ -330,5 +330,20 @@ endfor fprintf(fn, " }\n"); fprintf(fn, "#end\n"); +fprintf(fn, "#macro triangulation()\n"); +fprintf(fn, " union {\n"); +for i = (1:nvertices) + punkt = coordinates(i,:); + fprintf(fn, "\tsphere { <%.4f,%.4f,%.4f>, r/3 }\n", punkt(1,1), punkt(1,3), punkt(1,2)); +endfor +for i = (1:nedges) + punkt1 = coordinates(edges(i,1)+1,:); + punkt2 = coordinates(edges(i,2)+1,:); + fprintf(fn, "\tcylinder { <%.4f,%.4f,%.4f>, ", punkt1(1,1), punkt1(1,3), punkt1(1,2)); + fprintf(fn, "<%.4f,%.4f,%.4f>, r/3 }\n", punkt2(1,1), punkt2(1,3), punkt2(1,2)); +endfor +fprintf(fn, " }\n"); +fprintf(fn, "#end\n"); + fclose(fn); |