1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
|
import math;
import bsp;
import animation;
size(100,100);
animation a;
void face(face[] faces, path3 p, int j, int k) {
picture pic=faces.push(p);
filldraw(pic,project(p),Pen(j));
int sign=(k % 2 == 0) ? 1 : -1;
transform t=scale(4)*transform(dir(p,0,sign),dir(p,0,-sign));
label(pic,t*(string) j,project(0.5*(min(p)+max(p))));
}
void snapshot(transform3 t)
{
static transform3 s=shift(-0.5*(X+Y+Z));
save();
face[] faces;
int j=-1;
transform3 T=t*s;
for(int k=0; k < 2; ++k) {
face(faces,T*plane((1,0,0),(0,1,0),(0,0,k)),++j,k);
face(faces,T*plane((0,1,0),(0,0,1),(k,0,0)),++j,k);
face(faces,T*plane((0,0,1),(1,0,0),(0,k,0)),++j,k);
}
add(faces);
a.add();
restore();
}
int n=50;
real step=360/n;
for(int i=0; i < n; ++i)
snapshot(rotate(i*step,X));
for(int i=0; i < n; ++i)
snapshot(rotate(i*step,Y));
for(int i=0; i < n; ++i)
snapshot(rotate(i*step,Z));
a.movie(loops=1,delay=50);
|