我正在尝试用圆环来可视化一个多维环。我画了一个这样的环:
\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}
您如何想象其中一些是按照这样的顺序进行游览的?
我尝试将我的 TikZ 绘图与圆环示例结合起来,但没有成功。有人知道如何做到这一点,也许可以画出箭头吗?
答案1
您可以使用tikz-3dplot
和3d
库。首先可以近似地
\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={%
\draw circle[radius=outerR];
\foreach \iAngle in {0,...,11}
{\node[dot node, label=center:\iAngle] at ({angleofNode(\iAngle)}:outerR) {};}
}}]
\begin{scope}[canvas is xy plane at z=0]
\draw circle[radius=8];
\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}