切线圆和线

切线圆和线

我正在尝试绘制这个图形

在此处输入图片描述

但我不知道该怎么做

这是我的代码

\begin{tikzpicture}

\draw (0,0) -- (10,0);
\draw (3,1) circle (1cm);
\draw (4.5,0.5) circle (0.5cm);

\end{tikzpicture}

答案1

由于显而易见的原因,我将使用 LaTeX 来排版推导。

在此处输入图片描述

\documentclass[fleqn]{article}
\usepackage{amsmath}
\usepackage{amssymb}
\usepackage{tikz}
\begin{document}
Call the $x$ coordinates of the circle centers by $x_a$, $x_b$ and $x_c$. Then
their $y$ coordinates are $y_a=r_a$, $y_b=r_b$ and $y_c=r_c$, i.e.\ the radii of the
circles. $x_b$ is fixed by the requirement that
\[ (x_a-x_b)^2+(y_a-y_b)^2=(r_a+r_b)^2\quad \curvearrowright\quad
x_b=x_a+\sqrt{(r_a+r_b)^2-(r_a-r_b)^2}\;.\]
For the circle around $c$ we have 
\begin{align*}
 (x_c-x_a)^2+(y_c-y_a)^2&=(r_a+r_c)^2\;,\\
 (x_c-x_b)^2+(y_c-y_b)^2&=(r_b+r_c)^2\;,
\end{align*}
which is solved by
\[ 
 x_c=\frac{\sqrt{r_a}x_b+\sqrt{r_b}x_a}{\sqrt{r_a}+\sqrt{r_b}}
 \quad\text{and}\quad
 r_c=\frac{(x_a-x_c)^2}{4r_a}\;.
\]

\begin{figure}
\centering
\begin{tikzpicture}[declare function={ra=1;xa=3;rb=0.5;
    xb=xa+sqrt(pow(ra+rb,2)-pow(ra-rb,2));yb=rb;
    xc=(sqrt(ra)*xb+sqrt(rb)*xa)/(sqrt(ra)+sqrt(rb));
    rc=pow(xa-xc,2)/(4*ra);}]
 \draw[-stealth] (0,0) -- (10,0);
 \draw (xa,ra) circle[radius=ra];
 \draw (xb,rb) circle[radius=rb];
 \draw (xc,rc) circle[radius=rc];
\end{tikzpicture}
\end{figure}
\end{document}

因此,为了制作图片,你可以这样做

\documentclass[tikz,border=3mm]{standalone}
\begin{document}
\begin{tikzpicture}[bullet/.style={circle,fill,inner sep=1.5pt},
    every label/.append style={font=\small,inner sep=1pt},
    declare function={ra=2;xa=3;rb=1;
    xb=xa+sqrt(pow(ra+rb,2)-pow(ra-rb,2));yb=rb;
    xc=(sqrt(ra)*xb+sqrt(rb)*xa)/(sqrt(ra)+sqrt(rb));
    rc=pow(xa-xc,2)/(4*ra);}]
 \draw[stealth-stealth] (0,0) -- (8,0);
 \draw (xa,ra) node[bullet,label=above:{$a$}](a){} circle[radius=ra]
  (xb,rb)  node[bullet,label=above:{$b$}](b){}  circle[radius=rb]
  (xc,rc) node[bullet,label=above:{$c$}](c){} circle[radius=rc]
  (a) -- (b);
\end{tikzpicture}
\end{document}

在此处输入图片描述

重要的是,您只需要指定ra=2;xa=3;rb=1;,其余部分都根据该输入计算。

显然,我们可以重复这个过程。

\documentclass[tikz,border=3mm]{standalone}
\begin{document}
\begin{tikzpicture}[bullet/.style={circle,fill,inner sep=1.5pt},
    every label/.append style={font=\small,inner sep=1pt},
    declare function={ra=2;xa=3;rb=1.5;
    xb=xa+sqrt(pow(ra+rb,2)-pow(ra-rb,2));yb=rb;
    xnext(\ra,\rb,\xa,\xb)=(sqrt(\ra)*\xb+sqrt(\rb)*\xa)/(sqrt(\ra)+sqrt(\rb));
    rnext(\ra,\xa,\x)=pow(\xa-\x,2)/(4*\ra);}]
 \draw[stealth-stealth] (0,0) -- (8,0);
 \draw (xa,ra) node[bullet,label=above:{$a$}](a){} circle[radius=ra]
  (xb,rb)  node[bullet,label=above:{$b$}](b){}  circle[radius=rb];
 \foreach \X [remember=\myr as \rprevious (initially rb),
 remember=\myx as \xprevious (initially xb)]in {c,...,g}
 {\pgfmathsetmacro{\myx}{xnext(ra,\rprevious,xa,\xprevious)}
 \pgfmathsetmacro{\myr}{rnext(ra,xa,\myx)}
 \draw (\myx,\myr) coordinate (\X) circle[radius=\myr];
 } 
 \draw  (c) node[bullet,label=above:{$c$}]{} (a) -- (b);
\end{tikzpicture}
\end{document}

在此处输入图片描述

相关内容