Xah Talk Show 2025-06-11 Ep666 Geometry, Circle Inversion, Wolfram Language Coding
xah talk show ep666 1d6c7
- do graphics demo, using my package
- explain what is inversion
- similar to 1/x in complex numbers
- extract code from my package, show standalone function.
- do graphics using it
Clear[InvertCircle]
InvertCircle[Circle[{c1_, c2_}, s_], Circle[{o1_, o2_}, r_]] :=
Module[{q1, q2, oc}, oc = Sqrt[Plus @@ (({c1, c2} - {o1, o2})^2)];
Which[N[oc] == 0. && N[r] == N[s], Circle[{c1, c2}, s],
N[oc] ==
N[s], (Line[
10000 {-{-Last[#1], First[#1]}, {-Last[#1],
First[#1]}} + ({#1, #1} (r/s)^2)/
2. + {{o1, o2}, {o1, o2}}] &)[{c1, c2} - {o1, o2}],
N[oc] == 0., Circle[{c1, c2}, r^2/s], True,
Circle[(({c1, c2} - {o1, o2}) (oc r^2))/(
oc (oc^2 - s^2)) + {o1, o2}, Abs[(r^2 s)/(oc^2 - s^2)]]]]
InvertCircle[Circle[{c1, c2}, s], Circle[{o1, o2}, r]]
InvertCircle[Line[{{a1_, a2_}, {b1_, b2_}}], Circle[{o1_, o2_}, r_]] :=
Module[{lineUnitV, cP},
lineUnitV = ({b1, b2} - {a1, a2})/Sqrt[
Plus @@ (({b1, b2} - {a1, a2})^2)];
cP = {a1, a2} + ({o1, o2} - {a1, a2}) . lineUnitV lineUnitV;
If[N[cP] == N[{o1, o2}],
Line[{{a1, a2}, {b1,
b2}}], (Circle[1/2 (#1 + {o1, o2}),
1/2 Sqrt[
Plus @@ ((#1 - {o1, o2})^2)]] &)[((cP - {o1, o2}) r^2)/
Plus @@ ((cP - {o1, o2})^2) + {o1, o2}]]]
InvertCircle[Circle[{c1_, c2_}, s_], Line[{{a1_, a2_}, {b1_, b2_}}]] :=
Circle[reflect[{c1, c2}, Line[{{a1, a2}, {b1, b2}}]], s]
InvertCircle[Line[{{c1_, c2_}, {d1_, d2_}}],
Line[{{a1_, a2_}, {b1_, b2_}}]] :=
Line[{{c1, c2}, {d1, d2}}] /. {x_, y_} ->
reflect[{x, y}, Line[{{a1, a2}, {b1, b2}}]]