diff options
author | Erich Eckner <git@eckner.net> | 2018-06-23 21:48:09 +0200 |
---|---|---|
committer | Erich Eckner <git@eckner.net> | 2018-06-23 21:48:09 +0200 |
commit | cf98cf2f6dd312687c649bda6484ca1cb9ba0f65 (patch) | |
tree | 2f62a7a6f688d5b456f9d958ec45e0dc2f7f14cd | |
parent | 83d120a88ca5dd5a0c4679a2b6f6ea7391b0a8a7 (diff) | |
download | polyeder-cf98cf2f6dd312687c649bda6484ca1cb9ba0f65.tar.xz |
-rw-r--r-- | .gitignore | 2 | ||||
-rwxr-xr-x | animate | 19 | ||||
-rw-r--r-- | polyeder.mp | 97 | ||||
-rw-r--r-- | polyeder.tex | 7 |
4 files changed, 75 insertions, 50 deletions
@@ -1,2 +1,4 @@ *.mps *.pdf +*.bmp +*.gif @@ -1,2 +1,21 @@ #!/bin/sh +set -e + +cd "$(dirname "$0")" + +mpost polyeder.mp + +find . -maxdepth 1 -name 'polyeder-*.mps' \ + -exec convert -depth 2 "{}" "{}.bmp" \; \ + -delete + +convert -delay 3 $( + find . -maxdepth 1 -name 'polyeder-*.mps.bmp' | + sed 's/^.*-\([0-9]\+\)\.mps\.bmp$/\1 \0/' | \ + sort -k1n,1 | \ + cut -d' ' -f2 +) polyeder.gif + +find . -maxdepth 1 -name 'polyeder-*.mps.bmp' \ + -delete diff --git a/polyeder.mp b/polyeder.mp index c0dbcb1..e5c7e5c 100644 --- a/polyeder.mp +++ b/polyeder.mp @@ -8,56 +8,67 @@ verbatimtex \begin{document} etex -beginfig(1); +ddd Ecken[]; +pair Kanten[]; - ddd Ecken[]; - pair Kanten[]; +centralperspective(3cm,4cm,4cm,(10cm,0cm,0cm)); - centralperspective(3cm,4cm,4cm,(16cm,8cm,12cm)); +for i=0 upto 1: + for j=0 upto 1: + Ecken[2*i+j]=(1-2*i,(1-2*j)*(1-i),(1-2*j)*i); + endfor + Kanten[i]=(2*i,2*i+1); +endfor - for i=0 upto 1: +for i=0 upto 1: + Ecken[4+i]=.3[Ecken[i],Ecken[1-i]]; + Ecken[6+i]=.3[Ecken[2+i],Ecken[4+i]]; + Kanten[2+i]=(2+i,6+i); + Ecken[8+i]=Ecken[6+i]+whatever*(0,1,0)=(whatever,0,whatever); + Kanten[4+i]=(6+i,8+i); + Kanten[6+i]=(8+i,i); + Ecken[10+i]=.9[Ecken[3-i],Ecken[4+i]]; + Kanten[8+i]=(3-i,10+i); + Kanten[10+i]=(10+i,i); +endfor +for i=0 upto 1: + Ecken[12+i] + = Ecken[6+i]+whatever*(Ecken[3]-Ecken[2]) + = Ecken[1-i]+whatever*(Ecken[11-i]-Ecken[1-i])+whatever*(Ecken[9-i]-Ecken[1-i]); + Kanten[12+i]=(6+i,12+i); + Kanten[14+i]=(13-i,8+i); +endfor +for i=0 upto 1: + Ecken[14+i] for j=0 upto 1: - Ecken[2*i+j]=(1-2*i,(1-2*j)*(1-i),(1-2*j)*i); + = Ecken[j] + whatever*(Ecken[8+j]-Ecken[j]) + whatever*(Ecken[10+j]-Ecken[j]) endfor - Kanten[i]=(2*i,2*i+1); - endfor + = Ecken[2] + whatever*(Ecken[3]-Ecken[2]) + whatever*(Ecken[10+i]-Ecken[2]); + Kanten[16+i]=(10+i,14+i); + Kanten[18+i]=(12+i,14+i); +endfor +Kanten[20]=(14,15); - for i=0 upto 1: - Ecken[4+i]=.25[Ecken[i],Ecken[1-i]]; - Ecken[6+i]=.3[Ecken[2+i],Ecken[4+i]]; - Kanten[2+i]=(2+i,6+i); - Ecken[8+i]=Ecken[6+i]+whatever*(0,1,0)=(whatever,0,whatever); - Kanten[4+i]=(6+i,8+i); - Kanten[6+i]=(8+i,i); - Ecken[10+i]=.9[Ecken[3-i],Ecken[4+i]]; - Kanten[8+i]=(3-i,10+i); - Kanten[10+i]=(10+i,i); - endfor - for i=0 upto 1: - Ecken[12+i] - = Ecken[6+i]+whatever*(Ecken[3]-Ecken[2]) - = Ecken[1-i]+whatever*(Ecken[11-i]-Ecken[1-i])+whatever*(Ecken[9-i]-Ecken[1-i]); - Kanten[12+i]=(6+i,12+i); - Kanten[14+i]=(13-i,8+i); - endfor - for i=0 upto 1: - Ecken[14+i] - for j=0 upto 1: - = Ecken[j] + whatever*(Ecken[8+j]-Ecken[j]) + whatever*(Ecken[10+j]-Ecken[j]) - endfor - = Ecken[2] + whatever*(Ecken[3]-Ecken[2]) + whatever*(Ecken[10+i]-Ecken[2]); - Kanten[16+i]=(10+i,14+i); - Kanten[18+i]=(13-i,14+i); - endfor - Kanten[20]=(14,15); +for j=1 upto 180: - for i=0 upto 20: - draw dddpoint(Ecken[xpart Kanten[i]])--dddpoint(Ecken[ypart Kanten[i]]); - endfor -% for i=0 upto 15: -% newlabel.b(decimal i, dddpoint(Ecken[i])); -% endfor + beginfig(j); + + fill for i=0 upto 3: (if i<2: - fi 5cm, if (i=1) or (i=2): - fi 6cm) -- endfor cycle withcolor black; + + for i=0 upto 20: + draw dddpoint( + Ecken[xpart Kanten[i]] rotatedaround((0,1,0),90) rotatedaround((0,0,1),1*j) + )--dddpoint( + Ecken[ypart Kanten[i]] rotatedaround((0,1,0),90) rotatedaround ((0,0,1),1*j) + ) withcolor white; + endfor + + % for i=0 upto 15: + % newlabel.b(decimal i, dddpoint(Ecken[i])); + % endfor + + endfig; -endfig; +endfor end; diff --git a/polyeder.tex b/polyeder.tex deleted file mode 100644 index 2c15c9c..0000000 --- a/polyeder.tex +++ /dev/null @@ -1,7 +0,0 @@ -\documentclass{article} - -\usepackage{graphicx} - -\begin{document} -\includegraphics{polyeder-01} -\end{document} |