如何在 TikZ 中繪製倒轉的圓?

如何在 TikZ 中繪製倒轉的圓?

點 P 和中心 O 的反轉是沿線 OP 的另一個點 P',從而得到乘積 OP。 OP'=k,即常數k。圓的倒轉,經過點O(不在圓內)是另一個圓,如下圖。 圓的反轉

是否可以在 TikZ 中繪製第二個圓作為第一個圓的(正確)反轉?我知道平移、旋轉和其他線性變換很容易......但從未見過反轉。

答案1

當您等待 TikZ 解決方案時,這裡有一個簡單的方法來製作您的圖表梅塔普斯特。基本幾何學得到很好的解釋在數學世界上,(雖然那裡的圖表顯示了點的反轉外部反轉圈;在這種情況下,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和 for a提供了兩個不同的函數,point但您可以輕鬆編寫一個invert函數並使用if path Pif pair P根據您傳遞給它的內容選擇正確的操作。

  • 此表達式 unitvector p scaled (k/abs(p)) scaled k可能更自然地寫為,但如果設定超過 181,則會unitvector p scaled (k**2/abs(p))出現算術溢位錯誤。為了避免這種情況,要么按照我所展示的方式對其進行編碼,要么使用它來處理它。k182**22**15mpost -numbersytem=double

  • 不要用它來反轉原點處的點;因為你不能輕易地在有限圖上表示無限大。

答案2

我在 Tikz 中按照以下方式解決了這個問題。

首先,有兩種不同的反轉:

  1. 該點在反演圓內;
  2. 重點在它之外。

我將從第二個案例開始。我將以點“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的交點。

相關內容