TikZ folding: The truncated cuboctahedron

This is the next post in a recent series 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 brought back to my attention recently, and this has motivated me to finish the Archimedean solids as I promised in the original post. Below is an overview of this series up to this point:

So today I want to talk about the truncated cuboctahedron. What makes this solid so special that I will discuss it separately? Nothing really, except for the fact that it is the first solid where the specific problem arises that I want to discuss.

The ears that are used in the TikZ folding library are isosceles triangles in which the height is one fifth of the base. This means that the base angles are roughly 22º. Such an ear is shown in the figure below. In the truncated cuboctahedron we have vertices where a regular hexagon and octagon meet a square. The sum of the inner angles of these faces gives 120º + 135º + 90º = 345º. This means that there is only 15º left for the ear.

Regular ear in TikZ folding libraryIn his comments on the original post, Jaroslaw Szczepanik solved this problem when he added the code for the truncated icosahedron. He made the ears smaller so they would fit into the limited space available. Personally I don’t think that that is the best solution. It changes the ears for all solids, and maybe they will need to be shrunk even more for another solid. This is why I used the following solution for the truncated cuboctahedron. Instead of redefining the ears, I’ve added two new types of ears. The second type is just the mirror image of the first type. This type takes an argument which specifies the angle at the right, respectively at the left.

Custom ear (right variant)

Custom ear in which the right angle can be specified (here 15º)

Custom ear (left variant)

Custom ear in which the left angle can be specified (here 15º)

The code for these new types of ears is given below:


\def\tikz@lib@fold@ear@custom@left@path#1{
  \draw[every fold](0,0) -- (\tikz@lib@fold@length,0pt);
  \draw[every cut] (0,0) -- (#1:.66\tikz@lib@fold@length) -- (\tikz@lib@fold@length,0pt);}
\def\tikz@lib@fold@ear@custom@right@path#1{
  \draw[every fold](0,0) -- (\tikz@lib@fold@length,0pt);
  \draw[every cut] (\tikz@lib@fold@length,0pt) -- ++(-#1:-.66\tikz@lib@fold@length) -- (0,0);}

We can now use these new type of ears in the truncated cuboctahedron. We let the ears fill the available 15º. Here is the code for this solid:

%truncated cuboctahedron

\def\tikzfoldingtruncatedcuboctahedron#1[#2]#3;{%
  \begingroup%
    \tikzset{#2}%
    \tikz@lib@fold@square
        {\tikz@lib@fold@face@A}
        {\tikz@lib@fold@octagon
            {\tikz@lib@fold@face@B}
            {\tikz@lib@fold@square
                {\tikz@lib@fold@face@C}
	       {\tikz@lib@fold@octagon
	           {\tikz@lib@fold@face@D}
	           {\tikz@lib@fold@square
	               {\tikz@lib@fold@face@E}
	               {\tikz@lib@fold@cut@path}
	               {\tikz@lib@fold@hexagon
	                   {\tikz@lib@fold@face@F}
	                   {\tikz@lib@fold@ear@path}
	                   {\tikz@lib@fold@ear@path}
	                   {\tikz@lib@fold@ear@custom@right@path{15}}
	                   {\tikz@lib@fold@path}
	                   {\tikz@lib@fold@ear@path}
	                   {\tikz@lib@fold@ear@path}
	               }
	               {\tikz@lib@fold@path}
	               {\tikz@lib@fold@hexagon
	                   {\tikz@lib@fold@face@G}
	                   {\tikz@lib@fold@ear@path}
	                   {\tikz@lib@fold@ear@path}
	                   {\tikz@lib@fold@ear@path}
	                   {\tikz@lib@fold@path}
	                   {\tikz@lib@fold@ear@custom@left@path{15}}
	                   {\tikz@lib@fold@ear@path}
	               }
	           }
	           {\tikz@lib@fold@cut@path}
	           {\tikz@lib@fold@square
	               {\tikz@lib@fold@face@H}
	               {\tikz@lib@fold@ear@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@cut@path}
	           {\tikz@lib@fold@square
	               {\tikz@lib@fold@face@I}
	               {\tikz@lib@fold@ear@path}
	               {\tikz@lib@fold@cut@path}
	               {\tikz@lib@fold@path}
	               {\tikz@lib@fold@cut@path}
	           }
	           {\tikz@lib@fold@cut@path}
	       }
	       {\tikz@lib@fold@hexagon
	           {\tikz@lib@fold@face@J}
	           {\tikz@lib@fold@ear@path}
	           {\tikz@lib@fold@ear@path}
	           {\tikz@lib@fold@ear@custom@right@path{15}}
	           {\tikz@lib@fold@path}
	           {\tikz@lib@fold@ear@custom@left@path{15}}
	           {\tikz@lib@fold@ear@path}
	       }
	       {\tikz@lib@fold@path}
	       {\tikz@lib@fold@hexagon
	           {\tikz@lib@fold@face@K}
	           {\tikz@lib@fold@ear@path}
	           {\tikz@lib@fold@ear@path}
	           {\tikz@lib@fold@ear@custom@right@path{15}}
	           {\tikz@lib@fold@path}
	           {\tikz@lib@fold@ear@custom@left@path{15}}
	           {\tikz@lib@fold@ear@path}
	       }
            }
            {\tikz@lib@fold@cut@path}
            {\tikz@lib@fold@square
                {\tikz@lib@fold@face@L}
	       {\tikz@lib@fold@ear@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@cut@path}
            {\tikz@lib@fold@square
                {\tikz@lib@fold@face@M}
	       {\tikz@lib@fold@ear@path}
	       {\tikz@lib@fold@cut@path}
	       {\tikz@lib@fold@path}
	       {\tikz@lib@fold@cut@path}
            }
            {\tikz@lib@fold@cut@path}
        }
        {\tikz@lib@fold@hexagon
            {\tikz@lib@fold@face@N}
            {\tikz@lib@fold@ear@path}
            {\tikz@lib@fold@ear@path}
            {\tikz@lib@fold@ear@custom@right@path{15}}
            {\tikz@lib@fold@path}
            {\tikz@lib@fold@ear@custom@left@path{15}}
            {\tikz@lib@fold@ear@path}
        }
        {\tikz@lib@fold@octagon
            {\tikz@lib@fold@face@O}
            {\tikz@lib@fold@square
                {\tikz@lib@fold@face@P}
	       {\tikz@lib@fold@octagon
	           {\tikz@lib@fold@face@Q}
	           {\tikz@lib@fold@ear@path}
	           {\tikz@lib@fold@cut@path}
	           {\tikz@lib@fold@square
	               {\tikz@lib@fold@face@R}
	               {\tikz@lib@fold@ear@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@cut@path}
	           {\tikz@lib@fold@square
	               {\tikz@lib@fold@face@S}
	               {\tikz@lib@fold@ear@path}
	               {\tikz@lib@fold@cut@path}
	               {\tikz@lib@fold@path}
	               {\tikz@lib@fold@cut@path}
	           }
	           {\tikz@lib@fold@cut@path}
	       }
	       {\tikz@lib@fold@hexagon
	           {\tikz@lib@fold@face@T}
	           {\tikz@lib@fold@ear@path}
	           {\tikz@lib@fold@ear@path}
	           {\tikz@lib@fold@ear@custom@right@path{15}}
	           {\tikz@lib@fold@path}
	           {\tikz@lib@fold@ear@custom@left@path{15}}
	           {\tikz@lib@fold@ear@path}
	       }
	       {\tikz@lib@fold@path}
	       {\tikz@lib@fold@hexagon
	           {\tikz@lib@fold@face@U}
	           {\tikz@lib@fold@ear@path}
	           {\tikz@lib@fold@ear@path}
	           {\tikz@lib@fold@ear@custom@right@path{15}}
	           {\tikz@lib@fold@path}
	           {\tikz@lib@fold@ear@custom@left@path{15}}
	           {\tikz@lib@fold@ear@path}
	       }
            }
            {\tikz@lib@fold@cut@path}
            {\tikz@lib@fold@square
                {\tikz@lib@fold@face@V}
	       {\tikz@lib@fold@octagon
	           {\tikz@lib@fold@face@W}
	           {\tikz@lib@fold@cut@path}
	           {\tikz@lib@fold@cut@path}
	           {\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@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@cut@path}
            {\tikz@lib@fold@square
                {\tikz@lib@fold@face@X}
	       {\tikz@lib@fold@octagon
	           {\tikz@lib@fold@face@Y}
	           {\tikz@lib@fold@cut@path}
	           {\tikz@lib@fold@cut@path}
	           {\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@cut@path}
	       }
	       {\tikz@lib@fold@cut@path}
	       {\tikz@lib@fold@path}
	       {\tikz@lib@fold@cut@path}
            }
            {\tikz@lib@fold@cut@path}
        }
        {\tikz@lib@fold@hexagon
            {\tikz@lib@fold@face@Z}
            {\tikz@lib@fold@ear@path}
            {\tikz@lib@fold@ear@path}
            {\tikz@lib@fold@ear@custom@right@path{15}}
            {\tikz@lib@fold@path}
            {\tikz@lib@fold@ear@custom@left@path{15}}
            {\tikz@lib@fold@ear@path}
        }
  \endgroup
}

This generates the following image.

Net for the truncated cuboctahedron

A truncated cuboctahedron as it is drawn by the folding library.

I want to conclude this post with one last thing. With these new types of ears, which can lie very close to the other faces, it might sometimes be difficult to spot the ears. Therefore I also wanted to add a way to make the ears more visible. To do this, I added a path to each ear and a new option which can be used to fill that path. The new code for the ears is given below:

\def\tikz@lib@fold@ear@path{
  \path[every ear] (0,0) -- (.5\tikz@lib@fold@length,.2\tikz@lib@fold@length) --(\tikz@lib@fold@length,0pt) --(0,0) -- cycle;
  \draw[every fold](0,0) -- (\tikz@lib@fold@length,0pt);
  \draw[every cut] (0,0) -- (.5\tikz@lib@fold@length,.2\tikz@lib@fold@length) --(\tikz@lib@fold@length,0pt);}
\def\tikz@lib@fold@ear@custom@left@path#1{
  \path[every ear] (0,0) -- (#1:.66\tikz@lib@fold@length) -- (\tikz@lib@fold@length,0pt) --(0,0) -- cycle;
  \draw[every fold](0,0) -- (\tikz@lib@fold@length,0pt);
  \draw[every cut] (0,0) -- (#1:.66\tikz@lib@fold@length) -- (\tikz@lib@fold@length,0pt);}
\def\tikz@lib@fold@ear@custom@right@path#1{
  \path[every ear] (0,0) -- (\tikz@lib@fold@length,0pt) -- ++(-#1:-.66\tikz@lib@fold@length) --(0,0) -- cycle;
  \draw[every fold](0,0) -- (\tikz@lib@fold@length,0pt);
  \draw[every cut] (\tikz@lib@fold@length,0pt) -- ++(-#1:-.66\tikz@lib@fold@length) -- (0,0);}

\tikzstyle{every ear}=[]

And with these modifications you can use the following code to generate the picture below.

\begin{tikzpicture}
     [transform shape,every cut/.style=red,every fold/.style=dotted,every ear/.style={fill,gray!20}]
	\tikzfoldingtruncatedcuboctahedron
	[folding line length=15mm,numbered faces];
\end{tikzpicture}
Net for the truncated cuboctahedron which demonstrates the new ears

A truncated cuboctahedron as it is drawn by the folding library. This time however, we also coloured the ears gray.

So, I hope this post clears up the final problems to implement the remaining Archimedean solids. This means that now it’s just a matter of implementing the solids, but, since the largest contains 92 faces, this might still be some work. We’ll see how long it takes.

Advertisements
Comments
3 Responses to “TikZ folding: The truncated cuboctahedron”
  1. huttarl says:

    Did you ever finish the Archimedean solids? Any plans to implement the Johnson solids? 🙂

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: