我想应用奇偶规则来填充圆和我的形状之间的区域:
\documentclass{standalone}
\usepackage{tikz}
\begin{document}
\begin{tikzpicture}[scale=2]
\draw[fill=gray!30,even odd rule] (0,0) circle (0.5)
(0,-0.16) to[out=120,in=0] (-0.131,0) to[out=180,in=70] (-0.27,-0.23) to[out=-45,in=180] (-0.15,-0.3) to[out=0,in=-135] (0,-0.18);
\begin{scope}[yscale=1,xscale=-1]
\draw (0,-0.16) to[out=120,in=0] (-0.131,0) to[out=180,in=70] (-0.27,-0.23) to[out=-45,in=180] (-0.15,-0.3) to[out=0,in=-135] (0,-0.18);
\end{scope}
\end{tikzpicture}
\end{document}
答案1
even odd rule
仅适用于当前路径,不适用于添加到额外范围的路径。但是,您可以在路径内开启[xscale=-1]
。这让您能够及时做好准备,例如为星球大战日做好准备。愿第四个与你同在!
\documentclass{standalone}
\usepackage{tikz}
\begin{document}
\begin{tikzpicture}[scale=2]
\draw[fill=gray!30,even odd rule] (0,0) circle (0.5)
(0,-0.16) to[out=120,in=0] (-0.131,0) to[out=180,in=70] (-0.27,-0.23)
to[out=-45,in=180] (-0.15,-0.3) to[out=0,in=-135] %(0,-0.16)
(0,-0.16) [xscale=-1] to[out=120,in=0] (-0.131,0) to[out=180,in=70]
(-0.27,-0.23) to[out=-45,in=180] (-0.15,-0.3) to[out=0,in=-135]
cycle;
\end{tikzpicture}
\end{document}