我尝试画一个有六个节点和四个箭头的东西。箭头应该在最弯曲的点处相接 - 在箭头的中间。
但是,我不想摆弄移动节点,以免箭头碰巧接触。最好的方法是什么?
到目前为止我有这个:
\documentclass[tikz,border=3mm]{standalone}
\usetikzlibrary{positioning}
\begin{document}
\begin{tikzpicture}
\node[](A){A};
\node[below = of A](B){B};
\node[left = of A](C){C};
\node[right = of A](D){D};
\node[left = of B](E){E};
\node[right = of B](F){F};
\draw [->] (B.east) to [bend right] (A.east);
\draw [->] (F.west) to [bend left] (D.west);
\draw [->] (A.west) to [bend right] (B.west);
\draw [->] (C.east) to [bend left] (E.east);
\end{tikzpicture}
\end{document}
答案1
利用重心坐标,你可以确定一个合适的接触点候选点,该候选点可以用于各种构造,例如
\documentclass[tikz,border=3mm]{standalone}
\usetikzlibrary{positioning}
\begin{document}
\begin{tikzpicture}
\begin{scope}
\node(A){A};
\node[below = of A](B){B};
\node[left = of A](C){C};
\node[right = of A](D){D};
\node[left = of B](E){E};
\node[right = of B](F){F};
\path (barycentric cs:A=1,B=1,D=1,F=1) coordinate (ABDF)
(barycentric cs:A=1,B=1,C=1,E=1) coordinate (ABCE);
\draw[->] (B.east) to[out=45,in=-90] (ABDF) to[out=90,in=-45] (A.east);
\draw[->] (F.west) to[out=135,in=-90] (ABDF) to[out=90,in=-135] (D.west);
\draw[->] (A.west) to[out=-135,in=90] (ABCE) to[out=-90,in=135] (B.west);
\draw[->] (C.east) to[out=-45,in=90] (ABCE) to[out=-90,in=45] (E.east);
\end{scope}
\begin{scope}[xshift=5cm]
\node(A){A};
\node[below = of A](B){B};
\node[left = of A](C){C};
\node[right = of A](D){D};
\node[left = of B](E){E};
\node[right = of B](F){F};
\path (barycentric cs:A=1,B=1,D=1,F=1) coordinate (ABDF)
(barycentric cs:A=1,B=1,C=1,E=1) coordinate (ABCE);
\draw[->] plot[smooth] coordinates {(B.east) (ABDF) (A.east)};
\draw[->] plot[smooth] coordinates {(F.west) (ABDF) (D.west)};
\draw[->] plot[smooth] coordinates {(A.west) (ABCE) (B.west)};
\draw[->] plot[smooth] coordinates {(C.east) (ABCE) (E.east)};
\end{scope}
\end{tikzpicture}
\end{document}
当然,人们可以使箭头变得更加时髦等等。