正四角錐
Author: 藍邦偉  老師

α = 0.4118977034706618 rad (slider from 0 to 6.283185307179586, step 0.1*°)
β = 0.5602506898901798 rad (slider from 0 to 6.283185307179586, step 0.1*°)
O = (81.13518068386762, 11.292036074454138)
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_1: O + 4 * u
A_2: O + 4 * v
A_3: O - 4 * u
A_4: O - 4 * v
A_5: O + 4 * w
多邊形1 = Poly_B3(A_5, A_2, A_1)
多邊形2 = Poly_R3(A_5, A_1, A_4)
多邊形3 = Poly_G3(A_5, A_4, A_3)
多邊形4 = Poly_Y3(A_5, A_3, A_2)
d, e = SDLine(A_5, A_3, A_4, A_2)
f, g = SDLine(A_5, A_4, A_1, A_3)
h, i = SDLine(A_5, A_1, A_2, A_4)
j, k = SDLine(A_5, A_2, A_3, A_1)
多邊形5 = Poly_P4(A_2, A_3, A_4, A_1)
a, b = SDLine(A_2, A_3, A_5, A_1)
c, l = SDLine(A_1, A_2, A_5, A_4)
m, n = SDLine(A_4, A_1, A_5, A_3)
p, q = SDLine(A_3, A_4, A_5, A_2)
A_a: (Corner[1] + Corner[3]) / 2
r, s = SDLine(A_2, A_3, A_5, A_4)

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

poly1 = Poly_B3(A, B, C)

Tool: Poly_G3
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_P3
Input: A, B, C
Output: poly1

poly1 = Poly_B3(A, B, C)

Tool: Poly_R3
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_Y3
Input: A, B, C
Output: poly1

poly1 = Poly_B3(A, B, C)

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

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