圍繞著有交點的圓的框

圍繞著有交點的圓的框

我想建立一個帶有三個相交圓的矩形框:

\documentclass[a4paper,11pt,fleqn]{scrartcl}
\usepackage{pgf,tikz}
\usetikzlibrary{arrows,shadows,decorations.pathreplacing,intersections,positioning,fit,calc,backgrounds}

\def\firstcircle{(0,0) circle (1.5cm)}
\def\secondcircle{(60:2.1cm) circle (1.5cm)}
\def\thirdcircle{(0:2.1cm) circle (1.5cm)}

\begin{document}
\begin{figure}[H]
\centering
\begin{tikzpicture}
\begin{scope}
\clip \firstcircle;
\clip \secondcircle;
\fill[red] \thirdcircle;
\end{scope}
\node (firstcircle)   {};
\node (secondcircle)  {};
\node (thirdcircle)  {};
\draw[name=first] \firstcircle node[below] (A) {$A$};
\draw[name=second] \secondcircle node [above] (B) {$B$};
\draw[name=third] \thirdcircle node [below] (C) {$C$};
\node (box) [fit=(firstcircle)(secondcircle)(thirdcircle), inner sep=1cm,draw,rounded corners] {};
\end{tikzpicture}
\end{figure}
\end{document}

在此輸入影像描述

我的問題是:矩形應該環繞所有圓。

答案1

像這樣:

在此輸入影像描述

我顯著更改了您的程式碼,圓被繪製為節點:

\documentclass[a4paper,11pt,fleqn]{scrartcl}
\usepackage{pgf,tikz}
\usetikzlibrary{arrows,shadows,decorations.pathreplacing,intersections,positioning,fit,calc,backgrounds}

\def\firstcircle{(0,0) circle (1.5cm)}
\def\secondcircle{(60:2.1cm) circle (1.5cm)}
\def\thirdcircle{(0:2.1cm) circle (1.5cm)}

\begin{document}
\begin{figure}%[H]
\centering
    \begin{tikzpicture}[
    C/.style = {circle, draw, minimum size=30mm},% C as circle, minimum size is circle diameter
    F/.style = {draw, rounded corners, inner sep=1cm}% F as fit node
                        ]
\node (first)   [C] at (0,0)    {$A$};
\node (second)  [C] at (60:2.1) {$B$};
\node (third)   [C] at ( 0:2.1) {$B$};
\node (box) [F, fit=(first)(second)(third)] {};
\begin{scope}
\clip \firstcircle;
\clip \secondcircle;
\fill[red] \thirdcircle;
\end{scope}
\end{tikzpicture}
\end{figure}
\end{document}

相關內容