4

I'm trying unsuccessfully to fill the intersection of two double lines with an other colour. Here is minimal working example :

\documentclass{standalone}
\usepackage{tikz}


\begin{document}
    \begin{tikzpicture}

        \node (Emetteur) at (0,0) {};
        \node (Recepteur) at (2.5,0) {};
        \node (Recepteur2) at (-2.5,0) {};
        \node (Cible) at (1,3) {};

        \draw [black!15, double = black!15, double distance = 5] (1.25,0) ellipse (6cm and 3.025cm);
        \draw [black!15, double = black!15, double distance = 5] (-1.25,0) ellipse (6cm and 3.25cm);

        \draw (-4,0) -- (4,0);
        \draw (Emetteur) node {$\bullet$} node [below] {\'Emetteur};
        \draw (Recepteur) node {$\bullet$} node [below] {R\'ecepeur 1};
        \draw (Recepteur2) node {$\bullet$} node [below] {R\'ecepeur 2};
        \draw (Cible) node {$\bullet$} node [above=0.1cm, align = center] {Cible};

        \draw [blue] (Emetteur) -- (Cible) node [midway, sloped, above] {$d_1$};
        \draw [red] (Cible) -- (Recepteur) node [pos = 0.5, sloped, above] {$d_2$}; 
        \draw [green!50!black] (Cible) -- (Recepteur2) node [pos = 0.5, sloped, above] {$d_3$}; 


    \end{tikzpicture}
\end{document}

I get the following result :

enter image description here

I've found a way using the opacity option :

    \draw [black!15, double = black!50, double distance = 5, opacity = 0.2] (1.25,0) ellipse (6cm and 3.025cm);
    \draw [black!15, double = black!50, double distance = 5, opacity = 0.2] (-1.25,0) ellipse (6cm and 3.25cm);

Then I get :

enter image description here

That's just a trick since the superposition of two transparent shapes makes an other colour, but I prefer to avoid the opacity option since I get bad rendering when printing and I can't get an intersection of the colour I want.

Any clue ?

  • You need the transparency group key to combine the opacity settings not leaking out if I understood this correctly. – percusse Mar 8 '15 at 12:40
4

You can use blending

\begin{scope}[blend group=multiply]
        \draw [black!15, double = black!15, double distance = 5] (1.25,0) ellipse (6cm and 3.025cm);
        \draw [black!15, double = black!15, double distance = 5] (-1.25,0) ellipse (6cm and 3.25cm);
\end{scope}

Full code:

\documentclass{standalone}
\usepackage{tikz}


\begin{document}
    \begin{tikzpicture}

        \node (Emetteur) at (0,0) {};
        \node (Recepteur) at (2.5,0) {};
        \node (Recepteur2) at (-2.5,0) {};
        \node (Cible) at (1,3) {};
       \begin{scope}[blend group=multiply]
        \draw [black!15, double = black!15, double distance = 5] (1.25,0) ellipse (6cm and 3.025cm);
        \draw [black!15, double = black!15, double distance = 5] (-1.25,0) ellipse (6cm and 3.25cm);
    \end{scope}

        \draw (-4,0) -- (4,0);
        \draw (Emetteur) node {$\bullet$} node [below] {\'Emetteur};
        \draw (Recepteur) node {$\bullet$} node [below] {R\'ecepeur 1};
        \draw (Recepteur2) node {$\bullet$} node [below] {R\'ecepeur 2};
        \draw (Cible) node {$\bullet$} node [above=0.1cm, align = center] {Cible};

        \draw [blue] (Emetteur) -- (Cible) node [midway, sloped, above] {$d_1$};
        \draw [red] (Cible) -- (Recepteur) node [pos = 0.5, sloped, above] {$d_2$};
        \draw [green!50!black] (Cible) -- (Recepteur2) node [pos = 0.5, sloped, above] {$d_3$};


    \end{tikzpicture}
\end{document}

enter image description here

  • For different blending modes refer to pages 342 and 343 of pgfmanual version 3. – user11232 Mar 8 '15 at 12:36

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.