topologicpy 0.4.36__py3-none-any.whl → 0.4.38__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/Color.py +47 -0
- topologicpy/Graph.py +181 -0
- topologicpy/Plotly.py +33 -24
- topologicpy/Shell.py +159 -95
- topologicpy/Topology.py +609 -614
- topologicpy/Vertex.py +53 -1
- topologicpy/Wire.py +26 -21
- topologicpy/__init__.py +1 -1
- {topologicpy-0.4.36.dist-info → topologicpy-0.4.38.dist-info}/METADATA +1 -1
- {topologicpy-0.4.36.dist-info → topologicpy-0.4.38.dist-info}/RECORD +13 -13
- {topologicpy-0.4.36.dist-info → topologicpy-0.4.38.dist-info}/WHEEL +1 -1
- {topologicpy-0.4.36.dist-info → topologicpy-0.4.38.dist-info}/LICENSE +0 -0
- {topologicpy-0.4.36.dist-info → topologicpy-0.4.38.dist-info}/top_level.txt +0 -0
topologicpy/Vertex.py
CHANGED
|
@@ -5,10 +5,62 @@ from topologicpy.Topology import Topology
|
|
|
5
5
|
import collections
|
|
6
6
|
|
|
7
7
|
class Vertex(Topology):
|
|
8
|
+
@staticmethod
|
|
9
|
+
def AreCollinear(vertices: list, tolerance: float = 0.0001):
|
|
10
|
+
"""
|
|
11
|
+
Returns True if the input list of vertices form a straight line. Returns False otherwise.
|
|
12
|
+
|
|
13
|
+
Parameters
|
|
14
|
+
----------
|
|
15
|
+
vertices : list
|
|
16
|
+
The input list of vertices.
|
|
17
|
+
tolerance : float, optional
|
|
18
|
+
The desired tolerance. The default is 0.0001.
|
|
19
|
+
|
|
20
|
+
Returns
|
|
21
|
+
-------
|
|
22
|
+
bool
|
|
23
|
+
True if the input vertices are on the same side of the face. False otherwise.
|
|
24
|
+
|
|
25
|
+
"""
|
|
26
|
+
from topologicpy.Cluster import Cluster
|
|
27
|
+
from topologicpy.Topology import Topology
|
|
28
|
+
from topologicpy.Vector import Vector
|
|
29
|
+
|
|
30
|
+
def areCollinear(vertices, tolerance=0.0001):
|
|
31
|
+
point1 = [Vertex.X(vertices[0]), Vertex.Y(vertices[0]), Vertex.Z(vertices[0])]
|
|
32
|
+
point2 = [Vertex.X(vertices[1]), Vertex.Y(vertices[1]), Vertex.Z(vertices[1])]
|
|
33
|
+
point3 = [Vertex.X(vertices[2]), Vertex.Y(vertices[2]), Vertex.Z(vertices[2])]
|
|
34
|
+
|
|
35
|
+
vector1 = [point2[0] - point1[0], point2[1] - point1[1], point2[2] - point1[2]]
|
|
36
|
+
vector2 = [point3[0] - point1[0], point3[1] - point1[1], point3[2] - point1[2]]
|
|
37
|
+
|
|
38
|
+
cross_product_result = Vector.Cross(vector1, vector2, tolerance=tolerance)
|
|
39
|
+
return cross_product_result == None
|
|
40
|
+
|
|
41
|
+
if not isinstance(vertices, list):
|
|
42
|
+
print("Vertex.AreCollinear - Error: The input list of vertices is not a valid list. Returning None.")
|
|
43
|
+
return None
|
|
44
|
+
vertexList = [x for x in vertices if isinstance(x, topologic.Vertex)]
|
|
45
|
+
if len(vertexList) < 2:
|
|
46
|
+
print("Vertex.AreCollinear - Error: The input list of vertices does not contain sufficient valid vertices. Returning None.")
|
|
47
|
+
return None
|
|
48
|
+
if len(vertexList) < 3:
|
|
49
|
+
return True # Any two vertices can form a line!
|
|
50
|
+
cluster = Topology.SelfMerge(Cluster.ByTopologies(vertexList))
|
|
51
|
+
vertexList = Topology.Vertices(cluster)
|
|
52
|
+
slices = []
|
|
53
|
+
for i in range(2,len(vertexList)):
|
|
54
|
+
slices.append([vertexList[0], vertexList[1], vertexList[i]])
|
|
55
|
+
for slice in slices:
|
|
56
|
+
if not areCollinear(slice, tolerance=tolerance):
|
|
57
|
+
return False
|
|
58
|
+
return True
|
|
59
|
+
|
|
8
60
|
@staticmethod
|
|
9
61
|
def AreIpsilateral(vertices: list, face: topologic.Face) -> bool:
|
|
10
62
|
"""
|
|
11
|
-
Returns True if the
|
|
63
|
+
Returns True if the input list of vertices form a straight line. Returns False otherwise. If at least one of the vertices is on the face, this method return True.
|
|
12
64
|
|
|
13
65
|
Parameters
|
|
14
66
|
----------
|
topologicpy/Wire.py
CHANGED
|
@@ -10,7 +10,7 @@ import numpy as np
|
|
|
10
10
|
|
|
11
11
|
class Wire(topologic.Wire):
|
|
12
12
|
@staticmethod
|
|
13
|
-
def BoundingRectangle(topology: topologic.Topology, optimize: int = 0) -> topologic.Wire:
|
|
13
|
+
def BoundingRectangle(topology: topologic.Topology, optimize: int = 0, tolerance=0.0001) -> topologic.Wire:
|
|
14
14
|
"""
|
|
15
15
|
Returns a wire representing a bounding rectangle of the input topology. The returned wire contains a dictionary with key "zrot" that represents rotations around the Z axis. If applied the resulting wire will become axis-aligned.
|
|
16
16
|
|
|
@@ -20,6 +20,8 @@ class Wire(topologic.Wire):
|
|
|
20
20
|
The input topology.
|
|
21
21
|
optimize : int , optional
|
|
22
22
|
If set to an integer from 1 (low optimization) to 10 (high optimization), the method will attempt to optimize the bounding rectangle so that it reduces its surface area. The default is 0 which will result in an axis-aligned bounding rectangle. The default is 0.
|
|
23
|
+
tolerance : float , optional
|
|
24
|
+
The desired tolerance. The default is 0.0001.
|
|
23
25
|
|
|
24
26
|
Returns
|
|
25
27
|
-------
|
|
@@ -33,7 +35,10 @@ class Wire(topologic.Wire):
|
|
|
33
35
|
from topologicpy.Cluster import Cluster
|
|
34
36
|
from topologicpy.Topology import Topology
|
|
35
37
|
from topologicpy.Dictionary import Dictionary
|
|
38
|
+
from topologicpy.Vector import Vector
|
|
36
39
|
from random import sample
|
|
40
|
+
import time
|
|
41
|
+
|
|
37
42
|
|
|
38
43
|
def br(topology):
|
|
39
44
|
vertices = []
|
|
@@ -54,16 +59,23 @@ class Wire(topologic.Wire):
|
|
|
54
59
|
|
|
55
60
|
world_origin = Vertex.ByCoordinates(0,0,0)
|
|
56
61
|
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
62
|
+
vertices = Topology.SubTopologies(topology=topology, subTopologyType="vertex")
|
|
63
|
+
start = time.time()
|
|
64
|
+
period = 0
|
|
65
|
+
result = True
|
|
66
|
+
while result and period < 30:
|
|
67
|
+
vList = sample(vertices, 3)
|
|
68
|
+
result = Vertex.AreCollinear(vList)
|
|
69
|
+
end = time.time()
|
|
70
|
+
period = end - start
|
|
71
|
+
if result == True:
|
|
72
|
+
print("Wire.BoundingRectangle - Error: Could not find three vertices that are not colinear within 30 seconds. Returning None.")
|
|
73
|
+
return None
|
|
74
|
+
w = Wire.ByVertices(vList)
|
|
75
|
+
f = Face.ByWire(w)
|
|
76
|
+
f = Face.Flatten(f)
|
|
77
|
+
dictionary = Topology.Dictionary(f)
|
|
78
|
+
xTran = Dictionary.ValueAtKey(dictionary,"xTran")
|
|
67
79
|
yTran = Dictionary.ValueAtKey(dictionary,"yTran")
|
|
68
80
|
zTran = Dictionary.ValueAtKey(dictionary,"zTran")
|
|
69
81
|
phi = Dictionary.ValueAtKey(dictionary,"phi")
|
|
@@ -149,21 +161,14 @@ class Wire(topologic.Wire):
|
|
|
149
161
|
The created wire.
|
|
150
162
|
|
|
151
163
|
"""
|
|
164
|
+
from topologicpy.Cluster import Cluster
|
|
165
|
+
from topologicpy.Topology import Topology
|
|
152
166
|
if not isinstance(edges, list):
|
|
153
167
|
return None
|
|
154
168
|
edgeList = [x for x in edges if isinstance(x, topologic.Edge)]
|
|
155
169
|
if len(edgeList) < 1:
|
|
156
170
|
return None
|
|
157
|
-
wire =
|
|
158
|
-
for anEdge in edgeList:
|
|
159
|
-
if anEdge.Type() == 2:
|
|
160
|
-
if wire == None:
|
|
161
|
-
wire = topologic.Wire.ByEdges([anEdge])
|
|
162
|
-
else:
|
|
163
|
-
try:
|
|
164
|
-
wire = wire.Merge(anEdge)
|
|
165
|
-
except:
|
|
166
|
-
continue
|
|
171
|
+
wire = Topology.SelfMerge(Cluster.ByTopologies(edgeList))
|
|
167
172
|
if wire.Type() != 4:
|
|
168
173
|
wire = None
|
|
169
174
|
return wire
|
topologicpy/__init__.py
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: topologicpy
|
|
3
|
-
Version: 0.4.
|
|
3
|
+
Version: 0.4.38
|
|
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
|
Project-URL: Homepage, https://github.com/wassimj/TopologicPy
|
|
@@ -2,28 +2,28 @@ topologicpy/Aperture.py,sha256=kuplpOvicYMPDDghEREs3hZa8XvcWi5m4eJf9rVfI-o,1343
|
|
|
2
2
|
topologicpy/Cell.py,sha256=QEWgDcaqu4K6LpDxxMDeKNxqOh0tx72Aoa1Ux-z8lNQ,72885
|
|
3
3
|
topologicpy/CellComplex.py,sha256=b-JBSWJhIEvtxaT8JYj4DnHmJwt4EiqLFe2SpufYmFg,29478
|
|
4
4
|
topologicpy/Cluster.py,sha256=qkLwIHPJbTa4rFmRI-d6K9dq7HzcTZoL7ypHxwdKVzc,32569
|
|
5
|
-
topologicpy/Color.py,sha256=
|
|
5
|
+
topologicpy/Color.py,sha256=7ObLb4hxOOH6SyTCE-NRM5aBXd8KLBEJcM8fxDX3M88,9174
|
|
6
6
|
topologicpy/Context.py,sha256=cPxfxUScXcJVafSTnCTCNpRzBGSbu90D5i6uu26S5us,1643
|
|
7
7
|
topologicpy/DGL.py,sha256=F2pB1B3sjZwHU1nxJXCmu-xr3elk_inSCMfK6AE8mkE,131278
|
|
8
8
|
topologicpy/Dictionary.py,sha256=WKzY0laNMvUDQAWjkUeU6_jWYdYdK79cPWLHZK64SR8,18620
|
|
9
9
|
topologicpy/Edge.py,sha256=GS5N1a5MSkb2ZnGx0aGEbazPfJGGBiYV6UIvTr09edE,35603
|
|
10
10
|
topologicpy/EnergyModel.py,sha256=A-MlZ7gvOWcFRMP0QxodNSs9Shv9FLuWaSRTdNWGstk,50524
|
|
11
11
|
topologicpy/Face.py,sha256=u8fjAp8hYSSKZVS789cQlBDcM-_10FWd792LK7-57so,76074
|
|
12
|
-
topologicpy/Graph.py,sha256=
|
|
12
|
+
topologicpy/Graph.py,sha256=zhhv46bgj4-fMXmdip2wRW6rQZnl3M7OZfkhiFRQAoU,251120
|
|
13
13
|
topologicpy/Grid.py,sha256=rArW8J3vkhWt8dx9NDzCSyu4oMowUpsly7rEhsLPFII,16449
|
|
14
14
|
topologicpy/Helper.py,sha256=wpq9S2Bi11fcfY8SLHFi6TV4LXmO3pKeiIIKK460pj0,9465
|
|
15
15
|
topologicpy/Honeybee.py,sha256=Vy8e0Chv2EkzqyNcaK3y4QeSj89yY5pdbE8GZgVQyGw,19153
|
|
16
16
|
topologicpy/Matrix.py,sha256=GHd_o714eEWbTOhRM5X-fXcgsV5yYJJSj6xFdnkwC14,7625
|
|
17
17
|
topologicpy/Neo4j.py,sha256=EpfkjAQgoxYJjk7UvadBJxasTJbGjI8IEY8LthHMotI,18297
|
|
18
|
-
topologicpy/Plotly.py,sha256=
|
|
18
|
+
topologicpy/Plotly.py,sha256=ytCpr_F7-jfwYetv0LTA1rB7rO_oiN6ZeAP4J-W-x7I,91321
|
|
19
19
|
topologicpy/Polyskel.py,sha256=jz5k5H6p4QRWe3bbMnyYbP9Iji6EQ1wdk3qQvcnbg08,15156
|
|
20
|
-
topologicpy/Shell.py,sha256=
|
|
20
|
+
topologicpy/Shell.py,sha256=uQbuHYTOZ6Wfl4E_RBlsVyyBcy4AYxuJjw-XmgPLyJU,67832
|
|
21
21
|
topologicpy/Speckle.py,sha256=JBS2SW-KpV11XQON_aNwoBuyHdMNQlhcsaOEWqKUcp4,13959
|
|
22
|
-
topologicpy/Topology.py,sha256=
|
|
22
|
+
topologicpy/Topology.py,sha256=8WhqssjLaNGvnpm9ptywrSUYgRgBX13b_To52hv_VaM,256764
|
|
23
23
|
topologicpy/Vector.py,sha256=TE0Rt7SZ4NQD0YR3ty3crhb7BYbRws_UJ-lj2ihxPXU,17988
|
|
24
|
-
topologicpy/Vertex.py,sha256=
|
|
25
|
-
topologicpy/Wire.py,sha256=
|
|
26
|
-
topologicpy/__init__.py,sha256=
|
|
24
|
+
topologicpy/Vertex.py,sha256=c-MF4Fj2K-L1z5JbTP6GUXnhux4zF6CTUOM5HKLe8KI,34342
|
|
25
|
+
topologicpy/Wire.py,sha256=yiRKCax-4fd4SSMJOy-Jj4Da6opPKn5rCIpFPTX5C10,109015
|
|
26
|
+
topologicpy/__init__.py,sha256=0cPB6iiTHbBY1ZFTyixoUYvEw9llzLEKLhAFd47m1DY,662
|
|
27
27
|
topologicpy/bin/linux/topologic/__init__.py,sha256=qdj8gyp_GtYre27ZdFiVdLzLViOgX62woBZLTy9K91c,58
|
|
28
28
|
topologicpy/bin/linux/topologic/topologic.cpython-310-x86_64-linux-gnu.so,sha256=uvar01STZ8qu1c8fRmtYdVnK8evxBv305QScASXY9go,1852112
|
|
29
29
|
topologicpy/bin/linux/topologic/topologic.cpython-311-x86_64-linux-gnu.so,sha256=42yjVWetFu_qn6-eZcDxgd_A8SQN_wHqkdw91txKt9U,1852112
|
|
@@ -66,8 +66,8 @@ topologicpy/bin/windows/topologic/topologic.cp310-win_amd64.pyd,sha256=F0sPLuMpD
|
|
|
66
66
|
topologicpy/bin/windows/topologic/topologic.cp311-win_amd64.pyd,sha256=aBAJQj3OmJ58MOAF1ZIFybL_5fFK7FNR9hrIps6b6pc,1551872
|
|
67
67
|
topologicpy/bin/windows/topologic/topologic.cp38-win_amd64.pyd,sha256=aLgNf54nbJmGc7Tdmkuy-V0m6B9zLxabIbpRwAy7cBA,1551360
|
|
68
68
|
topologicpy/bin/windows/topologic/topologic.cp39-win_amd64.pyd,sha256=_8cp205hiRxkFHtzQQOweA4DhCPk8caH4kTVLWGQeVw,1411584
|
|
69
|
-
topologicpy-0.4.
|
|
70
|
-
topologicpy-0.4.
|
|
71
|
-
topologicpy-0.4.
|
|
72
|
-
topologicpy-0.4.
|
|
73
|
-
topologicpy-0.4.
|
|
69
|
+
topologicpy-0.4.38.dist-info/LICENSE,sha256=RUmXeeqj63bBySLJjEfhwb9OE7M8h9K6HuOBF3ASVyI,35697
|
|
70
|
+
topologicpy-0.4.38.dist-info/METADATA,sha256=SiOBjtu6NY-6q9S7-tijvCABIh4-SgskBtQqkV7iM94,6973
|
|
71
|
+
topologicpy-0.4.38.dist-info/WHEEL,sha256=5sUXSg9e4bi7lTLOHcm6QEYwO5TIF1TNbTSVFVjcJcc,92
|
|
72
|
+
topologicpy-0.4.38.dist-info/top_level.txt,sha256=J30bDzW92Ob7hw3zA8V34Jlp-vvsfIkGzkr8sqvb4Uw,12
|
|
73
|
+
topologicpy-0.4.38.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|