# Theory of Sets - apply even odd rule

Can anyone help me how to create tikz picture for these images. Thank you a a lot.

I tried this:

\documentclass[tikz,border=3mm]{standalone}

\begin{document}

\def\A{(0.5, 1) .. controls ++(180:-1) and ++(280: 2) .. (2.5, 3) .. controls ++(280:-1) and ++(170: -.5) .. (.5, 3) .. controls ++(170: 1) and ++(180: 1) .. (0.5, 1);}
\def\B{(1.5, 2) .. controls ++(150:-2) and ++(280: 1) .. ( 4.5, 2.5) .. controls ++(280:-1) and ++(180:-1) .. ( 3, 4) .. controls ++(180: 1) and ++(175:-1) .. (1, 4.5) .. controls ++(175: 1) and ++(150: 1) .. (1.5,2);}
\def\R{(-1,0) rectangle (5,5);}
\begin{tikzpicture}
\draw[very thick] \R;
\begin{scope} \clip \A;
\fill[gray] \B;
\end{scope}
\draw \A; \draw \B;
\end{tikzpicture}

\end{document}


• Search here for even odd rule, you'll find many interesting stuff to begin with. But don't expect members of this site to draw all these for you. Come back with what you tried and with specific questions. – SebGlav Jun 20 at 21:27
• Thank you, #SebGlav! I was not expecting anyone to draw all of these. I was hoping, as you did, someone to give me some light on this issue! – Emanuel Furtado Jun 20 at 22:23
• I prepared a few examples on how to use scope, clip and even odd rule, but the post is closed for now. Maybe if you edit your question with a simple MWE showing what you tried, I'd be able to share them with you. – SebGlav Jun 21 at 11:48
• I've edited your post to add your code which is pretty much a good start on what you're looking for. – SebGlav Jun 21 at 21:48
• I'm trying to draw the others. Thank you. – Emanuel Furtado Jun 21 at 22:01

So here are four examples of what you can do (you may find a way to achieve everything else from that starting point). You already did it well.

\documentclass[tikz,border=3.14mm]{standalone}

\begin{document}
\def\a{(1,3.5)(2,4.5)(3,3.5)(3.5,4)(4,3.5)(3.5,2.5)(4.5,1.5)(4.5,1)(3.5,1)(3.5,2)(1.5,2.5)}
\def\b{(.5,.5)(1,2)(2.5,3)(2,1)}
\def\A{plot[smooth cycle,tension=.75] coordinates {\a}}
\def\B{plot[smooth cycle,tension=1] coordinates {\b}}

\begin{tikzpicture}
\fill[orange,even odd rule] \A \B;
\draw[orange!50!black] \A \B;
\end{tikzpicture}

\begin{tikzpicture}
\begin{scope}
\clip \A;
\fill[orange] \B;
\end{scope}
\draw[orange!50!black] \A \B;
\end{tikzpicture}

\begin{tikzpicture}
\begin{scope}[even odd rule]
\clip \A;
\fill[orange,even odd rule] \A \B;
\end{scope}
\draw[orange!50!black] \A \B;
\end{tikzpicture}

\begin{tikzpicture}
\begin{scope}[even odd rule]
\clip \B;
\fill[orange,even odd rule] \A \B;
\end{scope}
\draw[orange!50!black] \A \B;
\end{tikzpicture}

\end{document}

• Thank you, SebGlav! – Emanuel Furtado Jun 22 at 12:18
• @EmanuelFurtado If this answer suits you, feel free to upvote and accept it. If you need more details, please feel free to ask in the comments. – SebGlav Jun 22 at 14:44