TikZ folding: Adding the platonic solids and beyond

When creating images for slides or papers, I quite often use PGF/TikZ. This is a powerful package that allows the creation of graphics within LaTeX and similar. Upon browsing through the TikZ manual I found the description of a library called folding. This library allows the creation of so-called folding nets that can then be cut out and pasted together to form a paper model of a solid. The library however only supports the dodecahedron which is used in the examples to construct a calendar.

Although as usual lacking any free-time I decided to add the remaining platonic solids. I contacted the makers of TikZ for adding the code, but until today I haven’t received any news from them. But that doesn’t mean you can’t already use this. Let’s look at the code.

The current version can be viewed by browsing the repository at SourceForge.net. The file containing my chances can be downloaded using this link. Just locate the tikzlibraryfolding.code.tex file in your installation and replace it with this file. You might want to keep your old file just in case something is broken (which really shouldn’t happen).

First a short explanation about the platonic solids for those of you who aren’t familiar with them. These are regular convex polyhedron with regular meaning that all faces have the same shape, all vertices have the same degree and all edges have the same length.  This means that all the faces are regular polygons. This is far from an exact definition, but it should be efficient to understand them for now. If you want more information I guess that Wikipedia would be a good starting point. You should also know that there are five platonic solids. In order of number of faces they are tetrahedron (4 triangles), hexahedron (usually called cube) (6 squares), octahedron (8 triangles), dodecahedron (12 pentagons) and icosahedron (20 triangles).

The folding library first defines how a face should look and then pastes these faces together adding folding, cutting and gluing marks. Because currently only the dodecahedron is supported, the only face type that is defined is the pentagon. So we will need to start by defining triangles and squares.

\def\tikz@lib@fold@triangle#1#2#3#4{%
  \begin{scope}[xshift=.5\tikz@lib@fold@length,yshift=.28868\tikz@lib@fold@length]
    #1
  \end{scope}
  \begin{scope}[shift={(60:\tikz@lib@fold@length)},rotate=-60]
    #2
  \end{scope}
  \begin{scope}[xshift=\tikz@lib@fold@length,rotate=180]
    #3
  \end{scope}
  \begin{scope}[rotate=60]
    #4
  \end{scope}
}

\def\tikz@lib@fold@square#1#2#3#4#5{%
  \begin{scope}[xshift=.5\tikz@lib@fold@length,yshift=.5\tikz@lib@fold@length]
    #1
  \end{scope}
  \begin{scope}[yshift=\tikz@lib@fold@length]
    #2
  \end{scope}
  \begin{scope}[xshift=\tikz@lib@fold@length,yshift=\tikz@lib@fold@length,rotate=-90]
    #3
  \end{scope}
  \begin{scope}[xshift=\tikz@lib@fold@length,rotate=180]
    #4
  \end{scope}
  \begin{scope}[rotate=90]
    #5
  \end{scope}
}

The basic idea behind the faces is that a n-gon has n+1 arguments. The first 1 describes the content of the face and the remaining n describe the different edges. So the triangle takes 4 arguments and the square 5. If you look at the original code for the pentagon, you’ll see that it takes 6 arguments. Let’s take the triangle as an example to see how this different arguments construct the face.

Line 2 in the code above sets a new scope with the origin at the center of the triangle. This center has x coordinate l/2 where l is the length of the side of the triangle and y coordinate l(√3)/4, which comes from the sine of 60 degrees divided by two. Inside this scope the first argument is placed. This takes care of the content of the face. Next we are going to draw the edges and whatever is connected to that edge. For each of the edges once again a new scope is set. This is done in such a way that for each edge its corresponding scope has its origin in a vertex incident with that edge, the X axis is parallel with that edges and directed towards it and the Y axis is perpendicular with the edge and pointing away from the face. Inside this scope the argument corresponding to that edge is placed. This argument can then draw the edge and whatever is connected to it: this could be a gluing mark, but could just as well be a whole array of faces.

Next we need to take care of a small technical detail. The user of the folding library can set the content of the faces using options. Since the library only supported dodecahedra it only provides these options for up to 12 faces, but we need to have support for 20 faces in case of the icosahedron. So we just need to extend that section as is shown below. In the first set of lines the options are defined and in the last set the default is set to empty.

\tikzoption{face 1}{\def\tikz@lib@fold@face@A{#1}}
\tikzoption{face 2}{\def\tikz@lib@fold@face@B{#1}}
\tikzoption{face 3}{\def\tikz@lib@fold@face@C{#1}}
\tikzoption{face 4}{\def\tikz@lib@fold@face@D{#1}}
\tikzoption{face 5}{\def\tikz@lib@fold@face@E{#1}}
\tikzoption{face 6}{\def\tikz@lib@fold@face@F{#1}}
\tikzoption{face 7}{\def\tikz@lib@fold@face@G{#1}}
\tikzoption{face 8}{\def\tikz@lib@fold@face@H{#1}}
\tikzoption{face 9}{\def\tikz@lib@fold@face@I{#1}}
\tikzoption{face 10}{\def\tikz@lib@fold@face@J{#1}}
\tikzoption{face 11}{\def\tikz@lib@fold@face@K{#1}}
\tikzoption{face 12}{\def\tikz@lib@fold@face@L{#1}}
\tikzoption{face 13}{\def\tikz@lib@fold@face@M{#1}}
\tikzoption{face 14}{\def\tikz@lib@fold@face@N{#1}}
\tikzoption{face 15}{\def\tikz@lib@fold@face@O{#1}}
\tikzoption{face 16}{\def\tikz@lib@fold@face@P{#1}}
\tikzoption{face 17}{\def\tikz@lib@fold@face@Q{#1}}
\tikzoption{face 18}{\def\tikz@lib@fold@face@R{#1}}
\tikzoption{face 19}{\def\tikz@lib@fold@face@S{#1}}
\tikzoption{face 20}{\def\tikz@lib@fold@face@T{#1}}

\let\tikz@lib@fold@face@A=\pgfutil@empty
\let\tikz@lib@fold@face@B=\pgfutil@empty
\let\tikz@lib@fold@face@C=\pgfutil@empty
\let\tikz@lib@fold@face@D=\pgfutil@empty
\let\tikz@lib@fold@face@E=\pgfutil@empty
\let\tikz@lib@fold@face@F=\pgfutil@empty
\let\tikz@lib@fold@face@G=\pgfutil@empty
\let\tikz@lib@fold@face@H=\pgfutil@empty
\let\tikz@lib@fold@face@I=\pgfutil@empty
\let\tikz@lib@fold@face@J=\pgfutil@empty
\let\tikz@lib@fold@face@K=\pgfutil@empty
\let\tikz@lib@fold@face@L=\pgfutil@empty
\let\tikz@lib@fold@face@M=\pgfutil@empty
\let\tikz@lib@fold@face@N=\pgfutil@empty
\let\tikz@lib@fold@face@O=\pgfutil@empty
\let\tikz@lib@fold@face@P=\pgfutil@empty
\let\tikz@lib@fold@face@Q=\pgfutil@empty
\let\tikz@lib@fold@face@R=\pgfutil@empty
\let\tikz@lib@fold@face@S=\pgfutil@empty
\let\tikz@lib@fold@face@T=\pgfutil@empty

Finally we come to our unfoldings of the platonic solids. The first platonic solid that we are going to add is the tetrahedron. The final result is already shown in the figure below, so you have a visual clue to which unfolding we want to create.

Unfolding of a tetrahedron

A tetrahedron as it is drawn by the folding library

Let’s jump right in! Here is the code that creates this unfolding of a tetrahedron:

\def\tikzfoldingtetrahedron#1[#2]#3;{%
  \begingroup%
    \tikzset{#2}%
    \tikz@lib@fold@triangle
        {\tikz@lib@fold@face@A}
        {\tikz@lib@fold@triangle
             {\tikz@lib@fold@face@B}
	         {\tikz@lib@fold@ear@path}
	         {\tikz@lib@fold@path}
	         {\tikz@lib@fold@cut@path}
        }
        {\tikz@lib@fold@triangle
             {\tikz@lib@fold@face@C}
	         {\tikz@lib@fold@ear@path}
	         {\tikz@lib@fold@path}
	         {\tikz@lib@fold@cut@path}
        }
        {\tikz@lib@fold@triangle
             {\tikz@lib@fold@face@D}
             {\tikz@lib@fold@ear@path}
             {\tikz@lib@fold@path}
             {\tikz@lib@fold@cut@path}
    }
  \endgroup
}

The unfoldings in the folding library are constructed as recursive trees. Starting from one face all the faces connected to it are described, and for these faces again all faces connected to it that not yet have been described are handled. For the tetrahedron we start with the central face (line 4). As we said above a triangle takes 4 arguments. The first one is the content of the face (line 5). The three other arguments are the three edges (line 6, 12 and 18).

As can be seen in the figure above this unfolding has a threefold symmetry and thus the three different edges have the same structure connected to them. I will only discuss one of them, but as is clear from the listing, I hope, the code for the three edges is identical except for the code that adds the content of the faces. So let’s look at the code at line 6. There is just a triangle connected to this edge. Like all other triangles, this triangle has 4 arguments. The first is the content of the face (in this case face B) at line 7. At the first edge we hang a gluing mark (line 8). The library defines the command \tikz@lib@fold@ear@path for this purpose. The second edge is the edge with which this triangle is connected to the first triangle. At the moment there isn’t actually anything drawn at this edge, so we draw the folding line now (line 9) and use the command \tikz@lib@fold@path for this. And finally the last edge doesn’t need anything special, so we just draw a simple edge along which one needs to cut (line 10) using the command \tikz@lib@fold@cut@path.

Next in line is the cube or hexahedron.

Unfolding of a cube

A cube as it is drawn by the folding library

\def\tikzfoldingcube#1[#2]#3;{%
  \begingroup%
    \tikzset{#2}%
    \tikz@lib@fold@square{\tikz@lib@fold@face@A}
    {
			\tikz@lib@fold@square{\tikz@lib@fold@face@B}
	    {\tikz@lib@fold@cut@path}
	    {\tikz@lib@fold@ear@path}
	    {\tikz@lib@fold@path}
	    {\tikz@lib@fold@ear@path}
    }
    {
			\tikz@lib@fold@square{\tikz@lib@fold@face@C}
	    {\tikz@lib@fold@cut@path}
	    {\tikz@lib@fold@cut@path}
	    {\tikz@lib@fold@path}
	    {\tikz@lib@fold@cut@path}
    }
    {
			\tikz@lib@fold@square{\tikz@lib@fold@face@D}
	    {
				\tikz@lib@fold@square{\tikz@lib@fold@face@E}
		    {\tikz@lib@fold@ear@path}
		    {\tikz@lib@fold@cut@path}
		    {\tikz@lib@fold@path}
		    {\tikz@lib@fold@ear@path}
	    }
	    {\tikz@lib@fold@ear@path}
	    {\tikz@lib@fold@path}
	    {\tikz@lib@fold@ear@path}
    }
    {
			\tikz@lib@fold@square{\tikz@lib@fold@face@F}
	    {\tikz@lib@fold@ear@path}
	    {\tikz@lib@fold@cut@path}
	    {\tikz@lib@fold@path}
	    {\tikz@lib@fold@cut@path}
    }
  \endgroup
}

Then comes the octahedron.

Unfolding of an octahedron

An octahedron as it is drawn by the folding library

\def\tikzfoldingoctahedron#1[#2]#3;{%
  \begingroup%
    \tikzset{#2}%
    \tikz@lib@fold@triangle
        {\tikz@lib@fold@face@A}
        {\tikz@lib@fold@triangle
             {\tikz@lib@fold@face@B}
	         {\tikz@lib@fold@triangle
	              {\tikz@lib@fold@face@C}
		          {\tikz@lib@fold@cut@path}
		          {\tikz@lib@fold@path}
		          {\tikz@lib@fold@triangle
		               {\tikz@lib@fold@face@D}
			           {\tikz@lib@fold@cut@path}
			           {\tikz@lib@fold@path}
			           {\tikz@lib@fold@cut@path}
		          }
	         }
	         {\tikz@lib@fold@path}
	         {\tikz@lib@fold@triangle
                  {\tikz@lib@fold@face@E}
                  {\tikz@lib@fold@ear@path}
                  {\tikz@lib@fold@path}
		          {\tikz@lib@fold@ear@path}
	         }
        }
        {\tikz@lib@fold@triangle
             {\tikz@lib@fold@face@F}
	         {\tikz@lib@fold@ear@path}
	         {\tikz@lib@fold@path}
	         {\tikz@lib@fold@ear@path}
        }
        {\tikz@lib@fold@triangle
             {\tikz@lib@fold@face@G}
	         {\tikz@lib@fold@cut@path}
	         {\tikz@lib@fold@path}
	         {\tikz@lib@fold@triangle
	              {\tikz@lib@fold@face@H}
		          {\tikz@lib@fold@ear@path}
		          {\tikz@lib@fold@path}
		          {\tikz@lib@fold@cut@path}
	         }
        }
  \endgroup
}

Usually the dodecahedron is next in line, but since this is already implemented in the folding library we skip right on to the icosahedron.

Unfolding of an icosahedron

An icosahedron as it is drawn by the folding library

\def\tikzfoldingicosahedron#1[#2]#3;{%
  \begingroup%
    \tikzset{#2}%
    \tikz@lib@fold@triangle
        {\tikz@lib@fold@face@A}
        {\tikz@lib@fold@triangle
             {\tikz@lib@fold@face@B}
	         {\tikz@lib@fold@triangle
	              {\tikz@lib@fold@face@C}
		          {\tikz@lib@fold@triangle
		               {\tikz@lib@fold@face@D}
			           {\tikz@lib@fold@cut@path}
			           {\tikz@lib@fold@path}
			           {\tikz@lib@fold@triangle
			                {\tikz@lib@fold@face@E}
				            {\tikz@lib@fold@cut@path}
				            {\tikz@lib@fold@path}
				            {\tikz@lib@fold@triangle
				                 {\tikz@lib@fold@face@F}
		                         {\tikz@lib@fold@ear@path}
			                     {\tikz@lib@fold@path}
			                     {\tikz@lib@fold@triangle
			                          {\tikz@lib@fold@face@G}
			                          {\tikz@lib@fold@ear@path}
			                          {\tikz@lib@fold@path}
			                          {\tikz@lib@fold@cut@path}
			                     }
		                    }
			           }
		          }
                  {\tikz@lib@fold@path}
                  {\tikz@lib@fold@ear@path}
	         }
	         {\tikz@lib@fold@path}
	         {\tikz@lib@fold@ear@path}
        }
        {\tikz@lib@fold@triangle
             {\tikz@lib@fold@face@H}
	         {\tikz@lib@fold@triangle
	              {\tikz@lib@fold@face@I}
		          {\tikz@lib@fold@triangle
		               {\tikz@lib@fold@face@J}
			           {\tikz@lib@fold@cut@path}
			           {\tikz@lib@fold@path}
			           {\tikz@lib@fold@triangle
			                {\tikz@lib@fold@face@K}
				            {\tikz@lib@fold@cut@path}
				            {\tikz@lib@fold@path}
				            {\tikz@lib@fold@triangle
				                 {\tikz@lib@fold@face@L}
					             {\tikz@lib@fold@triangle
					                  {\tikz@lib@fold@face@M}
						              {\tikz@lib@fold@cut@path}
						              {\tikz@lib@fold@path}
						              {\tikz@lib@fold@cut@path}
					             }
					             {\tikz@lib@fold@path}
					             {\tikz@lib@fold@triangle
					                  {\tikz@lib@fold@face@N}
						              {\tikz@lib@fold@ear@path}
						              {\tikz@lib@fold@path}
						              {\tikz@lib@fold@cut@path}
					             }
				            }
			           }
		          }
		          {\tikz@lib@fold@path}
		          {\tikz@lib@fold@ear@path}
	         }
	         {\tikz@lib@fold@path}
	         {\tikz@lib@fold@ear@path}
        }
        {\tikz@lib@fold@triangle
             {\tikz@lib@fold@face@O}
	         {\tikz@lib@fold@triangle
	              {\tikz@lib@fold@face@P}
		          {\tikz@lib@fold@triangle
		               {\tikz@lib@fold@face@Q}
			           {\tikz@lib@fold@cut@path}
			           {\tikz@lib@fold@path}
			           {\tikz@lib@fold@triangle
			                {\tikz@lib@fold@face@R}
				            {\tikz@lib@fold@cut@path}
				            {\tikz@lib@fold@path}
				            {\tikz@lib@fold@triangle
				                 {\tikz@lib@fold@face@S}
				                 {\tikz@lib@fold@ear@path}
					             {\tikz@lib@fold@path}
					             {\tikz@lib@fold@triangle
                                      {\tikz@lib@fold@face@T}
                                      {\tikz@lib@fold@ear@path}
						              {\tikz@lib@fold@path}
						              {\tikz@lib@fold@cut@path}
					             }
				            }
			           }
		          }
		          {\tikz@lib@fold@path}
		          {\tikz@lib@fold@ear@path}
	         }
	         {\tikz@lib@fold@path}
	         {\tikz@lib@fold@ear@path}
        }
  \endgroup
}

Like I said above, the dodecahedron is already implemented in the folding library, but on the support forum for TikZ there was a request for an alternate unfolding that would allow a larger format (because its bounding box is smaller). I added this unfolding, since I was already writing the rest.

First have a look at the unfolding that currently is in the folding library.

Unfolding of a dodecahedron

A dodecahedron as it is drawn by the folding library

And this is the new version:

Unfolding of a dodecahedron

A dodecahedron as it is drawn by the folding library (alternate version)

\def\tikzfoldingalternatedodecahedron#1[#2]#3;{%
  \begingroup%
    \tikzset{#2}%
    \tikz@lib@fold@pentagon
        {\tikz@lib@fold@face@A}
        {\tikz@lib@fold@pentagon
             {\tikz@lib@fold@face@B}
             {\tikz@lib@fold@cut@path}
             {\tikz@lib@fold@ear@path}
             {\tikz@lib@fold@path}
             {\tikz@lib@fold@cut@path}
             {\tikz@lib@fold@pentagon
                  {\tikz@lib@fold@face@C}
                  {\tikz@lib@fold@pentagon
                       {\tikz@lib@fold@face@D}
                       {\tikz@lib@fold@ear@path}
                       {\tikz@lib@fold@ear@path}
                       {\tikz@lib@fold@path}
                       {\tikz@lib@fold@cut@path}
                       {\tikz@lib@fold@ear@path}
                  }
                  {\tikz@lib@fold@pentagon
                       {\tikz@lib@fold@face@E}
                       {\tikz@lib@fold@ear@path}
                       {\tikz@lib@fold@ear@path}
                       {\tikz@lib@fold@path}
                       {\tikz@lib@fold@cut@path}
                       {\tikz@lib@fold@ear@path}
                  }
                  {\tikz@lib@fold@path}
                  {\tikz@lib@fold@pentagon
                       {\tikz@lib@fold@face@F}
                       {\tikz@lib@fold@ear@path}
                       {\tikz@lib@fold@ear@path}
                       {\tikz@lib@fold@path}
                       {\tikz@lib@fold@ear@path}
                       {\tikz@lib@fold@cut@path}
                  }
                  {\tikz@lib@fold@pentagon
                       {\tikz@lib@fold@face@G}
                       {\tikz@lib@fold@ear@path}
                       {\tikz@lib@fold@ear@path}
                       {\tikz@lib@fold@path}
                       {\tikz@lib@fold@cut@path}
                       {\tikz@lib@fold@ear@path}
                  }
             }
        }
        {\tikz@lib@fold@ear@path}
        {\tikz@lib@fold@pentagon
             {\tikz@lib@fold@face@H}
             {\tikz@lib@fold@pentagon
                  {\tikz@lib@fold@face@I}
                  {\tikz@lib@fold@cut@path}
                  {\tikz@lib@fold@ear@path}
                  {\tikz@lib@fold@path}
                  {\tikz@lib@fold@cut@path}
                  {\tikz@lib@fold@cut@path}
             }
             {\tikz@lib@fold@pentagon
                  {\tikz@lib@fold@face@J}
                  {\tikz@lib@fold@cut@path}
                  {\tikz@lib@fold@cut@path}
                  {\tikz@lib@fold@path}
                  {\tikz@lib@fold@cut@path}
            {\tikz@lib@fold@cut@path}
        }
        {\tikz@lib@fold@path}
        {\tikz@lib@fold@pentagon
             {\tikz@lib@fold@face@K}
             {\tikz@lib@fold@cut@path}
             {\tikz@lib@fold@ear@path}
             {\tikz@lib@fold@path}
             {\tikz@lib@fold@cut@path}
             {\tikz@lib@fold@cut@path}
        }
        {\tikz@lib@fold@pentagon
             {\tikz@lib@fold@face@L}
             {\tikz@lib@fold@cut@path}
             {\tikz@lib@fold@ear@path}
             {\tikz@lib@fold@path}
             {\tikz@lib@fold@cut@path}
             {\tikz@lib@fold@cut@path}
        }
    }
    {\tikz@lib@fold@ear@path}
    {\tikz@lib@fold@ear@path}
  \endgroup
}

So, that’s all for the platonic solids. But I wasn’t about to let some small detail like a finite set of structures stop me. The next logical step would be the archimedean solids and that was the step I took.

Archimedean solids are semi-regular polyhedra i.e. there faces can be different regular polygons, but the vertices are still always the same. There are 13 Archimedean solids. Ranked in ascending order of number of faces they are: truncated tetrahedron, cuboctahedron, truncated cube, truncated octahedron, rhombicuboctahedron, truncated cuboctahedron, snub cube, icosidodecahedron, truncated dodecahedron, truncated icosahedron, rhombicosidodecahedron, truncated icosidodecahedron and snub dodecahedron. The smallest has 8 faces, but the largest has 92 faces. This means a lot of work. At the moment I just implemented the first two. The truncated tetrahedron has triangular and hexagonal faces, so first I need to add the hexagon as a face.

\def\tikz@lib@fold@hexagon#1#2#3#4#5#6#7{%
  \begin{scope}
          [shift={(60:\tikz@lib@fold@length)}]
    #1
  \end{scope}
  \begin{scope}
          [shift={(120:\tikz@lib@fold@length)},
           shift={(60:\tikz@lib@fold@length)}]
    #2
  \end{scope}
   \begin{scope}
           [shift={(120:\tikz@lib@fold@length)},
            shift={(60:\tikz@lib@fold@length)},
            xshift=\tikz@lib@fold@length,
            rotate=-60]
    #3
  \end{scope}
  \begin{scope}
          [xshift=\tikz@lib@fold@length,
           shift={(60:\tikz@lib@fold@length)},
           rotate=-120]
    #4
  \end{scope}
  \begin{scope}
          [xshift=\tikz@lib@fold@length,
           rotate=180]
    #5
  \end{scope}
  \begin{scope}
          [rotate=120]
    #6
  \end{scope}
  \begin{scope}
          [shift={(120:\tikz@lib@fold@length)},
           rotate=60]
    #7
  \end{scope}
}

First an image of the unfoldings that are used:

An unfolding of a truncated tetrahedron

A truncated tetrahedron as it is drawn by the folding library

An unfolding of a cuboctahedron

A cuboctahedron as it is drawn by the folding library

And finally the code for the truncated tetrahedron and cuboctahedron.

\def\tikzfoldingtruncatedtetrahedron#1[#2]#3;{%
  \begingroup%
    \tikzset{#2}%
    \tikz@lib@fold@hexagon
        {\tikz@lib@fold@face@A}
        {\tikz@lib@fold@hexagon
             {\tikz@lib@fold@face@B}
	         {\tikz@lib@fold@ear@path}
	         {\tikz@lib@fold@ear@path}
	         {\tikz@lib@fold@ear@path}
	         {\tikz@lib@fold@path}
	         {\tikz@lib@fold@ear@path}
	         {\tikz@lib@fold@cut@path}
        }
        {\tikz@lib@fold@triangle
             {\tikz@lib@fold@face@C}
	         {\tikz@lib@fold@cut@path}
	         {\tikz@lib@fold@path}
	         {\tikz@lib@fold@cut@path}
        }
        {\tikz@lib@fold@hexagon
             {\tikz@lib@fold@face@D}
	         {\tikz@lib@fold@ear@path}
	         {\tikz@lib@fold@ear@path}
	         {\tikz@lib@fold@ear@path}
	         {\tikz@lib@fold@path}
	         {\tikz@lib@fold@ear@path}
	         {\tikz@lib@fold@cut@path}
        }
        {\tikz@lib@fold@triangle
             {\tikz@lib@fold@face@E}
	         {\tikz@lib@fold@cut@path}
	         {\tikz@lib@fold@path}
	         {\tikz@lib@fold@cut@path}
        }
        {\tikz@lib@fold@hexagon
             {\tikz@lib@fold@face@F}
	         {\tikz@lib@fold@triangle
	              {\tikz@lib@fold@face@G}
		          {\tikz@lib@fold@cut@path}
		          {\tikz@lib@fold@path}
		          {\tikz@lib@fold@cut@path}
	         }
	         {\tikz@lib@fold@ear@path}
	         {\tikz@lib@fold@ear@path}
	         {\tikz@lib@fold@path}
	         {\tikz@lib@fold@ear@path}
	         {\tikz@lib@fold@cut@path}
        }
        {\tikz@lib@fold@triangle
             {\tikz@lib@fold@face@H}
	         {\tikz@lib@fold@cut@path}
	         {\tikz@lib@fold@path}
	         {\tikz@lib@fold@cut@path}
        }
  \endgroup
}

\def\tikzfoldingcuboctahedron#1[#2]#3;{%
  \begingroup%
    \tikzset{#2}%
    \tikz@lib@fold@square
        {\tikz@lib@fold@face@A}
        {\tikz@lib@fold@triangle
             {\tikz@lib@fold@face@B}
	         {\tikz@lib@fold@square
	              {\tikz@lib@fold@face@C}
		          {\tikz@lib@fold@triangle
		               {\tikz@lib@fold@face@D}
			           {\tikz@lib@fold@cut@path}
			           {\tikz@lib@fold@path}
			           {\tikz@lib@fold@square
		                    {\tikz@lib@fold@face@E}
		                    {\tikz@lib@fold@ear@path}
		                    {\tikz@lib@fold@ear@path}
		                    {\tikz@lib@fold@path}
		                    {\tikz@lib@fold@ear@path}
                       }
		          }
		          {\tikz@lib@fold@ear@path}
		          {\tikz@lib@fold@path}
		          {\tikz@lib@fold@ear@path}
	         }
	         {\tikz@lib@fold@path}
	         {\tikz@lib@fold@cut@path}
        }
        {\tikz@lib@fold@triangle
             {\tikz@lib@fold@face@F}
	         {\tikz@lib@fold@square
	              {\tikz@lib@fold@face@G}
                  {\tikz@lib@fold@ear@path}
                  {\tikz@lib@fold@ear@path}
                  {\tikz@lib@fold@path}
                  {\tikz@lib@fold@ear@path}
             }
	         {\tikz@lib@fold@path}
	         {\tikz@lib@fold@cut@path}
        }
        {\tikz@lib@fold@triangle
             {\tikz@lib@fold@face@H}
	         {\tikz@lib@fold@square
	              {\tikz@lib@fold@face@I}
		          {\tikz@lib@fold@ear@path}
		          {\tikz@lib@fold@ear@path}
		          {\tikz@lib@fold@path}
		          {\tikz@lib@fold@triangle
		               {\tikz@lib@fold@face@J}
			           {\tikz@lib@fold@cut@path}
			           {\tikz@lib@fold@path}
			           {\tikz@lib@fold@cut@path}
		          }
	         }
	         {\tikz@lib@fold@path}
	         {\tikz@lib@fold@cut@path}
        }
        {\tikz@lib@fold@triangle
             {\tikz@lib@fold@face@K}
	         {\tikz@lib@fold@square
	              {\tikz@lib@fold@face@L}
		          {\tikz@lib@fold@triangle
		               {\tikz@lib@fold@face@M}
			           {\tikz@lib@fold@cut@path}
			           {\tikz@lib@fold@path}
			           {\tikz@lib@fold@cut@path}
		          }
		          {\tikz@lib@fold@ear@path}
		          {\tikz@lib@fold@path}
		          {\tikz@lib@fold@triangle
                       {\tikz@lib@fold@face@N}
			           {\tikz@lib@fold@cut@path}
			           {\tikz@lib@fold@path}
			           {\tikz@lib@fold@cut@path}
		          }
	         }
	    {\tikz@lib@fold@path}
	    {\tikz@lib@fold@cut@path}
    }
  \endgroup
}

That’s about all I have at the moment. I promise to also post the other Archimedean solids as soon as I find the time to write them.

Advertisements
Comments
15 Responses to “TikZ folding: Adding the platonic solids and beyond”
  1. Walter says:

    This is awesome! Thanks for sharing.

  2. That’s super interesting! But I see that 3 years afterward, it’s not integrated yet. Did you contact upstream informally in a mail or so, or formally in a patch report on sourceforge? Please resumbit your work to ensure that it gets integrated, that’s very interesting!

    • nvcleemp says:

      Hi, yes, I’ve send two mails and made some posts on sourceforge, but never got an answer. At the moment I’m writing up my PhD thesis, but I’ll try again next month. I kind of lost track of this, but it’s good to know that there are people who find it interesting. It gives me the energy to retry tyo get it added, and maybe try to finish to other archimedean solids, as I promised.

  3. I was trying to build a Truncated icosidodecahedron (http://en.wikipedia.org/wiki/File:Truncated_icosidodecahedron_flat.png) but I have to confess that I failed. The thing is that it contains there is 62 faces (!) a few of them being decagones. I think I see how to deal with the extra number of faces, but I’m puzzled with building the decagones…
    Could you please give me a hand? Thanks a lot.

    • nvcleemp says:

      It’s been a while that I looked at it, but I’ll give it a try. Basically the parts that might be missing from the explanation above is, that a face is just constructed as its contents, together with the content at the edges. No edges or lines are defined by the face. So you need to define the contents of the face as a scope that is centered in the face and has contents #1. Then you basically can add the content at the edges: define different scopes which have the origin at a corner, the X axis parallel to the edge and the Y axis pointing away from the face.

      As I am writing this down, I just realise that in TeX you can’t have more than 9 arguments. I’m sure there are default ways to deal with more arguments, but I don’t know these. If I have some more time I will try to look that up.
      Another thing that might be needed for this unfolding are smaller ears. If I recall correctly I stopped, I had already defined some extra ear shapes which were smaller, because the default size overlaps with the faces in case the angles between faces become to small.

      I have also some good news. I had some spare time last evening, so I made a patch of these changes, and submitted it on Sourceforge. I have already been in contact with the developers, and I’ll try to invest enough time in this, to at least see the code getting added to PGF/TikZ.

    • nvcleemp says:

      I’ve written the code for the octagons and the decagons. I will write a blog article about it, later this week.

  4. Jaroslaw Szczepanik says:

    Quite inspiring. I added truncated icosahedron (it was my first bigger LaTeX macro :)). Since it has 32 faces, I had to modify ”face” part of your file, so this part has to be replaced in order to use truncated icosahedron. In addition, I shrank ears a little (some overlapped faces while having default size). Here is the modified part for the ear size & new faces (lines starting from line 119 of the original file):

    \def\tikz@lib@fold@path{\draw[every fold](0,0) -- (\tikz@lib@fold@length,0pt);}
    \def\tikz@lib@fold@cut@path{\draw[every cut](0,0) -- (\tikz@lib@fold@length,0pt);}
    \def\tikz@lib@fold@ear@path{
      \draw[every fold](0,0) -- (\tikz@lib@fold@length,0pt);
      \draw[every cut] (0,0) -- (.2\tikz@lib@fold@length,.1\tikz@lib@fold@length) --(\tikz@lib@fold@length,0pt);}
    
    \tikzstyle{every cut}=[]
    \tikzstyle{every fold}=[help lines]
    
    \tikzoption{face 1}{\def\tikz@lib@fold@face@A{#1}}
    \tikzoption{face 2}{\def\tikz@lib@fold@face@B{#1}}
    \tikzoption{face 3}{\def\tikz@lib@fold@face@C{#1}}
    \tikzoption{face 4}{\def\tikz@lib@fold@face@D{#1}}
    \tikzoption{face 5}{\def\tikz@lib@fold@face@E{#1}}
    \tikzoption{face 6}{\def\tikz@lib@fold@face@F{#1}}
    \tikzoption{face 7}{\def\tikz@lib@fold@face@G{#1}}
    \tikzoption{face 8}{\def\tikz@lib@fold@face@H{#1}}
    \tikzoption{face 9}{\def\tikz@lib@fold@face@I{#1}}
    \tikzoption{face 10}{\def\tikz@lib@fold@face@J{#1}}
    \tikzoption{face 11}{\def\tikz@lib@fold@face@K{#1}}
    \tikzoption{face 12}{\def\tikz@lib@fold@face@L{#1}}
    \tikzoption{face 13}{\def\tikz@lib@fold@face@M{#1}}
    \tikzoption{face 14}{\def\tikz@lib@fold@face@N{#1}}
    \tikzoption{face 15}{\def\tikz@lib@fold@face@O{#1}}
    \tikzoption{face 16}{\def\tikz@lib@fold@face@P{#1}}
    \tikzoption{face 17}{\def\tikz@lib@fold@face@Q{#1}}
    \tikzoption{face 18}{\def\tikz@lib@fold@face@R{#1}}
    \tikzoption{face 19}{\def\tikz@lib@fold@face@S{#1}}
    \tikzoption{face 20}{\def\tikz@lib@fold@face@T{#1}}
    \tikzoption{face 21}{\def\tikz@lib@fold@face@U{#1}}
    \tikzoption{face 22}{\def\tikz@lib@fold@face@V{#1}}
    \tikzoption{face 23}{\def\tikz@lib@fold@face@W{#1}}
    \tikzoption{face 24}{\def\tikz@lib@fold@face@X{#1}}
    \tikzoption{face 25}{\def\tikz@lib@fold@face@Y{#1}}
    \tikzoption{face 26}{\def\tikz@lib@fold@face@Z{#1}}
    \tikzoption{face 27}{\def\tikz@lib@fold@face@AA{#1}}
    \tikzoption{face 28}{\def\tikz@lib@fold@face@AB{#1}}
    \tikzoption{face 29}{\def\tikz@lib@fold@face@AC{#1}}
    \tikzoption{face 30}{\def\tikz@lib@fold@face@AD{#1}}
    \tikzoption{face 31}{\def\tikz@lib@fold@face@AE{#1}}
    \tikzoption{face 32}{\def\tikz@lib@fold@face@AF{#1}}
    
    
    
    
    \let\tikz@lib@fold@face@A=\pgfutil@empty
    \let\tikz@lib@fold@face@B=\pgfutil@empty
    \let\tikz@lib@fold@face@C=\pgfutil@empty
    \let\tikz@lib@fold@face@D=\pgfutil@empty
    \let\tikz@lib@fold@face@E=\pgfutil@empty
    \let\tikz@lib@fold@face@F=\pgfutil@empty
    \let\tikz@lib@fold@face@G=\pgfutil@empty
    \let\tikz@lib@fold@face@H=\pgfutil@empty
    \let\tikz@lib@fold@face@I=\pgfutil@empty
    \let\tikz@lib@fold@face@J=\pgfutil@empty
    \let\tikz@lib@fold@face@K=\pgfutil@empty
    \let\tikz@lib@fold@face@L=\pgfutil@empty
    \let\tikz@lib@fold@face@M=\pgfutil@empty
    \let\tikz@lib@fold@face@N=\pgfutil@empty
    \let\tikz@lib@fold@face@O=\pgfutil@empty
    \let\tikz@lib@fold@face@P=\pgfutil@empty
    \let\tikz@lib@fold@face@Q=\pgfutil@empty
    \let\tikz@lib@fold@face@R=\pgfutil@empty
    \let\tikz@lib@fold@face@S=\pgfutil@empty
    \let\tikz@lib@fold@face@T=\pgfutil@empty
    \let\tikz@lib@fold@face@U=\pgfutil@empty
    \let\tikz@lib@fold@face@V=\pgfutil@empty
    \let\tikz@lib@fold@face@W=\pgfutil@empty
    \let\tikz@lib@fold@face@X=\pgfutil@empty
    \let\tikz@lib@fold@face@Y=\pgfutil@empty
    \let\tikz@lib@fold@face@Z=\pgfutil@empty
    \let\tikz@lib@fold@face@AA=\pgfutil@empty
    \let\tikz@lib@fold@face@AB=\pgfutil@empty
    \let\tikz@lib@fold@face@AC=\pgfutil@empty
    \let\tikz@lib@fold@face@AD=\pgfutil@empty
    \let\tikz@lib@fold@face@AE=\pgfutil@empty
    \let\tikz@lib@fold@face@AF=\pgfutil@empty
    

    And here are two versions for truncated icosahedron: the first one has more intuitive faces order, but I had to remove some ears because there was not enough space for them; the second one has all ears, but faces order is more difficult to follow. Nonetheless they are working well. To use them, put the following code at the end of the file:

    %truncated isocahedron  (by Jaroslaw Szczepanik)
    
    \def\tikzfoldingtisocahedron#1[#2]#3;{%
        \begingroup%
        \tikzset{#2}%
        \tikz@lib@fold@pentagon{\tikz@lib@fold@face@A}
    	%edge A-1
            {\tikz@lib@fold@hexagon
    		{\tikz@lib@fold@face@B}
    		%edge B-1
    		{\tikz@lib@fold@cut@path}
    		%edge B-2 
    		{\tikz@lib@fold@pentagon
    			{\tikz@lib@fold@face@C}
    			%edge C-1
    			{\tikz@lib@fold@hexagon
    				{\tikz@lib@fold@face@D}
    				%edge D-1
    				{\tikz@lib@fold@ear@path}
    				%edge D-2
    				{\tikz@lib@fold@ear@path}
    				%edge D-3
    				{\tikz@lib@fold@ear@path}
    				%edge D-4
    				{\tikz@lib@fold@path}
    				%edge D-5
    				{\tikz@lib@fold@cut@path} % replaced ear!
    				%edge D-6 
    				{\tikz@lib@fold@ear@path}
    			}
    			%edge C-2
    			{\tikz@lib@fold@ear@path}
    			%edge C-3
    			{\tikz@lib@fold@path}
    			%edge C-4
    			{\tikz@lib@fold@cut@path}
    			%edge C-5
    			{\tikz@lib@fold@hexagon
    				{\tikz@lib@fold@face@E}
    				%edge E-1
    				{\tikz@lib@fold@hexagon
    					{\tikz@lib@fold@face@F}
    					%edge F-1
    					{\tikz@lib@fold@ear@path}
    					%edge F-2
    					{\tikz@lib@fold@ear@path}
    					%edge F-3
    					{\tikz@lib@fold@cut@path}
    					%edge F-4
    					{\tikz@lib@fold@path}
    					%edge F-5
    					{\tikz@lib@fold@cut@path}
    					%edge F-6
    					{\tikz@lib@fold@cut@path}
    				}
    				%edge E-2
    				{\tikz@lib@fold@pentagon
    					{\tikz@lib@fold@face@G}
    					%edge G-1
    					{\tikz@lib@fold@ear@path}
    					%edge G-2
    					{\tikz@lib@fold@cut@path}
    					%edge G-3
    					{\tikz@lib@fold@path}
    					%edge G-4
    					{\tikz@lib@fold@cut@path} % replaced ear!
    					%edge G-5
    					{\tikz@lib@fold@ear@path}
    				}
    				%edge E-3
    				{\tikz@lib@fold@cut@path}
    				%edge E-4
    				{\tikz@lib@fold@path}
    				%edge E-5
    				{\tikz@lib@fold@cut@path}
    				%edge E-6
    				{\tikz@lib@fold@cut@path}
    			}
    		}
    		%edge B-3
    		{\tikz@lib@fold@ear@path}
    		%edge B-4
    		{\tikz@lib@fold@path}
    		%edge B-5
    		{\tikz@lib@fold@cut@path}
    		%edge B-6
    		{\tikz@lib@fold@cut@path}
    	}
    	%edge A-2	
    	{\tikz@lib@fold@hexagon
    		{\tikz@lib@fold@face@H}
    		%edge H-1
    		{\tikz@lib@fold@cut@path}
    		%edge H-2
    		{\tikz@lib@fold@pentagon
    			{\tikz@lib@fold@face@I}
    			%edge I-1
    			{\tikz@lib@fold@hexagon
    				{\tikz@lib@fold@face@J}
    				%edge J-1
    				{\tikz@lib@fold@ear@path}
    				%edge J-2
    				{\tikz@lib@fold@ear@path}
    				%edge J-3
    				{\tikz@lib@fold@ear@path}
    				%edge J-4
    				{\tikz@lib@fold@path}
    				%edge J-5
    				{\tikz@lib@fold@cut@path} % replaced ear!
    				%edge J-6
    				{\tikz@lib@fold@ear@path}
    			}
    			%edge I-2
    			{\tikz@lib@fold@ear@path}
    			%edge I-3
    			{\tikz@lib@fold@path}
    			%edge I-4
    			{\tikz@lib@fold@cut@path}
    			%edge I-5
    			{\tikz@lib@fold@hexagon
    				{\tikz@lib@fold@face@K}
    				%edge K-1
    				{\tikz@lib@fold@hexagon
    					{\tikz@lib@fold@face@L}
    					%edge L-1
    					{\tikz@lib@fold@ear@path}
    					%edge L-2
    					{\tikz@lib@fold@ear@path}
    					%edge L-3
    					{\tikz@lib@fold@cut@path}
    					%edge L-4
    					{\tikz@lib@fold@path}
    					%edge L-5
    					{\tikz@lib@fold@cut@path}
    					%edge L-6
    					{\tikz@lib@fold@cut@path}
    				}
    				%edge K-2
    				{\tikz@lib@fold@pentagon
    					{\tikz@lib@fold@face@M}
    					%edge M-1
    					{\tikz@lib@fold@ear@path}
    					%edge M-2
    					{\tikz@lib@fold@cut@path}
    					%edge M-3
    					{\tikz@lib@fold@path}
    					%edge M-4
    					{\tikz@lib@fold@cut@path} % replaced ear!
    					%edge M-5
    					{\tikz@lib@fold@ear@path}
    				}
    				%edge K-3
    				{\tikz@lib@fold@cut@path}
    				%edge K-4
    				{\tikz@lib@fold@path}
    				%edge K-5
    				{\tikz@lib@fold@cut@path}
    				%edge K-6
    				{\tikz@lib@fold@cut@path}
    			}
    		}
    		%edge H-3
    		{\tikz@lib@fold@ear@path}
    		%edge H-4
    		{\tikz@lib@fold@path}
    		%edge H-5
    		{\tikz@lib@fold@cut@path}
    		%edge H-6
    		{\tikz@lib@fold@cut@path}
    	}
    	%edge A-3
    	{\tikz@lib@fold@hexagon
    		{\tikz@lib@fold@face@N}
    		%edge N-1
    		{\tikz@lib@fold@cut@path}
    		%edge N-2
    		{\tikz@lib@fold@pentagon
    			{\tikz@lib@fold@face@O}
    			%edge O-1
    			{\tikz@lib@fold@hexagon
    				{\tikz@lib@fold@face@P}
    				%edge P-1
    				{\tikz@lib@fold@ear@path}
    				%edge P-2
    				{\tikz@lib@fold@ear@path}
    				%edge P-3
    				{\tikz@lib@fold@ear@path}
    				%edge P-4
    				{\tikz@lib@fold@path}
    				%edge P-5
    				{\tikz@lib@fold@cut@path} % replaced ear!
    				%edge P-6
    				{\tikz@lib@fold@ear@path}
    			}
    			%edge O-2
    			{\tikz@lib@fold@ear@path}
    			%edge O-3
    			{\tikz@lib@fold@path}
    			%edge O-4
    			{\tikz@lib@fold@cut@path}
    			%edge O-5
    			{\tikz@lib@fold@hexagon
    				{\tikz@lib@fold@face@Q}
    				%edge Q-1
    				{\tikz@lib@fold@hexagon
    					{\tikz@lib@fold@face@R}
    					%edge R-1
    					{\tikz@lib@fold@pentagon
    						{\tikz@lib@fold@face@S}
    						%edge S-1
    						{\tikz@lib@fold@cut@path}
    						%edge S-2
    						{\tikz@lib@fold@cut@path}
    						%edge S-3
    						{\tikz@lib@fold@path}
    						%edge S-4
    						{\tikz@lib@fold@cut@path}
    						%edge S-5
    						{\tikz@lib@fold@cut@path}
    					}
    					%edge R-2
    					{\tikz@lib@fold@ear@path}
    					%edge R-3
    					{\tikz@lib@fold@cut@path}
    					%edge R-4
    					{\tikz@lib@fold@path}
    					%edge R-5
    					{\tikz@lib@fold@cut@path}
    					%edge R-6
    					{\tikz@lib@fold@cut@path}
    				}
    				%edge Q-2
    				{\tikz@lib@fold@pentagon
    					{\tikz@lib@fold@face@T}
    					%edge T-1
    					{\tikz@lib@fold@ear@path}
    					%edge T-2
    					{\tikz@lib@fold@cut@path}
    					%edge T-3
    					{\tikz@lib@fold@path}
    					%edge T-4
    					{\tikz@lib@fold@cut@path} % replaced ear!
    					%edge T-5	
    					{\tikz@lib@fold@ear@path}
    				}
    				%edge Q-3
    				{\tikz@lib@fold@cut@path}
    				%edge Q-4
    				{\tikz@lib@fold@path}
    				%edge Q-5
    				{\tikz@lib@fold@cut@path}
    				%edge Q-6
    				{\tikz@lib@fold@cut@path}
    			}
    		}
    		%edge N-3 
    		{\tikz@lib@fold@ear@path}
    		%edge N-4
    		{\tikz@lib@fold@path}
    		%edge N-5
    		{\tikz@lib@fold@cut@path}
    		%edge N-6
    		{\tikz@lib@fold@cut@path}
    	}
    	%edge A4
    	{\tikz@lib@fold@hexagon
    		{\tikz@lib@fold@face@U}
    		%edge U-1
    		{\tikz@lib@fold@cut@path}
    		%edge U-2
    		{\tikz@lib@fold@pentagon
    			{\tikz@lib@fold@face@V}
    			%edge V-1
    			{\tikz@lib@fold@hexagon
    				{\tikz@lib@fold@face@W}
    				%edge W-1
    				{\tikz@lib@fold@ear@path}
    				%edge W-2
    				{\tikz@lib@fold@ear@path}
    				%edge W-3
    				{\tikz@lib@fold@ear@path}
    				%edge W-4
    				{\tikz@lib@fold@path}
    				%edge W-5
    				{\tikz@lib@fold@cut@path} % replaced ear!
    				%edge W-6
    				{\tikz@lib@fold@ear@path}
    			}
    			%edge V-2
    			{\tikz@lib@fold@cut@path}
    			%edge V-3
    			{\tikz@lib@fold@path}
    			%edge V-4
    			{\tikz@lib@fold@cut@path}
    			%edge V-5
    			{\tikz@lib@fold@hexagon
    				{\tikz@lib@fold@face@X}
    				%edge X-1
    				{\tikz@lib@fold@hexagon
    					{\tikz@lib@fold@face@Y}
    					%edge Y-1
    					{\tikz@lib@fold@ear@path}
    					%edge Y-2
    					{\tikz@lib@fold@ear@path}
    					%edge Y-3
    					{\tikz@lib@fold@cut@path}
    					%edge Y-4
    					{\tikz@lib@fold@path}
    					%edge Y-5
    					{\tikz@lib@fold@cut@path}
    					%edge Y-6
    					{\tikz@lib@fold@cut@path}
    				}
    				%edge X-2
    				{\tikz@lib@fold@pentagon
    					  {\tikz@lib@fold@face@Z}
    					  %edge Z-1
    					  {\tikz@lib@fold@ear@path}
    					  %edge Z-2
    					  {\tikz@lib@fold@cut@path}
    					  %edge Z-3
    					  {\tikz@lib@fold@path}
    					  %edge Z-4
    					  {\tikz@lib@fold@cut@path} % replaced ear!
    					  %edge Z-5
    					  {\tikz@lib@fold@ear@path}
    				}	  
    				%edge X-3
    				{\tikz@lib@fold@cut@path}
    				%edge X-4
    				{\tikz@lib@fold@path}
    				%edge X-5
    				{\tikz@lib@fold@cut@path}
    				%edge X-6
    				{\tikz@lib@fold@cut@path}
    			}	
    		}
    		%edge U-3
    		{\tikz@lib@fold@ear@path}
    		%edge U-4
    		{\tikz@lib@fold@path}
    		%edge U-5
    		{\tikz@lib@fold@cut@path}
    		%edge U-6
    		{\tikz@lib@fold@cut@path}
    	}
    	%edge A5
    	{\tikz@lib@fold@hexagon
    		{\tikz@lib@fold@face@AA}
    		%edge AA-1
    		{\tikz@lib@fold@cut@path}
    		%edge AA-2
    		{\tikz@lib@fold@pentagon
    			{\tikz@lib@fold@face@AB}
    			%edge AB-1
    			{\tikz@lib@fold@hexagon
    				{\tikz@lib@fold@face@AC}
    				%edge AC-1
    				{\tikz@lib@fold@ear@path}
    				%edge AC-2
    				{\tikz@lib@fold@ear@path}
    				%edge AC-3
    				{\tikz@lib@fold@ear@path}
    				%edge AC-4
    				{\tikz@lib@fold@path}
    				%edge AC-5
    				{\tikz@lib@fold@cut@path} % replaced ear!
    				%edge AC-6
    				{\tikz@lib@fold@ear@path}
    			}
    			%edge AB-2
    			{\tikz@lib@fold@ear@path}
    			%edge AB-3
    			{\tikz@lib@fold@path}
    			%edge AB-4
    			{\tikz@lib@fold@cut@path}
    			%edge AB-5
    			{\tikz@lib@fold@hexagon
    				 {\tikz@lib@fold@face@AD}
    				 %edge AD-1
    				 {\tikz@lib@fold@hexagon
    					{\tikz@lib@fold@face@AE}
    					%edge AE-1
    					{\tikz@lib@fold@ear@path}
    					%edge AE-2
    					{\tikz@lib@fold@ear@path}
    					%edge AE-3
    					{\tikz@lib@fold@cut@path}
    					%edge AE-4
    					{\tikz@lib@fold@path}
    					%edge AE-5
    					{\tikz@lib@fold@cut@path}
    					%edge AE-6
    					{\tikz@lib@fold@cut@path}
    				}
    				%edge AD-2
    				{\tikz@lib@fold@pentagon
    					{\tikz@lib@fold@face@AF}
    					%edge AF-1
    					{\tikz@lib@fold@ear@path}
    					%edge AF-2
    					{\tikz@lib@fold@cut@path}
    					%edge AF-3
    					{\tikz@lib@fold@path}
    					%edge AF-4
    					{\tikz@lib@fold@cut@path} % replaced ear!
    					%edge AF-5
    					{\tikz@lib@fold@ear@path}
    				}
    				%edge AD-3
    				{\tikz@lib@fold@cut@path}
    				%edge AD-4
    				{\tikz@lib@fold@path}
    				%edge AD-5
    				{\tikz@lib@fold@cut@path}
    				%edge AD-6
    				{\tikz@lib@fold@cut@path}
    			}	 
    		 }
    		 %edge AA-3
    		 {\tikz@lib@fold@ear@path}
    		 %edge AA-4
    		 {\tikz@lib@fold@path}
    		 %edge AA-5
    		 {\tikz@lib@fold@cut@path}
    		 %edge AA-6
    		 {\tikz@lib@fold@cut@path}
    	}	
      \endgroup
    }
    
    %alternative truncated isocahedron  (by Jaroslaw Szczepanik)
    
    \def\tikzfoldingatisocahedron#1[#2]#3;{%
      \begingroup%
        \tikzset{#2}%
        \tikz@lib@fold@pentagon
            {\tikz@lib@fold@face@A}
    	%edge A1
    	{\tikz@lib@fold@ear@path}
    	%edge A2
    	{\tikz@lib@fold@hexagon
    	    {\tikz@lib@fold@face@B}
    	    %edge B-1
    	    {\tikz@lib@fold@hexagon
    		{\tikz@lib@fold@face@C}
    		%edge C-1
    		{\tikz@lib@fold@ear@path}
    		%edge C-2
    		{\tikz@lib@fold@ear@path}
    		%edge C-3
    		{\tikz@lib@fold@ear@path}
    		%edge C-4
    		{\tikz@lib@fold@path}
    		%edge C-5
    		{\tikz@lib@fold@cut@path}
    		%edge C-6
    		{\tikz@lib@fold@ear@path}
    	    }
    	    %edge B-2
    	    {\tikz@lib@fold@ear@path}
    	    %edge B-3
    	    {\tikz@lib@fold@hexagon
    		{\tikz@lib@fold@face@D}
    		%edge D-1
    		{\tikz@lib@fold@cut@path}
    		%edge D-2
    		{\tikz@lib@fold@hexagon
    		    {\tikz@lib@fold@face@E}
    		    %edge E-1
    		    {\tikz@lib@fold@ear@path}
    		    %edge E-2
    		    {\tikz@lib@fold@ear@path}
    		    %edge E-3
    		    {\tikz@lib@fold@ear@path}
    		    %edge E-4
    		    {\tikz@lib@fold@path}
    		    %edge E-5
    		    {\tikz@lib@fold@cut@path}
    		    %edge E-6
    		    {\tikz@lib@fold@cut@path}
    		}    
    		%edge D-3
    		{\tikz@lib@fold@ear@path}
    		%edge D-4
    		{\tikz@lib@fold@path}
    		%edge D-5
    		{\tikz@lib@fold@pentagon
    		    {\tikz@lib@fold@face@F}
    		    %edge F-1
    		    {\tikz@lib@fold@ear@path}
    		    %edge F-2
    		    {\tikz@lib@fold@ear@path}
    		    %edge F-3
    		    {\tikz@lib@fold@path}
    		    %edge F-4
    		    {\tikz@lib@fold@cut@path}
    		    %edge F-5
    		    {\tikz@lib@fold@cut@path}
    		}
    		%edge D-6
    		{\tikz@lib@fold@hexagon
    		    {\tikz@lib@fold@face@G}
    		    %edge G-1
    		    {\tikz@lib@fold@ear@path}
    		    %edge G-2
    		    {\tikz@lib@fold@hexagon
    			{\tikz@lib@fold@face@H}
    			%edge H-1
    			{\tikz@lib@fold@cut@path}
    			%edge H-2
    			{\tikz@lib@fold@hexagon
    			    {\tikz@lib@fold@face@I}
    			    %edge I-1
    			    {\tikz@lib@fold@ear@path}
    			    %edge I-2
    			    {\tikz@lib@fold@ear@path}
    			    %edge I-3
    			    {\tikz@lib@fold@ear@path}
    			    %edge I-4
    			    {\tikz@lib@fold@path}
    			    %edge I-5
    			    {\tikz@lib@fold@cut@path}
    			    %edge I-6
    			    {\tikz@lib@fold@cut@path}
    			}
    			%edge H-3
    			{\tikz@lib@fold@cut@path}
    			%edge H-4
    			{\tikz@lib@fold@path}
    			%edge H-5
    			{\tikz@lib@fold@pentagon
    			    {\tikz@lib@fold@face@J}
    			    %edge J-1
    			    {\tikz@lib@fold@ear@path}
    			    %edge J-2
    			    {\tikz@lib@fold@ear@path}
    			    %edge J-3
    			    {\tikz@lib@fold@path}
    			    %edge J-4
    			    {\tikz@lib@fold@cut@path}
    			    %edge J-5
    			    {\tikz@lib@fold@cut@path}
    			}
    			%edge H-6
    			{\tikz@lib@fold@hexagon
    			    {\tikz@lib@fold@face@K}
    			    %edge K-1
    			    {\tikz@lib@fold@ear@path}
    			    %edge K-2
    			    {\tikz@lib@fold@hexagon
    				{\tikz@lib@fold@face@L}
    				%edge L-1
    				{\tikz@lib@fold@cut@path}
    				%edge L-2
    				{\tikz@lib@fold@hexagon
    				    {\tikz@lib@fold@face@M}
    				    %edge M-1
    				    {\tikz@lib@fold@pentagon
    					{\tikz@lib@fold@face@N}
    					%edge N-1
    					{\tikz@lib@fold@cut@path}
    					%edge N-2
    					{\tikz@lib@fold@cut@path}
    					%edge N-3
    					{\tikz@lib@fold@path}
    					%edge N-4
    					{\tikz@lib@fold@cut@path}
    					%edge N-5
    					{\tikz@lib@fold@cut@path}
    				    }
    				    %edge M-2
    				    {\tikz@lib@fold@ear@path}
    				    %edge M-3
    				    {\tikz@lib@fold@ear@path}
    				    %edge M-4
    				    {\tikz@lib@fold@path}
    				    %edge M-5
    				    {\tikz@lib@fold@cut@path}
    				    %edge M-6
    				    {\tikz@lib@fold@cut@path}
    				}
    				%edge L-3
    				{\tikz@lib@fold@ear@path}
    				%edge L-4
    				{\tikz@lib@fold@path}
    				%edge L-5
    				{\tikz@lib@fold@pentagon
    					{\tikz@lib@fold@face@O}
    					%edge O-1
    					{\tikz@lib@fold@ear@path}
    					%edge O-2
    					{\tikz@lib@fold@ear@path}
    					%edge O-3
    					{\tikz@lib@fold@path}
    					%edge O-4
    					{\tikz@lib@fold@cut@path}
    					%edge O-5
    					{\tikz@lib@fold@cut@path}
    				}
    				%edge L-6
    				{\tikz@lib@fold@hexagon
    				    {\tikz@lib@fold@face@P}
    				    %edge P-1
    				    {\tikz@lib@fold@ear@path}
    				    %edge P-2
    				    {\tikz@lib@fold@hexagon
    					{\tikz@lib@fold@face@Q}
    					%edge Q-1
    					{\tikz@lib@fold@cut@path}
    					%edge Q-2
    					{\tikz@lib@fold@hexagon
    					    {\tikz@lib@fold@face@R}
    					    %edge R-1
    					    {\tikz@lib@fold@ear@path}
    					    %edge R-2
    					    {\tikz@lib@fold@ear@path}
    					    %edge R-3
    					    {\tikz@lib@fold@ear@path}
    					    %edge R-4
    					    {\tikz@lib@fold@path}
    					    %edge R-5
    					    {\tikz@lib@fold@cut@path}
    					    %edge R-6
    					    {\tikz@lib@fold@cut@path}
    					}
    					%edge Q-3
    					{\tikz@lib@fold@ear@path}
    					%edge Q-4
    					{\tikz@lib@fold@path}
    					%edge Q-5
    					{\tikz@lib@fold@pentagon
    					    {\tikz@lib@fold@face@S}
    					    %edge S-1
    					    {\tikz@lib@fold@ear@path}
    					    %edge S-2
    					    {\tikz@lib@fold@ear@path}
    					    %edge S-3
    					    {\tikz@lib@fold@path}
    					    %edge S-4
    					    {\tikz@lib@fold@cut@path}
    					    %edge S-5
    					    {\tikz@lib@fold@cut@path}
    					}
    					%edge Q-6
    					{\tikz@lib@fold@hexagon
    					    {\tikz@lib@fold@face@T}
    					    %edge T-1
    					    {\tikz@lib@fold@ear@path}
    					    %edge T-2
    					    {\tikz@lib@fold@hexagon
    						{\tikz@lib@fold@face@U}
    						%edge U-1
    						{\tikz@lib@fold@cut@path}
    						%edge U-2
    						{\tikz@lib@fold@hexagon
    						    {\tikz@lib@fold@face@V}
    						    %edge V-1
    						    {\tikz@lib@fold@ear@path}
    						    %edge V-2
    						    {\tikz@lib@fold@ear@path}
    						    %edge V-3
    						    {\tikz@lib@fold@ear@path}
    						    %edge V-4
    						    {\tikz@lib@fold@path}
    						    %edge V-5
    						    {\tikz@lib@fold@cut@path}
    						    %edge V-6
    						    {\tikz@lib@fold@cut@path}
    						}
    						%edge U-3
    						{\tikz@lib@fold@ear@path}
    						%edge U-4
    						{\tikz@lib@fold@path}
    						%edge U-5
    						{\tikz@lib@fold@pentagon
    						    {\tikz@lib@fold@face@W}
    						    %edge W-1
    						    {\tikz@lib@fold@ear@path}
    						    %edge W-2
    						    {\tikz@lib@fold@ear@path}
    						    %edge W-3
    						    {\tikz@lib@fold@path}
    						    %edge W-4
    						    {\tikz@lib@fold@cut@path}
    						    %edge W-5
    						    {\tikz@lib@fold@cut@path}
    						}    
    						%edge U-6
    						{\tikz@lib@fold@ear@path}
    					    }
    					    %edge T-3
    					    {\tikz@lib@fold@pentagon
    						{\tikz@lib@fold@face@X}
    						%edge X-1
    						{\tikz@lib@fold@ear@path}
    						%edge X-2
    						{\tikz@lib@fold@ear@path}
    						%edge X-3
    						{\tikz@lib@fold@path}
    						%edge X-4
    						{\tikz@lib@fold@cut@path}
    						%edge X-5
    						{\tikz@lib@fold@cut@path}
    					    }
    					    %edge T-4
    					    {\tikz@lib@fold@path}
    					    %edge T-5
    					    {\tikz@lib@fold@cut@path}
    					    %edge T-6
    					    {\tikz@lib@fold@hexagon
    						{\tikz@lib@fold@face@Y}
    						%edge Y-1
    						{\tikz@lib@fold@cut@path}
    						%edge Y-2
    						{\tikz@lib@fold@ear@path}
    						%edge Y-3
    						{\tikz@lib@fold@ear@path}
    						%edge Y-4
    						{\tikz@lib@fold@path}
    						%edge Y-5
    						{\tikz@lib@fold@cut@path}
    						%edge Y-6
    						{\tikz@lib@fold@cut@path}
    					    }
    					}
    				    }
    				    %edge P-3
    				    {\tikz@lib@fold@pentagon
    					{\tikz@lib@fold@face@Z}
    					%edge Z-1
    					{\tikz@lib@fold@ear@path}
    					%edge Z-2
    					{\tikz@lib@fold@ear@path}
    					%edge Z-3
    					{\tikz@lib@fold@path}
    					%edge Z-4
    					{\tikz@lib@fold@cut@path}
    					%edge Z-5
    					{\tikz@lib@fold@cut@path}
    				    }
    				    %edge P-4
    				    {\tikz@lib@fold@path}
    				    %edge P-5
    				    {\tikz@lib@fold@cut@path}
    				    %edge P-6
    				    {\tikz@lib@fold@hexagon
    					{\tikz@lib@fold@face@AA}
    					%edge AA-1
    					{\tikz@lib@fold@ear@path}
    					%edge AA-2
    					{\tikz@lib@fold@ear@path}
    					%edge AA-3
    					{\tikz@lib@fold@ear@path}
    					%edge AA-4
    					{\tikz@lib@fold@path}
    					%edge AA-5
    					{\tikz@lib@fold@cut@path}
    					%edge AA-6
    					{\tikz@lib@fold@cut@path}
    				    }
    				}
    			    }
    			    %edge K-3
    			    {\tikz@lib@fold@pentagon
    				{\tikz@lib@fold@face@AB}
    				%edge AB-1
    				{\tikz@lib@fold@ear@path}
    				%edge AB-2
    				{\tikz@lib@fold@ear@path}
    				%edge AB-3
    				{\tikz@lib@fold@path}
    				%edge AB-4
    				{\tikz@lib@fold@cut@path}
    				%edge AB-5
    				{\tikz@lib@fold@cut@path}
    			    }
    			    %edge K-4
    			    {\tikz@lib@fold@path}
    			    %edge K-5
    			    {\tikz@lib@fold@cut@path}
    			    %edge K-6
    			    {\tikz@lib@fold@hexagon
    				{\tikz@lib@fold@face@AC}
    				%edge AC-1
    				{\tikz@lib@fold@pentagon
    				    {\tikz@lib@fold@face@AD}
    				    %edge AD-1
    				    {\tikz@lib@fold@ear@path}
    				    %edge AD-2
    				    {\tikz@lib@fold@cut@path}
    				    %edge AD-3
    				    {\tikz@lib@fold@path}
    				    %edge AD-4
    				    {\tikz@lib@fold@ear@path}
    				    %edge AD-5
    				    {\tikz@lib@fold@cut@path}
    				}
    				%edge AC-2
    				{\tikz@lib@fold@ear@path}
    				%edge AC-3
    				{\tikz@lib@fold@ear@path}
    				%edge AC-4
    				{\tikz@lib@fold@path}
    				%edge AC-5
    				{\tikz@lib@fold@cut@path}
    				%edge AC-6
    				{\tikz@lib@fold@cut@path}
    			    }
    			}
    		    }
    		    %edge G-3
    		    {\tikz@lib@fold@pentagon
    			{\tikz@lib@fold@face@AE}
    			%edge AE-1
    			{\tikz@lib@fold@ear@path}
    			%edge AE-2
    			{\tikz@lib@fold@ear@path}
    			%edge AE-3
    			{\tikz@lib@fold@path}
    			%edge AE-4
    			{\tikz@lib@fold@cut@path}
    			%edge AE-5
    			{\tikz@lib@fold@cut@path}
    		    }
    		    %edge G-4
    		    {\tikz@lib@fold@path}
    		    %edge G-5
    		    {\tikz@lib@fold@cut@path}
    		    %edge G-6
    		    {\tikz@lib@fold@hexagon
    			{\tikz@lib@fold@face@AF}
    			%edge AF-1
    			{\tikz@lib@fold@cut@path}
    			%edge AF-2
    			{\tikz@lib@fold@ear@path}
    			%edge AF-3
    			{\tikz@lib@fold@ear@path}
    			%edge AF-4
    			{\tikz@lib@fold@path}
    			%edge AF-5
    			{\tikz@lib@fold@cut@path}
    			%edge AF-6 
    			{\tikz@lib@fold@cut@path}
    		    }
    		}
    	    }
    	    %edge B-4
    	    {\tikz@lib@fold@path}
    	    %edge B-5
    	    {\tikz@lib@fold@cut@path}
    	    %edge B-6
    	    {\tikz@lib@fold@ear@path}
    	}		
    	%edge A-3
    	{\tikz@lib@fold@cut@path}
    	%edge A-4
    	{\tikz@lib@fold@cut@path}
    	%edge A-5
    	{\tikz@lib@fold@ear@path}
      \endgroup
    }
    

    Regards!

    • Jaroslaw Szczepanik says:

      P.S. Sorry for the lack of indents. I don’t have an account here and couldn’t see a way to add a file, I’ve just pasted the code into the post. If someone is interested, e-mail me and I will send you the modified tikzlibraryfolding.code.tex file.

Trackbacks
Check out what others are saying...
  1. […] a strong ‘believer’ of PGF/TikZ as you might have noticed in my post about the folding library. For my PhD thesis I have dozens of TikZ pictures in separate files which I give a .tikz extension. […]

  2. […] solids and also added two Archimedean solids. I wrote a blog article about this, which can be found here. In that article I promised to finish the remaining Archimedean solids. I didn’t let it lie […]

  3. […] of posts I’ve been writing about the TikZ folding library. This series finds it origin in a post about an extension to the TikZ folding library, which I wrote about three years ago. This post was […]



Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: