-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathsnub_12-20.py
93 lines (75 loc) · 4.09 KB
/
snub_12-20.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
import sys
sys.path.append("../..")
from classes import Polyhedron, Polygon, Point
c0 = 0.192893711352359022108262546061
c1 = 0.330921024729844230963655269187
c2 = 0.374821658114562295266609516608
c3 = 0.567715369466921317374872062669
c4 = 0.643029605914072573107464141441
c5 = 0.728335176957191477360671629838
c6 = 0.847550046789060797396217956030
c7 = 1.103156835071753772627281146446
c8 = 1.24950378846302719500774109632
c9 = 1.41526541625598211477109001870
c10 = 1.45402422933801541929649491091
c11 = 1.64691794069037444140475745697
c12 = 1.74618644098582634573474528789
c13 = 1.97783896542021867236841272616
c14 = 2.097053835252087992403959052348
coordinate_tuples = [
(c2, -c1, c14), (c2, c1, -c14), (-c2, c1, c14), (-c2, -c1, -c14), (c14, -c2, c1),
(c14, c2, -c1), (-c14, c2, c1), (-c14, -c2, -c1), (c1, -c14, c2), (c1, c14, -c2),
(-c1, c14, c2), (-c1, -c14, -c2), (c3, c4, c13), (c3, -c4, -c13), (-c3, -c4, c13),
(-c3, c4, -c13), (c13, c3, c4), (c13, -c3, -c4), (-c13, -c3, c4), (-c13, c3, -c4),
(c4, c13, c3), (c4, -c13, -c3), (-c4, -c13, c3), (-c4, c13, -c3), (c0, -c8, c12),
(c0, c8, -c12), (-c0, c8, c12), (-c0, -c8, -c12), (c12, -c0, c8), (c12, c0, -c8),
(-c12, c0, c8), (-c12, -c0, -c8), (c8, -c12, c0), (c8, c12, -c0), (-c8, c12, c0),
(-c8, -c12, -c0), (c7, -c6, c11), (c7, c6, -c11), (-c7, c6, c11), (-c7, -c6, -c11),
(c11, -c7, c6), (c11, c7, -c6), (-c11, c7, c6), (-c11, -c7, -c6), (c6, -c11, c7),
(c6, c11, -c7), (-c6, c11, c7), (-c6, -c11, -c7), (c9, c5, c10), (c9, -c5, -c10),
(-c9, -c5, c10), (-c9, c5, -c10), (c10, c9, c5), (c10, -c9, -c5), (-c10, -c9, c5),
(-c10, c9, -c5), (c5, c10, c9), (c5, -c10, -c9), (-c5, -c10, c9), (-c5, c10, -c9)
]
faces_raw = [
(0, 36, 28, 48, 12), (1, 37, 29, 49, 13), (2, 38, 30, 50, 14), (3, 39, 31, 51, 15),
(4, 40, 32, 53, 17), (5, 41, 33, 52, 16), (6, 42, 34, 55, 19), (7, 43, 35, 54, 18),
(8, 44, 24, 58, 22), (9, 45, 25, 59, 23), (10, 46, 26, 56, 20), (11, 47, 27, 57, 21),
(0, 2, 14), (1, 3, 15), (2, 0, 12), (3, 1, 13), (4, 5, 16), (5, 4, 17), (6, 7, 18), (7, 6, 19),
(8, 11, 21), (9, 10, 20), (10, 9, 23), (11, 8, 22), (12, 48, 56), (13, 49, 57), (14, 50, 58),
(15, 51, 59), (16, 52, 48), (17, 53, 49), (18, 54, 50), (19, 55, 51), (20, 56, 52),
(21, 57, 53), (22, 58, 54), (23, 59, 55), (24, 44, 36), (25, 45, 37), (26, 46, 38),
(27, 47, 39), (28, 36, 40), (29, 37, 41), (30, 38, 42), (31, 39, 43), (32, 40, 44),
(33, 41, 45), (34, 42, 46), (35, 43, 47), (36, 0, 24), (37, 1, 25), (38, 2, 26), (39, 3, 27),
(40, 4, 28), (41, 5, 29), (42, 6, 30), (43, 7, 31), (44, 8, 32), (45, 9, 33), (46, 10, 34),
(47, 11, 35), (48, 28, 16), (49, 29, 17), (50, 30, 18), (51, 31, 19), (52, 33, 20),
(53, 32, 21), (54, 35, 22), (55, 34, 23), (56, 26, 12), (57, 27, 13), (58, 24, 14),
(59, 25, 15), (24, 0, 14), (25, 1, 15), (26, 2, 12), (27, 3, 13), (28, 4, 16), (29, 5, 17),
(30, 6, 18), (31, 7, 19), (32, 8, 21), (33, 9, 20), (34, 10, 23), (35, 11, 22), (36, 44, 40),
(37, 45, 41), (38, 46, 42), (39, 47, 43), (48, 52, 56), (49, 53, 57), (50, 54, 58), (51, 55, 59)
]
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('###########################################################')
for face in polyhedron.faces:
print(face.povray_array_of_vertices_P())
print('###########################################################')
normal_points_dict = polyhedron._face_normal_points()
normal_points = [tuple(normal_points_dict[face]) for face in polyhedron.faces]
print(normal_points)