TikZ 中的截角二十面体?

TikZ 中的截角二十面体?

我想绘制阿基米德立体截头二十面体(足球、巴基球),这样就可以利用透明度、位置和光源方面的资源来处理图像。

在此处输入图片描述

左侧的图像是在 POVRay 中执行的,来源可从以下网址获取维基百科,右边的是来自 Mathematica,顶点数据可以通过命令获取多面体数据[“截断二十面体”]

列出顶点、边和面

顶点都是偶数排列:

(0, ±1, ±3ϕ)
(±2, ±(1+2ϕ), ±ϕ)
(±1, ±(2+ϕ), ±2ϕ) 

黄金分割率在哪里$\phi = (1 + \sqrt{5})/2$,有关详细列表,请参阅维基百科这里或者这里

顶点(60)、边(90)和面(32)的数量似乎有点太大,无法像其他示例一样手动处理,例如绘制八面体。此配置中的所有边的长度均为 2,因此可以通过简单的算法确定边(距离 < 2.1 的 3 个邻居)。给定一个顶点的两条边,也(从算法上)很容易找到组成面的第三条边 - 它是与前两个向量构成零体积的那条边。在 TikZ 中实现所有这些有多容易?也许准备好一组坐标边和面会更容易?

切割预定义二十面体的顶点

另一种可能的构造是将(预定义的)二十面体的顶点以某种方式切断,使得每条边的长度相同。几个包(pst-solids3dpst-platon) 使用一个命令预定义二十面体——这里的问题将是截止的执行。

在这种特殊情况下,立体的中心位于原点,并且所有平面(切断的平面)都垂直于定义原始二十面体的向量,并且与原点等距。

答案1

我们从骨架开始。坐标是从 复制而来polyhedron_js.asy

\documentclass[border=9,tikz]{standalone}

\usepackage{tikz-3dplot}

\begin{document}
\foreach\s in{2,4,...,360}{
    \tdplotsetmaincoords{2.71828+\s}{2.71828+\s*2}
    \tikz[tdplot_main_coords,scale=.1]{
        \path(-150cm,-150cm)(150cm,150cm);
        \draw
            (20.1774,0,-97.9432)--(40.3548,-32.6477,-85.4729)--(73.0026,-20.1774,-65.2955)--(73.0026,20.1774,-65.2955)--(40.3548,32.6477,-85.4729)--cycle
            (20.1774,0,97.9432)--(40.3548,32.6477,85.4729)--(73.0026,20.1774,65.2955)--(73.0026,-20.1774,65.2955)--(40.3548,-32.6477,85.4729)--cycle
            (-20.1774,0,97.9432)--(-40.3548,-32.6477,85.4729)--(-73.0026,-20.1774,65.2955)--(-73.0026,20.1774,65.2955)--(-40.3548,32.6477,85.4729)--cycle
            (-20.1774,0,-97.9432)--(-40.3548,32.6477,-85.4729)--(-73.0026,20.1774,-65.2955)--(-73.0026,-20.1774,-65.2955)--(-40.3548,-32.6477,-85.4729)--cycle
            (97.9432,20.1774,0)--(85.4729,40.3548,32.6477)--(65.2955,73.0026,20.1774)--(65.2955,73.0026,-20.1774)--(85.4729,40.3548,-32.6477)--cycle
            (0,97.9432,20.1774)--(32.6477,85.4729,40.3548)--(20.1774,65.2955,73.0026)--(-20.1774,65.2955,73.0026)--(-32.6477,85.4729,40.3548)--cycle
            (-97.9432,20.1774,0)--(-85.4729,40.3548,-32.6477)--(-65.2955,73.0026,-20.1774)--(-65.2955,73.0026,20.1774)--(-85.4729,40.3548,32.6477)--cycle
            (0,97.9432,-20.1774)--(-32.6477,85.4729,-40.3548)--(-20.1774,65.2955,-73.0026)--(20.1774,65.2955,-73.0026)--(32.6477,85.4729,-40.3548)--cycle
            (-97.9432,-20.1774,0)--(-85.4729,-40.3548,32.6477)--(-65.2955,-73.0026,20.1774)--(-65.2955,-73.0026,-20.1774)--(-85.4729,-40.3548,-32.6477)--cycle
            (0,-97.9432,-20.1774)--(32.6477,-85.4729,-40.3548)--(20.1774,-65.2955,-73.0026)--(-20.1774,-65.2955,-73.0026)--(-32.6477,-85.4729,-40.3548)--cycle
            (97.9432,-20.1774,0)--(85.4729,-40.3548,-32.6477)--(65.2955,-73.0026,-20.1774)--(65.2955,-73.0026,20.1774)--(85.4729,-40.3548,32.6477)--cycle
            (0,-97.9432,20.1774)--(-32.6477,-85.4729,40.3548)--(-20.1774,-65.2955,73.0026)--(20.1774,-65.2955,73.0026)--(32.6477,-85.4729,40.3548)--cycle
            (85.4729,40.3548,-32.6477)--(97.9432,20.1774,0)--(97.9432,-20.1774,0)--(85.4729,-40.3548,-32.6477)--(73.0026,-20.1774,-65.2955)--(73.0026,20.1774,-65.2955)--cycle
            (85.4729,-40.3548,32.6477)--(97.9432,-20.1774,0)--(97.9432,20.1774,0)--(85.4729,40.3548,32.6477)--(73.0026,20.1774,65.2955)--(73.0026,-20.1774,65.2955)--cycle
            (-85.4729,40.3548,32.6477)--(-97.9432,20.1774,0)--(-97.9432,-20.1774,0)--(-85.4729,-40.3548,32.6477)--(-73.0026,-20.1774,65.2955)--(-73.0026,20.1774,65.2955)--cycle
            (-85.4729,-40.3548,-32.6477)--(-97.9432,-20.1774,0)--(-97.9432,20.1774,0)--(-85.4729,40.3548,-32.6477)--(-73.0026,20.1774,-65.2955)--(-73.0026,-20.1774,-65.2955)--cycle
            (40.3548,32.6477,-85.4729)--(20.1774,0,-97.9432)--(-20.1774,0,-97.9432)--(-40.3548,32.6477,-85.4729)--(-20.1774,65.2955,-73.0026)--(20.1774,65.2955,-73.0026)--cycle
            (-40.3548,-32.6477,-85.4729)--(-20.1774,0,-97.9432)--(20.1774,0,-97.9432)--(40.3548,-32.6477,-85.4729)--(20.1774,-65.2955,-73.0026)--(-20.1774,-65.2955,-73.0026)--cycle
            (40.3548,-32.6477,85.4729)--(20.1774,0,97.9432)--(-20.1774,0,97.9432)--(-40.3548,-32.6477,85.4729)--(-20.1774,-65.2955,73.0026)--(20.1774,-65.2955,73.0026)--cycle
            (-40.3548,32.6477,85.4729)--(-20.1774,0,97.9432)--(20.1774,0,97.9432)--(40.3548,32.6477,85.4729)--(20.1774,65.2955,73.0026)--(-20.1774,65.2955,73.0026)--cycle
            (32.6477,85.4729,-40.3548)--(0,97.9432,-20.1774)--(0,97.9432,20.1774)--(32.6477,85.4729,40.3548)--(65.2955,73.0026,20.1774)--(65.2955,73.0026,-20.1774)--cycle
            (-32.6477,85.4729,40.3548)--(0,97.9432,20.1774)--(0,97.9432,-20.1774)--(-32.6477,85.4729,-40.3548)--(-65.2955,73.0026,-20.1774)--(-65.2955,73.0026,20.1774)--cycle
            (-32.6477,-85.4729,-40.3548)--(0,-97.9432,-20.1774)--(0,-97.9432,20.1774)--(-32.6477,-85.4729,40.3548)--(-65.2955,-73.0026,20.1774)--(-65.2955,-73.0026,-20.1774)--cycle
            (32.6477,-85.4729,40.3548)--(0,-97.9432,20.1774)--(0,-97.9432,-20.1774)--(32.6477,-85.4729,-40.3548)--(65.2955,-73.0026,-20.1774)--(65.2955,-73.0026,20.1774)--cycle
            (20.1774,65.2955,-73.0026)--(32.6477,85.4729,-40.3548)--(65.2955,73.0026,-20.1774)--(85.4729,40.3548,-32.6477)--(73.0026,20.1774,-65.2955)--(40.3548,32.6477,-85.4729)--cycle
            (85.4729,40.3548,32.6477)--(73.0026,20.1774,65.2955)--(40.3548,32.6477,85.4729)--(20.1774,65.2955,73.0026)--(32.6477,85.4729,40.3548)--(65.2955,73.0026,20.1774)--cycle
            (-73.0026,20.1774,65.2955)--(-40.3548,32.6477,85.4729)--(-20.1774,65.2955,73.0026)--(-32.6477,85.4729,40.3548)--(-65.2955,73.0026,20.1774)--(-85.4729,40.3548,32.6477)--cycle
            (-85.4729,40.3548,-32.6477)--(-65.2955,73.0026,-20.1774)--(-32.6477,85.4729,-40.3548)--(-20.1774,65.2955,-73.0026)--(-40.3548,32.6477,-85.4729)--(-73.0026,20.1774,-65.2955)--cycle
            (-85.4729,-40.3548,32.6477)--(-65.2955,-73.0026,20.1774)--(-32.6477,-85.4729,40.3548)--(-20.1774,-65.2955,73.0026)--(-40.3548,-32.6477,85.4729)--(-73.0026,-20.1774,65.2955)--cycle
            (-20.1774,-65.2955,-73.0026)--(-32.6477,-85.4729,-40.3548)--(-65.2955,-73.0026,-20.1774)--(-85.4729,-40.3548,-32.6477)--(-73.0026,-20.1774,-65.2955)--(-40.3548,-32.6477,-85.4729)--cycle
            (85.4729,-40.3548,-32.6477)--(65.2955,-73.0026,-20.1774)--(32.6477,-85.4729,-40.3548)--(20.1774,-65.2955,-73.0026)--(40.3548,-32.6477,-85.4729)--(73.0026,-20.1774,-65.2955)--cycle
            (20.1774,-65.2955,73.0026)--(32.6477,-85.4729,40.3548)--(65.2955,-73.0026,20.1774)--(85.4729,-40.3548,32.6477)--(73.0026,-20.1774,65.2955)--(40.3548,-32.6477,85.4729)--cycle;
    }
}

\end{document}

答案2

我从一些代码开始关于二十面体的帖子

结果图像相当不错。五边形很小。调整代码以获得所需的效果。结果图像是这里

请参阅所附代码。

\documentclass[border=2 mm,12pt,tikz]{standalone}
\usepackage{tikz,tikz-3dplot} 
\usetikzlibrary{calc} %NEED TO CALCULATE NEW POINTS
\usepackage{fouriernc}

\pgfmathsetmacro{\b}{0.1}
\pgfmathsetmacro{\c}{1-\b}

\newcommand{\pentagon}[6]{
\filldraw[fill=gray,draw=black] 
($\c*(#1)+\b*(#2)$)--
($\c*(#1)+\b*(#3)$)--
($\c*(#1)+\b*(#4)$)--
($\c*(#1)+\b*(#5)$)--
($\c*(#1)+\b*(#6)$)--cycle;
}
\newcommand{\hexagon}[4]{
\draw[#4]
($\c*(#1)+\b*(#2)$)--
($\b*(#1)+\c*(#2)$)--
($\c*(#2)+\b*(#3)$)--
($\b*(#2)+\c*(#3)$)--
($\c*(#3)+\b*(#1)$)--
($\b*(#3)+\c*(#1)$)--cycle;
}



\begin{document}
    \tdplotsetmaincoords{65}{100}
    \begin{tikzpicture}[tdplot_main_coords,scale=1,line join=round]
    \pgfmathsetmacro\a{2}
    \pgfmathsetmacro{\phi}{\a*(1+sqrt(5))/2}
    \path 
    coordinate(A) at (0,\phi,\a)
    coordinate(B) at (0,\phi,-\a)
    coordinate(C) at (0,-\phi,\a)
    coordinate(D) at (0,-\phi,-\a)
    coordinate(E) at (\a,0,\phi)
    coordinate(F) at (\a,0,-\phi)
    coordinate(G) at (-\a,0,\phi)
    coordinate(H) at (-\a,0,-\phi)
    coordinate(I) at (\phi,\a,0)
    coordinate(J) at (\phi,-\a,0)
    coordinate(K) at (-\phi,\a,0)
    coordinate(L) at (-\phi,-\a,0);
    %MORE POINTS
    %G-CEAKL "TOP" 
    \hexagon{G}{C}{E}{}
    \hexagon{G}{E}{A}{}
    \hexagon{G}{A}{K}{dotted}
    \hexagon{G}{K}{L}{dotted}
    \hexagon{G}{L}{C}{dotted}
    %F-IJDHB "BOTTOM"
    \hexagon{F}{I}{J}{}
    \hexagon{F}{J}{D}{}
    \hexagon{F}{D}{H}{dotted}
    \hexagon{F}{H}{B}{dotted}
    \hexagon{F}{B}{I}{}
    %CJEIABKHLD "STRIP"
    \hexagon{C}{J}{E}{}
    \hexagon{J}{E}{I}{}
    \hexagon{E}{I}{A}{}
    \hexagon{I}{A}{B}{}
    \hexagon{A}{B}{K}{dotted}
    \hexagon{B}{K}{H}{dotted}
    \hexagon{K}{H}{L}{dotted}
    \hexagon{H}{L}{D}{dotted}
    \hexagon{L}{D}{C}{dotted}
    \hexagon{D}{C}{J}{}
    %A-BKGEI
    %B-AIFKH
    %K-ABHLG
    %G-AKLCE
    %E-AGCJK
    %I-AEJFB
    %D-CLHFJ
    %C-DJEGL
    %L-DHKGC
    %H-DFBKL
    %F-DHBIJ
    %J-DFHLC
    \pentagon{A}{B}{K}{G}{E}{I}
    \pentagon{B}{A}{I}{F}{K}{H}
    \pentagon{C}{D}{J}{E}{G}{L}
    \pentagon{D}{C}{L}{H}{F}{J}
    \pentagon{E}{A}{G}{C}{J}{I}
    \pentagon{F}{D}{H}{B}{I}{J}
    \pentagon{G}{A}{K}{L}{C}{E}
    \pentagon{H}{D}{F}{B}{K}{L}
    \pentagon{I}{A}{E}{J}{F}{B}
    \pentagon{J}{D}{F}{I}{E}{C}
    \pentagon{K}{A}{B}{H}{L}{G}
    \pentagon{L}{D}{H}{K}{G}{C}
    
    
    \path[dashed, thick]    (B) -- (H) -- (F) 
    (D) -- (L) -- (H) --cycle 
    (K) -- (L) -- (H) --cycle
    (K) -- (L) -- (G) --cycle
    (C) -- (L) (B)--(K) (A)--(K)
    ;

        \path[ultra thick]
        (A) -- (I) -- (B) --cycle 
        (F) -- (I) -- (B) --cycle 
        (F) -- (I) -- (J) --cycle
        (F) -- (D) -- (J) --cycle
        (C) -- (D) -- (J) --cycle
        (C) -- (E) -- (J) --cycle
        (I) -- (E) -- (J) --cycle
        (I) -- (E) -- (A) --cycle
        (G) -- (E) -- (A) --cycle
        (G) -- (E) -- (C) --cycle
        ; 
% \foreach \point/\position in {A/right,B/below,C/above,D/left,E/{above right},F/below,G/above,H/left,I/below,J/right,K/below,L/left}
%{
%    \fill (\point) circle (1.5pt);
%    \node[\position=3pt] at (\point) {$\point$};
%}

\end{tikzpicture}
\end{document} 

答案3

使用非官方的 Asymptote 包多面体_js.asy

使用以下方式编译asy -f png -render=8 <name>.asy

import polyhedron_js;

currentprojection=orthographic(1,1,.5);
currentlight=Viewport;
size(7cm);

int numberofframes=72;
string[] files;

// Optional arguments and "normal" is always coincide with orthographic (1,1,.5)
path3 boundingbox = circle((0,0,0), r=1.01, normal=(1,1,.5)); 


for (int j=0; j<numberofframes; ++j)
{
  files[j]="T"+(string) j;
  picture pic;
  draw(pic, boundingbox,invisible);
  draw(pic,rotate(-j*5,Z)*surface(truncIcos),lightgreen+opacity(.7));
  draw(pic,rotate(-j*5,Z)*truncIcos,1bp+red);
  add(pic);
  shipout(files[j],bbox(invisible));
  erase();
}

在此处输入图片描述

使用https://ezgif.com/pdf-to-gif获取具有以下尺寸的 gif 文件400 x 400

import polyhedron_js;
currentprojection=orthographic(1,1,.5);
currentlight=Viewport;
size(7cm);

draw(surface(truncIcos),lightgreen+opacity(.7));
draw(truncIcos,1bp+red);
shipout(bbox(invisible));

在此处输入图片描述

相关内容