空間中的過兩點的直線
Author: 藍邦偉  老師

x

y

z

顯示xy平面

顯示單位向量

顯示座標軸

1

2

3

4

5

6

P (

,

,

)

Q(

,

,

)

A: (x((Corner[3] + 39 * Corner[4]) / 40), y((Corner[1] + 9 * Corner[4]) / 10))
B: (x((4 * Corner[3] + 16 * Corner[4]) / 20), y((Corner[1] + 9 * Corner[4]) / 10))
a = Segment(A, B)
C: (3 * A + B) / 4
D: (3 * B + A) / 4
E = Point(a)
c = Circle(C, E)
c' = Translate(c, Vector[C, D])
A' = Rotate(A, 270*°, C)
B' = Rotate(B, 270*°, C)
a' = Segment(A', B')
c'' = Rotate(c', 270*°, C)
D' = Rotate(D, 270*°, C)
E' = Rotate(Translate[E, Vector[C, D]], 90*°, D)
E'' = Rotate(E', 270*°, C)
F = Point(c'')
G = Point(c')
α = Angle(E'', D', F)
b = Segment(D', F)
d = Segment(D, G)
β = Angle(G, D, E')
I: C + (b * cos(α), b * sin(α) * sin(β))
J: C + (b * cos(α + 90°), b * sin(α + 90°) * sin(β))
K: C + (0, b * cos(β))
e = Segment(C, K)
f = Segment(C, I)
g = Segment(C, J)
O = (7.030897846831445, -3.9467953086731065)
I' = Translate(I, Vector[C, O])
J' = Translate(J, Vector[C, O])
K' = Translate(K, Vector[C, O])
L = 9 (slider from 1 to 10, step 1)
I'' = Dilate(I', L, O)
J'' = Dilate(J', L, O)
K'' = Dilate(K', L, O)
I''' = Dilate(I'', -1, O)
J''' = Dilate(J'', -1, O)
K''' = Dilate(K'', -1, O)
u' = Vector(I''', I'')
v' = Vector(J''', J'')
w' = Vector(K''', K'')
h = Segment(D', E'')
i = Segment(D, E')
軌跡1 = Locus(I, F)
L_{axis}: L
j = false
w = Vector(O, K')
u = Vector(O, I')
v = Vector(O, J')
k = false
list1 = Sequence(CurveCartesian[x(O + t * u + s * v), y(O + t * u + s * v), t, -L, L], s, -L, L, 1)
list2 = Sequence(CurveCartesian[x(O + t * u + s * v), y(O + t * u + s * v), s, -L, L], t, -L, L, 1)
x_1 = 5 (slider from -5 to 5, step 1)
y_1 = 5 (slider from -5 to 5, step 1)
z_1 = 5 (slider from -5 to 5, step 1)
x_2 = -5 (slider from -5 to 5, step 1)
y_2 = -5 (slider from -5 to 5, step 1)
z_2 = -5 (slider from -5 to 5, step 1)
P: O + x_1 * u + y_1 * v + z_1 * w
Q: O + x_2 * u + y_2 * v + z_2 * w
m = Line(Q, P)
l = true
inputBox1 = Textfield(x_1)
inputBox2 = Textfield(y_1)
inputBox3 = Textfield(z_1)
inputBox4 = Textfield(x_2)
inputBox5 = Textfield(y_2)
inputBox6 = Textfield(z_2)
P1: O + x_1 * u
P2: O + x_1 * u + y_1 * v
P3: O + y_1 * v
P4: O + x_1 * u + z_1 * w
P5: O + y_1 * v + z_1 * w
P6: O + z_1 * w
R1: O + x_2 * u
R2: O + x_2 * u + y_2 * v
R3: O + y_2 * v
R4: O + x_2 * u + z_2 * w
R5: O + y_2 * v + z_2 * w
R6: O + z_2 * w
n, p = SDLine(P4, P1, P6, P)
q, r = SDLine(P4, P, P1, P6)
s, t = SDLine(P, P2, P4, P5)
a_1, b_1 = SDLine(P, P5, P2, P4)
c_1, d_1 = SDLine(P5, P3, P, P6)
e_1, f_1 = SDLine(P6, O, P5, P4)
g_1, h_1 = SDLine(P5, P6, P3, P)
i_1, j_1 = SDLine(P6, P4, O, P5)
k_1, l_1 = SDLine(R2, Q, R1, R3)
m_1, n_1 = SDLine(R1, R2, R4, O)
p_1, q_1 = SDLine(R2, R3, Q, R1)
r_1, s_1 = SDLine(R3, R5, R2, O)
t_1, a_2 = SDLine(O, R6, R3, R1)
b_2, c_2 = SDLine(R3, O, R5, R2)
d_2, e_2 = SDLine(O, R1, R6, R3)
f_2, g_2 = SDLine(R1, R4, O, R2)
h_2, i_2 = SDLine(Q, R4, R2, R5)
j_2, k_2 = SDLine(R4, R6, R1, Q)
l_2, m_2 = SDLine(P3, P2, P5, O)
n_2, p_2 = SDLine(O, P3, P6, P1)
q_2, r_2 = SDLine(R5, Q, R3, R6)
s_2, t_2 = SDLine(P1, O, P4, P2)
a_3, b_3 = SDLine(R6, R5, O, R4)
c_3, d_3 = SDLine(P2, P1, P, P3)
Q_2: 0.25 * Corner[2] + 0.75 * Corner[1]
Q_3: (x(Q_2), y(Corner[4]))
poly1, e_3, q_3, q_4, f_3 = Polygon(Corner[1], Q_2, Q_3, Corner[4])
g_3 = Segment(Q_2, Q_3)

Tool: SDLine
Input: A, B, C, D
Output: g, h

b: sgn(sin(Angle[D, B, A]))
a: sgn(sin(Angle[A, B, C]))
c: sgn(a + b + 0.5)
d: sqrt(c)
e: sqrt(-c)
E = Midpoint(A, B)
A' = Dilate(A, d, E)
B' = Dilate(B, d, E)
g = Segment(A', B')
A'_1 = Dilate(A, e, E)
B'_1 = Dilate(B, e, E)
h = Segment(A'_1, B'_1)