Einen gekrümmten Pfad in Bezug auf einen TikZ-Knoten parallel erscheinen lassen

Einen gekrümmten Pfad in Bezug auf einen TikZ-Knoten parallel erscheinen lassen

Ich habe ein Diagramm, das so aussieht:

Bildbeschreibung hier eingeben

Ich habe Knoten horizontal bund cin Bezug auf ihre Mittelpunkte ausgerichtet, aber dies verursacht ein Problem mit dem gekrümmten Pfad, zda dieser nicht mehr symmetrisch ist.

Wie kann ich dafür sorgen, dass die Enden des Pfads zparallel zueinander verlaufen und die Beschriftung mit dem Knoten übereinstimmt ( awie im Diagramm unten), während gleichzeitig die bmittige cAusrichtung beibehalten wird?

Bildbeschreibung hier eingeben

Code:

\documentclass[border=3mm]{standalone}
\usepackage{tikz}
\usetikzlibrary{arrows,positioning,calc}
\begin{document}
\begin{tikzpicture}[auto,node distance=2cm, align=center,
block/.style={rectangle,draw, thick,inner sep=2pt,minimum size=10mm},
paths/.style={->, very thick, >=stealth'},
curve/.style={<->, thick, >=stealth', bend left=270, looseness=2, distance = 60mm},
]

%Draw, place, and label variables
\node [block] (a) {a};
\node [block] (b) [above right=of a] {bbbbbbbbbb};
\node [block] (c) [below= 4cm of b.south, anchor = north] {ccc};
%\node [block] (c) [below right= of a] {ccc}; % ideal curved path between b and c here, but block not centered

% Draw paths and label them
\draw [paths] (a) to node {x} (b);
\draw [paths] (a) to node [swap] {y} (c);
\draw [curve] (b) to node [swap,midway] {z} (c);
\end{tikzpicture}
\end{document}

Antwort1

Das folgende Beispiel platziert zuerst den Knoten zfür „z“ links von Knoten , aum „z“ auf die gleiche Grundlinie wie „a“ zu bringen. Dann wird die Kurve in zwei Teile geteilt, vom Knoten b.westzu z.eastund z.eastzu c.west. Die Komponenten .westund .eastsorgen für die richtigen Start- und Endpunkte. Die Start- und Endwinkel der Kurventeile werden durch Optionen inund outfür den Pfadoperator angegeben to. Dies erfordert die Bibliothek topaths:

\documentclass[border=3mm]{standalone}
\usepackage{tikz}
\usetikzlibrary{arrows,positioning,calc,topaths}
\begin{document}
\begin{tikzpicture}[auto,node distance=2cm, align=center,
  block/.style={rectangle,draw, thick,inner sep=2pt,minimum size=10mm},
  paths/.style={->, very thick, >=stealth'},
  curve/.style={<->, thick, >=stealth'},
]

%Draw, place, and label variables
\node [block] (a) {a};
\node [block] (b) [above right=of a] {bbbbbbbbbb};
\node [block] (c) [below= 4cm of b.south, anchor = north] {ccc};
%\node [block] (c) [below right= of a] {ccc}; % ideal curved path between b
%and c here, but block not centered

% Draw paths and label them
\draw [paths] (a) to node {x} (b);
\draw [paths] (a) to node [swap] {y} (c);
\node [xshift=-3em, anchor=base east] (z) at (a.base west) {z};
\draw [curve] (b.west) to[out=180, in=90] (z.east)
                  to[out=-90, in=180] (c.west);
\end{tikzpicture}
\end{document}

Ergebnis

Und eine Variante, bei der die geraden Verbindungen (a) -- (b)an (a) -- (c)den Ecken verbunden werden. In diesem Fall sieht es vielleicht besser aus.

\documentclass[border=3mm]{standalone}
\usepackage{tikz}
\usetikzlibrary{arrows,positioning,calc,topaths}
\begin{document}
\begin{tikzpicture}[auto,node distance=2cm, align=center,
  block/.style={rectangle,draw, thick,inner sep=2pt,minimum size=10mm},
  paths/.style={->, very thick, >=stealth'},
  curve/.style={<->, thick, >=stealth'},
]

%Draw, place, and label variables
\node [block] (a) {a};
\node [block] (b) [above right=of a] {bbbbbbbbbb};
\node [block] (c) [below= 4cm of b.south, anchor = north] {ccc};
%\node [block] (c) [below right= of a] {ccc}; % ideal curved path between b
%and c here, but block not centered

% Draw paths and label them
\draw [
  paths,
  shorten <=-.7\pgflinewidth,
] (a.north east) to node {x} (b.south west);
\draw [
  paths,
  shorten <=-.7\pgflinewidth,
] (a.south east) to node [swap] {y} (c.north west);
\node [xshift=-3em, anchor=base east] (z) at (a.base west) {z};
\draw [curve] (b.west) to[out=180, in=90] (z.east)
                  to[out=-90, in=180] (c.west);
\end{tikzpicture}
\end{document}

Ergebnisvariante Ecken

verwandte Informationen