以Dodecahedron(正十二面体) 为例, 投影到XY平面
- PolyhedronData["Dodecahedron", "Points"] /. Point -> (#[[1 ;; 2]] &) //N
- PolyhedronData["Dodecahedron", "FaceIndices"]
复制代码
注意Mathematica的列表index是从1开始的,导入Asymptote需注意p=p--Points[i-1];
unitsize(3cm);
pair[] Points={(-1.37638,0),(1.37638,0),(-0.425325,-1.30902),(-0.425325,1.30902),(1.11352,-0.809017),(1.11352,0.809017),(-0.262866,-0.809017),(-0.262866,0.809017),(-0.688191,-0.5),(-0.688191,0.5),(0.688191,-0.5),(0.688191,0.5),(0.850651,0),(-1.11352,-0.809017),(-1.11352,0.809017),(-0.850651,0),(0.262866,-0.809017),(0.262866,0.809017),(0.425325,-1.30902),(0.425325,1.30902)};
int[][] FaceIndices={{15,10,9,14,1},{2,6,12,11,5},{5,11,7,3,19},{11,12,8,16,7},{12,6,20,4,8},{6,2,13,18,20},{2,5,19,17,13},{4,20,18,10,15},{18,13,17,9,10},{17,19,3,14,9},{3,7,16,1,14},{16,8,4,15,1}};
for(int[] face:FaceIndices){
guide p;
for(int i:face){
p=p--Points[i-1];
}
draw(p--cycle);
}
for(pair i:Points){
dot(i,red);
} | 可以与Wikipedia的regular map图对比: The projection of the regular dodecahedron on the H3 Coxeter plane. |
主要的代码可以重复使用:- for(int[] face:FaceIndices){
- guide p;
- for(int i:face){
- p=p--Points[i-1];
- }
- draw(p--cycle);
- }
- for(pair i:Points){
- dot(i,red);
- }
复制代码 |