Toroidal Polyhedron

toroidal-polyhedron

Edit and compile if you like:

\documentclass{article}
\usepackage{tikz}
\usepackage{tikz-3dplot}
\usetikzlibrary{patterns}
\usetikzlibrary{math}
\usepackage[active,tightpage]{preview}
\PreviewEnvironment{tikzpicture}
\setlength\PreviewBorder{0.125pt}
%
% File name: toroidal-polyhedron.tex
% Description: 
% A geometric representation of toroidal-polyhedron is shown.
% 
% Date of creation: July, 06th, 2021.
% Date of last modification: October, 9th, 2022.
% Author: Efraín Soto Apolinar.
% https://www.aprendematematicas.org.mx/author/efrain-soto-apolinar/instructing-courses/
% Source: page 351 of the 
% Glosario Ilustrado de Matem\'aticas Escolares.
% https://tinyurl.com/5udm2ufy
%
% Terms of use:
% According to TikZ.net
% https://creativecommons.org/licenses/by-nc-sa/4.0/
% Your commitment to the terms of use is greatly appreciated.
%
\begin{document}
	%
	\tdplotsetmaincoords{35}{115}
	%
	\begin{tikzpicture}[tdplot_main_coords,scale=0.85]
	\pgfmathsetmacro{\rInt}{2.5}	% inner radius
	\pgfmathsetmacro{\rExt}{4.0}	% outer radius
	\pgfmathsetmacro{\r}{0.5*(\rInt+\rExt)}
	\pgfmathsetmacro{\h}{0.5*(\rExt-\rInt)}
	\pgfmathsetmacro{\n}{5}	% number of pseudovertices of the toroidal polyhedron
	\pgfmathsetmacro{\anguloi}{30}
	\pgfmathsetmacro{\angulo}{360.0/\n}
	\pgfmathsetmacro{\criterio}{int(0.5*\n)}
	\pgfmathsetmacro{\pxn}{\r*cos(0.5*\anguloi)}
	\pgfmathsetmacro{\pyn}{\r*sin(0.5*\anguloi)}		
	% Coordinates of the vertices
	\foreach \vertice in {1,2,...,\n}{
		\pgfmathsetmacro{\pxi}{\rInt*cos((\angulo)*\vertice+\anguloi)}
		\pgfmathsetmacro{\pyi}{\rInt*sin((\angulo)*\vertice+\anguloi)}
		\coordinate (A\vertice) at (\pxi,\pyi,0);
		\pgfmathsetmacro{\pxi}{\rExt*cos((\angulo)*\vertice+\anguloi)}
		\pgfmathsetmacro{\pyi}{\rExt*sin((\angulo)*\vertice+\anguloi)}
		\coordinate (C\vertice) at (\pxi,\pyi,0);
		\pgfmathsetmacro{\pxi}{\r*cos((\angulo)*\vertice+\anguloi)}
		\pgfmathsetmacro{\pyi}{\r*sin((\angulo)*\vertice+\anguloi)}
		\coordinate (B\vertice) at (\pxi,\pyi,\h);
		\coordinate (D\vertice) at (\pxi,\pyi,-\h);
	}
	% The toroidal polyhedron
	\foreach \vertice in {1,2,...,\n}{
		\pgfmathsetmacro{\vf}{\vertice+1}
		\ifthenelse{\vertice<\n}{
			\draw[help lines] (A\vertice) -- (B\vertice) -- (B\vf) -- (A\vf) -- (A\vertice);
			\draw[help lines] (B\vertice) -- (C\vertice) -- (C\vf) -- (B\vf) -- (B\vertice);
			\draw[help lines] (C\vertice) -- (D\vertice) -- (D\vf) -- (C\vf) -- (C\vertice);
			\draw[help lines] (A\vertice) -- (D\vertice) -- (D\vf) -- (A\vf) -- (A\vertice);
		}{ % la última cara
			\draw[help lines] (A\vertice) -- (B\vertice) -- (B1) -- (A1) -- (A\vertice);
			\draw[help lines] (B\vertice) -- (C\vertice) -- (C1) -- (B1) -- (B\vertice);
			\draw[help lines] (C\vertice) -- (D\vertice) -- (D1) -- (C1) -- (C\vertice);
			\draw[help lines] (A\vertice) -- (D\vertice) -- (D1) -- (A1) -- (A\vertice);
		}
	}
	% bottom faces (back)
	\draw[red,thick,fill=cyan!35,opacity=0.75]  (A1) -- (D1) -- (D2) -- (A2) -- (A1);
	\draw[red,thick,fill=cyan!35,opacity=0.75]  (A2) -- (D2) -- (D3) -- (A3) -- (A2);
	\draw[red,thick,fill=cyan!35,opacity=0.75]  (A3) -- (D3) -- (D4) -- (A4) -- (A3);
	\draw[red,thick,fill=cyan!35,opacity=0.75]  (A4) -- (D4) -- (D5) -- (A5) -- (A4);
	\draw[red,thick,fill=cyan!35,opacity=0.75]  (A5) -- (D5) -- (D1) -- (A1) -- (A5);		
	% external faces (back)
	\draw[red,thick,fill=cyan!35,opacity=0.75]  (D1) -- (C1) -- (C2) -- (D2) -- (D1);
	\draw[red,thick,fill=cyan!35,opacity=0.75]  (D2) -- (C2) -- (C3) -- (D3) -- (D2);
	\draw[red,thick,fill=cyan!35,opacity=0.75]  (D3) -- (C3) -- (C4) -- (D4) -- (D3);
	% internal faces (front)
	\draw[red,thick,fill=cyan!35,opacity=0.75]  (A1) -- (B1) -- (B5) -- (A5) -- (A1);
	\draw[red,thick,fill=cyan!35,opacity=0.75]  (A1) -- (B1) -- (B2) -- (A2) -- (A1);
	\draw[red,thick,fill=cyan!35,opacity=0.75]  (A2) -- (B2) -- (B3) -- (A3) -- (A2);
	\draw[red,thick,fill=cyan!35,opacity=0.75]  (A3) -- (B3) -- (B4) -- (A4) -- (A3);
	\draw[red,thick,fill=cyan!35,opacity=0.75]  (A5) -- (B5) -- (B4) -- (A4) -- (A5);
	% external faces (front)
	\draw[red,thick,fill=cyan!35,opacity=0.75]  (D1) -- (C1) -- (C5) -- (D5) -- (D1);
	\draw[red,thick,fill=cyan!35,opacity=0.75]  (D5) -- (C5) -- (C4) -- (D4) -- (D5);
	% top faces
	\draw[red,thick,fill=cyan!35,opacity=0.75]  (B1) -- (C1) -- (C2) -- (B2) -- (B1);
	\draw[red,thick,fill=cyan!35,opacity=0.75]  (B2) -- (C2) -- (C3) -- (B3) -- (B2);
	\draw[red,thick,fill=cyan!35,opacity=0.75]  (B3) -- (C3) -- (C4) -- (B4) -- (B3);
	\draw[red,thick,fill=cyan!35,opacity=0.75]  (B4) -- (C4) -- (C5) -- (B5) -- (B4);
	\draw[red,thick,fill=cyan!35,opacity=0.75]  (B5) -- (C5) -- (C1) -- (B1) -- (B5);
	%
	\end{tikzpicture}
	%
\end{document}

Click to download: toroidal-polyhedron.textoroidal-polyhedron.pdf
Open in Overleaf:
toroidal-polyhedron.tex
See more on the author page of Efraín Soto Apolinar.

Leave a Reply

Your email address will not be published.