-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathsnub_12-20_dual.py
98 lines (83 loc) · 4.63 KB
/
snub_12-20_dual.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
import sys
sys.path.append("../..")
from classes import Polyhedron, Polygon, Point
c0 = 0.192893711352359022108262546061
c1 = 0.218483370127321224365534157111
c2 = 0.374821658114562295266609516608
c3 = 0.567715369466921317374872062669
c4 = 0.728335176957191477360671629838
c5 = 0.755467260516595579705585253517
c6 = 0.824957552676275846265811111988
c7 = 0.921228888309550499468934175898
c8 = 0.959987701391583803994339068107
c9 = 1.13706613386050418840961998424
c10 = 1.16712343647533397917215468549
c11 = 1.22237170490362309266282747264
c12 = 1.27209628257581214613814794036
c13 = 1.52770307085850512136921113078
c14 = 1.64691794069037444140475745697
c15 = 1.74618644098582634573474528789
c16 = 1.86540131081769566577029161408
c17 = 1.88844538928366915418351670356
c18 = 1.97783896542021867236841272616
c19 = 2.097053835252087992403959052348
coordinate_tuples = [
(-c0, -c1, -c19), (-c0, c1, c19), (c0, c1, -c19), (c0, -c1, c19), (-c19, -c0, -c1),
(-c19, c0, c1), (c19, c0, -c1), (c19, -c0, c1), (-c1, -c19, -c0), (-c1, c19, c0),
(c1, c19, -c0), (c1, -c19, c0), (0, -c5, -c18), (0, -c5, c18), (0, c5, -c18), (0, c5, c18),
(-c18, 0, -c5), (-c18, 0, c5), (c18, 0, -c5), (c18, 0, c5), (-c5, -c18, 0), (-c5, c18, 0),
(c5, -c18, 0), (c5, c18, 0), (-c10, 0, -c17), (-c10, 0, c17), (c10, 0, -c17), (c10, 0, c17),
(-c17, -c10, 0), (-c17, c10, 0), (c17, -c10, 0), (c17, c10, 0), (0, -c17, -c10), (0, -c17, c10),
(0, c17, -c10), (0, c17, c10), (-c3, c6, -c16), (-c3, -c6, c16), (c3, -c6, -c16), (c3, c6, c16),
(-c16, c3, -c6), (-c16, -c3, c6), (c16, -c3, -c6), (c16, c3, c6), (-c6, c16, -c3),
(-c6, -c16, c3), (c6, -c16, -c3), (c6, c16, c3), (-c2, -c9, -c15), (-c2, c9, c15),
(c2, c9, -c15), (c2, -c9, c15), (-c15, -c2, -c9), (-c15, c2, c9), (c15, c2, -c9),
(c15, -c2, c9), (-c9, -c15, -c2), (-c9, c15, c2), (c9, c15, -c2), (c9, -c15, c2),
(-c7, -c8, -c14), (-c7, c8, c14), (c7, c8, -c14), (c7, -c8, c14), (-c14, -c7, -c8),
(-c14, c7, c8), (c14, c7, -c8), (c14, -c7, c8), (-c8, -c14, -c7), (-c8, c14, c7),
(c8, c14, -c7), (c8, -c14, c7), (-c4, c12, -c13), (-c4, -c12, c13), (c4, -c12, -c13),
(c4, c12, c13), (-c13, c4, -c12), (-c13, -c4, c12), (c13, -c4, -c12), (c13, c4, c12),
(-c12, c13, -c4), (-c12, -c13, c4), (c12, -c13, -c4), (c12, c13, c4), (-c11, -c11, -c11),
(-c11, -c11, c11), (-c11, c11, -c11), (-c11, c11, c11), (c11, -c11, -c11), (c11, -c11, c11),
(c11, c11, -c11), (c11, c11, c11)
]
faces_raw = [
(24, 36, 14, 2, 0), (24, 76, 86, 72, 36), (24, 52, 16, 40, 76), (24, 60, 84, 64, 52),
(24, 0, 12, 48, 60), (25, 37, 13, 3, 1), (25, 77, 85, 73, 37), (25, 53, 17, 41, 77),
(25, 61, 87, 65, 53), (25, 1, 15, 49, 61), (26, 38, 12, 0, 2), (26, 78, 88, 74, 38),
(26, 54, 18, 42, 78), (26, 62, 90, 66, 54), (26, 2, 14, 50, 62), (27, 39, 15, 1, 3),
(27, 79, 91, 75, 39), (27, 55, 19, 43, 79), (27, 63, 89, 67, 55), (27, 3, 13, 51, 63),
(28, 41, 17, 5, 4), (28, 81, 85, 77, 41), (28, 56, 20, 45, 81), (28, 64, 84, 68, 56),
(28, 4, 16, 52, 64), (29, 40, 16, 4, 5), (29, 80, 86, 76, 40), (29, 57, 21, 44, 80),
(29, 65, 87, 69, 57), (29, 5, 17, 53, 65), (30, 42, 18, 6, 7), (30, 82, 88, 78, 42),
(30, 59, 22, 46, 82), (30, 67, 89, 71, 59), (30, 7, 19, 55, 67), (31, 43, 19, 7, 6),
(31, 83, 91, 79, 43), (31, 58, 23, 47, 83), (31, 66, 90, 70, 58), (31, 6, 18, 54, 66),
(32, 46, 22, 11, 8), (32, 74, 88, 82, 46), (32, 48, 12, 38, 74), (32, 68, 84, 60, 48),
(32, 8, 20, 56, 68), (33, 45, 20, 8, 11), (33, 73, 85, 81, 45), (33, 51, 13, 37, 73),
(33, 71, 89, 63, 51), (33, 11, 22, 59, 71), (34, 44, 21, 9, 10), (34, 72, 86, 80, 44),
(34, 50, 14, 36, 72), (34, 70, 90, 62, 50), (34, 10, 23, 58, 70), (35, 47, 23, 10, 9),
(35, 75, 91, 83, 47), (35, 49, 15, 39, 75), (35, 69, 87, 61, 49), (35, 9, 21, 57, 69)
]
vertices = []
for coordinate_tuple in coordinate_tuples:
vertex = Point(coordinate_tuples, coordinate_tuple)
vertices.append(vertex)
faces = []
for face_raw in faces_raw:
vertices_in_correct_order = []
for vertex_index in face_raw:
vertex = Point(coordinate_tuples, coordinate_tuples[vertex_index])
vertices_in_correct_order.append(vertex)
face = Polygon(vertices_in_correct_order=vertices_in_correct_order)
faces.append(face)
vertices_and_faces = {
'coordinate_tuples': coordinate_tuples,
'vertices': vertices,
'faces': faces
}
polyhedron = Polyhedron(vertices_and_faces=vertices_and_faces)
print(polyhedron.povray_arrays())
print('###########################################################')
normal_points_dict = polyhedron._face_normal_points()
normal_points = [tuple(normal_points_dict[face]) for face in polyhedron.faces]
print(normal_points)