topologicpy 0.8.26__py3-none-any.whl → 0.8.29__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 +38 -6
- topologicpy/Graph.py +198 -0
- topologicpy/Grid.py +16 -12
- topologicpy/Plotly.py +12 -7
- topologicpy/ShapeGrammar.py +492 -0
- topologicpy/Shell.py +36 -0
- topologicpy/Topology.py +301 -251
- topologicpy/Vertex.py +95 -0
- topologicpy/version.py +1 -1
- {topologicpy-0.8.26.dist-info → topologicpy-0.8.29.dist-info}/METADATA +1 -1
- {topologicpy-0.8.26.dist-info → topologicpy-0.8.29.dist-info}/RECORD +14 -13
- {topologicpy-0.8.26.dist-info → topologicpy-0.8.29.dist-info}/WHEEL +1 -1
- {topologicpy-0.8.26.dist-info → topologicpy-0.8.29.dist-info}/licenses/LICENSE +0 -0
- {topologicpy-0.8.26.dist-info → topologicpy-0.8.29.dist-info}/top_level.txt +0 -0
topologicpy/Vertex.py
CHANGED
@@ -152,6 +152,50 @@ class Vertex():
|
|
152
152
|
return False
|
153
153
|
return True
|
154
154
|
|
155
|
+
@staticmethod
|
156
|
+
def AreCoplanar(vertices: list, mantissa: int = 6, tolerance: float = 0.0001, silent: bool = False) -> bool:
|
157
|
+
"""
|
158
|
+
Returns True if the input list of vertices are coplanar. Returns False otherwise.
|
159
|
+
|
160
|
+
Parameters
|
161
|
+
----------
|
162
|
+
vertices : list
|
163
|
+
The input list of vertices.
|
164
|
+
mantissa : int , optional
|
165
|
+
The desired length of the mantissa. The default is 6.
|
166
|
+
tolerance : float , optional
|
167
|
+
The desired tolerance. The default is 0.0001
|
168
|
+
silent : bool , optional
|
169
|
+
If set to True, no warnings or errors are printed. The default is False.
|
170
|
+
|
171
|
+
Returns
|
172
|
+
-------
|
173
|
+
bool
|
174
|
+
True if the input vertices are coplanar.
|
175
|
+
|
176
|
+
"""
|
177
|
+
from topologicpy.Topology import Topology
|
178
|
+
from numpy.linalg import svd
|
179
|
+
|
180
|
+
if not isinstance(vertices, list):
|
181
|
+
if not silent:
|
182
|
+
print("Vertex.Normal - Error: The vertices input parameter is not a valid list. Returning None.")
|
183
|
+
return None
|
184
|
+
|
185
|
+
verts = [v for v in vertices if Topology.IsInstance(v, "vertex")]
|
186
|
+
|
187
|
+
if len(verts) < 3:
|
188
|
+
if not silent:
|
189
|
+
print("Vertex.AreCoplanar - Error: The list of vertices contains less than 3 valid topologic vertices. Returning None.")
|
190
|
+
return None # At least 3 vertices are needed
|
191
|
+
|
192
|
+
coords = np.array([Vertex.Coordinates(v, mantissa=mantissa) for v in vertices])
|
193
|
+
|
194
|
+
# Check if points are coplanar using SVD
|
195
|
+
_, s, vh = svd(coords - coords.mean(axis=0))
|
196
|
+
rank = (s > tolerance).sum()
|
197
|
+
return (rank <= 2)
|
198
|
+
|
155
199
|
@staticmethod
|
156
200
|
def AreIpsilateral(vertices: list, face) -> bool:
|
157
201
|
"""
|
@@ -1453,6 +1497,57 @@ class Vertex():
|
|
1453
1497
|
sorted_indices = [x for _, x in sorted(zip(distances, indices))]
|
1454
1498
|
return vertices[sorted_indices[0]]
|
1455
1499
|
|
1500
|
+
@staticmethod
|
1501
|
+
def Normal(vertices, mantissa: int = 6, tolerance: float = 0.0001, silent: bool = False):
|
1502
|
+
"""
|
1503
|
+
Computes the normal vector of a list of co-planar Topologic vertices.
|
1504
|
+
Depending on the order of the vertices, the normal can be flipped 180 degrees.
|
1505
|
+
|
1506
|
+
Parameters
|
1507
|
+
----------
|
1508
|
+
vertices : list
|
1509
|
+
A list of Topologic Vertex objects that are assumed to be co-planar.
|
1510
|
+
mantissa : int, optional
|
1511
|
+
The desired length of the mantissa. The default is 6.
|
1512
|
+
tolerance : float, optional
|
1513
|
+
The desired tolerance. The default is 0.0001.
|
1514
|
+
silent : bool , optional
|
1515
|
+
If set to True no warnings or errors are printed. The default is False.
|
1516
|
+
|
1517
|
+
Returns
|
1518
|
+
-------
|
1519
|
+
list
|
1520
|
+
A unit normal vector [x, y, z] of the plane defined by the vertices, or None if invalid.
|
1521
|
+
"""
|
1522
|
+
from topologicpy.Vertex import Vertex
|
1523
|
+
from topologicpy.Topology import Topology
|
1524
|
+
import numpy as np
|
1525
|
+
|
1526
|
+
if not isinstance(vertices, list):
|
1527
|
+
if not silent:
|
1528
|
+
print("Vertex.Normal - Error: The vertices input parameter is not a valid list. Returning None.")
|
1529
|
+
return None
|
1530
|
+
|
1531
|
+
verts = [v for v in vertices if Topology.IsInstance(v, "vertex")]
|
1532
|
+
|
1533
|
+
if len(verts) < 3:
|
1534
|
+
if not silent:
|
1535
|
+
print("Vertex.Normal - Error: The list of vertices contains less than 3 valid topologic vertices. Returning None.")
|
1536
|
+
return None # At least 3 vertices are needed
|
1537
|
+
|
1538
|
+
coords = np.array([Vertex.Coordinates(v, mantissa=mantissa) for v in verts])
|
1539
|
+
centroid = np.mean(coords, axis=0)
|
1540
|
+
centered = coords - centroid
|
1541
|
+
|
1542
|
+
# Use SVD to find the normal as the vector corresponding to the smallest singular value
|
1543
|
+
_, _, vh = np.linalg.svd(centered)
|
1544
|
+
normal = vh[-1] # The last row is the normal of the best-fit plane
|
1545
|
+
|
1546
|
+
norm = np.linalg.norm(normal)
|
1547
|
+
if norm < tolerance:
|
1548
|
+
return None # Degenerate normal
|
1549
|
+
return list(np.round(normal / norm, mantissa))
|
1550
|
+
|
1456
1551
|
@staticmethod
|
1457
1552
|
def Origin():
|
1458
1553
|
"""
|
topologicpy/version.py
CHANGED
@@ -1 +1 @@
|
|
1
|
-
__version__ = '0.8.
|
1
|
+
__version__ = '0.8.29'
|
@@ -1,6 +1,6 @@
|
|
1
1
|
Metadata-Version: 2.4
|
2
2
|
Name: topologicpy
|
3
|
-
Version: 0.8.
|
3
|
+
Version: 0.8.29
|
4
4
|
Summary: An AI-Powered Spatial Modelling and Analysis Software Library for Architecture, Engineering, and Construction.
|
5
5
|
Author-email: Wassim Jabi <wassim.jabi@gmail.com>
|
6
6
|
License: AGPL v3 License
|
@@ -11,27 +11,28 @@ topologicpy/DGL.py,sha256=HQXy9iDnrvWGDxaBfe5pRbweQ2zLBvAf6UdjfhKkQYI,139041
|
|
11
11
|
topologicpy/Dictionary.py,sha256=Lf24WHW8q_RCq0l8VpT3XJTn6UuStY66JI4Lb4W08jI,34126
|
12
12
|
topologicpy/Edge.py,sha256=pu4tZbRbK8qx2oqRbwHAeKuwU2X8JFGPSJjJMTJw8Q0,71418
|
13
13
|
topologicpy/EnergyModel.py,sha256=Pyb28gDDwhzlQIH0xqAygqS0P3SJxWyyV7OWS_AAfRs,53856
|
14
|
-
topologicpy/Face.py,sha256=
|
15
|
-
topologicpy/Graph.py,sha256=
|
16
|
-
topologicpy/Grid.py,sha256=
|
14
|
+
topologicpy/Face.py,sha256=E1ffqvCNDWKFnFiDrEu70KWPGMGjtD3SoIxu4Yokn_I,186106
|
15
|
+
topologicpy/Graph.py,sha256=t_2lHDUdQHsG-PYVjeRZtqfjKv6eD8jI8ZJl9uQW_GU,574360
|
16
|
+
topologicpy/Grid.py,sha256=EbI2NcYhQDpD5mItd7A1Lpr8Puuf87vZPWuoh7_gChQ,18483
|
17
17
|
topologicpy/Helper.py,sha256=JdvC30WMrla46mTj5TdwCV_bRv-6y8vK5Bkx0prluy4,29100
|
18
18
|
topologicpy/Honeybee.py,sha256=yctkwfdupKnp7bAOjP1Z4YaYpRrWoMEb4gz9Z5zaWwE,21751
|
19
19
|
topologicpy/Matrix.py,sha256=BHGDRkBn1pf5DkRoY8feAhDGHTF3bjFM4jluiEb_A0w,22779
|
20
20
|
topologicpy/Neo4j.py,sha256=vNMaqTWerwr-3luLjYEXNhf8T97aFee6x5sIKBHY73s,22392
|
21
|
-
topologicpy/Plotly.py,sha256=
|
21
|
+
topologicpy/Plotly.py,sha256=FIFahDnWhvbQ--VJjy3lQGl5735w8hDzZNrVkCkpZFE,119455
|
22
22
|
topologicpy/Polyskel.py,sha256=oVfM4lqSMPTjnkHfsRU9VI8Blt6Vf0LVPkD9ebz7Wmw,27082
|
23
23
|
topologicpy/PyG.py,sha256=zvV6jtnol_aFiN6JRoMpYwBVfOU2aFs9gdWSdEo6mtU,109757
|
24
|
-
topologicpy/
|
24
|
+
topologicpy/ShapeGrammar.py,sha256=JwE__VcKum5X3r33WwToEWtpJdFuhzZYyNhU2ob15ss,21194
|
25
|
+
topologicpy/Shell.py,sha256=h8S2nP1e0JtMxeOdAFZVhOYTJWTW8vlZRM5lxK0gu2o,89577
|
25
26
|
topologicpy/Speckle.py,sha256=-eiTqJugd7pHiHpD3pDUcDO6CGhVyPV14HFRzaqEoaw,18187
|
26
27
|
topologicpy/Sun.py,sha256=_VBBAUIDhvpkp72JBZlv7k9qx9jYubm3yM56UZ1Nc6c,36837
|
27
|
-
topologicpy/Topology.py,sha256=
|
28
|
+
topologicpy/Topology.py,sha256=UN1BnwS4G0DN5oLb6rLFUHEPxTj7PR6KzH-AnJQ0NHQ,478331
|
28
29
|
topologicpy/Vector.py,sha256=mx7fgABdioikPWM9HzXKzmqfx3u_XBcU_jlLD4qK2x8,42407
|
29
|
-
topologicpy/Vertex.py,sha256=
|
30
|
+
topologicpy/Vertex.py,sha256=UMDhERrLH6b4WOu4pl0UgYzcfp9-NvmASLtKXwetO_4,84687
|
30
31
|
topologicpy/Wire.py,sha256=eRs4PM7h4yU5v6umPh0oBJR4cN8BwsqlVroaFdnvK4w,228499
|
31
32
|
topologicpy/__init__.py,sha256=RMftibjgAnHB1vdL-muo71RwMS4972JCxHuRHOlU428,928
|
32
|
-
topologicpy/version.py,sha256=
|
33
|
-
topologicpy-0.8.
|
34
|
-
topologicpy-0.8.
|
35
|
-
topologicpy-0.8.
|
36
|
-
topologicpy-0.8.
|
37
|
-
topologicpy-0.8.
|
33
|
+
topologicpy/version.py,sha256=c72Y0CCfU5Qgxq7demxoD7bRlDWidTBPnLUByhWGtHU,23
|
34
|
+
topologicpy-0.8.29.dist-info/licenses/LICENSE,sha256=FK0vJ73LuE8PYJAn7LutsReWR47-Ooovw2dnRe5yV6Q,681
|
35
|
+
topologicpy-0.8.29.dist-info/METADATA,sha256=ahE6eaRHVYotJtOLSidVqD3l81GOrkKbBhlSnJauDsk,10535
|
36
|
+
topologicpy-0.8.29.dist-info/WHEEL,sha256=Nw36Djuh_5VDukK0H78QzOX-_FQEo6V37m3nkm96gtU,91
|
37
|
+
topologicpy-0.8.29.dist-info/top_level.txt,sha256=J30bDzW92Ob7hw3zA8V34Jlp-vvsfIkGzkr8sqvb4Uw,12
|
38
|
+
topologicpy-0.8.29.dist-info/RECORD,,
|
File without changes
|
File without changes
|