
\documentclass[12pt]{article}
\usepackage{geometry}
\usepackage[T1]{fontenc}
\usepackage[latin1]{inputenc}
\usepackage[brazil]{babel}
\usepackage{tikz}
\begin{center}
\begin{document}
\begin{tikzpicture}
\draw[ultra thick](0,0) circle [radius=1];
\draw[ultra thick](1.5,0.5) circle [radius=1.5];
\end{tikzpicture}
\end{center}
\end{document}
Responder1
O tkz-euclide
pacote fornece uma macro \tkzInterCC
para calcular os pontos de intersecção de 2 círculos. Portanto, a linha \tkzInterCC[R](A,1 cm)(B,1.5 cm) \tkzGetPoints{M1}{N1}
especifica que o raio do círculo centrado em A
com raio de 1 cm e o círculo centrado em B
com raio de 1,5 cm encontrarão os pontos de interseção. A macro \tkzGetPoints{M1}{N1}
nomeia os pontos de intersecção como M1
e N1
.
\documentclass{standalone}
\usepackage{tikz}
\usepackage{tkz-euclide}
\usetkzobj{all}%IMPORTANT--recognizes points, lines, circles, etc
\begin{document}
\begin{tikzpicture}[scale=1]
\tkzDefPoint(0,0){A} %center of circle 1
\tkzDefPoint(1.5,0.5){B} %center of circle 2
\tkzInterCC[R](A,1 cm)(B,1.5 cm) \tkzGetPoints{M1}{N1} %get the intersection
% of circles centered at A with radius 1 and B with radius 1.5 and store as M1, N1
\begin{scope}
\tkzClipCircle(A,M1)
\tkzFillCircle[color=green!50,opacity=.5](B,M1)
\end{scope}
\tkzDrawCircle[R](A,1.cm) %draw circle 1 centered at A with radius 1
\tkzDrawCircle[R](B,1.5cm) %draw circle 2 centered at B with radius 1
\tkzDrawPoints[color=orange, fill=orange](M1,N1)%Draw points
\end{tikzpicture}
\end{document}
Acho útil desenhar os círculos após a região de intersecção (contagens de pedidos). A saída no Gummi é mostrada abaixo:
Responder2
Como dito no comentário, você não precisa dos pontos de intersecção para preencher a área sobreposta. Mas se precisar deles, você pode usar a biblioteca de interseções para encontrá-los. O código abaixo mostra um exemplo disso.
\documentclass[12pt]{article}
\usepackage{geometry}
\usepackage[T1]{fontenc}
\usepackage[latin1]{inputenc}
\usepackage[brazil]{babel}
\usepackage{tikz}
\usetikzlibrary{intersections}
\def\rayona{1}
\def\rayonb{1.5}
\def\interangle{90}
\begin{document}
\begin{tikzpicture}
% define first center
\coordinate (centera) at (0,0);
% Calculate second center based on radius and where is first intersection
\draw (centera) ++ (\interangle:\rayona) ++ (\interangle-90:\rayonb) coordinate (centerb);
% fill in first
\begin{scope}
\clip (centera) circle (\rayona);
\fill[black!15] (centerb) circle (\rayonb);
\end{scope}
% then draw the circles
\draw[ultra thick,name path=circlea] (centera) circle (\rayona);
\draw[ultra thick,name path=circleb] (centerb) circle (\rayonb);
%find intersections
\draw[name intersections = {of = circlea and circleb}] (intersection-1) node[red] {$\times$} node[above left]{Inter1} (intersection-2) node[red] {$\times$} node[below right]{Inter2};
\end{tikzpicture}
\end{document}
Também tentei fazer isso sem a biblioteca de interseções. As primeiras interseções são encontradas no caminho que leva ao segundo centro. Eu tentei encontrar o segundo usando
\draw (centera) ++ ({\pgfmathparse{\interangle-2*atan{\rayonb/\rayona}}\pgfmathresult}:\rayona) coordinate (inter2);
mas o látex me dá um erro \iffalse incompleto. Se alguém sabe como consertar isso?
Editarencontrei minha respostaaquiO \pgfmathparse precisa ser removido para que outra solução possa ser, sem a biblioteca de interseções
\documentclass[12pt]{article}
\usepackage{geometry}
\usepackage[T1]{fontenc}
\usepackage[latin1]{inputenc}
\usepackage[brazil]{babel}
\usepackage{tikz}
\def\rayona{1}
\def\rayonb{1.5}
\def\interangle{90}
\begin{document}
\begin{tikzpicture}
% define first center
\coordinate (centera) at (0,0);
% Calculate second center based on radius and where is first intersection and define the first intersection
\draw (centera) ++ (\interangle:\rayona) coordinate (inter1) ++ (\interangle-90:\rayonb) coordinate (centerb);
% fill in first
\begin{scope}
\clip (centera) circle (\rayona);
\fill[black!15] (centerb) circle (\rayonb);
\end{scope}
% then draw the circles
\draw[ultra thick] (centera) circle (\rayona);
\draw[ultra thick] (centerb) circle (\rayonb);
%calculate the position of the second intersection
\draw (centera) ++ ({\interangle-2*atan{\rayonb/\rayona}}:\rayona) coordinate (inter2);;
% Use intersection
\draw (inter1) node[red] {$\times$} node[above left] {Inter1};
\draw (inter2) node[red] {$\times$} node[below right] {Inter2};
\end{tikzpicture}
\end{document}
Responder3
Conforme mencionado por Alain, a intersections
biblioteca pode ser sua escolha para encontrar os pontos de intersecção.
Se você não se importa em ter o restante dos círculos preenchidos com a cor de fundo, o preenchimento da interseção dos círculos pode ser feito com esta linha:
\path[fill=yellow, postaction={fill=white, even odd rule, draw}] (0,0) circle (2) (2,.3) circle (3);
Primeiro preencha todo o caminho (união dos dois círculos) com a cor de destaque, depois (usando postaction
) redesenhe o resto (diferença simétrica) com a cor de fundo, usando even odd rule
.