[Tex/LaTex] How to plot the four regular star polyhedra with tikz

3dpst-3dplotpst-solides3dtikz-3dplottikz-pgf

I can plot the regular convex polyhedra, for examples

\begin{tikzpicture}[scale=1.0]
  \tikzstyle{every node}=[circle,fill=blue!20,inner sep=0pt,minimum size=0.4cm]
    \foreach \y[count=\a] in {10,9,4}
      {\pgfmathtruncatemacro{\kn}{120*\a-90}
       \node at (\kn:3) (b\a) {\small \y};}
    \foreach \y[count=\a] in {8,7,2}
      {\pgfmathtruncatemacro{\kn}{120*\a-90}
       \node at (\kn:2.2) (d\a) {\small \y};}
    \foreach \y[count=\a] in {1,5,6}
      {\pgfmathtruncatemacro{\jn}{120*\a-30}
       \node at (\jn:1.5) (a\a) {\small \y};}
    \foreach \y[count=\a] in {3,11,12}
      {\pgfmathtruncatemacro{\jn}{120*\a-30}
       \node at (\jn:3) (c\a) {\small \y};}
  \draw[dashed] (a1)--(a2)--(a3)--(a1);
  \draw[ultra thick] (d1)--(d2)--(d3)--(d1);
  \foreach \a in {1,2,3}
   {\draw[dashed] (a\a)--(c\a);
   \draw[ultra thick] (d\a)--(b\a);}
   \draw[ultra thick] (c1)--(b1)--(c3)--(b3)--(c2)--(b2)--(c1);
   \draw[ultra thick] (c1)--(d1)--(c3)--(d3)--(c2)--(d2)--(c1);
   \draw[dashed] (b1)--(a1)--(b2)--(a2)--(b3)--(a3)--(b1);
\end{tikzpicture}

enter image description here

But I just do not know how to plot the four regular star polyhedra with tikz properly (a pseudo-3D shape, the number in the vertex is not necessary.). And I didn't find any packages which may be helpful to this question. Any comments or answers will be appreciated! Any other methods in tex is also welcome!

Best Answer

You could start by specifying the coordinates in 3D (obtained from Sacred Geometry):

\documentclass{standalone}
\usepackage{tikz}
\begin{document}

\def \phi {1.617}
\begin{tikzpicture}[
    x={(-0.86in, -0.5in)}, y = {(0.86in, -0.5in)}, z = {(0, 1in)},
    rotate = 22,
    scale = 0.6,
    every node/.style = {
      circle, fill = blue!20, inner sep = 0pt, minimum size = 0.5cm
    },
    foreground/.style = { ultra thick },
    background/.style = { dashed }
  ]
  \coordinate (9) at (0, -\phi*\phi,  \phi);
  \coordinate (8) at (0,  \phi*\phi,  \phi);
  \coordinate (12) at (0,  \phi*\phi, -\phi);
  \coordinate (5) at (0, -\phi*\phi, -\phi);
  \coordinate (7) at ( \phi, 0,  \phi*\phi);
  \coordinate (3) at (-\phi, 0,  \phi*\phi);
  \coordinate (6) at (-\phi, 0, -\phi*\phi);
  \coordinate (4) at ( \phi, 0, -\phi*\phi);
  \coordinate (2) at ( \phi*\phi,  \phi, 0);
  \coordinate (10) at (-\phi*\phi,  \phi, 0);
  \coordinate (1) at (-\phi*\phi, -\phi, 0);
  \coordinate (11) at ( \phi*\phi, -\phi, 0);

  \draw[foreground] (10) -- (3) -- (8) -- (10) -- (12) -- (8);
  \draw[foreground] (4) -- (12) -- (2) -- (4) -- (11) -- (2);
  \draw[foreground] (9) -- (3) -- (7) -- (9) -- (11) -- (7);
  \draw[foreground] (7) -- (8) -- (2) -- cycle;
  \draw[background] (12) -- (6) -- (10) -- (1) -- (6) -- (5) -- (1)
    -- (9) -- (5) -- (11);
  \draw[background] (5) -- (4) -- (6);
  \draw[background] (3) -- (1);
  \foreach \n in {1,...,12}
    \node at (\n) {\n};
  \end{tikzpicture}
\end{document}

icosahedron

Drawing the star is then just a matter of connecting up the correct coordinates. Unfortunately, this will get ugly since tikz doesn't do "real" 3D drawing. I got this far before I decided the result would end up just a mess of lines.

polyhedron

To do this right, you probably need a better 3D rendering engine, such as asymptote.

Update

As requested, here's the code I used to draw the polyhedron above.

\documentclass{standalone}
\usepackage{tikz}

\begin{document}
  \def \phi {1.617}
  \begin{tikzpicture}[
      x={(-0.86in, -0.5in)}, y = {(0.86in, -0.5in)}, z = {(0, 1in)},
      rotate = 22,
      scale = 0.6,
      every node/.style = {
        circle, fill = blue!20, inner sep = 0pt, minimum size = 0.5cm
      },
      foreground/.style = { ultra thick },
      background/.style = { dashed }
    ]
    \coordinate (9) at (0, -\phi*\phi,  \phi);
    \coordinate (8) at (0,  \phi*\phi,  \phi);
    \coordinate (12) at (0,  \phi*\phi, -\phi);
    \coordinate (5) at (0, -\phi*\phi, -\phi);
    \coordinate (7) at ( \phi, 0,  \phi*\phi);
    \coordinate (3) at (-\phi, 0,  \phi*\phi);
    \coordinate (6) at (-\phi, 0, -\phi*\phi);
    \coordinate (4) at ( \phi, 0, -\phi*\phi);
    \coordinate (2) at ( \phi*\phi,  \phi, 0);
    \coordinate (10) at (-\phi*\phi,  \phi, 0);
    \coordinate (1) at (-\phi*\phi, -\phi, 0);
    \coordinate (11) at ( \phi*\phi, -\phi, 0);

    \coordinate (13) at ( \phi, 0,  1 / \phi);
    \coordinate (14) at (-\phi, 0,  1 / \phi);
    \coordinate (15) at (-\phi, 0, -1 / \phi);
    \coordinate (16) at ( \phi, 0, -1 / \phi);
    \coordinate (17) at ( 1 / \phi,  \phi, 0);
    \coordinate (18) at ( 1 / \phi, -\phi, 0);
    \coordinate (19) at (-1 / \phi, -\phi, 0);
    \coordinate (20) at (-1 / \phi,  \phi, 0);
    \coordinate (21) at (0,  1 / \phi,  \phi);
    \coordinate (22) at (0,  1 / \phi, -\phi);
    \coordinate (23) at (0, -1 / \phi, -\phi);
    \coordinate (24) at (0, -1 / \phi,  \phi);
    \coordinate (25) at ( 1,  1,  1);
    \coordinate (26) at ( 1, -1,  1);
    \coordinate (27) at (-1, -1,  1);
    \coordinate (28) at (-1,  1,  1);
    \coordinate (29) at (-1,  1, -1);
    \coordinate (30) at ( 1,  1, -1);
    \coordinate (31) at ( 1, -1, -1);
    \coordinate (32) at (-1, -1, -1);

    \draw[background] (12) -- (6) -- (10) (1) -- (6) -- (5) -- (1)
      (9) -- (5) -- (11);
    \draw[background] (5) -- (4) -- (6);
    \draw[background]
      (3) -- (27) (3) -- (14) (24) -- (27) -- (14) -- (28) -- (21) -- cycle
      (14) -- (1) -- (27);
    \draw[foreground] (10) -- (12) -- (8);
    \draw[foreground] (4) -- (12) -- (2) -- (4) -- (11) -- (2);
    \draw[foreground] (7) -- (11) -- (9);
    \draw[foreground] (8) -- (2) -- (7);
    \draw[foreground] (3) -- (24) (3) -- (21) (3) -- (28)
      (10) -- (14) (27) -- (9) -- (8) -- (28) (24) -- (7) -- (10);
  \end{tikzpicture}
\end{document}