答案1
在等待 TikZ 解决方案时,这里有一个简单的方法来绘制你的图表元帖子. 基本几何解释得很好在 Mathworld 上,(尽管那里的图表显示了一个点的反转外部反转圈;在这种情况下,P
和的角色P'
是相反的,因为P
在反转圈内)。
在这里,我用淡粉色添加了反转圆的一部分轮廓,使其工作原理更加明显 - 如果不需要,你当然可以删除粉红色弧。
prologues := 3;
outputtemplate := "%j%c.eps";
vardef invert_point(expr p, k) =
if abs(p)>0:
unitvector p scaled (k/abs(p)) scaled k
else:
origin % strictly this should be a point at infinity
fi
enddef;
vardef invert_path(expr P, k) =
for t=0 step 1/16 until length P-1/16:
invert_point(point t of P, k) --
endfor
if cycle P:
cycle
else:
invert_point(point infinity of P, k)
fi
enddef;
beginfig(1);
path C, C';
pair P, P', Q;
k = 150;
draw subpath (-1.4,1.4) of fullcircle scaled 2k withcolor .8[red,white];
C = fullcircle scaled 72 shifted 100 right;
P = point 1 of C;
C' = invert_path(C, k);
P' = invert_point(P, k);
Q = (origin -- P) intersectionpoint subpath (2,4) of C;
draw origin -- P';
draw origin -- center C' withcolor .5 white;
draw P' -- center C' withcolor .5 white;
draw Q -- center C withcolor .5 white;
draw C;
draw C' withcolor .78 blue;
fill fullcircle scaled 3;
fill fullcircle scaled 3 shifted P;
fill fullcircle scaled 3 shifted Q;
fill fullcircle scaled 3 shifted P';
fill fullcircle scaled 3 shifted center C;
fill fullcircle scaled 3 shifted center C';
label(btex $O$ etex, origin + (-6,3));
label(btex $P$ etex, P + (+3,7));
label(btex $P'$ etex, P' + (-3,7));
label(btex $Q$ etex, Q + (-3,7));
label(btex $C$ etex, point 5.5 of C + (-3,-7));
endfig;
end
笔记
为简单
invert_point
起见,假设反转圆以原点为中心。但调整子程序以接受任意圆而不是半径并不困难k
。path
同样,为了简单起见,我在这里为 a和 a提供了两个不同的函数,point
但您可以轻松编写单个invert
函数并使用if path P
和if pair P
根据传递给它的内容选择正确的操作。该表达式
unitvector p scaled (k/abs(p)) scaled k
可能更自然地写成,但是如果设置为超过 181,unitvector p scaled (k**2/abs(p))
您将得到算术溢出错误。这是因为大于,这是纯 MP 允许的最大数字。为了避免这种情况,请按照我所展示的方式对其进行编码,或者使用它来处理它。k
182**2
2**15
mpost -numbersytem=double
不要使用它来反转原点;因为你不能轻易地在有限图上表示无穷大。
答案2
我已经按照以下方式在 Tikz 中解决了这个问题。
首先,有两种不同的倒置:
- 该点位于反转圈内;
- 点在它的外面。
我先从第二种情况开始,以点“O”(称为“k”)为圆心画一个圆,在圆“k”外寻找点“P”的反转点。
首先你需要知道“P”到“k”的切点之一。这个点到直线“OP”的投影就是“P”的反转点。
\documentclass{article}
\usepackage{tikz}
\usetikzlibrary{calc}
\usetikzlibrary{intersections}
\begin{document}
\begin{tikzpicture}
\coordinate (O) at (0,0);
\coordinate (P) at (5,0);
\draw[red,thick,name path=circ1](O)circle(2);
%
% I look for the midpoint of O and P. This point will be the centre of
% an arc whose intersection with k will give me the tangent points
%
\path(O)--coordinate[midway](M)(P);
%
% I draw the arc whose intersection with circle are the 2 tangent points
%
\path[name path=circ2] let
\p1=(O),
\p2=(M),
\n1={veclen(\x2-\x1,\y2-\y1)} in
($(M)+({\n1*cos(130)},{\n1*sin(130)})$) arc (130:230:\n1);
\path[name intersections={of=circ1 and circ2}]
(intersection-1) coordinate (Tg1)
(intersection-2) coordinate (Tg2);
\draw[blue]
(A)--(Tg1)
(O)--node[midway,left,black]{$\mathtt{r}$}(B)
(O)--(A);
%
% Here we are. This projection is the inversion of point P with regards
% to circle k
%
\draw[orange](Tg1)--($(O)!(Tg1)!(P)$)coordinate(InvP);
%
\draw[black,line width=.75,fill=white]
(P)circle(1.5pt)node[black,below]{$\mathtt{P}$};
\draw[black,line width=.75,fill=white]
(O)circle(1.5pt)node[black,below]{$\mathtt{O}$};
\draw[black,line width=.75,fill=white]
(Tg1)circle(1.5pt)node[black,below]{$\mathtt{Tg1}$};
\draw[black,line width=.75,fill=white]
(InvP)circle(1.5pt)node[black,below]{$\mathtt{P'}$};
\node at (-1.75,0) {$\symtt{k}$};
\end{tikzpicture}
\end{document}
当该点在圆内时,我们要做的就是从 OP 找到垂直线,找到这条线与圆 k 的交点(称为 TgP),从该点画切线并找到它与 OP 的交点。