topologicpy 0.7.10__py3-none-any.whl → 0.7.12__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/Face.py +55 -13
- topologicpy/Vertex.py +78 -0
- topologicpy/Wire.py +13 -8
- topologicpy/version.py +1 -1
- {topologicpy-0.7.10.dist-info → topologicpy-0.7.12.dist-info}/METADATA +6 -5
- {topologicpy-0.7.10.dist-info → topologicpy-0.7.12.dist-info}/RECORD +9 -9
- {topologicpy-0.7.10.dist-info → topologicpy-0.7.12.dist-info}/LICENSE +0 -0
- {topologicpy-0.7.10.dist-info → topologicpy-0.7.12.dist-info}/WHEEL +0 -0
- {topologicpy-0.7.10.dist-info → topologicpy-0.7.12.dist-info}/top_level.txt +0 -0
topologicpy/Face.py
CHANGED
@@ -1317,32 +1317,71 @@ class Face():
|
|
1317
1317
|
obstacles = [obs for obs in obstacles if Topology.IsInstance(obs, "Wire")]
|
1318
1318
|
else:
|
1319
1319
|
obstacles = []
|
1320
|
+
|
1321
|
+
origin = Vertex.Origin()
|
1322
|
+
normal = Face.Normal(face)
|
1323
|
+
flat_face = Topology.Flatten(face, origin=origin, direction=normal)
|
1324
|
+
flat_vertex = Topology.Flatten(vertex, origin=origin, direction=normal)
|
1325
|
+
eb = Face.ExternalBoundary(flat_face)
|
1326
|
+
vertices = Topology.Vertices(eb)
|
1327
|
+
coords = [Vertex.Coordinates(v, outputType="xy") for v in vertices]
|
1328
|
+
new_vertices = [Vertex.ByCoordinates(coord) for coord in coords]
|
1329
|
+
eb = Wire.ByVertices(new_vertices, close=True)
|
1330
|
+
|
1331
|
+
ib_list = Face.InternalBoundaries(flat_face)
|
1332
|
+
new_ib_list = []
|
1333
|
+
for ib in ib_list:
|
1334
|
+
vertices = Topology.Vertices(ib)
|
1335
|
+
coords = [Vertex.Coordinates(v, outputType="xy") for v in vertices]
|
1336
|
+
new_vertices = [Vertex.ByCoordinates(coord) for coord in coords]
|
1337
|
+
new_ib_list.append(Wire.ByVertices(new_vertices, close=True))
|
1338
|
+
|
1339
|
+
flat_face = Face.ByWires(eb, new_ib_list)
|
1320
1340
|
for obs in obstacles:
|
1321
|
-
|
1322
|
-
targets = Topology.Vertices(
|
1341
|
+
flat_face = Topology.Difference(flat_face, Face.ByWire(obs))
|
1342
|
+
targets = Topology.Vertices(flat_face)
|
1323
1343
|
distances = []
|
1324
1344
|
for target in targets:
|
1325
|
-
distances.append(Vertex.Distance(
|
1345
|
+
distances.append(Vertex.Distance(flat_vertex, target))
|
1326
1346
|
distances.sort()
|
1327
1347
|
max_d = distances[-1]*1.05
|
1328
1348
|
edges = []
|
1329
1349
|
for target in targets:
|
1330
|
-
if Vertex.Distance(
|
1331
|
-
e = Edge.ByVertices(
|
1350
|
+
if Vertex.Distance(flat_vertex, target) > tolerance:
|
1351
|
+
e = Edge.ByVertices(flat_vertex, target, silent=True)
|
1332
1352
|
e = Edge.SetLength(e, length=max_d, bothSides=False, tolerance=tolerance)
|
1333
1353
|
edges.append(e)
|
1334
|
-
shell = Topology.Slice(
|
1354
|
+
shell = Topology.Slice(flat_face, Cluster.ByTopologies(edges))
|
1335
1355
|
faces = Topology.Faces(shell)
|
1336
1356
|
final_faces = []
|
1337
|
-
for
|
1338
|
-
if vertexPartofFace(
|
1339
|
-
final_faces.append(
|
1357
|
+
for f in faces:
|
1358
|
+
if vertexPartofFace(flat_vertex, f, tolerance=0.001):
|
1359
|
+
final_faces.append(f)
|
1340
1360
|
shell = Shell.ByFaces(final_faces)
|
1341
|
-
return_face = Topology.RemoveCoplanarFaces(shell)
|
1361
|
+
return_face = Topology.RemoveCoplanarFaces(shell, epsilon=0.1)
|
1362
|
+
if not Topology.IsInstance(return_face, "face"):
|
1363
|
+
temp = Shell.ExternalBoundary(shell)
|
1364
|
+
if Topology.IsInstance(temp, "Wire"):
|
1365
|
+
return_face = Face.ByWire(temp)
|
1366
|
+
elif Topology.IsInstance(temp, "Cluster"):
|
1367
|
+
edges = Topology.Edges(temp)
|
1368
|
+
vertices = Topology.Vertices(temp)
|
1369
|
+
vertices = Vertex.Fuse(vertices, tolerance=0.01)
|
1370
|
+
new_edges = []
|
1371
|
+
for edge in edges:
|
1372
|
+
sv = vertices[Vertex.Index(Edge.StartVertex(edge), vertices, tolerance=0.01)]
|
1373
|
+
ev = vertices[Vertex.Index(Edge.EndVertex(edge), vertices, tolerance=0.01)]
|
1374
|
+
if Vertex.Distance(sv, ev) > tolerance:
|
1375
|
+
new_edges.append(Edge.ByVertices([sv,ev]))
|
1376
|
+
w = Wire.ByEdges(new_edges, tolerance=0.01)
|
1377
|
+
return_face = Face.ByWire(w)
|
1378
|
+
if not Topology.IsInstance(return_face, "Face"):
|
1379
|
+
print("Face.Isovist - Error: Could not create isovist. Returning None.")
|
1380
|
+
return None
|
1381
|
+
|
1342
1382
|
compAngle = 0
|
1343
1383
|
if fov == 360:
|
1344
|
-
|
1345
|
-
pie = Face.ByWire(c)
|
1384
|
+
pie = Face.Circle(origin= vertex, radius=max_d, sides=180)
|
1346
1385
|
else:
|
1347
1386
|
compAngle = Vector.CompassAngle(Vector.North(), direction, mantissa=mantissa, tolerance=tolerance) - 90
|
1348
1387
|
fromAngle = -fov*0.5 - compAngle
|
@@ -1358,7 +1397,10 @@ class Face():
|
|
1358
1397
|
if return_face == None:
|
1359
1398
|
print("Face.Isovist - Error: Could not create isovist. Returning None.")
|
1360
1399
|
return None
|
1361
|
-
|
1400
|
+
simpler_face = Face.RemoveCollinearEdges(return_face)
|
1401
|
+
if Topology.IsInstance(simpler_face, "face"):
|
1402
|
+
return Topology.Unflatten(simpler_face, origin=origin, direction=normal)
|
1403
|
+
return Topology.Unflatten(return_face, origin=origin, direction=normal)
|
1362
1404
|
|
1363
1405
|
@staticmethod
|
1364
1406
|
def MedialAxis(face, resolution: int = 0, externalVertices: bool = False, internalVertices: bool = False, toLeavesOnly: bool = False, angTolerance: float = 0.1, tolerance: float = 0.0001):
|
topologicpy/Vertex.py
CHANGED
@@ -747,6 +747,45 @@ class Vertex():
|
|
747
747
|
return_vertices = [Vertex.ByCoordinates(list(coord)) for coord in fused_vertices]
|
748
748
|
return return_vertices
|
749
749
|
|
750
|
+
@staticmethod
|
751
|
+
def IncomingEdges(vertex, hostTopology, tolerance: float = 0.0001) -> list:
|
752
|
+
"""
|
753
|
+
Returns the incoming edges connected to a vertex. An edge is considered incoming if its end vertex is
|
754
|
+
coincident with the input vertex.
|
755
|
+
|
756
|
+
Parameters
|
757
|
+
----------
|
758
|
+
vertex : topologic_core.Vertex
|
759
|
+
The input vertex.
|
760
|
+
hostTopology : topologic_core.Topology
|
761
|
+
The input host topology to which the vertex belongs.
|
762
|
+
tolerance : float , optional
|
763
|
+
The desired tolerance. The default is 0.0001.
|
764
|
+
|
765
|
+
Returns
|
766
|
+
-------
|
767
|
+
list
|
768
|
+
The list of incoming edges
|
769
|
+
|
770
|
+
"""
|
771
|
+
from topologicpy.Edge import Edge
|
772
|
+
from topologicpy.Topology import Topology
|
773
|
+
|
774
|
+
if not Topology.IsInstance(vertex, "Vertex"):
|
775
|
+
print("Vertex.IncomingEdges - Error: The input vertex parameter is not a valid vertex. Returning None.")
|
776
|
+
return None
|
777
|
+
if not Topology.IsInstance(hostTopology, "Topology"):
|
778
|
+
print("Vertex.IncomingEdges - Error: The input graph parameter is not a valid graph. Returning None.")
|
779
|
+
return None
|
780
|
+
|
781
|
+
edges = Topology.SuperTopologies(vertex, hostTopology=hostTopology, topologyType="Edge")
|
782
|
+
incoming_edges = []
|
783
|
+
for edge in edges:
|
784
|
+
ev = Edge.EndVertex(edge)
|
785
|
+
if Vertex.Distance(vertex, ev) < tolerance:
|
786
|
+
incoming_edges.append(edge)
|
787
|
+
return incoming_edges
|
788
|
+
|
750
789
|
@staticmethod
|
751
790
|
def Index(vertex, vertices: list, strict: bool = False, tolerance: float = 0.0001) -> int:
|
752
791
|
"""
|
@@ -1335,6 +1374,45 @@ class Vertex():
|
|
1335
1374
|
"""
|
1336
1375
|
return Vertex.ByCoordinates(0, 0, 0)
|
1337
1376
|
|
1377
|
+
@staticmethod
|
1378
|
+
def OutgoingEdges(vertex, hostTopology, tolerance: float = 0.0001) -> list:
|
1379
|
+
"""
|
1380
|
+
Returns the outgoing edges connected to a vertex. An edge is considered incoming if its start vertex is
|
1381
|
+
coincident with the input vertex.
|
1382
|
+
|
1383
|
+
Parameters
|
1384
|
+
----------
|
1385
|
+
vertex : topologic_core.Vertex
|
1386
|
+
The input vertex.
|
1387
|
+
hostTopology : topologic_core.Topology
|
1388
|
+
The input host topology to which the vertex belongs.
|
1389
|
+
tolerance : float , optional
|
1390
|
+
The desired tolerance. The default is 0.0001.
|
1391
|
+
|
1392
|
+
Returns
|
1393
|
+
-------
|
1394
|
+
list
|
1395
|
+
The list of outgoing edges
|
1396
|
+
|
1397
|
+
"""
|
1398
|
+
from topologicpy.Edge import Edge
|
1399
|
+
from topologicpy.Topology import Topology
|
1400
|
+
|
1401
|
+
if not Topology.IsInstance(vertex, "Vertex"):
|
1402
|
+
print("Vertex.OutgoingEdges - Error: The input vertex parameter is not a valid vertex. Returning None.")
|
1403
|
+
return None
|
1404
|
+
if not Topology.IsInstance(hostTopology, "Topology"):
|
1405
|
+
print("Vertex.OutgoingEdges - Error: The input graph parameter is not a valid graph. Returning None.")
|
1406
|
+
return None
|
1407
|
+
|
1408
|
+
edges = Topology.SuperTopologies(vertex, hostTopology=hostTopology, topologyType="Edge")
|
1409
|
+
outgoing_edges = []
|
1410
|
+
for edge in edges:
|
1411
|
+
sv = Edge.StartVertex(edge)
|
1412
|
+
if Vertex.Distance(vertex, sv) < tolerance:
|
1413
|
+
outgoing_edges.append(edge)
|
1414
|
+
return outgoing_edges
|
1415
|
+
|
1338
1416
|
@staticmethod
|
1339
1417
|
def PerpendicularDistance(vertex, face, mantissa: int = 6):
|
1340
1418
|
"""
|
topologicpy/Wire.py
CHANGED
@@ -1478,11 +1478,12 @@ class Wire(Topology):
|
|
1478
1478
|
# Unflatten the wire
|
1479
1479
|
return_wire = Topology.Unflatten(flat_wire, origin=Vertex.Origin(), direction=normal)
|
1480
1480
|
return return_wire
|
1481
|
-
|
1481
|
+
|
1482
1482
|
@staticmethod
|
1483
1483
|
def InteriorAngles(wire, tolerance: float = 0.0001, mantissa: int = 6) -> list:
|
1484
1484
|
"""
|
1485
1485
|
Returns the interior angles of the input wire in degrees. The wire must be planar, manifold, and closed.
|
1486
|
+
This code has been contributed by Yidan Xue.
|
1486
1487
|
|
1487
1488
|
Parameters
|
1488
1489
|
----------
|
@@ -1521,16 +1522,20 @@ class Wire(Topology):
|
|
1521
1522
|
w = Topology.Flatten(wire, origin=origin, direction=normal)
|
1522
1523
|
angles = []
|
1523
1524
|
edges = Topology.Edges(w)
|
1525
|
+
e1 = edges[len(edges)-1]
|
1526
|
+
e2 = edges[0]
|
1527
|
+
a = Vector.CompassAngle(Vector.Reverse(Edge.Direction(e1)), Edge.Direction(e2))
|
1528
|
+
angles.append(a)
|
1524
1529
|
for i in range(len(edges)-1):
|
1525
1530
|
e1 = edges[i]
|
1526
1531
|
e2 = edges[i+1]
|
1527
|
-
a =
|
1528
|
-
angles.append(a)
|
1529
|
-
|
1530
|
-
|
1531
|
-
|
1532
|
-
|
1533
|
-
|
1532
|
+
a = Vector.CompassAngle(Vector.Reverse(Edge.Direction(e1)), Edge.Direction(e2))
|
1533
|
+
angles.append(round(a, mantissa))
|
1534
|
+
if abs(sum(angles)-(len(angles)-2)*180)<tolerance:
|
1535
|
+
return angles
|
1536
|
+
else:
|
1537
|
+
angles = [360-ang for ang in angles]
|
1538
|
+
return angles
|
1534
1539
|
|
1535
1540
|
@staticmethod
|
1536
1541
|
def Interpolate(wires: list, n: int = 5, outputType: str = "default", mapping: str = "default", tolerance: float = 0.0001):
|
topologicpy/version.py
CHANGED
@@ -1 +1 @@
|
|
1
|
-
__version__ = '0.7.
|
1
|
+
__version__ = '0.7.12'
|
@@ -1,6 +1,6 @@
|
|
1
1
|
Metadata-Version: 2.1
|
2
2
|
Name: topologicpy
|
3
|
-
Version: 0.7.
|
3
|
+
Version: 0.7.12
|
4
4
|
Summary: An Advanced Spatial Modelling and Analysis Software Library for Architecture, Engineering, and Construction.
|
5
5
|
Author-email: Wassim Jabi <wassim.jabi@gmail.com>
|
6
6
|
License: MIT License
|
@@ -27,7 +27,7 @@ License: MIT License
|
|
27
27
|
|
28
28
|
Project-URL: Homepage, https://github.com/wassimj/TopologicPy
|
29
29
|
Project-URL: Bug Tracker, https://github.com/wassimj/TopologicPy/issues
|
30
|
-
Project-URL: Documentation, https://
|
30
|
+
Project-URL: Documentation, https://topologicpy.readthedocs.io
|
31
31
|
Classifier: Programming Language :: Python :: 3
|
32
32
|
Classifier: License :: OSI Approved :: GNU General Public License v3 (GPLv3)
|
33
33
|
Classifier: Operating System :: OS Independent
|
@@ -40,6 +40,7 @@ Requires-Dist: pandas
|
|
40
40
|
Requires-Dist: tqdm
|
41
41
|
Requires-Dist: plotly
|
42
42
|
Requires-Dist: lark
|
43
|
+
Requires-Dist: specklepy
|
43
44
|
Requires-Dist: topologic-core >=7.0.1
|
44
45
|
Provides-Extra: test
|
45
46
|
Requires-Dist: pytest-xdist >=2.4.0 ; extra == 'test'
|
@@ -105,8 +106,8 @@ topologicpy depends on the following python libraries which will be installed au
|
|
105
106
|
1. Start using the API
|
106
107
|
|
107
108
|
## API Documentation
|
108
|
-
API documentation can be found at [https://
|
109
|
+
API documentation can be found at [https://topologicpy.readthedocs.io](https://topologicpy.readthedocs.io)
|
109
110
|
|
110
|
-
topologicpy:
|
111
|
+
topologicpy: © 2024 Wassim Jabi
|
111
112
|
|
112
|
-
Topologic:
|
113
|
+
Topologic: © 2024 Cardiff University and UCL
|
@@ -8,7 +8,7 @@ topologicpy/DGL.py,sha256=RpkLnAzjg6arY7cEMs2pDFYzRdkerVg1Wbm9hcE3QaM,138991
|
|
8
8
|
topologicpy/Dictionary.py,sha256=pMbfE2RYGCNpVr2x58qiHRc-aBWnp1jLlyzwS9nz6-w,25891
|
9
9
|
topologicpy/Edge.py,sha256=EiOgg2HtuR-YtL5cpFcLcL1Y3A2Y-m4qPNtLjHGRZBQ,52407
|
10
10
|
topologicpy/EnergyModel.py,sha256=ni0H1JgvLl1-q90yK9Sm1qj5P1fTuidlimEIcwuj6qE,53287
|
11
|
-
topologicpy/Face.py,sha256=
|
11
|
+
topologicpy/Face.py,sha256=IiejcLoTDhY0C97I-2IQuOniHf7vDirpzjhG_rj4X5s,101031
|
12
12
|
topologicpy/Graph.py,sha256=IFEGU0MCE4_fPe2j8sx1vuXPKMjGaov5wTlgRAwB7ns,384631
|
13
13
|
topologicpy/Grid.py,sha256=2uDFDxg4NqROC-7bNi1BjK5Uz__BPH13afJ-VDBRW0M,18466
|
14
14
|
topologicpy/Helper.py,sha256=07V9IFu5ilMpvAdZVhIbdBOjBJSRTtJ0BfR1IoRaRXU,17743
|
@@ -22,12 +22,12 @@ topologicpy/Speckle.py,sha256=rUS6PCaxIjEF5_fUruxvMH47FMKg-ohcoU0qAUb-yNM,14267
|
|
22
22
|
topologicpy/Sun.py,sha256=3tYb8kssU882lE1gEWg2mxDvCCY_LAVElkyUT6wa-ZU,36935
|
23
23
|
topologicpy/Topology.py,sha256=sXvhiMShOjOp0aILjEU6uNDqKm3zEAEdrN_IJgDK47c,308819
|
24
24
|
topologicpy/Vector.py,sha256=2OXmty9CKZZzfsg5T4ckml-lPUUvgDvqokcKDsZVN9Y,29806
|
25
|
-
topologicpy/Vertex.py,sha256=
|
26
|
-
topologicpy/Wire.py,sha256=
|
25
|
+
topologicpy/Vertex.py,sha256=rueGIe6YY6kFFzCcbe2YHUDWOMTTHvumaYtApAoWrNQ,70462
|
26
|
+
topologicpy/Wire.py,sha256=rmS841P_bbMMow10h7k0tAwL19eIbtA3q5weIcv4DHs,139316
|
27
27
|
topologicpy/__init__.py,sha256=D7ky87CAQMiS2KE6YLvcTLkTgA2PY7rASe6Z23pjp9k,872
|
28
|
-
topologicpy/version.py,sha256=
|
29
|
-
topologicpy-0.7.
|
30
|
-
topologicpy-0.7.
|
31
|
-
topologicpy-0.7.
|
32
|
-
topologicpy-0.7.
|
33
|
-
topologicpy-0.7.
|
28
|
+
topologicpy/version.py,sha256=CatnPF7yPLD2d-GM4uSODskCctBnNw6bxogl_dJlCwA,23
|
29
|
+
topologicpy-0.7.12.dist-info/LICENSE,sha256=BRNw73R2WdDBICtwhI3wm3cxsaVqLTAGuRwrTltcfxs,1068
|
30
|
+
topologicpy-0.7.12.dist-info/METADATA,sha256=VzaA4JismCnxZAyxHIN90KLCmgxEM5UHQX5lJiI60Yw,8410
|
31
|
+
topologicpy-0.7.12.dist-info/WHEEL,sha256=GJ7t_kWBFywbagK5eo9IoUwLW6oyOeTKmQ-9iHFVNxQ,92
|
32
|
+
topologicpy-0.7.12.dist-info/top_level.txt,sha256=J30bDzW92Ob7hw3zA8V34Jlp-vvsfIkGzkr8sqvb4Uw,12
|
33
|
+
topologicpy-0.7.12.dist-info/RECORD,,
|
File without changes
|
File without changes
|
File without changes
|