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

3

1 Answer 1

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{\clip[overlay](10.5,-2) rectangle (8,2);
   \draw\firstcircle;}               
   \scoped{\clip[overlay](10.5,-2) rectangle (15,2);
   \draw\secondcircle;}               
\end{tikzpicture}
   
\end{document}

enter image description here

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .