RDG-Networks 0.3.9__py3-none-any.whl → 0.3.11__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {RDG_Networks-0.3.9.dist-info → RDG_Networks-0.3.11.dist-info}/METADATA +1 -1
- {RDG_Networks-0.3.9.dist-info → RDG_Networks-0.3.11.dist-info}/RECORD +11 -10
- {RDG_Networks-0.3.9.dist-info → RDG_Networks-0.3.11.dist-info}/entry_points.txt +3 -1
- RDG_networks/__init__.py +4 -2
- RDG_networks/{save_to_stl.py → save_data.py} +14 -1
- RDG_networks/save_to_json.py +14 -0
- RDG_networks/thickness/Classes.py +29 -0
- RDG_networks/thickness/generate_line_segments_thickness.py +3 -0
- {RDG_Networks-0.3.9.dist-info → RDG_Networks-0.3.11.dist-info}/LICENSE.txt +0 -0
- {RDG_Networks-0.3.9.dist-info → RDG_Networks-0.3.11.dist-info}/WHEEL +0 -0
- {RDG_Networks-0.3.9.dist-info → RDG_Networks-0.3.11.dist-info}/top_level.txt +0 -0
@@ -1,5 +1,5 @@
|
|
1
1
|
RDG_networks/Classes.py,sha256=_9X3JPHFAYYlaC8IZ_H9__sfz99G5l9UfPl65lL60_4,7977
|
2
|
-
RDG_networks/__init__.py,sha256=
|
2
|
+
RDG_networks/__init__.py,sha256=XWmsAEPzxbMBO3tU9OjDOyGGLIfwvRK7ebGEon3Y8wE,1659
|
3
3
|
RDG_networks/draw_segments.py,sha256=U53N5GXmQHWKdM1Q1faP_EGKjc6enOu2mcsunzSFpP0,984
|
4
4
|
RDG_networks/generate_line_network.py,sha256=lJ4rhObim3WcEQoebomewRQKWNJC5phFyFYRW7qjXIg,1127
|
5
5
|
RDG_networks/generate_line_segments.py,sha256=QV8_k7q6TD5c7Hcb2Ms_apEdWYw4XdLr7rdJgh49v4Q,9004
|
@@ -7,17 +7,18 @@ RDG_networks/generate_line_segments_dynamic.py,sha256=GoIhGXYbcvjqR5BJCnkvAGp8QB
|
|
7
7
|
RDG_networks/generate_line_segments_static.py,sha256=7KvHZi3krv-tAGydJR_gbMMmHKZ5azzrKcQe3fuWzCE,9265
|
8
8
|
RDG_networks/get_intersection_segments.py,sha256=mXB5qCy1oOps4Vu1mX6flW6v_4Xxc71YK41yOWjJX8o,2797
|
9
9
|
RDG_networks/sample_in_polygon.py,sha256=qpPpW-Da1vK8ZkVWMJ0zBsE8IgyMB619gCdybSkzKSQ,1605
|
10
|
-
RDG_networks/
|
11
|
-
RDG_networks/
|
10
|
+
RDG_networks/save_data.py,sha256=pMbQtWu1-Q_rSOKm_GeT_0wILu4Yk7tLHiyq3g46BQk,4378
|
11
|
+
RDG_networks/save_to_json.py,sha256=YPO0Kc5AjLysr_y9kVGeAWvO-mv4LHWEbujbfjHOChE,531
|
12
|
+
RDG_networks/thickness/Classes.py,sha256=NweH3l77rzZGoAcYwYq_LrpnIsDrXOem6poznTBm9a8,8972
|
12
13
|
RDG_networks/thickness/__init__.py,sha256=DzH-mmdrk5e1LL7oq5kg0xaDjtWR7DiCeKKchArHSIs,703
|
13
|
-
RDG_networks/thickness/generate_line_segments_thickness.py,sha256=
|
14
|
+
RDG_networks/thickness/generate_line_segments_thickness.py,sha256=D32KQMzOsqnzJ05XMgy-BF3PgET5UZLFhPBi_rCH26I,29112
|
14
15
|
RDG_networks/thickness/generate_line_segments_thickness_correct.py,sha256=rvvqEMGYX7imosKedyXHyTkBV4C2_24K8UxthXDTe7Q,28627
|
15
16
|
RDG_networks/thickness/generate_line_segments_thickness_static.py,sha256=6-2p4GOQFU-dP5Q9nYuaVqeb7wvxk2Fqld3A7cV2pY8,8964
|
16
17
|
RDG_networks/thickness/orientate_network.py,sha256=4jii3y89Jlw1tPmTWoUyrKE7MlHq21JuoiuwnBa1Mkk,15484
|
17
18
|
RDG_networks/thickness/sample_in_polygon.py,sha256=nJ-yqfoCCGfC6_EpGL3L1t1LOYdqWZd-7v5bxy6th34,1849
|
18
|
-
RDG_Networks-0.3.
|
19
|
-
RDG_Networks-0.3.
|
20
|
-
RDG_Networks-0.3.
|
21
|
-
RDG_Networks-0.3.
|
22
|
-
RDG_Networks-0.3.
|
23
|
-
RDG_Networks-0.3.
|
19
|
+
RDG_Networks-0.3.11.dist-info/LICENSE.txt,sha256=BHUkX2GsdTr30sKmVZ1MLGR1njnx17EX_oUuuSVZZPE,598
|
20
|
+
RDG_Networks-0.3.11.dist-info/METADATA,sha256=qD0yBa-cEhs1AUcprwg8B9L7VkczxX37NmdLL9EZP4A,2578
|
21
|
+
RDG_Networks-0.3.11.dist-info/WHEEL,sha256=In9FTNxeP60KnTkGw7wk6mJPYd_dQSjEZmXdBdMCI-8,91
|
22
|
+
RDG_Networks-0.3.11.dist-info/entry_points.txt,sha256=TxynZ-ZDOUTjGcNE04io0GRKkUgDKn-Byxf0Zo-tLU8,1080
|
23
|
+
RDG_Networks-0.3.11.dist-info/top_level.txt,sha256=4gUUYafD5Al9V8ZSiViVGYHpRMMCsCBcGgCNodk9Syg,13
|
24
|
+
RDG_Networks-0.3.11.dist-info/RECORD,,
|
@@ -9,7 +9,9 @@ generate_line_segments_thickness = RDG_networks.thickness.generate_line_segments
|
|
9
9
|
generate_line_segments_thickness_static = RDG_networks.generate_line_segments_thickness_static:main
|
10
10
|
get_alignment_mean = RDG_networks.thickness.get_alignment_mean:main
|
11
11
|
get_intersection_segments = RDG_networks.get_intersection_segments:main
|
12
|
+
load_from_json = RDG_networks.load_from_json:main
|
12
13
|
orientate_network = RDG_networks.thickness.orientate_network:main
|
13
14
|
rotate_network = RDG_networks.thickness.rotate_network:main
|
14
|
-
|
15
|
+
save_data = RDG_networks.save_to_stl:main
|
16
|
+
save_to_json = RDG_networks.save_to_json:main
|
15
17
|
translate_network = RDG_networks.thickness.translate_network:main
|
RDG_networks/__init__.py
CHANGED
@@ -14,7 +14,7 @@ from .thickness.orientate_network import translate_network
|
|
14
14
|
from .thickness.orientate_network import clip_network
|
15
15
|
from .thickness.orientate_network import rotate_network
|
16
16
|
from .thickness.orientate_network import get_alignment_mean
|
17
|
-
from .
|
17
|
+
from .save_data import save_to_stl, save_to_json, load_from_json
|
18
18
|
|
19
19
|
__all__ = ['generate_line_segments',
|
20
20
|
'generate_line_segments_thickness',
|
@@ -33,5 +33,7 @@ __all__ = ['generate_line_segments',
|
|
33
33
|
'Line',
|
34
34
|
'LineSegment',
|
35
35
|
'Polygon',
|
36
|
-
'save_to_stl'
|
36
|
+
'save_to_stl',
|
37
|
+
'save_to_json',
|
38
|
+
'load_from_json'
|
37
39
|
]
|
@@ -7,6 +7,7 @@ import matplotlib.pyplot as plt
|
|
7
7
|
import numpy as np
|
8
8
|
import math
|
9
9
|
import pickle
|
10
|
+
import json
|
10
11
|
|
11
12
|
import numpy as np
|
12
13
|
from stl import mesh
|
@@ -114,4 +115,16 @@ def save_to_stl(seg_thick_dict, thickness, name, frame_thickness = None):
|
|
114
115
|
merged_mesh = merge_3d_meshes(mesh_list)
|
115
116
|
|
116
117
|
# Save the merged mesh as an STL file
|
117
|
-
merged_mesh.save(name)
|
118
|
+
merged_mesh.save(name)
|
119
|
+
|
120
|
+
def save_to_json(data_dict, file_path):
|
121
|
+
data_dict['segments_dict'] = {key: pol.to_dict() for key, pol in data_dict['segments_dict'].items()}
|
122
|
+
data_dict['segment_thickness_dict'] = {key: pol.to_dict() for key, pol in data_dict['segment_thickness_dict'].items()}
|
123
|
+
|
124
|
+
with open(file_path, 'w') as json_file:
|
125
|
+
json.dump(data_dict, json_file)
|
126
|
+
|
127
|
+
def load_from_json(file_path):
|
128
|
+
with open(file_path, 'r') as file:
|
129
|
+
data = json.load(file)
|
130
|
+
return data
|
@@ -0,0 +1,14 @@
|
|
1
|
+
import json
|
2
|
+
from .Classes import Line, LineSegment, Polygon
|
3
|
+
|
4
|
+
def save_to_json(data_dict, file_path):
|
5
|
+
data_dict['segments_dict'] = {key: pol.to_dict() for key, pol in data_dict['segments_dict'].items()}
|
6
|
+
data_dict['segment_thickness_dict'] = {key: pol.to_dict() for key, pol in data_dict['segment_thickness_dict'].items()}
|
7
|
+
|
8
|
+
with open(file_path, 'w') as json_file:
|
9
|
+
json.dump(data_dict, json_file)
|
10
|
+
|
11
|
+
def load_from_json(file_path):
|
12
|
+
with open(file_path, 'r') as file:
|
13
|
+
data = json.load(file)
|
14
|
+
return data
|
@@ -3,6 +3,7 @@ import matplotlib.axes._axes as axes
|
|
3
3
|
from matplotlib.patches import Polygon as polgon
|
4
4
|
import numpy as np
|
5
5
|
from typing import List, Tuple, Union, Optional
|
6
|
+
import json
|
6
7
|
|
7
8
|
class Line:
|
8
9
|
"""
|
@@ -87,6 +88,21 @@ class LineSegment:
|
|
87
88
|
"""
|
88
89
|
return copy.deepcopy(self)
|
89
90
|
|
91
|
+
def to_dict(self) -> dict:
|
92
|
+
"""
|
93
|
+
Convert the LineSegment object to a dictionary.
|
94
|
+
|
95
|
+
Returns:
|
96
|
+
- dict: A dictionary representation of the LineSegment object.
|
97
|
+
"""
|
98
|
+
return {
|
99
|
+
'start': self.start,
|
100
|
+
'end': self.end,
|
101
|
+
'id': self.id,
|
102
|
+
'neighbors_initial': self.neighbors_initial,
|
103
|
+
'neighbors': self.neighbors
|
104
|
+
}
|
105
|
+
|
90
106
|
class Polygon:
|
91
107
|
"""
|
92
108
|
Represents a polygon defined by a list of vertices.
|
@@ -178,6 +194,19 @@ class Polygon:
|
|
178
194
|
x2, y2 = self.vertices[(i + 1) % len(self.vertices)]
|
179
195
|
perimeter += np.sqrt((x1-x2)**2 + (y1-y2)**2)
|
180
196
|
return perimeter
|
197
|
+
|
198
|
+
def to_dict(self) -> dict:
|
199
|
+
"""
|
200
|
+
Convert the Polygon object to a dictionary.
|
201
|
+
|
202
|
+
Returns:
|
203
|
+
dict: A dictionary representation of the Polygon object.
|
204
|
+
"""
|
205
|
+
return {
|
206
|
+
'vertices': self.vertices,
|
207
|
+
'middle_segment': self.middle_segment.to_dict(),
|
208
|
+
'neighbors': self.neighbors
|
209
|
+
}
|
181
210
|
|
182
211
|
class Cycle:
|
183
212
|
def __init__(self, vertices, id=None):
|
@@ -604,6 +604,7 @@ def generate_line_segments_thickness(
|
|
604
604
|
size = len(config)
|
605
605
|
|
606
606
|
jammed = False
|
607
|
+
nucleation_points = []
|
607
608
|
for i in range(size):
|
608
609
|
if config:
|
609
610
|
nucleation_point = config[i]['location']
|
@@ -623,6 +624,8 @@ def generate_line_segments_thickness(
|
|
623
624
|
segments_dict, polygon_arr, segment_thickness_dict, location, angle = output
|
624
625
|
generated_config.append({ 'location': location, 'angle': angle, 'thickness': thickness_arr[i] })
|
625
626
|
|
627
|
+
nucleation_points.append(location)
|
628
|
+
|
626
629
|
else:
|
627
630
|
if config:
|
628
631
|
print('Configuration not possible. Point is skipped.')
|
File without changes
|
File without changes
|
File without changes
|