# Visualize a multi dimensional mathematical ring with TikZ

I'm trying to visualize a multi dimensional ring with a torus. I draw a single ring like this:

\tikzset{
dot node/.style={
shape=circle,
fill=white,
draw,
inner sep=+0pt,
minimum size=+5mm
},
arc style/.style={
o->|,
shorten >=+-.5\pgflinewidth,
shorten <=+-.5\pgflinewidth,
}
}

\begin{tikzpicture}[
thick,
every pin edge/.style={<-},
>=latex,
declare function/.list={
outerR=3.0;,
innerR=2.4;,
angleofNode(\a)=\a/12*360;}
]
\node [draw,circle through=(0:outerR)] (c) {};

\foreach \iAngle in {0,...,11}
\node[dot node, label=center:\iAngle] at (c.{angleofNode(\iAngle)}) {};

\foreach \sAngle/\eAngle/\tLabel in {-1/3/+4}
\draw[arc style] ({angleofNode(\sAngle)}:innerR) arc[radius=innerR, start angle=angleofNode(\sAngle), end angle=angleofNode(\eAngle)]
node at ({angleofNode(\sAngle+\eAngle)/2}:innerR-.5) {${\tLabel}$} ;
\end{tikzpicture} How would you visualize a few of them ordered around a tours like this? I've tried to combine my TikZ drawing with a torus example but I didn't come far. Does somebody have an idea how to do this and maybe being able to draw arrows?

You can use tikz-3dplot and the 3d library. To very first approximation one could do

\documentclass[tikz,border=3mm]{standalone}
\usepackage{tikz-3dplot}
\usetikzlibrary{3d}
\tikzset{
dot node/.style={
shape=circle,
fill=white,
draw,
inner sep=+0pt,
minimum size=+5mm
},
arc style/.style={
o->|,
shorten >=+-.5\pgflinewidth,
shorten <=+-.5\pgflinewidth,
}
}

\begin{document}

\tdplotsetmaincoords{60}{0}
\begin{tikzpicture}[tdplot_main_coords,
declare function={outerR=3.0;
innerR=2.4;
angleofNode(\a)=\a/12*360;},
pics/ring/.style={code={%
\foreach \iAngle in {0,...,11}
{\node[dot node, label=center:\iAngle] at ({angleofNode(\iAngle)}:outerR) {};}
}}]
\begin{scope}[canvas is xy plane at z=0]
\end{scope}
\foreach \XX in {0,...,7}
{\tdplotsetrotatedcoords{0}{0}{22.5+\XX*45}
\begin{scope}[tdplot_rotated_coords,canvas is xz plane at y=0]
\pgfmathtruncatemacro{\itest}{sign(cos(22.5+\XX*45))}
\path (8,0) node[dot node]{$x^\XX$} pic[transform shape,xscale=\itest]{ring};
\ifnum\XX=1
\foreach \sAngle/\eAngle/\tLabel in {-1/3/+4}
\draw[arc style] (8,0) +({angleofNode(\sAngle)}:innerR) arc[radius=innerR, start angle=angleofNode(\sAngle), end angle=angleofNode(\eAngle)]
node[transform shape] at ($(8,0)+({angleofNode(\sAngle+\eAngle)/2}:innerR-.5)$) {${\tLabel}$} ;
\fi
\end{scope}
}
\begin{scope}[canvas is xy plane at z=3.6]
\pgflowlevelsynccm
\draw[arc style] (3*45+22.5:8) arc[start angle=3*45+22.5,end angle=1*45+22.5,radius=8];
\end{scope}
\end{tikzpicture}
\end{document} • Thank you very much for helping me out! – Robin Mar 7 '20 at 9:52