topologicpy 0.7.21__py3-none-any.whl → 0.7.22__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.
- topologicpy/ANN.py +3 -6
- topologicpy/Cell.py +5 -3
- topologicpy/Cluster.py +0 -4
- topologicpy/DGL.py +1 -9
- topologicpy/Dictionary.py +24 -13
- topologicpy/Edge.py +0 -6
- topologicpy/Face.py +35 -26
- topologicpy/Graph.py +2 -19
- topologicpy/Grid.py +0 -1
- topologicpy/Helper.py +0 -2
- topologicpy/Honeybee.py +27 -2
- topologicpy/Plotly.py +0 -1
- topologicpy/Polyskel.py +0 -21
- topologicpy/Shell.py +2 -4
- topologicpy/Sun.py +14 -5
- topologicpy/Topology.py +372 -179
- topologicpy/Vector.py +21 -13
- topologicpy/Vertex.py +8 -5
- topologicpy/Wire.py +53 -35
- topologicpy/version.py +1 -1
- {topologicpy-0.7.21.dist-info → topologicpy-0.7.22.dist-info}/METADATA +1 -1
- topologicpy-0.7.22.dist-info/RECORD +34 -0
- {topologicpy-0.7.21.dist-info → topologicpy-0.7.22.dist-info}/WHEEL +1 -1
- topologicpy-0.7.21.dist-info/RECORD +0 -34
- {topologicpy-0.7.21.dist-info → topologicpy-0.7.22.dist-info}/LICENSE +0 -0
- {topologicpy-0.7.21.dist-info → topologicpy-0.7.22.dist-info}/top_level.txt +0 -0
topologicpy/Polyskel.py
CHANGED
@@ -41,7 +41,6 @@ EPSILON = 0.00001
|
|
41
41
|
|
42
42
|
|
43
43
|
|
44
|
-
|
45
44
|
import math
|
46
45
|
|
47
46
|
class Point2:
|
@@ -93,7 +92,6 @@ class Point2:
|
|
93
92
|
def distance(self, other):
|
94
93
|
return abs(self - other)
|
95
94
|
|
96
|
-
|
97
95
|
class Ray2:
|
98
96
|
def __init__(self, p, v):
|
99
97
|
self.p = p
|
@@ -150,7 +148,6 @@ class Line2:
|
|
150
148
|
def __str__(self):
|
151
149
|
return f"Line2({self.p}, {self.v})"
|
152
150
|
|
153
|
-
|
154
151
|
class LineSegment2(Line2):
|
155
152
|
def __init__(self, p1, p2):
|
156
153
|
super().__init__(p1, p2)
|
@@ -180,10 +177,6 @@ class LineSegment2(Line2):
|
|
180
177
|
|
181
178
|
|
182
179
|
|
183
|
-
|
184
|
-
|
185
|
-
|
186
|
-
|
187
180
|
class Debug:
|
188
181
|
def __init__(self, image):
|
189
182
|
if image is not None:
|
@@ -205,40 +198,32 @@ class Debug:
|
|
205
198
|
if self.do:
|
206
199
|
self.im.show()
|
207
200
|
|
208
|
-
|
209
201
|
_debug = Debug(None)
|
210
202
|
|
211
|
-
|
212
203
|
def set_debug(image):
|
213
204
|
global _debug
|
214
205
|
_debug = Debug(image)
|
215
206
|
|
216
|
-
|
217
207
|
def _window(lst):
|
218
208
|
prevs, items, nexts = tee(lst, 3)
|
219
209
|
prevs = islice(cycle(prevs), len(lst) - 1, None)
|
220
210
|
nexts = islice(cycle(nexts), 1, None)
|
221
211
|
return zip(prevs, items, nexts)
|
222
212
|
|
223
|
-
|
224
213
|
def _cross(a, b):
|
225
214
|
res = a.x * b.y - b.x * a.y
|
226
215
|
return res
|
227
216
|
|
228
|
-
|
229
217
|
def _approximately_equals(a, b):
|
230
218
|
return a == b or (abs(a - b) <= max(abs(a), abs(b)) * 0.001)
|
231
219
|
|
232
|
-
|
233
220
|
def _approximately_same(point_a, point_b):
|
234
221
|
return _approximately_equals(point_a.x, point_b.x) and _approximately_equals(point_a.y, point_b.y)
|
235
222
|
|
236
|
-
|
237
223
|
def _normalize_contour(contour):
|
238
224
|
contour = [Point2(float(x), float(y)) for (x, y) in contour]
|
239
225
|
return [point for prev, point, next in _window(contour) if not (point == next or (point-prev).normalized() == (next - point).normalized())]
|
240
226
|
|
241
|
-
|
242
227
|
class _SplitEvent(namedtuple("_SplitEvent", "distance, intersection_point, vertex, opposite_edge")):
|
243
228
|
__slots__ = ()
|
244
229
|
|
@@ -248,7 +233,6 @@ class _SplitEvent(namedtuple("_SplitEvent", "distance, intersection_point, verte
|
|
248
233
|
def __str__(self):
|
249
234
|
return "{} Split event @ {} from {} to {}".format(self.distance, self.intersection_point, self.vertex, self.opposite_edge)
|
250
235
|
|
251
|
-
|
252
236
|
class _EdgeEvent(namedtuple("_EdgeEvent", "distance intersection_point vertex_a vertex_b")):
|
253
237
|
__slots__ = ()
|
254
238
|
|
@@ -258,12 +242,10 @@ class _EdgeEvent(namedtuple("_EdgeEvent", "distance intersection_point vertex_a
|
|
258
242
|
def __str__(self):
|
259
243
|
return "{} Edge event @ {} between {} and {}".format(self.distance, self.intersection_point, self.vertex_a, self.vertex_b)
|
260
244
|
|
261
|
-
|
262
245
|
_OriginalEdge = namedtuple("_OriginalEdge", "edge bisector_left, bisector_right")
|
263
246
|
|
264
247
|
Subtree = namedtuple("Subtree", "source, height, sinks")
|
265
248
|
|
266
|
-
|
267
249
|
class _LAVertex:
|
268
250
|
def __init__(self, point, edge_left, edge_right, direction_vectors=None):
|
269
251
|
self.point = point
|
@@ -381,7 +363,6 @@ class _LAVertex:
|
|
381
363
|
self.point.x, self.point.y, self.bisector,
|
382
364
|
self.edge_left, self.edge_right)
|
383
365
|
|
384
|
-
|
385
366
|
class _SLAV:
|
386
367
|
def __init__(self, polygon, holes):
|
387
368
|
contours = [_normalize_contour(polygon)]
|
@@ -506,7 +487,6 @@ class _SLAV:
|
|
506
487
|
event.vertex.invalidate()
|
507
488
|
return (Subtree(event.intersection_point, event.distance, sinks), events)
|
508
489
|
|
509
|
-
|
510
490
|
class _LAV:
|
511
491
|
def __init__(self, slav):
|
512
492
|
self.head = None
|
@@ -592,7 +572,6 @@ class _LAV:
|
|
592
572
|
if cur == self.head:
|
593
573
|
break
|
594
574
|
|
595
|
-
|
596
575
|
class _EventQueue:
|
597
576
|
def __init__(self):
|
598
577
|
self.__data = []
|
topologicpy/Shell.py
CHANGED
@@ -331,7 +331,6 @@ class Shell():
|
|
331
331
|
_ = cluster.Faces(None, faces)
|
332
332
|
return Shell.ByFaces(faces, tolerance=tolerance)
|
333
333
|
|
334
|
-
|
335
334
|
@staticmethod
|
336
335
|
def ByThickenedWire(wire, offsetA: float = 1.0, offsetB: float = 1.0, tolerance: float = 0.0001):
|
337
336
|
"""
|
@@ -571,7 +570,6 @@ class Shell():
|
|
571
570
|
if len(vertices) < 3:
|
572
571
|
return None
|
573
572
|
|
574
|
-
|
575
573
|
if Topology.IsInstance(face, "Face"):
|
576
574
|
# Flatten the face
|
577
575
|
origin = Topology.Centroid(face)
|
@@ -775,6 +773,7 @@ class Shell():
|
|
775
773
|
The desired length of the mantissa. The default is 6.
|
776
774
|
tolerance : float , optional
|
777
775
|
The desired tolerance. The default is 0.0001.
|
776
|
+
|
778
777
|
Returns
|
779
778
|
-------
|
780
779
|
topologic_core.Shell
|
@@ -870,6 +869,7 @@ class Shell():
|
|
870
869
|
The desired length of the mantissa. The default is 6
|
871
870
|
tolerance : float , optional
|
872
871
|
The desired tolerance. The default is 0.0001.
|
872
|
+
|
873
873
|
Returns
|
874
874
|
-------
|
875
875
|
topologic_core.Shell
|
@@ -1180,7 +1180,6 @@ class Shell():
|
|
1180
1180
|
shell = Topology.Orient(shell, origin=origin, dirA=[0, 0, 1], dirB=direction)
|
1181
1181
|
return shell
|
1182
1182
|
|
1183
|
-
|
1184
1183
|
@staticmethod
|
1185
1184
|
def Planarize(shell, origin= None, mantissa: int = 6, tolerance: float = 0.0001):
|
1186
1185
|
"""
|
@@ -1695,7 +1694,6 @@ class Shell():
|
|
1695
1694
|
final_result = Shell.ByFaces(final_faces, tolerance=tolerance)
|
1696
1695
|
return final_result
|
1697
1696
|
|
1698
|
-
|
1699
1697
|
@staticmethod
|
1700
1698
|
def Vertices(shell) -> list:
|
1701
1699
|
"""
|
topologicpy/Sun.py
CHANGED
@@ -132,6 +132,7 @@ class Sun():
|
|
132
132
|
-------
|
133
133
|
datetime
|
134
134
|
The datetime of the summer solstice
|
135
|
+
|
135
136
|
"""
|
136
137
|
import os
|
137
138
|
import warnings
|
@@ -172,6 +173,7 @@ class Sun():
|
|
172
173
|
-------
|
173
174
|
datetime
|
174
175
|
The datetime of the summer solstice
|
176
|
+
|
175
177
|
"""
|
176
178
|
import os
|
177
179
|
import warnings
|
@@ -214,6 +216,7 @@ class Sun():
|
|
214
216
|
-------
|
215
217
|
float
|
216
218
|
The azimuth angle.
|
219
|
+
|
217
220
|
"""
|
218
221
|
import os
|
219
222
|
import warnings
|
@@ -260,6 +263,7 @@ class Sun():
|
|
260
263
|
-------
|
261
264
|
float
|
262
265
|
The altitude angle.
|
266
|
+
|
263
267
|
"""
|
264
268
|
import os
|
265
269
|
import warnings
|
@@ -306,8 +310,8 @@ class Sun():
|
|
306
310
|
-------
|
307
311
|
datetime
|
308
312
|
The Sunrise datetime.
|
309
|
-
"""
|
310
313
|
|
314
|
+
"""
|
311
315
|
import os
|
312
316
|
import warnings
|
313
317
|
try:
|
@@ -351,8 +355,8 @@ class Sun():
|
|
351
355
|
-------
|
352
356
|
datetime
|
353
357
|
The Sunset datetime.
|
354
|
-
"""
|
355
358
|
|
359
|
+
"""
|
356
360
|
import os
|
357
361
|
import warnings
|
358
362
|
try:
|
@@ -398,6 +402,7 @@ class Sun():
|
|
398
402
|
-------
|
399
403
|
list
|
400
404
|
The sun vector pointing from the location of the sun towards the origin.
|
405
|
+
|
401
406
|
"""
|
402
407
|
from topologicpy.Vector import Vector
|
403
408
|
azimuth = Sun.Azimuth(latitude=latitude, longitude=longitude, date=date)
|
@@ -426,13 +431,14 @@ class Sun():
|
|
426
431
|
mantissa : int , optional
|
427
432
|
The desired length of the mantissa. The default is 6.
|
428
433
|
|
429
|
-
|
430
434
|
Returns
|
431
435
|
-------
|
432
436
|
topologic_core.Vertex
|
433
437
|
The sun represented as a vertex.
|
438
|
+
|
434
439
|
"""
|
435
440
|
from topologicpy.Vertex import Vertex
|
441
|
+
|
436
442
|
sun_v = Sun.Vertex(latitude=latitude, longitude=longitude, date=date, origin=origin, radius=radius, north=north)
|
437
443
|
return Vertex.Coordinates(sun_v, mantissa=mantissa)
|
438
444
|
|
@@ -585,6 +591,7 @@ class Sun():
|
|
585
591
|
-------
|
586
592
|
topologic_core.Wire
|
587
593
|
The sun path represented as a wire.
|
594
|
+
|
588
595
|
"""
|
589
596
|
from topologicpy.Vertex import Vertex
|
590
597
|
from topologicpy.Wire import Wire
|
@@ -645,9 +652,11 @@ class Sun():
|
|
645
652
|
-------
|
646
653
|
list
|
647
654
|
The sun locations represented as a list of vertices.
|
655
|
+
|
648
656
|
"""
|
649
657
|
from datetime import datetime
|
650
658
|
from datetime import timedelta
|
659
|
+
|
651
660
|
def day_of_year_to_datetime(year, day_of_year):
|
652
661
|
# Construct a datetime object for the first day of the year
|
653
662
|
base_date = datetime(year, 1, 1)
|
@@ -699,8 +708,8 @@ class Sun():
|
|
699
708
|
-------
|
700
709
|
topologic_core.Wire
|
701
710
|
The sun path represented as a topologic wire.
|
702
|
-
"""
|
703
711
|
|
712
|
+
"""
|
704
713
|
from topologicpy.Wire import Wire
|
705
714
|
from topologicpy.Dictionary import Dictionary
|
706
715
|
from topologicpy.Topology import Topology
|
@@ -767,8 +776,8 @@ class Sun():
|
|
767
776
|
- 'center' : This is a cross-shape (wire) at the center of the diagram. This is included only if the compass option is set to True.
|
768
777
|
- 'ground' : This is a circle (face) on the ground. It is made of 36 sides. This is included only if
|
769
778
|
the compass option is set to False.
|
770
|
-
"""
|
771
779
|
|
780
|
+
"""
|
772
781
|
from datetime import datetime
|
773
782
|
from datetime import timedelta
|
774
783
|
from topologicpy.Vertex import Vertex
|