填充路径而不细化线条

填充路径而不细化线条

考虑以下 MWE:

\documentclass{standalone}
\usepackage{tikz}

\begin{document}
\begin{tikzpicture}
   \path[draw] (1,0) circle (1) (1.7,1.2);
   \path[draw] (.5,-1) circle (1) (0.5,-2.2);
   \path[clip] (.5,-1) circle (1) (0.5,-2.2);
   \path[clip] (1,0) circle (1) (1.7,1.2);
   \path[fill=white] (.5,-1) circle (1) (0.5,-2.2);
%  \path[draw] (1,0) circle (1) (1.7,1.2);
%  \path[draw] (.5,-1) circle (1) (0.5,-2.2);  add the commented lines to get the desired output
\end{tikzpicture}
\end{document}

在此处输入图片描述

是否可以在填充剪切区域时考虑线宽,以便填充区域的边框不会变细,而是保持原来的宽度?

为了达到这个结果,我在填充之后确实重新绘制了两个圆圈,但这对我来说听起来像是一个次优的解决方案。

答案1

您可以使用将仅scope应用于clip重叠区域,然后在填充重叠后简单地绘制两个圆圈:

\documentclass{standalone}
\usepackage{tikz}

\begin{document}
\begin{tikzpicture}
    \begin{scope}
        \path[clip] (.5,-1) circle (1) (0.5,-2.2);
        \path[clip] (1,0) circle (1) (1.7,1.2);
        \path[fill=orange] (.5,-1) circle (1) (0.5,-2.2);
    \end{scope}
    \path[draw] (1,0) circle (1) (1.7,1.2);
    \path[draw] (.5,-1) circle (1) (0.5,-2.2);
\end{tikzpicture}
\end{document}

相关内容