6

I have some pictures http://www.mediafire.com/view/?58gs6ye0zf149fv How can I draw development of polyherons in Tex? Please help me.


enter image description here

enter image description here

minthao_2011
  • 4,534
  • 7
  • 36
  • 61

1 Answers1

14

Here's a solution for regular convex polyhedra:

  • the triangle solution (tetraeder, octaeder, ikosaeder) uses redifinition of the coordinate axes (0°, 60°). You have to specify the coordinates of the lower right (\uptrig) or upper right (\downtrig) corners.
  • the square solution (hexaeder) is straight forward as it only needs to draw squares
  • for the pentagon solution (dodecaeder) there are 10 directions (see picture). For both \uppent and \downpent you have to specify the path to the destination. So {10,1,10,7} means do go each one step in directions 10,1,10 and 7

Code

\documentclass[parskip]{scrartcl}
\usepackage[margin=5mm]{geometry}
\usepackage{tikz}
\usetikzlibrary{calc}

% === regular triangles ===
\newcommand{\uptrig}[2][blue!50!gray,draw=white,thick]% [options], list of coordinates e.g {1,2},{1,3},{4,2}
{   \foreach \c in {#2}
    \fill[#1] (\c) -- ($(\c)+(1,0)$) -- ($(\c)+(0,1)$) -- cycle;
}
\newcommand{\downtrig}[2][blue!50!gray,draw=white,thick]% [options], list of coordinates e.g {1,2},{1,3},{4,2}
{   \foreach \c in {#2}
    \fill[#1] (\c) -- ($(\c)+(1,0)$) -- ($(\c)+(1,-1)$) -- cycle;
}

% === squares ===
\newcommand{\squares}[2][blue!50!gray,draw=white,thick]% [options], list of coordinates e.g {1,2},{1,3},{4,2}
{   \foreach \c in {#2}
    \fill[#1] (\c) rectangle ($(\c)+(1,1)$) -- cycle;
}

% === regular pentagon ==
\newcommand{\downpent}[2][blue!50!gray,draw=white,thick]% [options], list of direction steps e.g {10/2/1/1}
{   
    \coordinate (temp) at (0,0);
    \foreach \p in {#2}
    {   \foreach \s in \p
        {   \coordinate (temp) at ($(temp)+(\s*36-18:1)$);
        }
        \fill[#1] ($(temp)+(54:0.618)$) -- ($(temp)+(126:0.618)$) -- ($(temp)+(198:0.618)$) -- ($(temp)+(270:0.618)$) -- ($(temp)+(342:0.618)$) -- cycle;
        \coordinate (temp) at (0,0);
    }
}
\newcommand{\uppent}[2][blue!50!gray,draw=white,thick]% [options], list of coordinates e.g {1,2},{1,3},{4,2}
{   
    \coordinate (temp) at (0,0);
    \foreach \p in {#2}
    {   \foreach \s in \p
        {   \coordinate (temp) at ($(temp)+(\s*36-18:1)$);
        }
        \fill[#1] ($(temp)+(-54:0.618)$) -- ($(temp)+(-126:0.618)$) -- ($(temp)+(-198:0.618)$) -- ($(temp)+(-270:0.618)$) -- ($(temp)+(-342:0.618)$) -- cycle;
        \coordinate (temp) at (0,0);
    }
}

\begin{document}
\section*{3}
\begin{tikzpicture}
[   x={(0:1cm)},
    y={(60:1cm)},
    scale=2
]
    \uptrig[red,draw=white,thick]{{0,0},{1,0},{-1,1},{0,-1}}
    \downtrig{{-1,1},{0,1},{0,0},{0,-1}}
\end{tikzpicture}

\section*{4}
\begin{tikzpicture}[scale=2]
    \squares[green!50!gray,dashed,draw= white]{{0,0},{-1,0},{1,0},{0,1},{0,-1},{0,-2}}
\end{tikzpicture}

\section*{5}
\begin{tikzpicture}[scale=2]
    \downpent[orange,draw=white,thick]{{2},{4},{6},{8},{10},{10,1,10}}
    \uppent[cyan!50!blue,draw=white,thick]{{},{10,1},{10,1,10,3},{10,1,10,1},{10,1,10,9},{10,1,10,7}}
    \foreach \a [count=\c] in {18,54,...,342} \draw[->,thick] (0,0) -- (\a:1cm) node[label=\a:\c] {};
\end{tikzpicture}

\end{document}

Output

enter image description here

Tom Bombadil
  • 40,123