我有这个图表,
而我唯一关心的部分是连接中心 C2(蓝色圆圈)和 C3(紫色圆圈)的线。无论我在以下代码中更改多少值,它们都不会重合。我不确定为什么。请注意,连接切点(来自 l 线)和圆心的线以及圆之间的接触点是通过反复试验获得的,正如intersections
您将在代码中看到的那样。此外,如果有任何其他更好的方法来获得相同的图表,请告诉我。
代码如下:
%% Figure 13
\documentclass[border=3mm,tikz]{standalone}
\usepackage{tkz-euclide}
\usetikzlibrary{intersections,calc}
\begin{document}
\begin{tikzpicture}[scale=0.9]
%frames
\draw[thick,->] (0,0) coordinate (origin) -- (23,0) coordinate (a1) node[right]{$x$}; % x-axis
\draw[thick,->] (origin) -- (0,20) coordinate (a2) node[above]{$y$}; % y-axis
\draw[name path=lline,thick] (origin) -- (60:22.25) coordinate (a3) node[anchor=south west]{$l$}; % l-line
%circle 1
\coordinate (CC1) at (1.732,1){};
\coordinate[label={[red]below:$C_1$}] (C1) at (1.732,0){};
\tkzDrawPoint[red,scale=2pt](CC1)
\tkzDrawCircle[name path=circle1,red](CC1,C1);
\draw[thick,red](C1)--(CC1) node[right,pos=.5]{1};
\draw[name intersections={of=lline and circle1}] (intersection-1) coordinate (A1);
\draw[thick,red](A1)--(CC1) node[above,pos=.5]{1};
%circle 2
\coordinate (CC2) at (5.1983,3){};
\coordinate[label={[blue]below:$C_2$}] (C2) at (5.1983,0){};
\tkzDrawPoint[blue,scale=2pt](CC2)
\tkzDrawCircle[name path=circle2,blue](CC2,C2);
\draw[thick,blue](C2)--(CC2) node[right,pos=.5]{3};
\draw[name intersections={of=lline and circle2}] (intersection-1) coordinate (A2);
\draw[thick,blue](A2)--(CC2) node[above,pos=.5]{3};
%circle 3
\coordinate (CC3) at (15.59229,9){};
\coordinate[label={[violet]below:$C_3$}] (C3) at (15.59229,0){};
\tkzDrawPoint[violet,scale=2pt](CC3)
\tkzDrawCircle[name path=circle3,violet](CC3,C3);
\draw[thick,violet](C3)--(CC3) node[right,pos=.5]{$r$};
\draw[name intersections={of=lline and circle3}] (intersection-1) coordinate (A4);
\draw[thick,violet](A4)--(CC3) node[above,pos=.5]{$r$};
% circle 1 and circle 2 point of contact
\draw[name intersections={of=circle1 and circle2}] (intersection-1) coordinate (A3);
% circle 2 and circle 3 point of contact
\draw[name intersections={of=circle2 and circle3}] (intersection-1) coordinate (A5);
%bisector
%\tkzDrawBisector(a1,origin,a3)
\draw[red,thick] (origin) -- (CC1);
\draw[red,thick](CC1) -- (A3);
\draw[blue,thick](A3) -- (CC2);
\draw[blue,thick](CC2) -- (A5);
\draw[violet,thick](A5) -- (CC3);
%angle marks 1
\tkzMarkAngle[size=.6,mark=none](a1,origin,a3)
\tkzLabelAngle[fill=white,dist=.2](a1,origin,a3){$2\alpha$}
%angle marks 2
\tkzMarkAngle[size=1,mark=none,red](a1,origin,CC1)
\tkzLabelAngle[dist=.8,red](a1,origin,CC1){$\alpha$}
\tkzMarkRightAngle[size=.2,red](CC1,C1,origin)
%angle marks 3
\tkzMarkRightAngle[size=.2,blue](CC2,C2,origin)
%angle marks 4
\tkzMarkRightAngle[size=.2,violet](CC3,C3,origin)
%markings
\draw[orange,very thick] (CC2) --++ (0:10.4) coordinate (a5);
\draw[orange,very thick] (CC3) -- (a5);
\draw[orange,very thick] (CC2) -- (CC3);
\end{tikzpicture}
\end{document}
更新 由于某些原因,无论你给出的坐标值有多精确,总会有一些离散的点,这意味着每个点之间实际上没有“连续性”,因此在坐标值增加一定量后,它将切换到另一个离散点。这可能是由于计算机或系统的工作方式所致。
答案1
我想用 来绘制pic
具有半径、直角和标签pic
的圆。此外,如果 的原点位于坐标原点,绘制起来会更容易。
像这样:
\documentclass[tikz,border=2mm]{standalone}
\usetikzlibrary{calc}
\tikzset
{%
pics/my circle/.style n args={4}{% #1 = radius, #2 = tangent angle,
code={% #3 = radius label, #4 = circle label
\pgfmathsetmacro\aux{90+2*#2} % angle, top radius
\coordinate (-C) at ({#1/tan(#2)},#1); % center
\draw (-C) circle (#1);
\fill (-C) circle (3pt);
\node at ({#1/tan(#2)},0) [below] {$#4$};
\foreach\i in {-90,\aux}
{
\begin{scope}[shift={(-C)},rotate=\i]
\draw (0,0) -- (#1,0) node[midway,yshift=1.5mm,xshift=1mm] {$#3$};
\draw ($(#1,0)+(0,-0.3)$) --++ (-0.3,0) --++ (0,0.3);
\end{scope}
}
}},
}
\begin{document}
\begin{tikzpicture}[line cap=round,line join=round]
% circles
\pic[red] (C1) {my circle={1}{30}{1}{C_1}};
\pic[blue] (C2) {my circle={3}{30}{3}{C_2}};
\pic[magenta] (C3) {my circle={9}{30}{r}{C_3}};
% axes
\draw[latex-latex] (0,18) node [above] {$y$} |- (25,0) node [right] {$x$};
% tangent, bisector
\draw (0,0) --++ (60:20) node [above right] {$\ell$};
\draw (0,0) --++ (30:20);
% triangle
\draw[very thick,orange] (C2-C) -- (C3-C) |- cycle;
% angles
\draw (0.3,0) node[below] {\strut$2\alpha$} arc (0:60:0.3);
\draw[red] (0.7,0) node[below] {\strut$\alpha$} arc (0:30:0.7);
\end{tikzpicture}
\end{document}