答案1
如果您不介意使用白色填充,则可以使用double
线和。clip
例如:
\documentclass[tikz,border=2mm]{standalone}
\newcommand{\kidneyA}
{
(2.1,1.5) to[out=100,in=0] (0.3,3) to[out=180,in=90] (-0.5,2) to[out=270,in=90] (-0.3,0.4)
to[out=270,in=35] (-1.4,-1) to[out=215,in=90] (-2.7,-2.7) to[out=270,in=215] (-0.1,-2.8)
}
\newcommand{\kidneyB}{(-0.1,-2.8) to [out=35,in=280] (2.1,1.5)}
\begin{document}
\begin{tikzpicture}[line join=round,line cap=round]
\begin{scope}
\clip \kidneyA \kidneyB;
\draw[red,ultra thick,double,double distance=6mm] \kidneyB;
\end{scope}
\draw \kidneyA;
\draw[blue,ultra thick] \kidneyB;
\end{tikzpicture}
\end{document}
答案2
\documentclass[tikz, border=1cm]{standalone}
\usetikzlibrary{hobby}
\begin{document}
\begin{tikzpicture}[very thick, use Hobby shortcut]
\begin{scope}
\clip[closed] (0,0)..(-1,1)..(1,3)..(1.5,5)..(3,4)..(1.5,0.5);
\draw[red, line cap=round, double, double distance=1cm, closed] ([blank=soft]0,0)..([blank=soft]-1,1)..([blank=soft]1,3)..([blank=soft]1.5,5)..([blank=soft]3,4)..(1.5,0.5);
\end{scope}
\draw[closed] (0,0)..(-1,1)..(1,3)..(1.5,5)..(3,4)..(1.5,0.5);
\draw[cyan, closed] ([blank=soft]0,0)..([blank=soft]-1,1)..([blank=soft]1,3)..([blank=soft]1.5,5)..([blank=soft]3,4)..(1.5,0.5);
\end{tikzpicture}
\end{document}