圓的外公切線
Author: 藍邦偉  老師

外公切線

h_1 = 5 (slider from -10 to 10, step 1)
k_1 = 0 (slider from -10 to 10, step 1)
h_2 = -4 (slider from -10 to 10, step 1)
k_2 = 0 (slider from -10 to 10, step 1)
r_1 = 5 (slider from -10 to 10, step 1)
r_2 = 2 (slider from -10 to 10, step 1)
C_1: (x - h_1)^(2.0) + (y - k_1)^(2.0) = r_1^(2.0)
C_2: (x - h_2)^(2.0) + (y - k_2)^(2.0) = r_2^(2.0)
Q_1: (h_1, k_1)
Q_2: (h_2, k_2)
a: r_2 < r_1
b = Segment(Q_1, Q_2)
C_3: (x - h_1)^(2.0) + (y - k_1)^(2.0) = (r_2 - r_1)^(2.0)
c, d = Tangent(Q_2, C_3)
A = Intersect(C_3, d)
B = Intersect(C_3, c)
e = Ray(Q_1, A)
f = Ray(Q_1, B)
C = Intersect(C_1, e)
D = Intersect(C_1, f)
g = Line(C, d)
h = Line(D, c)
E, F_1 = Intersect(C_2, g)
F, G = Intersect(C_2, h)
i = Segment(E, C)
j = Segment(F, D)
k = Segment(E, Q_2)
l = Segment(Q_2, F)
u = Vector((x(Corner[1.0]), 0.0), (x(Corner[3.0]), 0.0))
v = Vector((0.0, y(Corner[1.0])), (0.0, y(Corner[3.0])))
T_1 = Corner(1.0)
T_4 = Corner(4.0)
T_2: (6.0 * Corner[1.0] + Corner[2.0]) / 7.0
T_3: (6.0 * Corner[4.0] + Corner[3.0]) / 7.0
多邊形1, t_1, t_2, t_3, t_4 = Polygon(T_1, T_2, T_3, T_4)