画线推动下面的链条

画线推动下面的链条

我正在尝试绘制一条与我已经绘制的链相交的线。但是,绘制的线会将链推到下方,因此它们不相交。有人能帮忙吗?我希望该线与两条链的从节点 1 到节点 2 的两个箭头相交。

\documentclass[]{article}
\usepackage{tikz}
\usetikzlibrary{calc,trees,positioning,arrows,chains,shapes.geometric,%
    decorations.pathreplacing,decorations.pathmorphing,shapes,%
    matrix,shapes.symbols}
\tikzset{
>=stealth',
  punktchain/.style={
    rectangle, 
    rounded corners, 
    % fill=black!10,
    draw=black, very thick,
    text width=10em, 
    minimum height=3em, 
    text centered, 
    on chain},
   small punktchain/.style={
    rectangle, 
    rounded corners, 
    % fill=black!10,
    draw=black, very thick,
    text width=5em, 
    minimum height=3em, 
    text centered, 
    on chain},
  line/.style={draw, thick, <-},
  element/.style={
    tape,
    top color=white,
    bottom color=blue!50!black!60!,
    minimum width=8em,
    draw=blue!40!black!90, very thick,
    text width=10em, 
    minimum height=3.5em, 
    text centered, 
    on chain},
  every join/.style={->, thick,shorten >=1pt},
  decoration={brace},
  tuborg/.style={decorate},
  tubnode/.style={midway, right=2pt},
}

\begin{document}

\begin{figure}[h]
\centering
\begin{tikzpicture}[node distance=.8cm,
  start chain=1 going right, start chain=2 going right]
     \node[punktchain, join] (start) {Static MC};

     \node[punktchain, join] (probf)      {Uniform Generator};
     \node[punktchain, join] (u) {U};
     \draw (2.2,1) --(2.2,5);




    % SECOND CHAIN
    \node[punktchain, below=1cm of start] (x) {...};
    \node[punktchain,join] (y) {...};
    \node[punktchain, join] (z) {...}

    ;




\end{tikzpicture}
\caption{}
\label{fig:6forces}
\end{figure}
\end{document} 

你可以在图片中看到在此处输入图片描述

答案1

\draw[shorten <= -1cm,shorten >= -1cm] ($(start)!0.5!(probf)$) --($(x)!0.5!(y)$);

就在之前\end{tikzpicture}

$(start)!0.5!(probf)$start是节点和 之间的中点probf,是节点和$(x)!0.5!(y)$之间的中点。这两者都需要您已加载的库。因此,您要从 和 之间的中点到和之间的中点绘制一条线。现在我们在两边将这条线延长。在一边延长 ,在另一边延长(减号将延长线)。xycalctikzstartprobfxyshortenshorten >=shorten <=-1cm

\documentclass[]{article}
\usepackage{tikz}
\usetikzlibrary{calc,trees,positioning,arrows,chains,shapes.geometric,%
    decorations.pathreplacing,decorations.pathmorphing,shapes,%
    matrix,shapes.symbols}
\tikzset{
>=stealth',
  punktchain/.style={
    rectangle,
    rounded corners,
    % fill=black!10,
    draw=black, very thick,
    text width=10em,
    minimum height=3em,
    text centered,
    on chain},
   small punktchain/.style={
    rectangle,
    rounded corners,
    % fill=black!10,
    draw=black, very thick,
    text width=5em,
    minimum height=3em,
    text centered,
    on chain},
  line/.style={draw, thick, <-},
  element/.style={
    tape,
    top color=white,
    bottom color=blue!50!black!60!,
    minimum width=8em,
    draw=blue!40!black!90, very thick,
    text width=10em,
    minimum height=3.5em,
    text centered,
    on chain},
  every join/.style={->, thick,shorten >=1pt},
  decoration={brace},
  tuborg/.style={decorate},
  tubnode/.style={midway, right=2pt},
}

\begin{document}

\begin{figure}[h]
\centering
\begin{tikzpicture}[node distance=.8cm,
  start chain=1 going right, start chain=2 going right]
     \node[punktchain, join] (start) {Static MC};

     \node[punktchain, join] (probf)      {Uniform Generator};
     \node[punktchain, join] (u) {U};
    % SECOND CHAIN
    \node[punktchain, below=1cm of start] (x) {...};
    \node[punktchain,join] (y) {...};
    \node[punktchain, join] (z) {...};
    %% vertical line
    \draw[shorten <= -1cm,shorten >= -1cm] ($(start)!0.5!(probf)$) --($(x)!0.5!(y)$);
\end{tikzpicture}
\caption{}
\label{fig:6forces}
\end{figure}
\end{document}

在此处输入图片描述

相关内容