0

I need to intersect two circles and have the borders around them except the borders inside the shared area. It is the tikz code I am trying to write, I have removed all borders but have no idea how to make the borders around the whole shape now.

\documentclass{article}
\usepackage{tikz}
\begin{document}

% Definition of circles \def\firstcircle{(10,0) circle (1.5cm)} \def\secondcircle{(0:11cm) circle (1.5cm)}

\colorlet{circle area}{blue!20}

\tikzset{filled/.style={fill=circle area, draw=none} }

\begin{tikzpicture}

\draw[filled] \firstcircle node {$A$} \secondcircle node {$B$}; \end{tikzpicture} \end{document}

intersected circles

Puya
  • 55
  • Welcome! This has come up before. See, for example Q71548 (and those that are linked there). You will have to draw those arcs yourself. You can either calculate them (you know the radii and the distance between your circles) or let TikZ calculate them. – Qrrbrbirlbel Apr 11 '23 at 17:09
  • https://tex.stackexchange.com/a/660943/15036 looks like an exact duplicate. – Thruston Apr 11 '23 at 17:21
  • https://tex.stackexchange.com/q/660933/47927 also looks like a duplicate. – Jasper Habicht Apr 11 '23 at 17:27

1 Answers1

1

It has already been pointed out that the simplest solution may be to compute the relevant angle, which is obviously given by the acos of the ratio between half the distance and the radius, and then draw arcs. And one can conveniently use spath3, see https://tex.stackexchange.com/a/660922/294623. There is yet another option which can be used if you have less analytic control: clips.

\documentclass{article}
\usepackage{tikz}
\begin{document}

% Definition of circles \def\firstcircle{(10,0) circle[radius=1.5cm]} \def\secondcircle{(0:11cm) circle [radius=1.5cm]}

\colorlet{circle area}{blue!20}

\tikzset{filled/.style={fill=circle area, draw=none} }

analytic

\begin{tikzpicture} \draw[filled] \firstcircle node {$A$} \secondcircle node {$B$}; \pgfmathsetmacro{\myalpha}{acos(0.5/1.5)}
\draw[radius=1.5] (10,0) + (\myalpha:1.5) arc[start angle=180-\myalpha,end angle=-180+\myalpha] arc[start angle=-\myalpha,end angle=-360+\myalpha]; \end{tikzpicture}

clip

\begin{tikzpicture} \draw[filled] \firstcircle node {$A$} \secondcircle node {$B$}; \scoped{\clipoverlay rectangle (8,2); \draw\firstcircle;}
\scoped{\clipoverlay rectangle (15,2); \draw\secondcircle;}
\end{tikzpicture}

\end{document}

enter image description here