summaryrefslogtreecommitdiff
path: root/Build/source/utils/asymptote/examples/truncatedIcosahedron.asy
diff options
context:
space:
mode:
Diffstat (limited to 'Build/source/utils/asymptote/examples/truncatedIcosahedron.asy')
-rw-r--r--Build/source/utils/asymptote/examples/truncatedIcosahedron.asy69
1 files changed, 69 insertions, 0 deletions
diff --git a/Build/source/utils/asymptote/examples/truncatedIcosahedron.asy b/Build/source/utils/asymptote/examples/truncatedIcosahedron.asy
new file mode 100644
index 00000000000..092f96a4e6c
--- /dev/null
+++ b/Build/source/utils/asymptote/examples/truncatedIcosahedron.asy
@@ -0,0 +1,69 @@
+import graph3;
+
+size(200);
+
+defaultrender.merge=true;
+
+real c=(1+sqrt(5))/2;
+
+triple[] z={(c,1,0),(-c,1,0),(-c,-1,0),(c,-1,0)};
+triple[] x={(0,c,1),(0,-c,1),(0,-c,-1),(0,c,-1)};
+triple[] y={(1,0,c),(1,0,-c),(-1,0,-c),(-1,0,c)};
+
+triple[][] Q=
+ {
+ {(c,1,0),(1,0,-c),(0,c,-1),(0,c,1),(1,0,c),(c,-1,0)},
+ {(-c,1,0),(0,c,1),(0,c,-1),(-1,0,-c),(-c,-1,0),(-1,0,c)},
+ {(-c,-1,0),(-c,1,0),(-1,0,-c),(0,-c,-1),(0,-c,1),(-1,0,c)},
+ {(c,-1,0),(c,1,0),(1,0,c),(0,-c,1),(0,-c,-1),(1,0,-c)},
+ {(0,c,1),(0,c,-1),(-c,1,0),(-1,0,c),(1,0,c),(c,1,0)},
+ {(0,-c,1),(0,-c,-1),(-c,-1,0),(-1,0,c),(1,0,c),(c,-1,0)},
+ {(0,-c,-1),(0,-c,1),(c,-1,0),(1,0,-c),(-1,0,-c),(-c,-1,0)},
+ {(0,c,-1),(0,c,1),(c,1,0),(1,0,-c),(-1,0,-c),(-c,1,0)},
+ {(1,0,c),(-1,0,c),(0,-c,1),(c,-1,0),(c,1,0),(0,c,1)},
+ {(1,0,-c),(-1,0,-c),(0,-c,-1),(c,-1,0),(c,1,0),(0,c,-1)},
+ {(-1,0,-c),(1,0,-c),(0,c,-1),(-c,1,0),(-c,-1,0),(0,-c,-1)},
+ {(-1,0,c),(1,0,c),(0,c,1),(-c,1,0),(-c,-1,0),(0,-c,1)}
+ };
+
+real R=abs(interp(Q[0][0],Q[0][1],1/3));
+
+triple[][] P;
+for(int i=0; i < Q.length; ++i) {
+ P[i]=new triple[] ;
+ for(int j=0; j < Q[i].length; ++j) {
+ P[i][j]=Q[i][j]/R;
+ }
+}
+
+for(int i=0; i < P.length; ++i) {
+ for(int j=1; j < P[i].length; ++j) {
+ triple C=P[i][0];
+ triple A=P[i][j];
+ triple B=P[i][j % 5+1];
+ triple[] sixout=new
+ triple[] {interp(C,A,1/3),interp(C,A,2/3),interp(A,B,1/3),interp(A,B,2/3),
+ interp(B,C,1/3),interp(B,C,2/3)};
+ triple M=(sum(sixout))/6;
+ triple[] sixin=sequence(new triple(int k) {
+ return interp(sixout[k],M,0.1);
+ },6);
+ draw(surface(reverse(operator--(...sixout)--cycle)^^
+ operator--(...sixin)--cycle,planar=true),magenta);
+ }
+}
+
+for(int i=0; i < P.length; ++i) {
+ triple[] fiveout=sequence(new triple(int k) {
+ return interp(P[i][0],P[i][k+1],1/3);
+ },5);
+ triple M=(sum(fiveout))/5;
+ triple[] fivein=sequence(new triple(int k) {
+ return interp(fiveout[k],M,0.1);
+ },5);
+ draw(surface(reverse(operator--(...fiveout)--cycle)^^
+ operator--(...fivein)--cycle,planar=true),cyan);
+}
+
+
+