空間中兩線段距離和的最小值
Author: 藍邦偉  老師

x

y

z

單位向量

座標軸

α = 4.468042885105484 rad (slider from 0 to 6.283185307179586, step 0.017453292519943295)
β = 1.3788101090755203 rad (slider from 0 to 6.283185307179586, step 0.017453292519943295)
O = (6.868179126753953, 3.857485527587954)
X_{unit}: O + (cos(α), sin(α) * cos(β))
Y_{unit}: O + (-1.0 * sin(α), cos(α) * cos(β))
Z_{unit}: O + (0.0, sin(β))
u = Vector(O, X_{unit})
v = Vector(O, Y_{unit})
w = Vector(O, Z_{unit})
L = 5 (slider from 1 to 10, step 1)
a = Vector(O - L * v, O + L * v)
b = Vector(O - L * w, O + L * w)
z = Vector(O - L * u, O + L * u)
A_1: O + L * u
B_1: O + L * v
Z: O + L * w
c = false
d = true
n = 2 (slider from 1 to 2, step 1)
A: O + 7.0 * u + 6.0 * v + 3.0 * w
B: O + 5.0 * u - v + 2.0 * w
P_1: O + u + 3.0 * w
P_2: O + v + w
e = Line(P_1, P_2)
f = OrthogonalLine(B, e)
N = Intersect(e, f)
l_2 = Segment(B, N)
h = OrthogonalLine(A, e)
M = Intersect(e, h)
l_1 = Segment(M, A)
P: l_2 / (l_1 + l_2) * M + l_1 / (l_1 + l_2) * N
g = Segment(B, P)
i = Segment(P, A)
A'_1: P + M - A
A' = Mirror(A, M)
P'_1 = Mirror(P, A'_1)
A'' = Mirror(A', P'_1)
P'' = Mirror(P'_1, A')
C = Mirror(A'_1, P)
M' = Mirror(M, A)
M'' = Mirror(M', C)
C' = Mirror(C, M')
多邊形1, m, p, q = Polygon(M'', C', P'')
B'_1: P + N - B
P'_2 = Mirror(P, B)
B''_1 = Mirror(B'_1, N)
B''_2 = Mirror(B'_1, B)
P' = Mirror(P, N)
B' = Mirror(B, P)
N' = Mirror(N, B'_1)
N'' = Mirror(N', B')
B'' = Mirror(B', N')
多邊形2, j, k, l = Polygon(P', B''_2, N'')

Tool: Poly_B3
Input: A, B, C
Output: poly1'

α = Angle(C, B, A)
d: sqrt(sgn(sin(α)))
A' = Dilate(A, d, A)
B' = Dilate(B, d, A)
C' = Dilate(C, d, A)
poly1', c', a', b' = Polygon(A', B', C')

Tool: Poly_B5
Input: A, B, C, D, E
Output: poly1'

poly1, a, b, c, d, e = Polygon(A, B, C, D, E)
F = Midpoint(b)
G = Midpoint(d)
α = Angle(G, F, A)
f: sqrt(sgn(sin(α)))
A' = Dilate(A, f, A)
B' = Dilate(B, f, A)
C' = Dilate(C, f, A)
D' = Dilate(D, f, A)
E' = Dilate(E, f, A)
poly1', a', b', c', d', e' = Polygon(A', B', C', D', E')