我正在尝试使用概括 Steiner 链的绘图tkz-euclide
,它工作正常。我已经用尺子和圆规进行了构造(并借助了一些 geogebra 的帮助),并将其传递给,tikz
但我想知道是否有其他选项可以绘制它,我可以控制外圆和第一个内圆的半径,现在我必须使用 A、B 和 C 的坐标才能调整绘图的尺寸。(最好是包tkz-euclide
,这样更容易将标签附加到点上,以备不时之需)。
这是我的示例文件:
\documentclass[10pt]{standalone}
\usepackage{tkz-euclide}
\pagestyle{empty}
\begin{document}
\begin{tikzpicture}
\clip(-6.35,-3.65) rectangle (1.36,3.78);
% base points
\tkzDefPoint(-0.77,0){A} \tkzDefPoint(-1.77,0){B} \tkzDefPoint(3.37,0){C}
% Circle tangent points
\tkzCalcLength[cm](A,B)\tkzGetLength{rAB}
% Base points in circle
\tkzDrawCircle[line width=0.8pt,dash pattern=on 4pt off 4pt,color=gray,R](A,\rAB cm)
\tkzDefPointOnCircle[angle=275,center=A,radius=\rAB cm] \tkzGetPoint{D}
\tkzDefLine[perpendicular=through A](A,D) \tkzGetPoint{G}
\tkzDefPointBy[symmetry=center A](G) \tkzGetPoint{E}
\tkzDefPointBy[symmetry=center A](D) \tkzGetPoint{F}
% Tangent ponits
\tkzInterLC[R](C,D)(A,\rAB cm) \tkzGetPoints{H}{} \tkzDrawPoint[color=gray](H)
\tkzInterLC[R](C,E)(A,\rAB cm) \tkzGetPoints{I}{} \tkzDrawPoint[color=gray](I)
\tkzInterLC[R](C,F)(A,\rAB cm) \tkzGetPoints{}{J} \tkzDrawPoint[color=gray](J)
\tkzInterLC[R](C,G)(A,\rAB cm) \tkzGetPoints{K}{} \tkzDrawPoint[color=gray](K)
% Tangent lines
\tkzDefLine[perpendicular=through H](A,H) \tkzGetPoint{H'}
\tkzDefLine[perpendicular=through I](A,I) \tkzGetPoint{I'}
% Centers and circles
\tkzInterLL(H,H')(I,I') \tkzGetPoint{N} \tkzDrawPoint[color=red](N)
\tkzDefCircle[through](N,H) \tkzDrawCircle(N,H)
\tkzDefLine[perpendicular=through J](A,J) \tkzGetPoint{J'}
\tkzInterLL(J,J')(I,I') \tkzGetPoint{O} \tkzDrawPoint[color=red](O)
\tkzDefCircle[through](O,I) \tkzDrawCircle(O,I)
\tkzDefLine[perpendicular=through K](A,K) \tkzGetPoint{K'}
\tkzInterLL(J,J')(K,K') \tkzGetPoint{P} \tkzDrawPoint[color=red](P)
\tkzDefCircle[through](P,J) \tkzDrawCircle(P,J)
\tkzInterLL(K,K')(H,H') \tkzGetPoint{Q} \tkzDrawPoint[color=red](Q)
\tkzDefCircle[through](Q,K) \tkzDrawCircle(Q,K)
% Most inner circle
\tkzInterLL(J,I)(K,H) \tkzGetPoint{L}
\tkzDefPointBy[projection=onto O--L](A) \tkzGetPoint{A'}
\tkzInterLC(A,A')(O,I) \tkzGetPoints{R}{M}
\tkzInterLL(A,B)(O,M) \tkzGetPoint{S} \tkzDrawPoint[color=blue](S)
\tkzDefCircle[through](S,M) \tkzDrawCircle[color=blue](S,M)
% Most outer circle
\tkzInterLL(A,B)(O,R) \tkzGetPoint{T} \tkzDrawPoint[color=blue](T)
\tkzDefCircle[through](T,R) \tkzDrawCircle[color=blue](T,R)
% ellipse for centers
\tkzGetPointCoord(T){t} \tkzGetPointCoord(S){s} \tkzGetPointCoord(N){n}
\pgfmathsetmacro{\fixedtotallength}{sqrt((\nx-\tx)^2+(\ny-\ty)^2)+sqrt((\nx-\sx)^2+(\ny-\sy)^2)}
\pgfmathsetmacro{\majoraxisradius}{\fixedtotallength/2}
\pgfmathsetmacro{\focidistance}{sqrt((\sx-\tx)^2+(\sy-\ty)^2)}
\pgfmathsetmacro{\minoraxisradius}{sqrt((\fixedtotallength/2)^2-(\focidistance/2)^2)}
\pgfmathsetmacro{\majoraxisangle}{atan((\sy-\ty)/(\sx-\tx))}
\draw[line width=0.8pt,dash pattern=on 4pt off 4pt,color=red,rotate=\majoraxisangle]($(T)!0.5!(S)$) ellipse ({\majoraxisradius cm} and {\minoraxisradius cm});
\end{tikzpicture}
\end{document}
输出图像如下:
答案1
我不太熟悉tkz-euclide
所以我只使用一些标准库。维基百科说圆心位于椭圆上。显然圆心也必须遵守余弦定律,即,如果有两个半径为 的圆,r1
并且r2
它们互相接触,则它们的半径为 的圆r3
位于一个三角形的一个角上,而另外两个角是前两个圆的圆心,边长分别为r1+r2
、r1+r3
和r2+r3
。因此,我们可以从交点构造新的圆。在下面的代码中,您可以指定大圆的半径R
、第一个圆的半径rA
和第一个圆的 x 坐标xA
。由此,使用交点构造其他圆。当然,对于任意输入,圆都不会闭合,但对于特殊输入,它们会闭合。
\documentclass[tikz,border=3mm]{standalone}
\usetikzlibrary{calc,intersections}
\begin{document}
\begin{tikzpicture}[dot/.style={circle,fill,inner sep=1pt},
declare function={R=5;rA=1.5;xA=-1;%<- you can adjust
rB=R/2+xA/2-rA/2;xB=xA-rA-rB;
cosinelaw(\a,\b,\c)=acos((\a*\a+\b*\b-\c*\c)/(2*\a*\b));}]
\draw (0,0) coordinate(O) circle[radius=R];
\draw (xA,0) node[dot,label=above:$A$] (A){} circle[radius=rA];
\draw (xB,0) node[dot,alias=Y,label=above:{$B=P_0$}] (B){} circle[radius=rB];
\pgfmathsetmacro{\a}{R/2+rA/2}
\pgfmathsetmacro{\ecc}{abs(xA)/(R+rA)}
\pgfmathsetmacro{\b}{\a*sqrt(1-\ecc*\ecc)}
\draw[dashed,name path=elli] (xA/2,0) circle[x radius=\a,y radius=\b];
\begin{scope}[shift={(A)}]
\foreach \X in {1,2,3}
{\path[overlay,name path=mid] let \p1=($(Y)-(A)$),
\n1={sqrt((\x1/1cm)*(\x1/1cm)+(\y1/1cm)*(\y1/1cm))},\n2={atan2(\y1,\x1)} in
plot[variable=\t,domain=0:2*rA]
(({\n2-cosinelaw(\n1,rA+\t,\n1-rA+\t)}:rA+\t);
\draw[name intersections={of=elli and mid}]
let \p1=($(intersection-1)-(O)$),
\n1={sqrt((\x1/1cm)*(\x1/1cm)+(\y1/1cm)*(\y1/1cm))} in
(intersection-1) node[dot,alias=Y,label=above:{$P_{\X}$}] (p\X){}
circle[radius=R*1cm-\n1*1cm];}
\end{scope}
\end{tikzpicture}
\end{document}
这是更接近您的屏幕截图并且圆圈“发挥作用”的地方。
\documentclass[tikz,border=3mm]{standalone}
\usetikzlibrary{calc,intersections}
\begin{document}
\begin{tikzpicture}[dot/.style={circle,fill,inner sep=1pt},
declare function={R=5;rA=0.93;xA=2.6;beta=20;s=1;%<- you can adjust
cosinelaw(\a,\b,\c)=acos((\a*\a+\b*\b-\c*\c)/(2*\a*\b));}]
\draw (0,0) coordinate(O) circle[radius=R];
\draw (xA,0) node[dot,label=above:$A$] (A){} circle[radius=rA];
\pgfmathsetmacro{\a}{R/2+rA/2}
\pgfmathsetmacro{\ecc}{abs(xA)/(R+rA)}
\pgfmathsetmacro{\b}{\a*sqrt(1-\ecc*\ecc)}
\draw[dashed,name path=elli] (xA/2,0) circle[x radius=\a,y radius=\b];
\draw (xA/2,0) + (beta:\a\space and \b)
node[dot,alias=Y,label=above:{$B=P_0$}] (B){}
let \p1=($(B)-(O)$),\n1={sqrt((\x1/1cm)*(\x1/1cm)+(\y1/1cm)*(\y1/1cm))},\n2={atan2(\y1,\x1)}
in (B) circle[radius=R*1cm-\n1*1cm];
\begin{scope}[shift={(A)}]
\foreach \X in {1,2,3,4}
{\path[overlay,name path=mid] let \p1=($(Y)-(A)$),
\n1={sqrt((\x1/1cm)*(\x1/1cm)+(\y1/1cm)*(\y1/1cm))},\n2={atan2(\y1,\x1)} in
plot[variable=\t,domain=0:R]
(({\n2+s*cosinelaw(\n1,rA+\t,\n1-rA+\t)}:rA+\t);
\draw[name intersections={of=elli and mid}]
let \p1=($(intersection-1)-(O)$),
\n1={sqrt((\x1/1cm)*(\x1/1cm)+(\y1/1cm)*(\y1/1cm))} in
(intersection-1) node[dot,alias=Y,label=above:{$P_{\X}$}] (p\X){}
circle[radius=R*1cm-\n1*1cm];}
\end{scope}
\end{tikzpicture}
\end{document}
您可以为其制作动画。
\documentclass[tikz,border=3mm]{standalone}
\usetikzlibrary{calc,intersections}
\begin{document}
\foreach \X in {0,2,...,36}
{\begin{tikzpicture}[dot/.style={circle,fill,inner sep=1pt},
declare function={R=5;rA=0.93;xA=2.6;beta=\X;s=1;%<- you can adjust
cosinelaw(\a,\b,\c)=acos((\a*\a+\b*\b-\c*\c)/(2*\a*\b));}]
\draw (0,0) coordinate(O) circle[radius=R];
\draw (xA,0) node[dot,label=above:$A$] (A){} circle[radius=rA];
\pgfmathsetmacro{\a}{R/2+rA/2}
\pgfmathsetmacro{\ecc}{abs(xA)/(R+rA)}
\pgfmathsetmacro{\b}{\a*sqrt(1-\ecc*\ecc)}
\draw[dashed,name path=elli] (xA/2,0) circle[x radius=\a,y radius=\b];
\draw (xA/2,0) + (beta:\a\space and \b)
node[dot,alias=Y] (B){}
let \p1=($(B)-(O)$),\n1={sqrt((\x1/1cm)*(\x1/1cm)+(\y1/1cm)*(\y1/1cm))},\n2={atan2(\y1,\x1)}
in (B) circle[radius=R*1cm-\n1*1cm];
\begin{scope}[shift={(A)}]
\foreach \X in {1,2,3,4}
{\path[overlay,name path=mid] let \p1=($(Y)-(A)$),
\n1={sqrt((\x1/1cm)*(\x1/1cm)+(\y1/1cm)*(\y1/1cm))},\n2={atan2(\y1,\x1)} in
plot[variable=\t,domain=0:R]
(({\n2+s*cosinelaw(\n1,rA+\t,\n1-rA+\t)}:rA+\t);
\draw[name intersections={of=elli and mid}]
let \p1=($(intersection-1)-(O)$),
\n1={sqrt((\x1/1cm)*(\x1/1cm)+(\y1/1cm)*(\y1/1cm))} in
(intersection-1) node[dot,alias=Y] (p\X){}
circle[radius=R*1cm-\n1*1cm];}
\end{scope}
\end{tikzpicture}}
\end{document}
答案2
tkz-elements
这是使用新软件包的解决方案这里。它采用了简化的宏tkz-euclide
。它不再需要 tkz-base,但它不再绘制轴,只有一个可能的单位:厘米。它只做经典(欧几里得)几何。以下解决方案使用一个新宏,通过反转给出圆的图像。
宏\nc
存储了圆的数量。点A是反演极点。点B是以A为圆心的反演圆上的一个点。
\documentclass{standalone}
\usepackage{tkz-elements}
\begin{document}
\begin{tikzpicture}[ultra thin]
\pgfmathsetmacro{\nc}{6}
\pgfmathsetmacro{\R}{8}
\pgfmathsetmacro{\offset}{0}
\edef\ratio{\fpeval{(1-sin(pi/\nc))/(1+sin(pi/\nc))}}
\pgfmathsetmacro{\r}{\R*\ratio}
\pgfmathsetmacro{\radius}{(\R-\r)/2}
\tkzDefPoints{0/0/O',\R/0/I',1/0/A,7/0/B}
\tkzDrawCircle(A,B) % cercle d'inversion
\foreach \i in {1,...,\nc} {
\tkzDefPoint(360/\nc*\i-\offset:\R){S\i'}
\tkzDefPoint(360/\nc*\i-\offset:\r){T\i'}
\tkzDefPoint(360/\nc*\i-\offset:(\r+\R)/2){c'\i}
\tkzDrawCircle[R,blue](c'\i,\radius)
}
\tkzDefPointOnCircle[angle=0,center=O',radius=\r]
\tkzGetPoint{J'}
\tkzDefCircle[inversion = center A through B](O',I')
\tkzGetPoints{p1}{p2}
\tkzDrawCircle[red,diameter](p1,p2)
\tkzDefCircle[inversion = center A through B](O',J')
\tkzGetPoints{q1}{q2}
\tkzDrawCircle[red,diameter](q1,q2)
\foreach \i in {1,...,\nc}
{ \tkzDefCircle[inversion = center A through B](c'\i,S\i')
\tkzDrawCircle[red,diameter](tkzFirstPointResult,tkzSecondPointResult)}
\tkzDrawCircle[R,blue](O',\R)
\tkzDrawCircle[R,blue](O',\r)
\end{tikzpicture}
\end{document}
这是一个有 8 个圆圈的解决方案:
最后一种解决方案使用具有负系数的反演和与给定圆正交的反演圆。第一个圆与反演圆正交,因此是不变的。
\documentclass{standalone}
\usepackage[usenames,dvipsnames]{xcolor}
\usepackage{tkz-elements}
\begin{document}
\pgfmathsetmacro{\nc}{64}
\pgfmathsetmacro{\R}{8}
\pgfmathtruncatemacro{\last}{\nc+1}
\pgfmathsetmacro{\offset}{10}
\edef\ratio{\fpeval{(1-sin(pi/\nc))/(1+sin(pi/\nc))}}
\pgfmathsetmacro{\r}{\R*\ratio}
\pgfmathsetmacro{\radius}{(\R-\r)/2}
\begin{tikzpicture}\[scale=.5,ultra thin\]
\tkzDefPoints{0/0/c'0,\R/0/I}
\tkzDrawCircle\[R,blue\](c'0,\R)
\tkzDrawCircle\[R,blue\](c'0,\r)
% contact points T'\i
% c1,...,c5 center of the circles between the Cr et CR
\foreach \i in {1,...,\nc} {
\tkzDefPoint(360/\nc*\i-\offset:\r){T'\i}
\tkzDefPoint(360/\nc*\i-\offset:(\r+\R)/2){c'\i}
\tkzDrawCircle\[R,blue\](c'\i,\radius)
}
% we get the pole of inversion
\tkzDefPoint(10,0){K}
\tkzDefCircle\[orthogonal from=K\](c'0,I) \tkzGetPoints{S'}{t2}
\tkzDefPointOnCircle\[angle=0,center=c'0,radius=\r\]
\tkzGetPoint{T'0}
\pgfnodealias{c'\last}{c'0}
\pgfnodealias{T'\last}{I}
\foreach \i/\col in {\last/20,0/50}
{
\tkzDefCircle\[inversion negative = center K through S'\](c'\i,T'\i)
\tkzGetPoints{p1}{p2}
\tkzDrawCircle\[fill=red!\col,diameter\](p1,p2)
}
\foreach \i in {1,...,\nc}
{ \pgfmathsetmacro{\density}{.3*\i}
\tkzDefCircle\[inversion negative = center K through S'\](c'\i,T'\i)
\tkzGetPoints{p1}{p2}
\tkzDrawCircle\[fill=MidnightBlue!\density,diameter\](p1,p2)
}
\end{tikzpicture}
\end{document}