6

What are my options to shade the region like below:

enter image description here

MWE:

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

\begin{tikzpicture}
\draw (0, 0) rectangle (12, 6);
\draw (3,3) circle [radius=3cm];
\draw (9,3) circle [radius=3cm];
\draw (0, 0)--(12,6);
\end{tikzpicture} 

\end{document}
blackened
  • 4,181

3 Answers3

9
\documentclass[tikz, border=1cm]{standalone}
\begin{document}
\begin{tikzpicture}
\begin{scope}
  \clip (0,0)--(12,6)--(12,0)--cycle; 
  \clip (3,0) rectangle (12,6);
  \fill[fill=red] (0,0) rectangle (12,6) (3,3) circle[radius=3cm] (9,3) circle[radius=3cm];
\end{scope}
\draw (0, 0) rectangle (12, 6);
\draw (3,3) circle [radius=3cm];
\draw (9,3) circle [radius=3cm];
\draw (0, 0)--(12,6);
\end{tikzpicture} 
\end{document}

enter image description here

StefanH
  • 13,823
6

Not the most elegant solution as you have to adjust your clipping area, when moving the circles around, but I'm sure this could be refined (e.g. using the calc library).

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

    \begin{tikzpicture}
        \draw (0, 0) rectangle (12, 6);
        \draw (3,3) circle [radius=3cm];
        \draw (9,3) circle [radius=3cm];
        \draw (0, 0)--(12,6);
        \begin{scope}[even odd rule]
            % you have to adjust the following line when moving your circles around
            \clip  (3,0)    % bottom of first circle
                -- (6,3)    % intersection of circles
                -- (12,6)   % upper right corner
                -- (12,0)   % lower right corner
                -- cycle;
            \fill (3,3) circle [radius=3cm] (0, 0) -- (12,6) -- (12, 0) -- cycle (9,3) circle [radius=3cm];
        \end{scope}

    \end{tikzpicture}

\end{document}

here's the preview

miffboi
  • 61
4

very close:

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

\begin{tikzpicture}
\draw[fill=black] (0,0) rectangle (12,6);
\draw[fill=white] (0,0) -- (12,6) -| cycle;
\draw[fill=white] (3,3) circle [radius=3cm];
\draw[fill=white] (9,3) circle [radius=3cm];
\draw (0, 0)--(12,6);
\end{tikzpicture}

\end{document}

enter image description here

more close:

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

\begin{tikzpicture}
\draw[fill=black] (0,0) rectangle (12,6);
\fill[white] (0,0) -- (3,0) -- (3,3) -- cycle;
\draw[fill=white] (0,0) -- (12,6) -| cycle;
\draw[fill=white] (3,3) circle [radius=3cm];
\draw[fill=white] (9,3) circle [radius=3cm];
\draw (0, 0)--(12,6);
\end{tikzpicture}

\end{document}

enter image description here

Zarko
  • 296,517
  • This only works as long as there is nothing in the unshaded regions that is covered here... – Dux Jun 03 '18 at 20:45