2

Is there a sensible way to achieve node connectors that look like this:

enter image description here

I can achieve the first part of the curve as follows:

% !TEX program = xelatex

\documentclass{book}

\usepackage{tikz}
\usetikzlibrary{positioning}
\usetikzlibrary{arrows}
\usetikzlibrary{calc}
\usetikzlibrary{shapes}
\pgfdeclarelayer{bg}
\pgfsetlayers{bg,main}

\tikzstyle{box}=[rectangle,draw=black,inner xsep=12pt,inner ysep=6pt]

\tikzset{>=triangle 45}

\begin{document}

    \begin{tikzpicture}%
        \node (top)    [box] {Top};
        \node (bottom) [box,below=1cm of top] {Bottom};

        \begin{pgfonlayer}{bg}%
            \draw[->] (bottom.east) -- ++(0.3,0) .. controls +(0.25,0) and +(0,-0.25) .. ++(0.25,0.25) -- ++(0,1);
        \end{pgfonlayer}
    \end{tikzpicture}%

\end{document}

Which looks like this:

enter image description here

However, I'm not sure how to easily finish off the connector. I could do the math to calculate where the second curve should start, but that will result in rather difficult to comprehend code.

Is there a sane way to pull this off?

Kent Boogaart
  • 664
  • 4
  • 15

1 Answers1

2

You can use the rounded corners option. To get what you want you can add ``waypoints´´ on the center of the line.

The following:

\documentclass{standalone}

\usepackage{tikz}
\begin{document}
\begin{tikzpicture}
        \node[draw,rectangle] (top) at (0,1) {top};
        \node[draw,rectangle] (bottom) at (0,0) {bottom};
        \draw [->,rounded corners] (bottom.east) -| (1.5,0.5) |- (top.east); %Here the (1.5,0.5) is a ``waypoint´´
\end{tikzpicture}
\end{document}

Returns:

enter image description here