3D 座標架的製作
Author: 藍邦偉  老師

六角形蛋糕

單位向量

單位點

座標軸

xy平面

x

y

z

α = 4.065220893745193 rad (slider from 0 to 6.283185307179586, step 0.01*°)
β = 4.9043751981040655 rad (slider from 225*° to 315*°, step 0.017453292519943295)
L = 10 (slider from 1 to 10, step 0.5)
O = (35.18306347998737, 5.146259980324267)
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})
x_{Axis} = Vector(O - L * u, O + L * u)
y_{Axis} = Vector(O - L * v, O + L * v)
z_{Axis} = Vector(O - L * w, O + L * w)
多邊形1, d, e, f, g = Polygon(O + L * u + L * v, O - L * u + L * v, O - L * u - L * v, O + L * u - L * v)
A = (20.64, 16.56)
h = false
i = false
j = false
k = false
R = 7.3 (slider from 1 to 9, step 0.01)
H = 3.6 (slider from 1 to 9, step 0.01)
A_1: O + R * cos(0°) * u + R * sin(0°) * v
A_2: O + R * cos(60°) * u + R * sin(60°) * v
A_3: O + R * cos(120°) * u + R * sin(120°) * v
A_4: O + R * cos(180°) * u + R * sin(180°) * v
A_5: O + R * cos(240°) * u + R * sin(240°) * v
A_6: O + R * cos(300°) * u + R * sin(300°) * v
a = Segment(A_5, A_6)
b = Segment(A_6, A_1)
c = Segment(A_1, A_2)
m = Segment(A_2, A_3)
n = Segment(A_3, A_4)
p = Segment(A_4, A_5)
B_1: A_1 + H * w
B_2: A_2 + H * w
B_3: A_3 + H * w
B_4: A_4 + H * w
B_5: A_5 + H * w
B_6: A_6 + H * w
q = Segment(B_6, A_6)
r = Segment(B_5, A_5)
s = Segment(B_4, A_4)
t = Segment(B_1, A_1)
a_1 = Segment(B_2, A_2)
b_1 = Segment(B_3, A_3)
c_1 = Segment(B_2, B_3)
d_1 = Segment(B_4, B_3)
e_1 = Segment(B_5, B_4)
f_1 = Segment(B_6, B_5)
g_1 = Segment(B_6, B_1)
h_1 = Segment(B_1, B_2)
poly1, b_6, a_6, a_2, b_2 = Polygon(B_6, A_6, A_1, B_1)
poly2, b_3, a_3, a_4, b_4 = Polygon(B_1, A_1, A_2, B_2)
B = Point(b_4)
C = Intersect(a_4, a_3)
poly3, b_5, c_2, a_5, b_7 = Polygon(B, C, A_3, B_3)
D = Point(b_7)
poly4, d_2, b_8, a_7, a_8 = Polygon(D, B_4, A_4, A_3)
E = Intersect(b_8, d_2)
F = Intersect(a_7, b_8)
poly5, e_2, f_2, a_9, b_9 = Polygon(E, F, A_5, B_5)
G = Intersect(b_9, a_9)
I = Intersect(a_9, f_2)
poly6, g_2, i_1, a_{10}, b_{10} = Polygon(G, I, A_6, B_6)
J = Intersect(b_{10}, a_{10})
K = Intersect(b_4, b_3)
poly7, j_1, k_1, b_{11}, d_3, e_3, g_3 = Polygon(J, K, B, D, E, G)
poly8, g_4, e_4, d_4, b_{12}, k_2, j_2 = Polygon(G, E, D, B, K, J)
C_1: O + 0.6 * R * cos(0°) * u + 0.6 * R * sin(0°) * v + H * w
C_2: O + 0.6 * R * cos(60°) * u + 0.6 * R * sin(60°) * v + H * w
C_3: O + 0.6 * R * cos(120°) * u + 0.6 * R * sin(120°) * v + H * w
C_4: O + 0.6 * R * cos(180°) * u + 0.6 * R * sin(180°) * v + H * w
C_5: O + 0.6 * R * cos(240°) * u + 0.6 * R * sin(240°) * v + H * w
C_6: O + 0.6 * R * cos(300°) * u + 0.6 * R * sin(300°) * v + H * w
l_1 = Segment(C_1, C_6)
m_1 = Segment(C_6, C_5)
n_1 = Segment(C_5, C_4)
p_1 = Segment(C_4, C_3)
q_1 = Segment(C_3, C_2)
r_1 = Segment(C_2, C_1)
D_1: O + 0.5 * R * cos(0°) * u + 0.5 * R * sin(0°) * v + 1.8 * H * w
D_2: O + 0.5 * R * cos(60°) * u + 0.5 * R * sin(60°) * v + 1.8 * H * w
D_3: O + 0.5 * R * cos(120°) * u + 0.5 * R * sin(120°) * v + 1.8 * H * w
D_4: O + 0.5 * R * cos(180°) * u + 0.5 * R * sin(180°) * v + 1.8 * H * w
D_5: O + 0.5 * R * cos(240°) * u + 0.5 * R * sin(240°) * v + 1.8 * H * w
D_6: O + 0.5 * R * cos(300°) * u + 0.5 * R * sin(300°) * v + 1.8 * H * w
s_1 = Segment(D_6, D_5)
t_1 = Segment(D_6, D_1)
h_2 = Segment(D_1, D_2)
i_2 = Segment(D_2, D_3)
l_2 = Segment(D_3, D_4)
m_2 = Segment(D_4, D_5)
n_2 = Segment(D_5, C_5)
p_2 = Segment(D_4, C_4)
q_2 = Segment(D_3, C_3)
r_2 = Segment(D_2, C_2)
s_2 = Segment(D_1, C_1)
t_2 = Segment(D_6, C_6)
E_1: O + 0.2 * R * cos(0°) * u + 0.2 * R * sin(0°) * v + 1.8 * H * w
E_2: O + 0.2 * R * cos(60°) * u + 0.2 * R * sin(60°) * v + 1.8 * H * w
E_3: O + 0.2 * R * cos(120°) * u + 0.2 * R * sin(120°) * v + 1.8 * H * w
E_4: O + 0.2 * R * cos(180°) * u + 0.2 * R * sin(180°) * v + 1.8 * H * w
E_5: O + 0.2 * R * cos(240°) * u + 0.2 * R * sin(240°) * v + 1.8 * H * w
E_6: O + 0.2 * R * cos(300°) * u + 0.2 * R * sin(300°) * v + 1.8 * H * w
c_3 = Segment(E_6, E_5)
f_3 = Segment(E_5, E_4)
h_3 = Segment(E_4, E_3)
i_3 = Segment(E_3, E_2)
j_3 = Segment(E_2, E_1)
k_3 = Segment(E_1, E_6)
F_1: O + 0.15 * R * cos(0°) * u + 0.15 * R * sin(0°) * v + 2.3 * H * w
F_2: O + 0.15 * R * cos(60°) * u + 0.15 * R * sin(60°) * v + 2.3 * H * w
F_3: O + 0.15 * R * cos(120°) * u + 0.15 * R * sin(120°) * v + 2.3 * H * w
F_4: O + 0.15 * R * cos(180°) * u + 0.15 * R * sin(180°) * v + 2.3 * H * w
F_5: O + 0.15 * R * cos(240°) * u + 0.15 * R * sin(240°) * v + 2.3 * H * w
F_6: O + 0.15 * R * cos(300°) * u + 0.15 * R * sin(300°) * v + 2.3 * H * w
l_3 = Segment(F_6, F_5)
m_3 = Segment(F_5, F_4)
n_3 = Segment(F_4, F_3)
p_3 = Segment(F_3, F_2)
q_3 = Segment(F_2, F_1)
r_3 = Segment(F_1, F_6)
s_3 = Segment(F_5, E_5)
t_3 = Segment(E_4, F_4)
c_4 = Segment(F_3, E_3)
f_4 = Segment(E_2, F_2)
h_4 = Segment(F_1, E_1)
i_4 = Segment(F_6, E_6)
poly9, f_5, f_6, f_7, f_8, f_9, f_{10} = Polygon(F_2, F_3, F_4, F_5, F_6, F_1)
poly10, d_5, d_6, c_5, c_6 = Polygon(D_3, D_2, C_2, C_3)
poly11, d_7, d_8, c_7, c_8 = Polygon(D_2, D_1, C_1, C_2)
poly12, d_9, d_{10}, c_9, c_{10} = Polygon(D_1, D_6, C_6, C_1)
poly13, d_{11}, d_{12}, c_{11}, c_{12} = Polygon(D_6, D_5, C_5, C_6)
poly14, d_{13}, c_{13}, c_{14}, d_{14} = Polygon(D_5, C_5, C_4, D_4)
poly15, d_{15}, d_{16}, c_{15}, c_{16} = Polygon(D_4, D_3, C_3, C_4)
poly17, c_{23}, c_{24}, c_{25}, c_{26}, c_{27}, c_{28} = Polygon(C_6, C_1, C_2, C_3, C_4, C_5)
poly16, d_{17}, d_{18}, d_{19}, d_{20}, d_{21}, d_{22} = Polygon(D_1, D_2, D_3, D_4, D_5, D_6)
poly18, e_5, e_6, f_{11}, f_{12} = Polygon(E_1, E_2, F_2, F_1)
poly20, e_9, e_{10}, f_{15}, f_{16} = Polygon(E_2, E_3, F_3, F_2)
poly19, e_7, e_8, f_{13}, f_{14} = Polygon(E_3, E_4, F_4, F_3)
poly21, e_{11}, e_{12}, f_{17}, f_{18} = Polygon(E_4, E_5, F_5, F_4)
poly22, e_{13}, e_{14}, f_{19}, f_{20} = Polygon(E_5, E_6, F_6, F_5)
poly23, e_{15}, e_{16}, f_{21}, f_{22} = Polygon(E_6, E_1, F_1, F_6)
poly24, e_{17}, e_{18}, e_{19}, e_{20}, e_{21}, e_{22} = Polygon(E_1, E_2, E_3, E_4, E_5, E_6)