![TikZ 中圆上两个节点之间的线](https://linux22.com/image/436902/TikZ%20%E4%B8%AD%E5%9C%86%E4%B8%8A%E4%B8%A4%E4%B8%AA%E8%8A%82%E7%82%B9%E4%B9%8B%E9%97%B4%E7%9A%84%E7%BA%BF.png)
我想按照给定半径的圆连接两个节点 n1 和 n2。我尝试过to[bend left=<>]
,但总是无法完美匹配(下图中我突出显示了这个问题)。有什么想法吗?
\begin{tikzpicture}
\def\radius{2cm}
\draw[color=black!50, name path=c] (0:\radius) arc (0:360:\radius);
\node[draw, circle, fill=white, name path=n1] at (110:\radius) (n1) {n1};
\node[draw, circle, fill=white, name path=n2] at (0:\radius) (n2) {n2};
\path[name intersections={of=n1 and c, by={i1, i2}}];
\path[name intersections={of=n2 and c, by={i2, i3}}];
\node[draw, red, circle, scale=0.5] at (i1) {};
\node[draw, red, circle, scale=0.5] at (i2) {};
\draw[<-, >=latex, blue] (i1) to[bend left=41] (i2);
\end{tikzpicture}
答案1
使用该bending
库,并将弯曲值设为 44,这似乎很合适。
\documentclass[tikz,border=3.14mm]{standalone}
\usetikzlibrary{bending,intersections}
\begin{document}
\begin{tikzpicture}
\def\radius{2cm}
\draw[color=black!50, name path=c] (0:\radius) arc (0:360:\radius);
\node[draw, circle, fill=white, name path=n1] at (110:\radius) (n1) {n1};
\node[draw, circle, fill=white, name path=n2] at (0:\radius) (n2) {n2};
\path[name intersections={of=n1 and c, by={i1, i2}}];
\path[name intersections={of=n2 and c, by={i2, i3}}];
\node[draw, red, circle, scale=0.5] at (i1) {};
\node[draw, red, circle, scale=0.5] at (i2) {};
\draw[<-, >=latex, blue] (i1) to[bend left=44] (i2);
\end{tikzpicture}
\end{document}