-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathrgscript.py
More file actions
68 lines (59 loc) · 2.18 KB
/
Copy pathrgscript.py
File metadata and controls
68 lines (59 loc) · 2.18 KB
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
from functions import *
#TODO: if name
name = input("Enter the type of polyhedra:")
numofnets = 0
# This if statement sets two variables based on the type of net.
# numOfNets is the total number of nets of that type
# k is the number of digits the number needs to have when it is part of the file name
if name == 'Tetrahedron':
numofnets = 2
k = 1
maxvc = 3
elif name == 'Cube':
numofnets = 11
k = 2
maxvc = 4
elif name == 'Octahedron':
numofnets = 11
k = 2
maxvc = 4
elif name == 'Dodecahedron':
numofnets = 43380
k = 5
maxvc = 10
maxvc = 10
else:
numofnets = 43380
k = 5
maxvc = 8
# creates an empty array to store [number of vertex connections, radius of gyration] for each net
array = [[0, 0] for i in range(numofnets)]
# for each Dürer net
for i in range(0, numofnets):
# Loads appropriate file as a dictionary
#TODO: fix this whole loadfile mess across every function (check to make sure zfill works)
data = loadFile(name, str(i).zfill(k))
v = np.array(data.get("Vertices")) # stores vertices
e = np.array(data.get("Edges")) # stores edges
f = np.array(data.get("Faces")) # stores faces
rg = radius_of_gyration(v, f) # tabulates radius of gyration
vc = countVC(name, v, e, False) # tabulates number of vertex connections
array[i] = [vc, rg] # adds [number of vertex connections, radius of gyration to the corresponding entry in array
# array2 is going to store the radius of gyration data, but each row is only radius of gyration data for that number
# of vertex connections
array2 = [None for i in range(0, maxvc + 1)]
# for each net
for i in range(numofnets):
pair = array[i]
vc = pair[0] # pulls out vertex connections for that net
rg = pair[1] # pulls out radius of gyration for that net
if array2[vc] == None: # If the row for that number of Vc is empty, the radius of gyration starts that row
array2[vc] = [rg]
else: # If the row for that number of Vc is not empty, the radius of gyration is appended to that row
array2[vc].append(rg)
# prints both arrays
print(array)
print(array2)
# prints the len of each
for i in len(array):
print("n = " + str(len(array2[i])))