14

I would like to fill the intersection of each of my 5 ellisses with the same color (black for example). It works very well with two. But with a third or more, I don't know how to "save" the first intersection. The problem is the superposition of colors.

The code is :

\begin{tikzpicture}

\def\firstellip{(0, 1.6) ellipse [x radius=4cm, y radius=1.5cm, rotate=90]} \\
\def\secondellip{(2.9, -0.25) ellipse [x radius=4cm, y radius=1.5cm, rotate=29]} 
\def\thirdellip{(2, -3.5) ellipse [x radius=4cm, y radius=1.5cm, rotate=-57]} 
\def\fourthellip{(-2,-3.5) ellipse [x radius=4cm, y radius=1.5cm, rotate=57]}
\def\fifthellip{(-2.9,-0.25) ellipse [x radius=4cm, y radius=1.5cm, rotate=-29]}

\scope

\fill[red] \firstellip;
\fill[blue] \secondellip;
%\fill[fill=red, even odd rule] \firstellip \secondellip;
\fill[green] \thirdellip;
%\fill[fill=green, even odd rule] \thirdellip \secondellip;
\fill[yellow] \fourthellip;
%\fill[fill=blue, even odd rule] \firstellip \thirdellip \secondellip \fourthellip;
\fill[orange] \fifthellip;

\endscope

\draw \firstellip node [label={[xshift=0cm, yshift=4cm]$A$}] {};
\draw \secondellip node [label={[xshift=3cm, yshift=2.5cm]$B$}] {};
\draw \thirdellip node [label={[xshift=3cm, yshift=-4.5cm]$C$}] {};
\draw \fourthellip node [label={[xshift=-3cm, yshift=-4.5cm]$D$}] {};
\draw \fifthellip node [label={[xshift=-3cm, yshift=2.5cm]$E$}] {};

\end{tikzpicture}

Currently the picture looks as follow :

13

enter image description here

or

enter image description here

\documentclass[border=3pt]{standalone}
\usepackage{tikz}

\begin{document}

\begin{tikzpicture}

\def\firstellip{(0, 1.6) ellipse [x radius=4cm, y radius=1.5cm, rotate=90]} \\
\def\secondellip{(2.9, -0.25) ellipse [x radius=4cm, y radius=1.5cm, rotate=29]} 
\def\thirdellip{(2, -3.5) ellipse [x radius=4cm, y radius=1.5cm, rotate=-57]} 
\def\fourthellip{(-2,-3.5) ellipse [x radius=4cm, y radius=1.5cm, rotate=57]}
\def\fifthellip{(-2.9,-0.25) ellipse [x radius=4cm, y radius=1.5cm, rotate=-29]}

\scope

\fill[red] \firstellip;
\fill[blue] \secondellip;
%\fill[fill=red, even odd rule] \firstellip \secondellip;
\fill[green] \thirdellip;
%\fill[fill=green, even odd rule] \thirdellip \secondellip;
\fill[yellow] \fourthellip;
%\fill[fill=blue, even odd rule] \firstellip \thirdellip \secondellip \fourthellip;
\fill[orange] \fifthellip;

\endscope

\draw \firstellip node [label={[xshift=0cm, yshift=4cm]$A$}] {};
\draw \secondellip node [label={[xshift=3cm, yshift=2.5cm]$B$}] {};
\draw \thirdellip node [label={[xshift=3cm, yshift=-4.5cm]$C$}] {};
\draw \fourthellip node [label={[xshift=-3cm, yshift=-4.5cm]$D$}] {};
\draw \fifthellip node [label={[xshift=-3cm, yshift=2.5cm]$E$}] {};

\begin{scope}
\clip \firstellip ;
\clip \secondellip ;
\clip \thirdellip ;
\clip \fourthellip ;
\clip \fifthellip ;

\fill[black] (-2,-3.5) rectangle (2,.5) ;
\end{scope}

\end{tikzpicture}

\end{document}

or

\documentclass[border=3pt]{standalone}
\usepackage{tikz}

\begin{document}

\begin{tikzpicture}

\def\first{%
(0, 1.6) ellipse [x radius=4cm, y radius=1.5cm, rotate=90]} \\

\def\second{%
(2.9, -0.25) ellipse [x radius=4cm, y radius=1.5cm, rotate=29]} 

\def\third{%
(2, -3.5) ellipse [x radius=4cm, y radius=1.5cm, rotate=-57]} 

\def\fourth{%
(-2,-3.5) ellipse [x radius=4cm, y radius=1.5cm, rotate=57]}

\def\fifth{%
(-2.9,-0.25) ellipse [x radius=4cm, y radius=1.5cm, rotate=-29]}

\draw[fill=red] \first node [label={[xshift=0cm, yshift=4cm]$A$}] {};
\draw[fill=blue] \second node [label={[xshift=3cm, yshift=2.5cm]$B$}] {};
\draw[fill=green] \third node [label={[xshift=3cm, yshift=-4.5cm]$C$}] {};
\draw[fill=yellow] \fourth node [label={[xshift=-3cm, yshift=-4.5cm]$D$}] {};
\draw[fill=violet] \fifth node [label={[xshift=-3cm, yshift=2.5cm]$E$}] {};

\begin{scope}[fill=black]
\clip \first ;
\fill \second ;
\fill \third ;
\fill \fourth ;
\fill \fifth ;
\end{scope}

\begin{scope}[fill=black]
\clip \second ;
\fill \first ;
\fill \third ;
\fill \fourth ;
\fill \fifth ;
\end{scope}

\begin{scope}[fill=black]
\clip \third ;
\fill \first ;
\fill \second ;
\fill \fourth ;
\fill \fifth ;
\end{scope}

\begin{scope}[fill=black]
\clip \fourth ;
\fill \first ;
\fill \third ;
\fill \second ;
\fill \fifth ;
\end{scope}

\end{tikzpicture}

\end{document}
  • Thanks a lot ! The second solution is the answer of my problem. – Doglain Oct 15 '14 at 13:49
  • Why did you use \scope … \endscope instead of the environment in you first code example? – Tobi Oct 15 '14 at 14:47
  • Because I copied and past the given work. Nothing special. – Tarass Oct 15 '14 at 15:49

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.