교차점이 있는 원 주위의 상자

교차점이 있는 원 주위의 상자

세 개의 원이 교차하는 직사각형 상자를 만들고 싶습니다.

\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}

관련 정보