topologicpy 0.5.3__py3-none-any.whl → 0.5.4__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/Cell.py +112 -112
- topologicpy/CellComplex.py +15 -15
- topologicpy/Cluster.py +3 -3
- topologicpy/Color.py +10 -10
- topologicpy/Edge.py +12 -9
- topologicpy/Face.py +32 -30
- topologicpy/Graph.py +29 -29
- topologicpy/Grid.py +9 -9
- topologicpy/Plotly.py +29 -29
- topologicpy/Shell.py +42 -43
- topologicpy/Speckle.py +1 -1
- topologicpy/Topology.py +58 -62
- topologicpy/Vector.py +36 -36
- topologicpy/Vertex.py +12 -12
- topologicpy/Wire.py +80 -76
- topologicpy/__init__.py +1 -1
- {topologicpy-0.5.3.dist-info → topologicpy-0.5.4.dist-info}/METADATA +1 -1
- {topologicpy-0.5.3.dist-info → topologicpy-0.5.4.dist-info}/RECORD +21 -21
- {topologicpy-0.5.3.dist-info → topologicpy-0.5.4.dist-info}/LICENSE +0 -0
- {topologicpy-0.5.3.dist-info → topologicpy-0.5.4.dist-info}/WHEEL +0 -0
- {topologicpy-0.5.3.dist-info → topologicpy-0.5.4.dist-info}/top_level.txt +0 -0
topologicpy/Shell.py
CHANGED
@@ -177,8 +177,8 @@ class Shell(Topology):
|
|
177
177
|
used = []
|
178
178
|
for v in vertices:
|
179
179
|
for w in vertices:
|
180
|
-
if not Topology.IsSame(v,w) and not w in used:
|
181
|
-
if Vertex.Distance(v,w) < threshold:
|
180
|
+
if not Topology.IsSame(v, w) and not w in used:
|
181
|
+
if Vertex.Distance(v, w) < threshold:
|
182
182
|
centers.append(v)
|
183
183
|
used.append(w)
|
184
184
|
edges = Shell.Edges(shell)
|
@@ -445,14 +445,14 @@ class Shell(Topology):
|
|
445
445
|
return Shell.ByWires(wires, triangulate=triangulate, tolerance=tolerance, silent=silent)
|
446
446
|
|
447
447
|
@staticmethod
|
448
|
-
def Circle(origin: topologic.Vertex = None, radius: float = 0.5, sides: int = 32, fromAngle: float = 0.0, toAngle: float = 360.0, direction: list = [0,0,1], placement: str = "center", tolerance: float = 0.0001) -> topologic.Shell:
|
448
|
+
def Circle(origin: topologic.Vertex = None, radius: float = 0.5, sides: int = 32, fromAngle: float = 0.0, toAngle: float = 360.0, direction: list = [0, 0, 1], placement: str = "center", tolerance: float = 0.0001) -> topologic.Shell:
|
449
449
|
"""
|
450
450
|
Creates a circle.
|
451
451
|
|
452
452
|
Parameters
|
453
453
|
----------
|
454
454
|
origin : topologic.Vertex , optional
|
455
|
-
The location of the origin of the circle. The default is None which results in the circle being placed at (0,0,0).
|
455
|
+
The location of the origin of the circle. The default is None which results in the circle being placed at (0, 0, 0).
|
456
456
|
radius : float , optional
|
457
457
|
The radius of the circle. The default is 0.5.
|
458
458
|
sides : int , optional
|
@@ -462,7 +462,7 @@ class Shell(Topology):
|
|
462
462
|
toAngle : float , optional
|
463
463
|
The angle in degrees at which to end creating the arc of the circle. The default is 360.
|
464
464
|
direction : list , optional
|
465
|
-
The vector representing the up direction of the circle. The default is [0,0,1].
|
465
|
+
The vector representing the up direction of the circle. The default is [0, 0, 1].
|
466
466
|
placement : str , optional
|
467
467
|
The description of the placement of the origin of the pie. This can be "center", or "lowerleft". It is case insensitive. The default is "center".
|
468
468
|
tolerance : float , optional
|
@@ -511,7 +511,7 @@ class Shell(Topology):
|
|
511
511
|
if len(vertices) < 3:
|
512
512
|
return None
|
513
513
|
|
514
|
-
# Create a Vertex at the world's origin (0,0,0)
|
514
|
+
# Create a Vertex at the world's origin (0, 0, 0)
|
515
515
|
world_origin = Vertex.Origin()
|
516
516
|
|
517
517
|
if isinstance(face, topologic.Face):
|
@@ -677,28 +677,28 @@ class Shell(Topology):
|
|
677
677
|
|
678
678
|
@staticmethod
|
679
679
|
def HyperbolicParaboloidRectangularDomain(origin: topologic.Vertex = None, llVertex: topologic.Vertex = None, lrVertex: topologic.Vertex =None, ulVertex: topologic.Vertex =None, urVertex: topologic.Vertex = None,
|
680
|
-
uSides: int = 10, vSides: int = 10, direction: list = [0,0,1], placement: str = "center", tolerance: float = 0.0001) -> topologic.Shell:
|
680
|
+
uSides: int = 10, vSides: int = 10, direction: list = [0, 0, 1], placement: str = "center", tolerance: float = 0.0001) -> topologic.Shell:
|
681
681
|
"""
|
682
682
|
Creates a hyperbolic paraboloid with a rectangular domain.
|
683
683
|
|
684
684
|
Parameters
|
685
685
|
----------
|
686
686
|
origin : topologic.Vertex , optional
|
687
|
-
The origin of the hyperbolic parabolid. If set to None, it will be placed at the (0,0,0) origin. The default is None.
|
687
|
+
The origin of the hyperbolic parabolid. If set to None, it will be placed at the (0, 0, 0) origin. The default is None.
|
688
688
|
llVertex : topologic.Vertex , optional
|
689
|
-
The lower left corner of the hyperbolic parabolid. If set to None, it will be set to (-0.5
|
689
|
+
The lower left corner of the hyperbolic parabolid. If set to None, it will be set to (-0.5, -0.5, -0.5).
|
690
690
|
lrVertex : topologic.Vertex , optional
|
691
|
-
The lower right corner of the hyperbolic parabolid. If set to None, it will be set to (0.5
|
691
|
+
The lower right corner of the hyperbolic parabolid. If set to None, it will be set to (0.5, -0.5, 0.5).
|
692
692
|
ulVertex : topologic.Vertex , optional
|
693
|
-
The upper left corner of the hyperbolic parabolid. If set to None, it will be set to (-0.5,0.5,0.5).
|
693
|
+
The upper left corner of the hyperbolic parabolid. If set to None, it will be set to (-0.5, 0.5, 0.5).
|
694
694
|
urVertex : topologic.Vertex , optional
|
695
|
-
The upper right corner of the hyperbolic parabolid. If set to None, it will be set to (0.5,0.5
|
695
|
+
The upper right corner of the hyperbolic parabolid. If set to None, it will be set to (0.5, 0.5, -0.5).
|
696
696
|
uSides : int , optional
|
697
697
|
The number of segments along the X axis. The default is 10.
|
698
698
|
vSides : int , optional
|
699
699
|
The number of segments along the Y axis. The default is 10.
|
700
700
|
direction : list , optional
|
701
|
-
The vector representing the up direction of the hyperbolic parabolid. The default is [0,0,1].
|
701
|
+
The vector representing the up direction of the hyperbolic parabolid. The default is [0, 0, 1].
|
702
702
|
placement : str , optional
|
703
703
|
The description of the placement of the origin of the hyperbolic parabolid. This can be "center", "lowerleft", "bottom". It is case insensitive. The default is "center".
|
704
704
|
tolerance : float , optional
|
@@ -714,15 +714,15 @@ class Shell(Topology):
|
|
714
714
|
from topologicpy.Face import Face
|
715
715
|
from topologicpy.Topology import Topology
|
716
716
|
if not isinstance(origin, topologic.Vertex):
|
717
|
-
origin = Vertex.ByCoordinates(0,0,0)
|
717
|
+
origin = Vertex.ByCoordinates(0, 0, 0)
|
718
718
|
if not isinstance(llVertex, topologic.Vertex):
|
719
|
-
llVertex = Vertex.ByCoordinates(-0.5
|
719
|
+
llVertex = Vertex.ByCoordinates(-0.5, -0.5, -0.5)
|
720
720
|
if not isinstance(lrVertex, topologic.Vertex):
|
721
|
-
lrVertex = Vertex.ByCoordinates(0.5
|
721
|
+
lrVertex = Vertex.ByCoordinates(0.5, -0.5, 0.5)
|
722
722
|
if not isinstance(ulVertex, topologic.Vertex):
|
723
|
-
ulVertex = Vertex.ByCoordinates(-0.5,0.5,0.5)
|
723
|
+
ulVertex = Vertex.ByCoordinates(-0.5, 0.5, 0.5)
|
724
724
|
if not isinstance(urVertex, topologic.Vertex):
|
725
|
-
urVertex = Vertex.ByCoordinates(0.5,0.5
|
725
|
+
urVertex = Vertex.ByCoordinates(0.5, 0.5, -0.5)
|
726
726
|
e1 = Edge.ByVertices([llVertex, lrVertex], tolerance=tolerance)
|
727
727
|
e3 = Edge.ByVertices([urVertex, ulVertex], tolerance=tolerance)
|
728
728
|
edges = []
|
@@ -765,12 +765,12 @@ class Shell(Topology):
|
|
765
765
|
zOffset = -(minZ + (maxZ - minZ)*0.5)
|
766
766
|
returnTopology = Topology.Translate(returnTopology, xOffset, yOffset, zOffset)
|
767
767
|
returnTopology = Topology.Place(returnTopology, originA=Vertex.Origin(), originB=origin)
|
768
|
-
returnTopology = Topology.Orient(returnTopology, origin=origin, dirA=[0,0,1], dirB=direction)
|
768
|
+
returnTopology = Topology.Orient(returnTopology, origin=origin, dirA=[0, 0, 1], dirB=direction)
|
769
769
|
return returnTopology
|
770
770
|
|
771
771
|
@staticmethod
|
772
772
|
def HyperbolicParaboloidCircularDomain(origin: topologic.Vertex = None, radius: float = 0.5, sides: int = 36, rings: int = 10,
|
773
|
-
A: float = 2.0, B: float = -2.0, direction: list = [0,0,1],
|
773
|
+
A: float = 2.0, B: float = -2.0, direction: list = [0, 0, 1],
|
774
774
|
placement: str = "center", tolerance: float = 0.0001) -> topologic.Shell:
|
775
775
|
"""
|
776
776
|
Creates a hyperbolic paraboloid with a circular domain. See https://en.wikipedia.org/wiki/Compactness_measure_of_a_shape
|
@@ -778,7 +778,7 @@ class Shell(Topology):
|
|
778
778
|
Parameters
|
779
779
|
----------
|
780
780
|
origin : topologic.Vertex , optional
|
781
|
-
The origin of the hyperbolic parabolid. If set to None, it will be placed at the (0,0,0) origin. The default is None.
|
781
|
+
The origin of the hyperbolic parabolid. If set to None, it will be placed at the (0, 0, 0) origin. The default is None.
|
782
782
|
radius : float , optional
|
783
783
|
The desired radius of the hyperbolic paraboloid. The default is 0.5.
|
784
784
|
sides : int , optional
|
@@ -790,7 +790,7 @@ class Shell(Topology):
|
|
790
790
|
B : float , optional
|
791
791
|
The *B* constant in the equation z = A*x^2^ + B*y^2^. The default is -2.0.
|
792
792
|
direction : list , optional
|
793
|
-
The vector representing the up direction of the hyperbolic paraboloid. The default is [0,0,1.
|
793
|
+
The vector representing the up direction of the hyperbolic paraboloid. The default is [0, 0, 1].
|
794
794
|
placement : str , optional
|
795
795
|
The description of the placement of the origin of the circle. This can be "center", "lowerleft", "bottom". It is case insensitive. The default is "center".
|
796
796
|
tolerance : float , optional
|
@@ -805,7 +805,7 @@ class Shell(Topology):
|
|
805
805
|
from topologicpy.Face import Face
|
806
806
|
from topologicpy.Topology import Topology
|
807
807
|
if not isinstance(origin, topologic.Vertex):
|
808
|
-
origin = Vertex.ByCoordinates(0,0,0)
|
808
|
+
origin = Vertex.ByCoordinates(0, 0, 0)
|
809
809
|
uOffset = float(360)/float(sides)
|
810
810
|
vOffset = float(radius)/float(rings)
|
811
811
|
faces = []
|
@@ -925,7 +925,7 @@ class Shell(Topology):
|
|
925
925
|
zOffset = -(minZ + (maxZ - minZ)*0.5)
|
926
926
|
returnTopology = Topology.Translate(returnTopology, xOffset, yOffset, zOffset)
|
927
927
|
returnTopology = Topology.Place(returnTopology, originA=Vertex.Origin(), originB=origin)
|
928
|
-
returnTopology = Topology.Orient(returnTopology, origin=origin, dirA=[0,0,1], dirB=direction)
|
928
|
+
returnTopology = Topology.Orient(returnTopology, origin=origin, dirA=[0, 0, 1], dirB=direction)
|
929
929
|
return returnTopology
|
930
930
|
|
931
931
|
@staticmethod
|
@@ -980,14 +980,14 @@ class Shell(Topology):
|
|
980
980
|
return shell.IsClosed()
|
981
981
|
|
982
982
|
@staticmethod
|
983
|
-
def Pie(origin: topologic.Vertex = None, radiusA: float = 0.5, radiusB: float = 0.0, sides: int = 32, rings: int = 1, fromAngle: float = 0.0, toAngle: float = 360.0, direction: list = [0,0,1], placement: str = "center", tolerance: float = 0.0001) -> topologic.Shell:
|
983
|
+
def Pie(origin: topologic.Vertex = None, radiusA: float = 0.5, radiusB: float = 0.0, sides: int = 32, rings: int = 1, fromAngle: float = 0.0, toAngle: float = 360.0, direction: list = [0, 0, 1], placement: str = "center", tolerance: float = 0.0001) -> topologic.Shell:
|
984
984
|
"""
|
985
985
|
Creates a pie shape.
|
986
986
|
|
987
987
|
Parameters
|
988
988
|
----------
|
989
989
|
origin : topologic.Vertex , optional
|
990
|
-
The location of the origin of the pie. The default is None which results in the pie being placed at (0,0,0).
|
990
|
+
The location of the origin of the pie. The default is None which results in the pie being placed at (0, 0, 0).
|
991
991
|
radiusA : float , optional
|
992
992
|
The outer radius of the pie. The default is 0.5.
|
993
993
|
radiusB : float , optional
|
@@ -1001,7 +1001,7 @@ class Shell(Topology):
|
|
1001
1001
|
toAngle : float , optional
|
1002
1002
|
The angle in degrees at which to end creating the arc of the pie. The default is 360.
|
1003
1003
|
direction : list , optional
|
1004
|
-
The vector representing the up direction of the pie. The default is [0,0,1].
|
1004
|
+
The vector representing the up direction of the pie. The default is [0, 0, 1].
|
1005
1005
|
placement : str , optional
|
1006
1006
|
The description of the placement of the origin of the pie. This can be "center", or "lowerleft". It is case insensitive. The default is "center".
|
1007
1007
|
tolerance : float , optional
|
@@ -1017,7 +1017,7 @@ class Shell(Topology):
|
|
1017
1017
|
from topologicpy.Face import Face
|
1018
1018
|
from topologicpy.Topology import Topology
|
1019
1019
|
if not origin:
|
1020
|
-
origin = Vertex.ByCoordinates(0,0,0)
|
1020
|
+
origin = Vertex.ByCoordinates(0, 0, 0)
|
1021
1021
|
if not isinstance(origin, topologic.Vertex):
|
1022
1022
|
return None
|
1023
1023
|
if toAngle < fromAngle:
|
@@ -1100,7 +1100,7 @@ class Shell(Topology):
|
|
1100
1100
|
return None
|
1101
1101
|
shell = Topology.Translate(shell, xOffset, yOffset, zOffset)
|
1102
1102
|
shell = Topology.Place(shell, originA=Vertex.Origin(), originB=origin)
|
1103
|
-
shell = Topology.Orient(shell, origin=origin, dirA=[0,0,1], dirB=direction)
|
1103
|
+
shell = Topology.Orient(shell, origin=origin, dirA=[0, 0, 1], dirB=direction)
|
1104
1104
|
return shell
|
1105
1105
|
|
1106
1106
|
|
@@ -1151,7 +1151,7 @@ class Shell(Topology):
|
|
1151
1151
|
|
1152
1152
|
@staticmethod
|
1153
1153
|
def Rectangle(origin: topologic.Vertex = None, width: float = 1.0, length: float = 1.0,
|
1154
|
-
uSides: int = 2, vSides: int = 2, direction: list = [0,0,1],
|
1154
|
+
uSides: int = 2, vSides: int = 2, direction: list = [0, 0, 1],
|
1155
1155
|
placement: str = "center", tolerance: float = 0.0001) -> topologic.Shell:
|
1156
1156
|
"""
|
1157
1157
|
Creates a rectangle.
|
@@ -1159,7 +1159,7 @@ class Shell(Topology):
|
|
1159
1159
|
Parameters
|
1160
1160
|
----------
|
1161
1161
|
origin : topologic.Vertex , optional
|
1162
|
-
The location of the origin of the rectangle. The default is None which results in the rectangle being placed at (0,0,0).
|
1162
|
+
The location of the origin of the rectangle. The default is None which results in the rectangle being placed at (0, 0, 0).
|
1163
1163
|
width : float , optional
|
1164
1164
|
The width of the rectangle. The default is 1.0.
|
1165
1165
|
length : float , optional
|
@@ -1169,7 +1169,7 @@ class Shell(Topology):
|
|
1169
1169
|
vSides : int , optional
|
1170
1170
|
The number of sides along the length. The default is 2.
|
1171
1171
|
direction : list , optional
|
1172
|
-
The vector representing the up direction of the rectangle. The default is [0,0,1].
|
1172
|
+
The vector representing the up direction of the rectangle. The default is [0, 0, 1].
|
1173
1173
|
placement : str , optional
|
1174
1174
|
The description of the placement of the origin of the rectangle. This can be "center", or "lowerleft". It is case insensitive. The default is "center".
|
1175
1175
|
tolerance : float , optional
|
@@ -1185,7 +1185,7 @@ class Shell(Topology):
|
|
1185
1185
|
from topologicpy.Wire import Wire
|
1186
1186
|
from topologicpy.Face import Face
|
1187
1187
|
if not origin:
|
1188
|
-
origin = Vertex.ByCoordinates(0,0,0)
|
1188
|
+
origin = Vertex.ByCoordinates(0, 0, 0)
|
1189
1189
|
if not isinstance(origin, topologic.Vertex):
|
1190
1190
|
return None
|
1191
1191
|
uOffset = float(width)/float(uSides)
|
@@ -1200,12 +1200,12 @@ class Shell(Topology):
|
|
1200
1200
|
for i in range(uSides):
|
1201
1201
|
for j in range(vSides):
|
1202
1202
|
rOrigin = Vertex.ByCoordinates(i*uOffset - wOffset, j*vOffset - lOffset, 0)
|
1203
|
-
w = Wire.Rectangle(origin=rOrigin, width=uOffset, length=vOffset, direction=[0,0,1], placement="lowerleft", tolerance=tolerance)
|
1203
|
+
w = Wire.Rectangle(origin=rOrigin, width=uOffset, length=vOffset, direction=[0, 0, 1], placement="lowerleft", tolerance=tolerance)
|
1204
1204
|
f = Face.ByWire(w, tolerance=tolerance)
|
1205
1205
|
faces.append(f)
|
1206
1206
|
shell = Shell.ByFaces(faces, tolerance=tolerance)
|
1207
1207
|
shell = Topology.Place(shell, originA=Vertex.Origin(), originB=origin)
|
1208
|
-
shell = Topology.Orient(shell, origin=origin, dirA=[0,0,1], dirB=direction)
|
1208
|
+
shell = Topology.Orient(shell, origin=origin, dirA=[0, 0, 1], dirB=direction)
|
1209
1209
|
return shell
|
1210
1210
|
|
1211
1211
|
@staticmethod
|
@@ -1240,7 +1240,7 @@ class Shell(Topology):
|
|
1240
1240
|
return Shell.ByFaces(clean_faces, tolerance=tolerance)
|
1241
1241
|
|
1242
1242
|
@staticmethod
|
1243
|
-
def Roof(face,
|
1243
|
+
def Roof(face, angle: float = 45, epsilon: float = 0.01, tolerance: float = 0.001):
|
1244
1244
|
"""
|
1245
1245
|
Creates a hipped roof through a straight skeleton. This method is contributed by 高熙鹏 xipeng gao <gaoxipeng1998@gmail.com>
|
1246
1246
|
This algorithm depends on the polyskel code which is included in the library. Polyskel code is found at: https://github.com/Botffy/polyskel
|
@@ -1249,7 +1249,7 @@ class Shell(Topology):
|
|
1249
1249
|
----------
|
1250
1250
|
face : topologic.Face
|
1251
1251
|
The input face.
|
1252
|
-
|
1252
|
+
angle : float , optioal
|
1253
1253
|
The desired angle in degrees of the roof. The default is 45.
|
1254
1254
|
epsilon : float , optional
|
1255
1255
|
The desired epsilon (another form of tolerance for distance from plane). The default is 0.01. (This is set to a larger number as it was found to work better)
|
@@ -1284,15 +1284,15 @@ class Shell(Topology):
|
|
1284
1284
|
|
1285
1285
|
if not isinstance(face, topologic.Face):
|
1286
1286
|
return None
|
1287
|
-
|
1288
|
-
if
|
1287
|
+
angle = abs(angle)
|
1288
|
+
if angle >= 90-tolerance:
|
1289
1289
|
return None
|
1290
|
-
if
|
1290
|
+
if angle < tolerance:
|
1291
1291
|
return None
|
1292
1292
|
origin = Topology.Centroid(face)
|
1293
1293
|
normal = Face.Normal(face)
|
1294
1294
|
flat_face = Topology.Flatten(face, origin=origin, direction=normal)
|
1295
|
-
roof = Wire.Roof(flat_face,
|
1295
|
+
roof = Wire.Roof(flat_face, angle=angle, tolerance=tolerance)
|
1296
1296
|
if not roof:
|
1297
1297
|
return None
|
1298
1298
|
shell = Shell.Skeleton(flat_face, tolerance=tolerance)
|
@@ -1342,7 +1342,6 @@ class Shell(Topology):
|
|
1342
1342
|
shell = Topology.RemoveCoplanarFaces(shell, epsilon=epsilon, tolerance=tolerance)
|
1343
1343
|
except:
|
1344
1344
|
pass
|
1345
|
-
#shell = Topology.Unflatten(shell, origin=origin, direction=normal)
|
1346
1345
|
return shell
|
1347
1346
|
|
1348
1347
|
@staticmethod
|
@@ -1724,7 +1723,7 @@ class Shell(Topology):
|
|
1724
1723
|
tempWire = []
|
1725
1724
|
if len(region) > 1 and not -1 in region:
|
1726
1725
|
for v in region:
|
1727
|
-
tempWire.append(Vertex.ByCoordinates(voronoiVertices[v].X(), voronoiVertices[v].Y(),0))
|
1726
|
+
tempWire.append(Vertex.ByCoordinates(voronoiVertices[v].X(), voronoiVertices[v].Y(), 0))
|
1728
1727
|
temp_verts = []
|
1729
1728
|
for v in tempWire:
|
1730
1729
|
if len(temp_verts) == 0:
|
topologicpy/Speckle.py
CHANGED
@@ -32,7 +32,7 @@ class Speckle:
|
|
32
32
|
return b
|
33
33
|
|
34
34
|
@staticmethod
|
35
|
-
def mesh_to_speckle_mesh(topology, mantissa: int=6) -> Mesh:
|
35
|
+
def mesh_to_speckle_mesh(topology, mantissa: int = 6) -> Mesh:
|
36
36
|
|
37
37
|
geom = Topology.Geometry(topology, mantissa=mantissa)
|
38
38
|
vertices = geom['vertices']
|