填滿路徑而不細化線條

填滿路徑而不細化線條

考慮以下 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

您可以使用 a將 onlyscope應用於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}

相關內容