截四面體
Author: 藍邦偉　老師

單位向量

座標軸

x

y

z

截四面體

O = (9.905867332562947, 2.852393504912894)
β = 1.3962634015954636 rad (slider from 0 to 6.283185307179586, step 0.1*°)
Z_{unit}: O + (0, sin(β))
w = Vector(O, Z_{unit})
α = 4.276056667386108 rad (slider from 0 to 6.283185307179586, step 0.1*°)
X_{unit}: O + (cos(α), sin(α) * cos(β))
u = Vector(O, X_{unit})
Y_{unit}: O + (-1 * sin(α), cos(α) * cos(β))
v = Vector(O, Y_{unit})
L = 7 (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)
c = false
d = false
Q_2: 0.2 * Corner[2] + 0.8 * Corner[1]
Q_3: (x(Q_2), y(Corner[3]))
g = Segment(Q_2, Q_3)
poly1, h, q_1, q_4, i = Polygon(Corner[1], Q_2, Q_3, Corner[4])
x_1 = 1 (slider from 0.1 to 5, step 0.1)
x_2 = 2 (slider from 0.1 to 5, step 0.1)
x_3 = 1 (slider from 0.1 to 5, step 0.1)
y_1 = 1 (slider from 0.1 to 5, step 0.1)
y_2 = 1 (slider from 0.1 to 5, step 0.1)
y_3 = 1 (slider from 0.1 to 5, step 0.1)
z_1 = 1 (slider from 0.1 to 5, step 0.1)
z_2 = 2 (slider from 0.1 to 5, step 0.1)
t = 0 (slider from 0 to 0.5, step 0.01)
r = 1.46 (slider from 1 to 3, step 0.01)
A_1: O + 3 * r * w
A_4: O - 2 * r * sqrt(2) * v - r * w
A_3: O + r * sqrt(6) * u + r * sqrt(2) * v - r * w
A_2: O - r * sqrt(6) * u + r * sqrt(2) * v - r * w
a_1 = Segment(A_1, A_2)
a_2 = Segment(A_1, A_3)
a_3 = Segment(A_1, A_4)
a_5 = Segment(A_2, A_4)
a_4 = Segment(A_2, A_3)
a_6 = Segment(A_4, A_3)
B_3: A_1 + t * Vector[A_1, A_3]
B_2: A_1 + t * Vector[A_1, A_2]
B_4: A_1 + t * Vector[A_1, A_4]
C_4: A_3 + t * Vector[A_3, A_4]
C_1: A_3 + t * Vector[A_3, A_1]
C_2: A_3 + t * Vector[A_3, A_2]
D_2: A_4 + t * Vector[A_4, A_2]
D_1: A_4 + t * Vector[A_4, A_1]
D_3: A_4 + t * Vector[A_4, A_3]
poly2 = Poly_B3(B_3, B_2, B_4)
E_1: A_2 + t * Vector[A_2, A_1]
E_3: A_2 + t * Vector[A_2, A_3]
E_4: A_2 + t * Vector[A_2, A_4]
poly3 = Poly_B3(D_1, D_2, D_3)
poly4 = Poly_B3(E_1, E_3, E_4)
poly5 = Poly_B3(C_1, C_4, C_2)
poly6 = Poly_C6(B_2, B_3, C_1, C_2, E_3, E_1)
poly7 = Poly_C6(B_4, B_2, E_1, E_4, D_2, D_1)
poly8 = Poly_C6(B_3, B_4, D_1, D_3, C_4, C_1)
poly9 = Poly_C6(C_2, C_4, D_3, D_2, E_4, E_3)
b_0, b_1 = SDLine(B_2, E_1, C_1, D_1)
b_2, b_3 = SDLine(B_4, D_1, E_1, C_1)
b_4, b_5 = SDLine(B_3, C_1, D_1, E_1)
b_6, b_7 = SDLine(C_1, C_4, D_3, C_2)
b_8, b_9 = SDLine(C_1, C_2, C_4, E_3)
b_{10}, b_{11} = SDLine(E_1, E_3, C_2, E_4)
b_{12}, b_{13} = SDLine(E_1, E_4, E_3, D_2)
b_{14}, b_{15} = SDLine(D_1, D_2, E_4, D_3)
b_{16}, b_{17} = SDLine(D_1, D_3, D_2, C_4)
b_{18}, b_{19} = SDLine(B_3, B_2, C_2, B_4)
b_{20}, b_{21} = SDLine(B_3, B_4, B_2, D_3)
b_{22}, b_{23} = SDLine(B_4, B_2, B_3, D_2)
b_{24}, b_{25} = SDLine(C_2, C_4, C_1, E_4)
b_{26}, b_{27} = SDLine(E_3, C_2, E_1, D_2)
b_{28}, b_{29} = SDLine(E_4, E_3, E_1, D_2)
b_{30}, b_{31} = SDLine(D_2, E_4, E_1, D_3)
b_{32}, b_{33} = SDLine(C_4, D_3, B_3, E_3)
b_{34}, b_{35} = SDLine(D_3, D_2, D_1, C_2)

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_R6
Input: A, B, C, D, E, F
Output: poly1'

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

Tool: Poly_C6
Input: A, B, C, D, E, F
Output: poly1

poly1 = Poly_R6(A, B, C, D, E, F)

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)