正立方體
Author: 藍邦偉  老師
Date: 13 12 月 2012

α = 2.5342180738957665 rad (slider from 0 to 6.283185307179586, step 0.1*°)
β = 3.9165188414752756 rad (slider from 0 to 6.283185307179586, step 0.1*°)
O = (81.1049599574163, 11.175182598842445)
X_{unit}: O + (cos(α), sin(α) * cos(β))
Y_{unit}: O + (-sin(α), cos(α) * cos(β))
Z_{unit}: O + (0, -sin(β))
u = Vector(O, X_{unit})
v = Vector(O, Y_{unit})
w = Vector(O, Z_{unit})
A_a: (Corner[1] + Corner[3]) / 2
A_1: O - 2 * sqrt(3) * w
B_1: O + 2 * sqrt(3) * w
C_1: O + 4 * u - 2 / sqrt(3) * w
D_1: O + 4 * cos(120°) * u + 4 * sin(120°) * v - 2 / sqrt(3) * w
E_1: O + 4 * cos(240°) * u + 4 * sin(240°) * v - 2 / sqrt(3) * w
F_1: O + 4 * cos(60°) * u + 4 * sin(60°) * v + 2 / sqrt(3) * w
G_1: O + 4 * cos(180°) * u + 4 * sin(180°) * v + 2 / sqrt(3) * w
H_1: O + 4 * cos(300°) * u + 4 * sin(300°) * v + 2 / sqrt(3) * w
a = Segment(A_1, E_1)
b = Segment(D_1, A_1)
c = Segment(A_1, C_1)
d = Segment(B_1, G_1)
e = Segment(B_1, H_1)
f = Segment(B_1, F_1)
g = Segment(G_1, E_1)
h = Segment(G_1, D_1)
i = Segment(D_1, F_1)
j = Segment(F_1, C_1)
k = Segment(E_1, H_1)
l = Segment(H_1, C_1)
多邊形1 = Poly_B4(G_1, E_1, A_1, D_1)
多邊形2 = Poly_R4(D_1, A_1, C_1, F_1)
多邊形3 = Poly_Y4(B_1, G_1, D_1, F_1)
多邊形4 = Poly_G4(E_1, G_1, B_1, H_1)
多邊形5 = Poly_P4(H_1, B_1, F_1, C_1)
多邊形6 = Poly_C4(A_1, E_1, H_1, C_1)
m, n = SDLine(A_1, E_1, D_1, C_1)
p, q = SDLine(E_1, H_1, B_1, C_1)
r, s = SDLine(H_1, B_1, G_1, F_1)
t, a_1 = SDLine(B_1, F_1, D_1, C_1)
b_1, c_1 = SDLine(F_1, D_1, G_1, A_1)
d_1, e_1 = SDLine(D_1, A_1, E_1, C_1)
f_1, g_1 = SDLine(F_1, C_1, A_1, H_1)
h_1, i_1 = SDLine(C_1, A_1, D_1, E_1)
j_1, k_1 = SDLine(H_1, C_1, F_1, A_1)
l_1, m_1 = SDLine(E_1, A_1, C_1, D_1)
n_1, p_1 = SDLine(B_1, G_1, E_1, D_1)
q_1, r_1 = SDLine(D_1, G_1, F_1, A_1)
s_1, t_1 = SDLine(G_1, E_1, B_1, D_1)

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)

Tool: Poly_B4
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_R4
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_C4
Input: A, B, C, D
Output: poly1

poly1 = Poly_R4(A, B, C, D)

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

poly1 = Poly_R4(A, B, C, D)

Tool: Poly_Y4
Input: A, B, C, D
Output: poly1

poly1 = Poly_R4(A, B, C, D)