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

  • 3
    A question should typically revolve around an abstract issue (e.g. "How do I get a double horizontal line in a table?") rather than a concrete application (e.g. "How do I make this table?"). Questions that look like "Please do this complicated thing for me" tend to get closed because they are "too localized". Please try to make your question clear and simple by giving a minimal working example (MWE): you'll stand a greater chance of getting help. – hpesoj626 Oct 17 '12 at 8:22
  • 1
    Perhaps you can start with Drawing polyhedra using TikZ with semi-transparent and shading effect – hpesoj626 Oct 17 '12 at 8:23
  • Yes, I saw. But I want to draw development of this polyhedrons. – minthao_2011 Oct 17 '12 at 8:35
  • So you want to draw polyhedra step-by-step, e.g. add a new face in every slide? – Tom Bombadil Oct 17 '12 at 8:48
  • TomBombadil: I guess the OP wants to draw this. @minthao_2011: Am I right? – Claudio Fiandrino Oct 17 '12 at 8:55
13

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

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.