Trong đoạn code metapost dưới đây ta xây dựng một hàm để tìm ảnh của đường tròn qua phép nghịch đảo.
Đầu tiên ta tìm hiểu định nghĩa phép nghịch đảo cực $I$ phương tích $k \ne 0$ trong mặt phẳng như sau:
Hai điểm P và P' được gọi là tương ứng của nhau trong phép $\rm NĐ(I,k)$ nếu $I, P, P'$ thẳng hàng và $\overline{IP}.\overline{IP'}=k$.
Nếu $k>0$, đường tròn tâm $I$ bán kính $\sqrt{k}$ gồm toàn những điểm bất biến (hay còn gọi bất động, hay điểm kép) và được gọi là đường tròn nghịch đảo.
Trong metapost ta định nghĩa phép nghịch đảo như sau:
vardef invert(expr P, C) =
save I, r, s, T;
pair I;
I = center C;
r = abs(point 0 of C-I);
if pair P: s = abs(P-I); I if s > eps: + (P-I) / s * r / s * r fi
elseif path P: T = length P; for t=0 upto T-1: invert(point t of P, C) ..
endfor
if cycle P: cycle else: invert(point T of P, C) fi
fi
enddef;
\RequirePackage{luatex85}
\documentclass[border=5mm]{standalone}
\usepackage{luamplib}
\begin{document}
\mplibtextextlabel{enable}
\begin{mplibcode}
% invert path or pair P in circle C
vardef invert(expr P, C) =
save I, r; pair I; numeric r;
I = center C;
r = abs(point 0 of C shifted -I);
if pair P: if abs(P-I) > 0: unitvector(P-I)
scaled (r/abs(P-I)*r) shifted fi I
elseif path P:
save T; numeric T;
T = length P;
for t=0 upto T-1: invert(point t of P, C) .. endfor
if cycle P: cycle else: invert(point T of P, C) fi
fi
enddef;
beginfig(1);
pair A,B,C;
numeric r;
A = origin;
C = (10cm,0);
r = 3/4;
B = r[A,C];
path c[];
c1 = fullcircle scaled 2 abs(A-C);
% large circle for the inversions
c2 = fullcircle scaled abs(A-C) shifted 1/2[A,C];
c3 = fullcircle scaled abs(A-B) shifted 1/2[A,B];
c4 = fullcircle scaled abs(B-C) shifted 1/2[B,C];
c5 = invert(c4,c1);
numeric d; d = abs(point 0 of c5-point 4 of c5);
for i=1 upto 42:
draw invert(c5 shifted (0,i*d), c1);
endfor
draw subpath(0,4) of c2 withcolor 2/3 blue;
draw subpath(0,4) of c3 withcolor 2/3 blue;
draw subpath(0,4) of c4 withcolor 2/3 blue;
draw A--C;
dotlabel.bot("$A$", A);
dotlabel.bot("$B$", B);
dotlabel.bot("$C$", C);
endfig;
\end{mplibcode}
\end{document}
Không có nhận xét nào:
Đăng nhận xét