TikZ - 沿着路径的节点位于其所在路径与另一条路径的交叉点处

TikZ - 沿着路径的节点位于其所在路径与另一条路径的交叉点处

a是否可以沿着路径绘制交叉点处的这个节点\draw,而不是像我使用附加\node命令那样绘制?即将其压缩为一行而不是两行?

路口 ‘a’

平均能量损失

\documentclass[border=1cm]{standalone}
\usepackage{tikz}
\usepackage{amsmath}
\usetikzlibrary{positioning,calc,intersections}

\begin{document}

\begin{tikzpicture}
    [node distance = 2cm,
     block/.style={draw, rectangle, minimum width=2cm, align=center},
     >={latex}
    ]

    % Main blocks
    \node [block, dashed, minimum size=5cm, name path=box]  (box)   {};
    \node [block, anchor=west] (internalblock) {internal\\block};
    \node [block, above=of box.north west, anchor=west] (externalblock) {external\\block};
    
    % Arrows
    \draw[->, name path=curve 1] ($ (internalblock.north) - (.5cm,0) $) -- ++(0,3cm) -| (externalblock);
    \node[rectangle, fill=white, font=\bfseries, name intersections={of=box and curve 1, by={a}}] at (a) {a};

\end{tikzpicture}

\end{document}

答案1

\documentclass[tikz, border=1cm]{standalone}
\usetikzlibrary{positioning}
\begin{document}
\begin{tikzpicture}
    [node distance = 2cm,
     block/.style={draw, rectangle, minimum width=2cm, align=center},
     >={latex}
    ]

    % Main blocks
    \node [block, dashed, minimum size=5cm]  (box)   {};
    \node [block, anchor=west] (internalblock) {internal\\block};
    \node [block, above=of box.north west, anchor=west] (externalblock) {external\\block};
    
    % Arrows
    \draw[->] ([xshift=-0.5cm] internalblock.north)   -- ++(0,3cm) -| (externalblock) ([xshift=-0.5cm] internalblock.north |- 0,2.5cm)  node[rectangle, fill=white, font=\bfseries] {a};
\end{tikzpicture}
\end{document}

带有三个框的图表

相关内容