我找到了一张这样的照片。
我想填充两个圆和椭圆的交点区域。这是我所做的:
\documentclass{article}
\usepackage{geometry}
\usepackage{tikz}
\begin{document}
\centering
\begin{tikzpicture}[scale=2]
\coordinate (P) at (0,0) ;
\coordinate (Q) at (5,0) ;
\coordinate (R) at (5,4) ;
\coordinate (S) at (0,4) ;
\draw[] (P)--(Q)--(R)--(S)--cycle;
\draw[fill=gray] (2,2) circle (1.5cm);
\draw[fill=white] (2.75,2) circle (0.75cm);
\draw[fill=gray] plot [smooth cycle] coordinates {(3.1,2) (3.24,1.75) (3.46,1.67) (3.5,2) (3.46,2.33) (3.24,2.25) };
\draw[] plot [smooth cycle] coordinates {(3.46,1.67) (3.77,1.73) (3.94,2) (3.77,2.27) (3.46,2.33) (3.5,2) (3.46,1.67)};
\end{tikzpicture}
\end{document}
我觉得效果不太好,对于椭圆来说。如何改进?
答案1
您可以even odd rule
按照fill
cfr 的建议使用。
\documentclass{article}
\usepackage{tikz}
\begin{document}
\centering
\begin{tikzpicture}[scale=2]
\draw[fill=gray] (0,0) circle (1.5cm);
\draw[fill=white,even odd rule] (0.75,0) circle (0.75cm) (1.5,0) circle (0.65cm and 0.15cm);
\node[text=white] at ((-0.5,-0.5) {A};
\node at (0.3,0.2) {B};
\node at (2,1.75) {S};
\draw (-2.5,-2) rectangle (2.5,2);
\end{tikzpicture}
\end{document}