如何绘制平滑的“圆角箭头”?

如何绘制平滑的“圆角箭头”?

我有下图:

\documentclass{standalone}

\usepackage{tikz}
\usetikzlibrary{calc}

\begin{document}

\begin{tikzpicture}
  \coordinate (shift) at (1mm,0mm);

  \node [draw=black, minimum size = 1cm] (1) {};
  \node [inner sep=0pt, circle, fill=black, minimum size = 2mm] (1bis) at (1) {};
  \node [anchor=west,draw=black, minimum size = 1cm] (2) at ($(1.east) + (shift)$) {};
  \node [inner sep=0pt, circle, fill=black, minimum size = 2mm] (2bis) at (2) {};
  \node [anchor=west,draw=black, minimum size = 1cm] (3) at ($(2.east) + (shift)$) {};
  \node [inner sep=0pt, circle, fill=black, minimum size = 2mm] (3bis) at (3) {};
  \node [anchor=west,draw=black, minimum size = 1cm] (4) at ($(3.east) + (shift)$) {};
  \node [inner sep=0pt, circle, fill=black, minimum size = 2mm] (4bis) at (4) {};
  \node [anchor=west,draw=black, minimum size = 1cm] (5) at ($(4.east) + (shift)$) {};
  \node [inner sep=0pt, circle, fill=black, minimum size = 2mm] (5bis) at (5) {};
  \node [anchor=west,draw=black, minimum size = 1cm] (6) at ($(5.east) + (shift)$) {};
  \node [inner sep=0pt, circle, fill=black, minimum size = 2mm] (6bis) at (6) {};

  \draw[-latex,very thick]  (1bis.center) -- ($(1.north) + (0,3mm)$) -| (3bis);
  \draw[-latex,very thick]  (3bis.center) -- ($(3.south) - (0,3mm)$) -| (5bis);
  \draw[-latex,very thick]  (5bis.center) -- ($(5.north) + (0,5mm)$) -| (2bis);
  \draw[-latex,very thick]  (2bis.center) -- ($(2.south) - (0,5mm)$) -| (4bis);
  \draw[-latex,very thick]  (4bis.center) -- ($(4.north) + (0,3mm)$) -| (6bis);
  \draw[-latex,very thick]  (6bis.center) -- ($(6.south) - (0,7mm)$) -| (1bis);
\end{tikzpicture}

\end{document}

我怎样才能用光滑的箭头代替有角的箭头?

答案1

像这样吗?

在此处输入图片描述

\documentclass[tikz,border=2mm]{standalone}

\usepackage{tikz}
\usetikzlibrary{calc,positioning}

\begin{document}

\begin{tikzpicture}
  \coordinate (shift) at (1mm,0mm);

\begin{scope}[node distance=1mm]
    \node[draw=black, minimum size = 1cm] (1) {};
    \foreach \i [count = \prev] in {2,...,6}
        \node [draw=black, minimum size = 1cm, right=of \prev] (\i) {};
\end{scope}
\foreach \i in {1,...,6}
    \draw[fill=black] (\i.center) circle (1mm);

\begin{scope}[>=latex, very thick,->, shorten >=1mm, shorten <=1mm]
\draw (1.center) to[out=90,in=180] ([yshift=1cm]2.center) to[out=0,in=90] (3.center);
\draw (3.center) to[out=-90,in=180] ([yshift=-1cm]4.center) to[out=0,in=-90] (5.center);
\draw (5.center) to[out=90,in=0] ($(5.center)!.5!(2.center)+(0,1.3)$) to[out=180,in=90] (2.center);
\draw (2.center) to[out=-90,in=180] ([yshift=-1cm]3.center) to[out=0,in=-90] (4.center);
\draw (4.center) to[out=90,in=180] ([yshift=1cm]5.center) to[out=0,in=90] (6.center);
\draw (6.center) to[out=-90,in=0] ($(6.center)!.5!(1.center)-(0,1.3)$) to[out=180,in=-90] (1.center);
\end{scope}
\end{tikzpicture}
\end{document}

答案2

这里还有更多选项(感谢 ignasi 的代码)

\documentclass[tikz,border=2mm]{standalone}

\usepackage{tikz}
\usetikzlibrary{calc,positioning}

\begin{document}

\begin{tikzpicture}
  \coordinate (shift) at (1mm,0mm);

\begin{scope}[node distance=1mm]
    \node[draw=black, minimum size = 1cm] (1) {};
    \foreach \i [count = \prev] in {2,...,6}
        \node [draw=black, minimum size = 1cm, right=of \prev] (\i) {};
\end{scope}
\foreach \i in {1,...,6}
    \draw[fill=black] (\i.center) circle (1mm);

\begin{scope}[>=latex, very thick,->, shorten >=1mm, shorten <=1mm]
\draw (1.center) to[controls=+(90:2) and +(90:2)] (3.center);
\draw (3.center) to[out=-90,in=-90,distance=2cm] (5.center);
\draw (5.center) to[out=90,in=90,min distance=2cm] (2.center);
\draw (2.center) to[out=-90,in=-90,min distance=2cm] (4.center);
\draw (4.center) to[controls=+(90:2) and +(90:2)] (6.center);
\draw (6.center) to[controls=+(-90:3) and +(-90:3)] (1.center);
\end{scope}
\end{tikzpicture}
\end{document}

在此处输入图片描述

相关内容