使用 tikz spath3 和 *nodes*

使用 tikz spath3 和 *nodes*

我可以使用 spath3路径(不是节点) 这样:

\documentclass{article}
\usepackage{tikz}
\usetikzlibrary{spath3, intersections}
\begin{document}
\begin{tikzpicture}

\draw[spath/save = rect, rounded corners=12pt] (0,0)  rectangle (2,1);
\draw[spath/save global = line3]               (-1,-1) --       (0.4,0.75);
\draw[spath/save global = line4]               (-1,-1) --       (1,0.5);

\tikzset{spath/.cd,
         split at intersections with={rect}{line3},
         split at intersections with={rect}{line4},
         get components of={rect}\cpts
}
\draw[ultra thick, color=red, spath/restore=\getComponentOf\cpts{3}] node {};
\end{tikzpicture}
\end{document}

结果:

在此处输入图片描述


到目前为止,一切都很好。

但我真正需要的是用双线突出显示交叉点处矩形节点的一部分,但它不起作用:

\documentclass{article}
\usepackage{tikz}
\usetikzlibrary{spath3, intersections}
\begin{document}
\begin{tikzpicture}
\node[spath/save global = rect, rectangle, rounded corners=12pt, draw=black!50, thick, fill=white, minimum height=27pt] {asdfasdfasdfasdf};
\draw[spath/save global = line, line width=1pt, double=white, draw=black!20, double distance=3pt] (-2, -1) -- (-0.5,0.0);
\tikzset{spath/.cd,
         split at intersections with={rect}{line},
         split at intersections with={rect}{line},
         get components of={rect}\cpts
}
\draw[ultra thick, color=red, spath/restore=\getComponentOf\cpts{2}] node {};
\end{tikzpicture}
\end{document}

在此处输入图片描述

有任何想法吗?

相关内容