
\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}
答案1
該軟體包為您提供了一個用於計算 2 個圓的交點的tkz-euclide
巨集。\tkzInterCC
因此,該行指定以半徑 1 公分為\tkzInterCC[R](A,1 cm)(B,1.5 cm) \tkzGetPoints{M1}{N1}
圓心的圓和以半徑 1.5 公分為圓心的圓的半徑將找到交點。該巨集將交點命名為和。A
B
\tkzGetPoints{M1}{N1}
M1
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}
我發現在交叉區域(訂單計數)之後繪製圓圈很有用。 Gummi 中的輸出如下所示:
答案2
正如評論中所述,您不需要交點來填充重疊區域。但如果您確實需要它們,您可以使用交集庫來尋找它們。下面的程式碼顯示了一個範例。
\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}
我也嘗試在沒有交叉庫的情況下做到這一點。第一個交叉點位於通往第二個中心的路徑。我試圖使用找到第二個
\draw (centera) ++ ({\pgfmathparse{\interangle-2*atan{\rayonb/\rayona}}\pgfmathresult}:\rayona) coordinate (inter2);
但乳膠給了我一個不完整的 \iffalse 錯誤。如果有人知道如何解決這個問題?
編輯找到了我的答案這裡需要刪除 \pgfmathparse ,以便可以使用其他解決方案,無需交集庫
\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}
答案3
正如阿蘭所提到的,intersections
圖書館可能是您尋找交點的選擇。
如果您不介意用背景顏色填滿圓圈的其餘部分,則可以使用以下一行來填滿圓圈的交集:
\path[fill=yellow, postaction={fill=white, even odd rule, draw}] (0,0) circle (2) (2,.3) circle (3);
首先用突出顯示顏色填滿整個路徑(兩個圓圈的並集),然後(使用postaction
)使用背景顏色重新繪製其餘部分(對稱差異),使用even odd rule
。