我需要使两个圆相交,并让它们周围有边框,但共享区域内的边框除外。这是我试图编写的 tikz 代码,我已经删除了所有边框,但现在不知道如何制作整个形状周围的边框。
\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}
答案1
已经指出,最简单的解决方案可能是计算相关角度,这显然是由一半距离与半径之比的 acos 给出的,然后绘制弧线。并且可以方便地使用 spath3,参见https://tex.stackexchange.com/a/660922/294623如果您对分析的控制力较弱,那么还有另一个选项可以使用:剪辑。
\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}