How to draw the crossings in a tikz picture?

I will leave the circles and the correct colors to you.

\documentclass[tikz, border=0.01cm]{standalone}
\begin{document}

\begin{tikzpicture}
\newcommand{\bgd}{(-0.5,-0.5) rectangle (0.5,0.5)}
\newcommand{\smallEll}{(-0.015,0.005) ellipse (0.17 and 0.46)}
\newcommand{\smallerEll}{(-0.015,0.005) ellipse (0.16 and 0.45)}
\newcommand{\largeEll}{(0,0) ellipse (0.2 and 0.5)};
\newcommand{\largerEll}{(0,0) ellipse (0.21 and 0.51)};

%test bgd
\shade[clip] \bgd;

%red
\fill[red, rotate=-10, even odd rule] \smallEll \largeEll;
    
%green
\begin{scope}
  \clip[rotate=-10] \smallerEll;
  \fill[green, rotate=50, even odd rule] \smallEll \largeEll;
\end{scope}
\begin{scope}
  \clip[rotate=-10] \bgd \largerEll;
  \fill[green, rotate=50, even odd rule] \smallEll \largeEll;
\end{scope}
    
%blue
\begin{scope}
  \clip[rotate=-10] \smallerEll;
  \clip[rotate=50] \smallerEll;
  \fill[blue, rotate=-70, even odd rule] \smallEll \largeEll; 
\end{scope}
\begin{scope}
  \clip[rotate=-10] \smallerEll;
  \clip[rotate=50] \bgd \largerEll;
  \fill[blue, rotate=-70, even odd rule] \smallEll \largeEll; 
\end{scope}
\begin{scope}
  \clip[rotate=-10] \bgd \largerEll;
  \clip[rotate=50] \smallerEll;
  \fill[blue, rotate=-70, even odd rule] \smallEll \largeEll; 
\end{scope}
\begin{scope}
  \clip[rotate=-10] \bgd \largerEll;
  \clip[rotate=50] \bgd \largerEll;
  \fill[blue, rotate=-70, even odd rule] \smallEll \largeEll; 
\end{scope}
   
\end{tikzpicture}
\end{document}

Red, green and blue ellipses with crossings


Edit: I just found, that I can make the clipping use even odd rule when in a scope and thereby fill the ellipses in one go. -making the code much simpler:

\documentclass[tikz, border=0.01cm]{standalone}
\begin{document}

\begin{tikzpicture}[even odd rule]
\newcommand{\bgd}{(-0.5,-0.5) rectangle (0.5,0.5)}
\newcommand{\smallEll}{(-0.015,0.005) ellipse (0.17 and 0.46)}
\newcommand{\smallerEll}{(-0.015,0.005) ellipse (0.16 and 0.45)}
\newcommand{\largeEll}{(0,0) ellipse (0.2 and 0.5)};
\newcommand{\largerEll}{(0,0) ellipse (0.21 and 0.51)};

%test bgd
\shade[clip] \bgd;

%red
\fill[red, rotate=-10] \smallEll \largeEll;
    
%green
\clip[rotate=-10] \smallerEll \largerEll \bgd;
\fill[green, rotate=50] \smallEll \largeEll;
   
%blue
\clip[rotate=50] \smallerEll \largerEll \bgd;
\fill[blue, rotate=-70] \smallEll \largeEll; 

\end{tikzpicture}
\end{document}

This is the finished code (thanks to @hpekristiansen):

\documentclass[tikz]{standalone}

\begin{document}

\color{orange}

\begin{tikzpicture}[even odd rule]
    \newcommand{\bgd}{(-0.5,-0.5) rectangle (0.5,0.5)}
    \newcommand{\smallEll}{(-0.015,0.005) ellipse (0.17 and 0.46)}
    \newcommand{\smallerEll}{(-0.015,0.005) ellipse (0.16 and 0.45)}
    \newcommand{\largeEll}{(0,0) ellipse (0.2 and 0.5)};
    \newcommand{\largerEll}{(0,0) ellipse (0.21 and 0.51)};
    
    %test bgd
    \clip \bgd;
    
    \begin{scope}[xshift=4,yshift=12.4]
        \fill (0,0) circle (0.05);
    \end{scope}
    
    \begin{scope}[xshift=10.5,yshift=-8.5]
        \fill (0,0) circle (0.05);
    \end{scope}
    
    \begin{scope}[xshift=-11.5,yshift=-5.5]
        \fill (0,0) circle (0.05);
    \end{scope}
    
    \clip[xshift=4,yshift=12.4] (0,0) circle (0.06) [insert path ={(-2,-2) rectangle (2,2)}];
    \clip[xshift=10.5,yshift=-8.5] (0,0) circle (0.06) [insert path ={(-2,-2) rectangle (2,2)}];
    \clip[xshift=-11.5,yshift=-5.5] (0,0) circle (0.06) [insert path ={(-2,-2) rectangle (2,2)}];
        
    \fill[rotate=-10] \smallEll \largeEll;
        
    \clip[rotate=-10] \smallerEll \largerEll \bgd;
    \fill[rotate=50] \smallEll \largeEll;
       
    \clip[rotate=50] \smallerEll \largerEll \bgd;
    \fill[rotate=-70] \smallEll \largeEll; 
    
    \fill (-0.02,0) circle (0.08);
\end{tikzpicture}

\end{document}

Here is the output: (thanks @projetmbc for this picture)

enter image description here

Tags:

Tikz Pgf