我想剪切某个区域的部分,以便经过该区域的路径在该区域的边界处继续。看起来应该是这样的,但一定有更好的解决方案,而不是用那个矩形进行剪切。
\documentclass[border=12pt]{standalone}
\usepackage{tikz}
\begin{document}
\begin{tikzpicture}
\draw (4,0) node (11) {}
(2,0.1) node (12) {}
(4.4,3.2) node (13) {}
(2,3.6) node (14) {}
(4.8,1.3) node (15) {}
(1.1,1.8) node (16) {}
(3.2,1.8) node (17) {}
;
\draw [line width=0.10mm] plot[smooth, tension=.7] coordinates {(15)(17)(16)};
\draw [fill=black!40, black!40] plot [smooth cycle, tension=.8] coordinates {(3,2.2)(3.6,2.3)(3.7,1.8)(3.5,1.5)(3,1.4)(2.8,1.8)};
\draw [line width=0.125mm] plot[smooth, tension=.7] coordinates {(11)(17)(14)};
\draw [fill=black!30, black!30] plot [smooth cycle, tension=.8] coordinates {(3.2,2.2)(3.5,2.2)(3.6,1.9)(3.3,1.5)(3,1.5)(2.9,1.8)};
\draw [line width=0.15mm] plot[smooth, tension=.7] coordinates {(12)(17)(13)};
\draw [fill=black!20, black!20] plot [smooth cycle, tension=.8] coordinates {(3.2,2)(3.4,2.1)(3.4,1.8)(3.2,1.6)(3.0245,1.579)(3,1.8)};
\clip [rotate=52](3.0653,-1.4084) rectangle (3.7509,-1.6064);
\draw [black!100] plot [smooth cycle, tension=.8] coordinates {(3.2,2)(3.4,2.1)(3.4,1.8)(3.2,1.6)(3.0245,1.579)(3,1.8)};
\end{tikzpicture}
\end{document}
编辑:我没能说清楚我想要什么。解决方案应该适用于所有 3 条路径,如下所示
答案1
您可以根据现有路径/节点进行剪辑,\clip plot[smooth, tension=.7] coordinates {(12)(17)(13)} -- (15) -- (11) -- cycle;
尽管这比预期的剪辑稍微紧密一些。
calc
通过对中点进行一些手动调整(通过 TikZ库) plot
,我们就可以更接近自然剪辑\clip plot[smooth, tension=.7] coordinates {(12)($(17)+(-0.005,0.005)$)(13)} -- (15) -- (11) -- cycle;
。
\documentclass[border=12pt]{standalone}
\usepackage{tikz}
\usetikzlibrary{calc}
\begin{document}
\begin{tikzpicture}[scale=1]
\draw (4,0) node (11) {}
(2,0.1) node (12) {}
(4.4,3.2) node (13) {}
(2,3.6) node (14) {}
(4.8,1.3) node (15) {}
(1.1,1.8) node (16) {}
(3.2,1.8) node (17) {}
;
\draw [line width=0.10mm] plot[smooth, tension=.7] coordinates {(15)(17)(16)};
\draw [fill=black!40, black!40] plot [smooth cycle, tension=.8] coordinates {(3,2.2)(3.6,2.3)(3.7,1.8)(3.5,1.5)(3,1.4)(2.8,1.8)};
\draw [line width=0.125mm] plot[smooth, tension=.7] coordinates {(11)(17)(14)};
\draw [fill=black!30, black!30] plot [smooth cycle, tension=.8] coordinates {(3.2,2.2)(3.5,2.2)(3.6,1.9)(3.3,1.5)(3,1.5)(2.9,1.8)};
\draw [line width=0.15mm] plot[smooth, tension=.7] coordinates {(12)(17)(13)};
\draw [fill=black!20, black!20] plot [smooth cycle, tension=.8] coordinates {(3.2,2)(3.4,2.1)(3.4,1.8)(3.2,1.6)(3.0245,1.579)(3,1.8)};
\clip plot[smooth, tension=.7] coordinates {(12)($(17)+(-0.005,0.005)$)(13)} -- (15) -- (11) -- cycle;
\draw [black!100] plot [smooth cycle, tension=.8] coordinates {(3.2,2)(3.4,2.1)(3.4,1.8)(3.2,1.6)(3.0245,1.579)(3,1.8)};
\end{tikzpicture}
\end{document}
将其应用于所有交叉路径需要对不同的\clip
s 进行适当的范围界定。
\documentclass[border=12pt]{standalone}
\usepackage{tikz}
\usetikzlibrary{calc}
\begin{document}
\begin{tikzpicture}[scale=1]
\draw (4,0) node (11) {}
(2,0.1) node (12) {}
(4.4,3.2) node (13) {}
(2,3.6) node (14) {}
(4.8,1.3) node (15) {}
(1.1,1.8) node (16) {}
(3.2,1.8) node (17) {}
;
\draw [line width=0.10mm] plot[smooth, tension=.7] coordinates {(15)(17)(16)};
\draw [fill=black!40, black!40] plot [smooth cycle, tension=.8] coordinates {(3,2.2)(3.6,2.3)(3.7,1.8)(3.5,1.5)(3,1.4)(2.8,1.8)};
\draw [line width=0.125mm] plot[smooth, tension=.7] coordinates {(11)(17)(14)};
\draw [fill=black!30, black!30] plot [smooth cycle, tension=.8] coordinates {(3.2,2.2)(3.5,2.2)(3.6,1.9)(3.3,1.5)(3,1.5)(2.9,1.8)};
\draw [line width=0.15mm] plot[smooth, tension=.7] coordinates {(12)(17)(13)};
\draw [fill=black!20, black!20] plot [smooth cycle, tension=.8] coordinates {(3.2,2)(3.4,2.1)(3.4,1.8)(3.2,1.6)(3.0245,1.579)(3,1.8)};
\begin{scope}
\clip plot[smooth, tension=.7] coordinates {(15)($(17)+(0,-0.005)$)(16)} -- (13) -- cycle;
\draw [black!100] plot [smooth cycle, tension=.8] coordinates {(3,2.2)(3.6,2.3)(3.7,1.8)(3.5,1.5)(3,1.4)(2.8,1.8)};
\end{scope}
\begin{scope}
\clip plot[smooth, tension=.7] coordinates {(11)($(17)+(-0.005,-0.005)$)(14)} -- (13) -- (15) -- cycle;
\draw [black!100] plot [smooth cycle, tension=.8] coordinates {(3.2,2.2)(3.5,2.2)(3.6,1.9)(3.3,1.5)(3,1.5)(2.9,1.8)};
\end{scope}
\begin{scope}
\clip plot[smooth, tension=.7] coordinates {(12)($(17)+(-0.005,0.005)$)(13)} -- (15) -- (11) -- cycle;
\draw [black!100] plot [smooth cycle, tension=.8] coordinates {(3.2,2)(3.4,2.1)(3.4,1.8)(3.2,1.6)(3.0245,1.579)(3,1.8)};
\end{scope}
\end{tikzpicture}
\end{document}