如何利用 Mathematica 和 Asymptote 的数据绘制 80 年代约翰逊立体?

如何利用 Mathematica 和 Asymptote 的数据绘制 80 年代约翰逊立体?

我读到约翰逊在这里通过使用 Mathematica 的语法,PolyhedronData[{"Johnson", 80}, {"Vertices", "Faces"}]我得到了

{{{-2.19149, -0.351484, -0.244698}, {-2.10378, -0.155834, 
       0.732046}, {-2.04429, 0.501655, -0.745182}, {-1.90236, 0.818222, 
       0.835221}, {-1.86559, 
       1.22457, -0.0777559}, {-1.79587, -0.866028, -1.00544}, {-1.64867, \
    -0.0128901, -1.50592}, {-1.56623, -0.353811, 1.55171}, {-1.44725, 
       0.961166, -1.40275}, {-1.36482, 0.620245, 1.65488}, {-1.26855, 
       1.68408, -0.735321}, {-1.21761, 1.47338, 1.1544}, {-1.18084, 
       1.87973, 
       0.241422}, {-1.06803, -1.50293, -1.2596}, {-0.829841, -0.122523, \
    -2.0694}, {-0.784177, -0.869794, 1.90121}, {-0.628423, 
       0.851534, -1.96623}, {-0.470986, -1.04342, -1.91716}, {-0.458277, 
       0.706262, 2.06815}, {-0.339292, 2.02124, -0.886307}, {-0.31107, 
       1.5594, 1.56766}, {-0.28597, -2.01891, -0.9101}, {-0.251577, 
       2.21689, 0.0904368}, {-0.0994221, -0.214633, 
       2.22039}, {-0.0563312, -1.5067, 1.64705}, {0.0563312, 
       1.5067, -1.64705}, {0.0994221, 
       0.214633, -2.22039}, {0.251577, -2.21689, -0.0904368}, {0.28597, 
       2.01891, 
       0.9101}, {0.31107, -1.5594, -1.56766}, {0.339292, -2.02124, 
       0.886307}, {0.458277, -0.706262, -2.06815}, {0.470986, 1.04342, 
       1.91716}, {0.628423, -0.851534, 1.96623}, {0.784177, 
       0.869794, -1.90121}, {0.829841, 0.122523, 2.0694}, {1.06803, 
       1.50293, 
       1.2596}, {1.18084, -1.87973, -0.241422}, {1.21761, -1.47338, \
    -1.1544}, {1.26855, -1.68408, 
       0.735321}, {1.36482, -0.620245, -1.65488}, {1.44725, -0.961166, 
       1.40275}, {1.56623, 0.353811, -1.55171}, {1.64867, 0.0128901, 
       1.50592}, {1.79587, 0.866028, 1.00544}, {1.86559, -1.22457, 
       0.0777559}, {1.90236, -0.818222, -0.835221}, {2.04429, -0.501655, 
       0.745182}, {2.10378, 0.155834, -0.732046}, {2.19149, 0.351484, 
       0.244698}}, {{23, 20, 11, 13}, {13, 11, 5}, {11, 9, 3, 5}, {20, 26,
        17, 9, 11}, {9, 7, 3}, {3, 7, 6, 1}, {17, 15, 7, 9}, {17, 27, 
       15}, {27, 32, 18, 15}, {15, 18, 14, 6, 7}, {32, 30, 18}, {18, 30, 
       22, 14}, {13, 5, 4, 12}, {12, 4, 10}, {4, 2, 8, 10}, {5, 3, 1, 2, 
       4}, {25, 16, 8, 2, 1, 6, 14, 22, 28, 31}, {12, 10, 19, 21}, {21, 
       19, 33}, {19, 24, 36, 33}, {10, 8, 16, 24, 19}, {24, 34, 36}, {36, 
       34, 42, 44}, {16, 25, 34, 24}, {25, 31, 40, 42, 34}, {31, 28, 38, 
       40}, {21, 33, 37, 29}, {29, 37, 45, 50, 49, 43, 35, 26, 20, 
       23}, {33, 36, 44, 45, 37}, {44, 48, 50, 45}, {44, 42, 48}, {42, 40,
        46, 48}, {48, 46, 47, 49, 50}, {40, 38, 46}, {46, 38, 39, 
       47}, {26, 35, 27, 17}, {49, 47, 41, 43}, {43, 41, 32, 27, 35}, {47,
        39, 41}, {41, 39, 30, 32}, {23, 13, 12, 21, 29}, {39, 38, 28, 22, 
       30}}}

如何使用 Mathematica 的数据绘制 80 年代约翰逊立体?

TikZ 的答案是这里

答案1

这是一个基本的直接转换为Asymptote

//
// ParabidiminishedRhombicosidodecahedron.asy
// 
// to get ParabidiminishedRhombicosidodecahedron.png, run
// asy -f png -render=4 ParabidiminishedRhombicosidodecahedron.asy
// 
import graph3;
size(200,0);
currentlight.background=paleyellow;
currentprojection=orthographic(camera=(-70,20,30),up=(0.4,-0.1,1));

triple [] Vertex={
  (-2.19149, -0.351484, -0.244698), (-2.10378, -0.155834, 0.732046), (-2.04429, 0.501655, -0.745182), 
  (-1.90236, 0.818222, 0.835221), (-1.86559, 1.22457, -0.0777559), (-1.79587, -0.866028, -1.00544), 
  (-1.64867, -0.0128901, -1.50592), (-1.56623, -0.353811, 1.55171), (-1.44725, 0.961166, -1.40275), 
  (-1.36482, 0.620245, 1.65488), (-1.26855, 1.68408, -0.735321), (-1.21761, 1.47338, 1.1544), 
  (-1.18084, 1.87973, 0.241422), (-1.06803, -1.50293, -1.2596), (-0.829841, -0.122523, -2.0694),
  (-0.784177, -0.869794, 1.90121), (-0.628423, 0.851534, -1.96623), (-0.470986, -1.04342, -1.91716), 
  (-0.458277, 0.706262, 2.06815), (-0.339292, 2.02124, -0.886307), (-0.31107, 1.5594, 1.56766), 
  (-0.28597, -2.01891, -0.9101), (-0.251577, 2.21689, 0.0904368), (-0.0994221, -0.214633, 2.22039), 
  (-0.0563312, -1.5067, 1.64705), (0.0563312, 1.5067, -1.64705), (0.0994221, 0.214633, -2.22039), 
  (0.251577, -2.21689, -0.0904368), (0.28597, 2.01891, 0.9101), (0.31107, -1.5594, -1.56766), 
  (0.339292, -2.02124, 0.886307), (0.458277, -0.706262, -2.06815), (0.470986, 1.04342, 1.91716), 
  (0.628423, -0.851534, 1.96623), (0.784177, 0.869794, -1.90121), (0.829841, 0.122523, 2.0694), 
  (1.06803, 1.50293, 1.2596), (1.18084, -1.87973, -0.241422), (1.21761, -1.47338, -1.1544), 
  (1.26855, -1.68408, 0.735321), (1.36482, -0.620245, -1.65488), (1.44725, -0.961166, 1.40275), 
  (1.56623, 0.353811, -1.55171), (1.64867, 0.0128901, 1.50592), (1.79587, 0.866028, 1.00544), 
  (1.86559, -1.22457, 0.0777559), (1.90236, -0.818222, -0.835221), (2.04429, -0.501655, 0.745182), 
  (2.10378, 0.155834, -0.732046), (2.19149, 0.351484, 0.244698)
};
   
int[][] Face={
  {23, 20, 11, 13}, {13, 11, 5}, {11, 9, 3, 5}, {20, 26,17, 9, 11}, 
  {9, 7, 3}, {3, 7, 6, 1}, {17, 15, 7, 9}, {17, 27,15}, {27, 32, 18, 15}, 
  {15, 18, 14, 6, 7}, {32, 30, 18}, {18, 30, 22, 14}, {13, 5, 4, 12}, 
  {12, 4, 10}, {4, 2, 8, 10}, {5, 3, 1, 2, 4}, {25, 16, 8, 2, 1, 6, 14, 22, 28, 31}, 
  {12, 10, 19, 21}, {21, 19, 33}, {19, 24, 36, 33}, {10, 8, 16, 24, 19}, {24, 34, 36}, 
  {36, 34, 42, 44}, {16, 25, 34, 24}, {25, 31, 40, 42, 34}, {31, 28, 38, 40}, 
  {21, 33, 37, 29}, {29, 37, 45, 50, 49, 43, 35, 26, 20, 23}, 
  {33, 36, 44, 45, 37}, {44, 48, 50, 45}, {44, 42, 48}, {42, 40, 46, 48}, 
  {48, 46, 47, 49, 50}, {40, 38, 46}, {46, 38, 39, 47}, {26, 35, 27, 17}, 
  {49, 47, 41, 43}, {43, 41, 32, 27, 35}, {47, 39, 41}, {41, 39, 30, 32}, 
  {23, 13, 12, 21, 29}, {39, 38, 28, 22, 30}
};

void drawFace(int k){
  for(int i=0;i<Face[k].length;++i){
    guide3 gFace;
    for(int j=0;j<Face[k].length;++j){
      gFace=gFace--Vertex[Face[k][j]-1];
    }
    gFace=gFace--cycle;
    draw(surface(gFace),paleblue,meshpen=nullpen,render(merge=true));
  }
}
  
for(int i=0;i<Face.length;++i){
  drawFace(i);
}

在此处输入图片描述

这个小修改更加漂亮,带有彩色的表面:

pen[] FacePen={lightred,lightgreen,lightblue};
FacePen[10-3]=orange;
void drawFace(int k){
  for(int i=0;i<Face[k].length;++i){
    guide3 gFace;
    int n=Face[k].length;
    for(int j=0;j<n;++j){
      gFace=gFace--Vertex[Face[k][j]-1];
    }
    gFace=gFace--cycle;
    draw(surface(gFace),FacePen[n-3],meshpen=nullpen,render(merge=true));
  }
}
  
for(int i=0;i<Face.length;++i){
  drawFace(i);
}

在此处输入图片描述

相关内容