Seite 1 von 1

TikZ Schnittmenge von Formen füllen

Verfasst: So 10. Mai 2020, 18:07
von uhuwe
\draw(40mm,100mm) circle (10mm);
\draw(50mm,100mm) circle (10mm);

Wie kann ich die Schnittmenge füllen?

Dankeschön


Re: TikZ Schnittmenge von Formen füllen

Verfasst: So 10. Mai 2020, 18:30
von Bartman

Eine Möglichkeit wäre der Einsatz von \clip:

\documentclass[tikz, border=2pt]{standalone}
\usetikzlibrary{backgrounds}

\begin{document}
\begin{tikzpicture}[radius=1cm]
\draw
    (4,10) circle coordinate (left circle)
    (5,10) circle coordinate (right circle)
;
\begin{scope}[on background layer]
    \clip (right circle) circle;
    \fill [red] (left circle) circle;
\end{scope}
\end{tikzpicture}
\end{document}

Re: TikZ Schnittmenge von Formen füllen

Verfasst: So 10. Mai 2020, 20:54
von esdd

Alternativ kann man auch path picture verwenden:

\documentclass[tikz, border=2pt]{standalone}
\begin{document}
\begin{tikzpicture}[
    second circle/.style={insert path={(5,10) circle [radius=1]}}
  ]
  \draw [path picture={\fill[red,second circle];}] (4,10) circle [radius=1];
  \draw [second circle];
\end{tikzpicture}
\end{document}
gl_pathpicture.png