截立方體
Author: 藍邦偉　老師

單位向量

座標軸

x

y

z

$ 截正六面體 $

O = (9.89231083801079, 3.6194995455815957)
β = 1.3962634015954636 rad (slider from 0 to 6.283185307179586, step 0.017)
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 = 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)
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)
r = 2.6 (slider from -5 to 5, step 0.1)
A_3: O - r * u - r * v - r * w
A_4: O + r * u - r * v - r * w
A_2: O - r * u + r * v - r * w
A_1: O + r * u + r * v - r * w
A_5: A_1 + 2 * r * w
A_6: A_2 + 2 * r * w
A_7: A_3 + 2 * r * w
A_8: A_4 + 2 * r * w
t = 0 (slider from 0 to 0.5, step 0.01)
B_1: A_1 + t * Vector[A_1, A_5]
B_2: A_2 + t * Vector[A_1, A_5]
B_3: A_3 + t * Vector[A_1, A_5]
B_4: A_4 + t * Vector[A_1, A_5]
B_5: A_5 - t * Vector[A_1, A_5]
B_6: A_6 - t * Vector[A_1, A_5]
B_7: A_7 - t * Vector[A_1, A_5]
B_8: A_8 - t * Vector[A_1, A_5]
C_1: A_1 + t * Vector[A_1, A_2]
C_4: A_4 + t * Vector[A_1, A_2]
C_5: A_5 + t * Vector[A_1, A_2]
C_8: A_8 + t * Vector[A_1, A_2]
C_2: A_2 - t * Vector[A_1, A_2]
C_3: A_3 - t * Vector[A_1, A_2]
C_6: A_6 - t * Vector[A_1, A_2]
C_7: A_7 - t * Vector[A_1, A_2]
D_1: A_1 + t * Vector[A_1, A_4]
D_2: A_2 + t * Vector[A_1, A_4]
D_5: A_5 + t * Vector[A_1, A_4]
D_6: A_6 + t * Vector[A_1, A_4]
D_4: A_4 - t * Vector[A_1, A_4]
D_3: A_3 - t * Vector[A_1, A_4]
D_7: A_7 - t * Vector[A_1, A_4]
D_8: A_8 - t * Vector[A_1, A_4]
poly2 = Poly_B3(C_5, D_5, B_5)
poly3 = Poly_B3(C_6, B_6, D_6)
poly4 = Poly_B3(D_7, B_7, C_7)
poly5 = Poly_B3(D_8, C_8, B_8)
poly6 = Poly_B3(B_4, C_4, D_4)
poly7 = Poly_B3(B_1, D_1, C_1)
poly8 = Poly_B3(B_2, C_2, D_2)
poly9 = Poly_B3(B_3, D_3, C_3)
poly10 = Poly_R8(D_7, D_6, B_6, B_2, D_2, D_3, B_3, B_7)
poly11 = Poly_R8(C_8, C_7, B_7, B_3, C_3, C_4, B_4, B_8)
poly12 = Poly_R8(C_6, C_5, B_5, B_1, C_1, C_2, B_2, B_6)
poly13 = Poly_R8(D_5, D_8, B_8, B_4, D_4, D_1, B_1, B_5)
poly14 = Poly_R8(D_5, C_5, C_6, D_6, D_7, C_7, C_8, D_8)
poly15 = Poly_R8(C_1, D_1, D_4, C_4, C_3, D_3, D_2, C_2)
a_1 = Segment(A_1, A_2)
a_2 = Segment(A_3, A_2)
a_3 = Segment(A_3, A_4)
a_4 = Segment(A_1, A_4)
a_5 = Segment(A_5, A_6)
a_6 = Segment(A_7, A_6)
a_7 = Segment(A_7, A_8)
a_8 = Segment(A_5, A_8)
a_9 = Segment(A_5, A_1)
a_0 = Segment(A_6, A_2)
a_{10} = Segment(A_3, A_7)
a_{11} = Segment(A_4, A_8)
b_0, b_1 = SDLine(B_5, B_1, B_4, B_2)
b_{10}, b_{11} = SDLine(B_8, B_4, B_7, B_5)
b_{12}, b_{13} = SDLine(D_8, B_8, C_8, B_5)
b_{14}, b_{15} = SDLine(C_8, B_8, B_3, D_8)
b_{20}, b_{21} = SDLine(B_6, B_2, B_1, B_3)
b_{30}, b_{31} = SDLine(B_7, B_3, B_2, B_4)
b_{36}, b_{37} = SDLine(B_3, C_3, D_3, B_4)
b_{38}, b_{39} = SDLine(C_7, B_7, D_7, C_8)
b_{40}, b_{41} = SDLine(D_8, D_5, B_4, D_7)
b_{42}, b_{43} = SDLine(D_5, C_5, B_5, C_7)
b_{44}, b_{45} = SDLine(C_5, C_6, C_1, C_7)
b_{46}, b_{47} = SDLine(C_6, D_6, D_2, D_8)
b_{48}, b_{49} = SDLine(D_6, D_7, D_2, D_5)
b_{50}, b_{51} = SDLine(D_7, C_7, B_7, D_5)
b_{52}, b_{53} = SDLine(C_7, C_8, C_3, C_6)
b_{54}, b_{55} = SDLine(C_8, D_8, C_3, C_6)
b_2, b_3 = SDLine(D_5, B_5, B_4, C_5)
b_{32}, b_{33} = SDLine(D_7, B_7, B_6, C_8)
b_{22}, b_{23} = SDLine(C_6, B_6, B_5, D_6)
b_4, b_5 = SDLine(C_5, B_5, D_5, C_6)
b_{24}, b_{25} = SDLine(D_6, B_6, C_6, D_7)
b_{56}, b_{57} = SDLine(C_2, D_2, C_1, B_2)
b_{58}, b_{59} = SDLine(D_2, D_3, D_4, B_2)
b_{66}, b_{67} = SDLine(C_4, D_4, C_3, B_4)
b_{70}, b_{71} = SDLine(D_3, C_3, D_2, B_3)
b_{28}, b_{29} = SDLine(B_2, D_2, C_2, B_3)
b_{26}, b_{27} = SDLine(B_2, C_2, B_1, D_2)
b_8, b_9 = SDLine(B_1, C_1, D_1, B_2)
b_6, b_7 = SDLine(B_1, D_1, B_5, C_2)
b_{16}, b_{17} = SDLine(B_4, D_4, C_4, B_1)
b_{18}, b_{19} = SDLine(B_4, C_4, B_7, D_1)
b_{34}, b_{35} = SDLine(B_3, D_3, B_2, C_3)
b_{60}, b_{61} = SDLine(C_1, C_2, C_4, C_5)
b_{64}, b_{65} = SDLine(D_4, D_1, D_3, D_5)
b_{68}, b_{69} = SDLine(C_3, C_4, D_3, C_8)
b_{62}, b_{63} = SDLine(D_1, C_1, C_3, B_1)

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

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

Tool: Poly_R8
Input: A, B, C, D, E, F, G, H
Output: poly1'

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

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)