答案1
添加一个中间点(其下方是),并通过曲线
(A)+(1,0.5)
将其连接到(A)
和。(B)
第一个例子使用
to[out=a,in=b]
,其中a
给出线离开第一个节点的角度和b
线到达第二个节点的角度。第二个示例使用
.. controls +(a:x) and +(b:y) ..
。a
和b
具有与上面相同的含义。x
和y
控制给定角度的“强度”。 值越大,线条尝试遵循角度的时间越长。
\documentclass[border=2pt]{standalone}
\usepackage{tikz}
\usetikzlibrary{positioning}
\begin{document}
\begin{tikzpicture}[on grid]
\node (A) {A};
\node[right=2 of A] (B) {B};
\draw (A) to[in=0,out=0] +(1,0.5) to[in=180,out=180] (B);
\end{tikzpicture}
\begin{tikzpicture}[on grid]
\node (A) {A};
\node[right=2 of A] (B) {B};
\draw (A) .. controls +(0:1) and +(0:1) .. +(1,0.5)
.. controls +(180:1) and +(180:1) .. (B);
\end{tikzpicture}
\end{document}
具有两个中间点,且‘实力’不对称。
\documentclass[border=2pt]{standalone}
\usepackage{tikz}
\usetikzlibrary{positioning}
\begin{document}
\begin{tikzpicture}[on grid,baseline=(A)]
\node (A) {A};
\node[right=2 of A] (B) {B};
\draw (A) .. controls +(0:1) and +(-90:0.3) .. +(1.3,0.5)
.. controls +(90:0.3) and +(90:0.3) .. +(0.7,0.5)
.. controls +(-90:0.3) and +(180:1) .. (B);
\end{tikzpicture}
\begin{tikzpicture}[on grid,baseline=(A)]
\node (A) {A};
\node[right=2 of A] (B) {B};
\draw (A) .. controls +(0:0.8) and +(-90:0.6) .. +(1.3,0.5)
.. controls +(90:0.3) and +(90:0.3) .. +(0.7,0.5)
.. controls +(-90:1) and +(180:1) .. (B);
\end{tikzpicture}
\end{document}