標籤未在指定位置排版

標籤未在指定位置排版

我有兩個以繪製為中心的同心圓O。我指定小圓的半徑為1。決定大圓的半徑,使得內切角LMN具有測量20度數,被半徑 平分,並在 處與OM較小圓相切,因此角度和具有測量度數。STSOMTOM80

我擔心的是和弦MN沒有被拉出來。和弦LM是繪製的,但不是和弦MN。以下是顯示全等和弦LM和的長度的計算MN

`triangle{OSM}` and `triangle{OTM}` are congruent, right triangles.
Since `OM` bisects `angle{LMN}`, and the measure of `angle{LMN}` is 20 degrees,
`angle{LMO}` and `angle{NMO` both have measure `10` degrees.

r is the radius of the smaller circle.
According to the Law of Sines, |OM| = r/sin(10). By the Pythagorean Theorem,
|MS| = |MT| = (r/sin(10))\sqrt{1 - sin^{2}(10)} =(r/sin(10))cos(10) = r*cot(10).

我聲明r=1。所以,大圓的半徑是cot(10)。透過以下命令,我預計必須angle{LMN}是大三角形中的內切角。

\coordinate (M) at ({-cot(10)},0);
\coordinate (L) at ($(M) +(10:{2*cot(10)})$);
\coordinate (N) at ($(M) +(-10:{2*cot(10)})$);

但這並沒有發生,LM並且在和 處MN被畫得稍微超出了圓圈。這是怎麼發生的?MN

我使用以下命令來彌補calc包中的錯誤。

\draw[name path=bigger_circle] (O) circle ({cot(10)});
\path[name path=chord_LM] (M) -- (L);
\draw[name path=chord_MN] (M) -- (N);
\coordinate[name intersections={of=bigger_circle and chord_LM, by=corrected_location_for_L}];
\coordinate[name intersections={of=bigger_circle and chord_MN, by=corrected_location_for_N}];

LM繪製了和弦,但N似乎位於 處M,因此MN未繪製和弦。

\documentclass{amsart}
\usepackage{tikz}

\usetikzlibrary{calc,intersections}


\begin{document}

\begin{tikzpicture}

%Two concentric circles are drawn.
%
\coordinate (O) at (0,0);
\draw[fill] (O) circle (1.5pt);
\draw (O) circle (1);
\draw[name path=bigger_circle] (O) circle ({cot(10)});
%

%
\coordinate (S) at (100:1);
\draw[fill] (S) circle (1.5pt);
\coordinate (T) at (-100:1);
\draw[fill] (T) circle (1.5pt);
%
\coordinate (M) at ({-cot(10)},0);
%
\coordinate (L) at ($(M) +(10:{2*cot(10)})$);
\coordinate (N) at ($(M) +(-10:{2*cot(10)})$);
%
\path[name path=chord_LM] (M) -- (L);
\path[name path=chord_MN] (M) -- (N);
%
%The calc package is drawing the chords LM and MN too long. So, the intersections package is used.
%
\coordinate[name intersections={of=bigger_circle and chord_LM, by=corrected_location_for_L}];
\coordinate[name intersections={of=bigger_circle and chord_MN, by=corrected_location_for_N}];
%
\draw (M) -- (corrected_location_for_L);
\draw[green] (M) -- (corrected_location_for_N);


%The labels for the points are typeset.
\path node[anchor=west, inner sep=0, font=\footnotesize] at ($(O) +(0.15,0)$){$O$};
\path node[anchor=east, inner sep=0, font=\footnotesize] at ($(M) +(-0.15,0)$){$M$};
\path let \p1=($(L)-(M)$), \n1={atan(\y1/\x1)} in node[anchor={\n1+180}, inner sep=0, font=\footnotesize] at ($(corrected_location_for_L) +({\n1}:0.15)$){$L$};
\path let \p1=($(M)-(N)$), \n1={atan(\y1/\x1)} in node[anchor={\n1+180}, inner sep=0, font=\footnotesize] at ($(corrected_location_for_N) +({\n1}:0.15)$){$N$};
\path node[anchor={80-180}, inner sep=0, font=\footnotesize] at ($(S) +(80:0.15)$){$S$};
\path node[anchor={-80+180}, inner sep=0, font=\footnotesize] at ($(T) +(-80:0.15)$){$T$};

\draw[fill=green] (corrected_location_for_L) circle (2pt);
\draw[fill=green] (corrected_location_for_N) circle (2pt);


\end{tikzpicture}

\end{document}

答案1

您選擇了錯誤的交點,每條線在所需的點處與圓相交M。為了絕對確定您選擇的點,您應該使用sort by交叉點選項。根據您的情況,使用和弦順序是最合適的。例如,對於第一組交叉點,您可以寫

\coordinate[name intersections={of=bigger_circle and chord_ML,
by={tmp,corrected_location_for_L}, sort by=chord_ML}];

按交點的順序對交點進行排序,並用和chord_ML標記它們。tmpcorrected_location_for_L

樣本輸出

\documentclass{amsart}

\usepackage{tikz}

\usetikzlibrary{calc,intersections}

\begin{document}

\begin{tikzpicture}

%Two concentric circles are drawn.
%
\coordinate (O) at (0,0);
\draw[fill] (O) circle (1.5pt);
\draw (O) circle (1);
\draw[name path=bigger_circle] (O) circle ({cot(10)});
%

%
\coordinate (S) at (100:1);
\draw[fill] (S) circle (1.5pt);
\coordinate (T) at (-100:1);
\draw[fill] (T) circle (1.5pt);
%
\coordinate (M) at ({-cot(10)},0);
%
\coordinate (L) at ($(M) + (10:{2*cot(10)})$);
\coordinate (N) at ($(M) + (-10:{2*cot(10)})$);
%
\path[name path=chord_ML] (M) -- (L);
\path[name path=chord_MN] (M) -- (N);
%
%The calc package is drawing the chords LM and MN too long. So, the intersections package is used.
%
\coordinate[name intersections={of=bigger_circle and chord_ML,
by={tmp,corrected_location_for_L}, sort by=chord_ML}];
\coordinate[name intersections={of=bigger_circle and chord_MN,
by={tmp,corrected_location_for_N}, sort by=chord_MN}];
%
\draw (M) -- (corrected_location_for_L);
\draw[green] (M) -- (corrected_location_for_N);

%The labels for the points are typeset.
\path node[anchor=west, inner sep=0, font=\footnotesize] at ($(O) +(0.15,0)$){$O$};
\path node[anchor=east, inner sep=0, font=\footnotesize] at ($(M) +(-0.15,0)$){$M$};
\path let \p1=($(L)-(M)$), \n1={atan(\y1/\x1)} in node[anchor={\n1+180}, inner sep=0, font=\footnotesize] at ($(corrected_location_for_L) +({\n1}:0.15)$){$L$};
\path let \p1=($(M)-(N)$), \n1={atan(\y1/\x1)} in node[anchor={\n1+180}, inner sep=0, font=\footnotesize] at ($(corrected_location_for_N) +({\n1}:0.15)$){$N$};
\path node[anchor={80-180}, inner sep=0, font=\footnotesize] at ($(S) +(80:0.15)$){$S$};
\path node[anchor={-80+180}, inner sep=0, font=\footnotesize] at ($(T) +(-80:0.15)$){$T$};

\draw[fill=green] (corrected_location_for_L) circle (2pt);
\draw[fill=green] (corrected_location_for_N) circle (2pt);

\end{tikzpicture}

\end{document}

答案2

我不知道線的長度,但錯誤的標籤位置是因為您使用了錯誤的交叉點。

圓和弦之間有兩個交點。一個位於M,另一個位於L/ N。當您使用時,如果您使用第一個 gets和第二個by={a},TikZ 找到的第一個交集會被賦予名稱。{a}by={a,b}ab

到底為什麼你在一種情況下得到正確的交點,但在另一種情況下卻得不到正確的交點,我不能肯定地說,但這將取決於 TikZ 如何找到交點。例如,假設它沿著圓看,從 0 度開始並逆時針方向移動,ML它找到的第一個交點位於L,第二個交點位於M。對於MN,它找到的第一個交點將位於M

所以,下面是一個完整的程式碼,可以完成您想要的操作。我確實還更改了其他一些內容,主要是標籤的繪製方式,但是如果您更喜歡自己的方法,當然可以忽略它。

在此輸入影像描述

\documentclass{amsart}
\usepackage{tikz}
\usetikzlibrary{calc,intersections}
\begin{document}

\begin{tikzpicture}[every label/.append style={font=\footnotesize}]
%Two concentric circles are drawn.
%
\coordinate [label=right:{$O$}] (O) at (0,0);
\draw (O) circle (1);
\draw[name path=bigger_circle] (O) circle[radius={cot(10)}];
%

%
\coordinate [label=above:{$S$}] (S) at (100:1);
\coordinate [label=below:{$T$}] (T) at (-100:1);

%
\foreach \x in {O,S,T}
  \draw[fill] (\x) circle (1.5pt);


\coordinate [label=left:{$M$}] (M) at ({-cot(10)},0);
%
\coordinate (L) at ($(M) +(10:{2*cot(10)})$);
\coordinate (N) at ($(M) +(-10:{2*cot(10)})$);
%
\path[name path=chord_LM] (M) -- (L);
\path[name path=chord_MN] (M) -- (N);
%
%The calc package is drawing the chords LM and MN too long. So, the intersections package is used.
%
\path[name intersections={of=bigger_circle and chord_LM, by={corrected_location_for_L,i}}];
\path[name intersections={of=bigger_circle and chord_MN, by={i,corrected_location_for_N}}];
%
\draw (M) -- (corrected_location_for_L);
\draw[green] (M) -- (corrected_location_for_N);

\draw[fill=green] (corrected_location_for_L) circle (2pt);
\draw[fill=green] (corrected_location_for_N) circle (2pt);

\node [font=\footnotesize] at ($(L)!-2mm!(M)$)  {$L$};
\node [font=\footnotesize] at ($(N)!-2mm!(M)$)  {$N$};
\end{tikzpicture}
\end{document}

相關內容