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/Topology.py
CHANGED
@@ -1044,7 +1044,7 @@ class Topology():
|
|
1044
1044
|
if diff1 == None:
|
1045
1045
|
return topologyA
|
1046
1046
|
else:
|
1047
|
-
return Topology.Difference(topologyA,diff1)
|
1047
|
+
return Topology.Difference(topologyA, diff1)
|
1048
1048
|
elif isinstance(topologyB, topologic.CellComplex):
|
1049
1049
|
cells = Topology.Cells(topologyB)
|
1050
1050
|
intersections = []
|
@@ -1373,7 +1373,7 @@ class Topology():
|
|
1373
1373
|
@staticmethod
|
1374
1374
|
def BoundingBox(topology, optimize=0, axes="xyz", tolerance=0.0001):
|
1375
1375
|
"""
|
1376
|
-
Returns a cell representing a bounding box of the input topology. The returned cell contains a dictionary with keys "xrot", "yrot", and "zrot" that represents rotations around the X,Y, and Z axes. If applied in the order of Z,Y,
|
1376
|
+
Returns a cell representing a bounding box of the input topology. The returned cell contains a dictionary with keys "xrot", "yrot", and "zrot" that represents rotations around the X, Y, and Z axes. If applied in the order of Z, Y, X, the resulting box will become axis-aligned.
|
1377
1377
|
|
1378
1378
|
Parameters
|
1379
1379
|
----------
|
@@ -1451,7 +1451,7 @@ class Topology():
|
|
1451
1451
|
if optimize > 0:
|
1452
1452
|
factor = (round(((11 - optimize)/30 + 0.57), 2))
|
1453
1453
|
flag = False
|
1454
|
-
for n in range(10,0
|
1454
|
+
for n in range(10, 0, -1):
|
1455
1455
|
if flag:
|
1456
1456
|
break
|
1457
1457
|
if x_flag:
|
@@ -1487,9 +1487,9 @@ class Topology():
|
|
1487
1487
|
for z in range(za,zb,zc):
|
1488
1488
|
if flag:
|
1489
1489
|
break
|
1490
|
-
t = Topology.Rotate(topology, origin=origin,
|
1491
|
-
t = Topology.Rotate(t, origin=origin,
|
1492
|
-
t = Topology.Rotate(t, origin=origin,
|
1490
|
+
t = Topology.Rotate(topology, origin=origin, axis=[0, 0, 1], angle=z)
|
1491
|
+
t = Topology.Rotate(t, origin=origin, axis=[0, 1, 0], angle=y)
|
1492
|
+
t = Topology.Rotate(t, origin=origin, axis=[1, 0, 0], angle=x)
|
1493
1493
|
minX, minY, minZ, maxX, maxY, maxZ = bb(t)
|
1494
1494
|
w = abs(maxX - minX)
|
1495
1495
|
l = abs(maxY - minY)
|
@@ -1525,9 +1525,9 @@ class Topology():
|
|
1525
1525
|
box = baseFace
|
1526
1526
|
else:
|
1527
1527
|
box = Cell.ByThickenedFace(baseFace, planarize=False, thickness=abs(maxZ-minZ), bothSides=False)
|
1528
|
-
box = Topology.Rotate(box, origin=origin,
|
1529
|
-
box = Topology.Rotate(box, origin=origin,
|
1530
|
-
box = Topology.Rotate(box, origin=origin,
|
1528
|
+
box = Topology.Rotate(box, origin=origin, axis=[1, 0, 0], angle=-best_x)
|
1529
|
+
box = Topology.Rotate(box, origin=origin, axis=[0, 1, 0], angle=-best_y)
|
1530
|
+
box = Topology.Rotate(box, origin=origin, axis=[0, 0, 1], angle=-best_z)
|
1531
1531
|
dictionary = Dictionary.ByKeysValues(["xrot","yrot","zrot", "minx", "miny", "minz", "maxx", "maxy", "maxz", "width", "length", "height"], [best_x, best_y, best_z, minX, minY, minZ, maxX, maxY, maxZ, (maxX-minX), (maxY-minY), (maxZ-minZ)])
|
1532
1532
|
box = Topology.SetDictionary(box, dictionary)
|
1533
1533
|
return box
|
@@ -1564,7 +1564,7 @@ class Topology():
|
|
1564
1564
|
return st
|
1565
1565
|
|
1566
1566
|
@staticmethod
|
1567
|
-
def ByGeometry(vertices=[], edges=[], faces=[], color=[1.0,1.0,1.0,1.0], id=None, name=None, lengthUnit="METERS", outputMode="default", tolerance=0.0001):
|
1567
|
+
def ByGeometry(vertices=[], edges=[], faces=[], color=[1.0, 1.0, 1.0, 1.0], id=None, name=None, lengthUnit="METERS", outputMode="default", tolerance=0.0001):
|
1568
1568
|
"""
|
1569
1569
|
Create a topology by the input lists of vertices, edges, and faces.
|
1570
1570
|
|
@@ -1717,7 +1717,7 @@ class Topology():
|
|
1717
1717
|
color = list(color[0])
|
1718
1718
|
values.append(color)
|
1719
1719
|
else:
|
1720
|
-
values.append([1.0,1.0,1.0,1.0])
|
1720
|
+
values.append([1.0, 1.0, 1.0, 1.0])
|
1721
1721
|
if id:
|
1722
1722
|
values.append(id)
|
1723
1723
|
else:
|
@@ -1834,7 +1834,7 @@ class Topology():
|
|
1834
1834
|
keys = []
|
1835
1835
|
values = []
|
1836
1836
|
keys.append("TOPOLOGIC_color")
|
1837
|
-
values.append([1.0,1.0,1.0,1.0])
|
1837
|
+
values.append([1.0, 1.0, 1.0, 1.0])
|
1838
1838
|
keys.append("TOPOLOGIC_id")
|
1839
1839
|
values.append(str(uuid.uuid4()))
|
1840
1840
|
keys.append("TOPOLOGIC_name")
|
@@ -2062,7 +2062,7 @@ class Topology():
|
|
2062
2062
|
def buildVertex(json_item):
|
2063
2063
|
x, y, z = json_item['coordinates']
|
2064
2064
|
d = json_item['dictionary']
|
2065
|
-
v = Vertex.ByCoordinates(x,y,z)
|
2065
|
+
v = Vertex.ByCoordinates(x, y, z)
|
2066
2066
|
if v == None:
|
2067
2067
|
print("Topology.ByJSONString - Error: Could not build a vertex. Returning None.")
|
2068
2068
|
return None
|
@@ -2510,7 +2510,7 @@ class Topology():
|
|
2510
2510
|
if vertices or faces:
|
2511
2511
|
topology = Topology.ByGeometry(vertices = vertices, faces = faces, outputMode="default", tolerance=tolerance)
|
2512
2512
|
if transposeAxes == True:
|
2513
|
-
topology = Topology.Rotate(topology, Vertex.Origin(), 1,0,0,90)
|
2513
|
+
topology = Topology.Rotate(topology, origin=Vertex.Origin(), axis=[1, 0, 0], angle=90)
|
2514
2514
|
return Topology.SelfMerge(topology)
|
2515
2515
|
print("Topology.ByOBJString - Error: Could not find vertices or faces. Returning None.")
|
2516
2516
|
return None
|
@@ -2916,7 +2916,7 @@ class Topology():
|
|
2916
2916
|
for i in range(len(matrix)):
|
2917
2917
|
for j in range(len(matrix)):
|
2918
2918
|
if collinear(samples[i], samples[j], tol):
|
2919
|
-
matrix[i,j] = 1
|
2919
|
+
matrix[i, j] = 1
|
2920
2920
|
return matrix
|
2921
2921
|
|
2922
2922
|
def determineRow(matrix):
|
@@ -2959,8 +2959,8 @@ class Topology():
|
|
2959
2959
|
|
2960
2960
|
def deleteChosenRowsAndCols(matrix, indexes):
|
2961
2961
|
for i in indexes:
|
2962
|
-
matrix[i
|
2963
|
-
matrix[:,i] = 0
|
2962
|
+
matrix[i, :] = 0
|
2963
|
+
matrix[:, i] = 0
|
2964
2964
|
return matrix
|
2965
2965
|
if not isinstance(topology, topologic.Topology):
|
2966
2966
|
print("Topology.ClusterFaces - Error: the input topology parameter is not a valid topology. Returning None.")
|
@@ -4119,7 +4119,7 @@ class Topology():
|
|
4119
4119
|
return {"filtered": filteredTopologies, "other": otherTopologies}
|
4120
4120
|
|
4121
4121
|
@staticmethod
|
4122
|
-
def Flatten(topology, origin=None, direction=[0,0,1]):
|
4122
|
+
def Flatten(topology, origin=None, direction=[0, 0, 1]):
|
4123
4123
|
"""
|
4124
4124
|
Flattens the input topology such that the input origin is located at the world origin and the input topology is rotated such that the input vector is pointed in the Up direction (see Vector.Up()).
|
4125
4125
|
|
@@ -4192,7 +4192,7 @@ class Topology():
|
|
4192
4192
|
|
4193
4193
|
def triangulateFace(face):
|
4194
4194
|
faceTriangles = []
|
4195
|
-
for i in range(0,5,1):
|
4195
|
+
for i in range(0, 5, 1):
|
4196
4196
|
try:
|
4197
4197
|
_ = topologic.FaceUtility.Triangulate(face, float(i)*0.1, faceTriangles)
|
4198
4198
|
return faceTriangles
|
@@ -4395,7 +4395,7 @@ class Topology():
|
|
4395
4395
|
b = a2 * c1 - a1 * c2
|
4396
4396
|
c = a1 * b2 - b1 * a2
|
4397
4397
|
d = (- a * v1.X() - b * v1.Y() - c * v1.Z())
|
4398
|
-
return [a,b,c,d]
|
4398
|
+
return [a, b, c, d]
|
4399
4399
|
|
4400
4400
|
if not isinstance(topology, topologic.Topology):
|
4401
4401
|
print("Topology.IsPlanar - Error: the input topology parameter is not a valid topology. Returning None.")
|
@@ -4625,7 +4625,7 @@ class Topology():
|
|
4625
4625
|
return [v for v in Topology.SubTopologies(topology, subTopologyType="vertex") if Topology.Degree(v, hostTopology=topology) < 2]
|
4626
4626
|
|
4627
4627
|
@staticmethod
|
4628
|
-
def Orient(topology, origin=None, dirA=[0,0,1], dirB=[0,0,1], tolerance=0.0001):
|
4628
|
+
def Orient(topology, origin=None, dirA=[0, 0, 1], dirB=[0, 0, 1], tolerance=0.0001):
|
4629
4629
|
"""
|
4630
4630
|
Orients the input topology such that the input such that the input dirA vector is parallel to the input dirB vector.
|
4631
4631
|
|
@@ -4636,9 +4636,9 @@ class Topology():
|
|
4636
4636
|
origin : topologic.Vertex , optional
|
4637
4637
|
The input origin. If set to None, The object's centroid will be used to locate the input topology. The default is None.
|
4638
4638
|
dirA : list , optional
|
4639
|
-
The first input direction vector. The input topology will be rotated such that this vector is parallel to the input dirB vector. The default is [0,0,1].
|
4639
|
+
The first input direction vector. The input topology will be rotated such that this vector is parallel to the input dirB vector. The default is [0, 0, 1].
|
4640
4640
|
dirB : list , optional
|
4641
|
-
The target direction vector. The input topology will be rotated such that the input dirA vector is parallel to this vector. The default is [0,0,1].
|
4641
|
+
The target direction vector. The input topology will be rotated such that the input dirA vector is parallel to this vector. The default is [0, 0, 1].
|
4642
4642
|
tolerance : float , optional
|
4643
4643
|
The desired tolerance. The default is 0.0001
|
4644
4644
|
|
@@ -4673,7 +4673,7 @@ class Topology():
|
|
4673
4673
|
originA : topologic.Vertex , optional
|
4674
4674
|
The old location to use as the origin of the movement. If set to None, the centroid of the input topology is used. The default is None.
|
4675
4675
|
originB : topologic.Vertex , optional
|
4676
|
-
The new location at which to place the topology. If set to None, the world origin (0,0,0) is used. The default is None.
|
4676
|
+
The new location at which to place the topology. If set to None, the world origin (0, 0, 0) is used. The default is None.
|
4677
4677
|
|
4678
4678
|
Returns
|
4679
4679
|
-------
|
@@ -4687,7 +4687,7 @@ class Topology():
|
|
4687
4687
|
if not isinstance(originA, topologic.Vertex):
|
4688
4688
|
originA = Topology.Centroid(topology)
|
4689
4689
|
if not isinstance(originA, topologic.Vertex):
|
4690
|
-
originA = Vertex.ByCoordinates(0,0,0)
|
4690
|
+
originA = Vertex.ByCoordinates(0, 0, 0)
|
4691
4691
|
|
4692
4692
|
x = originB.X() - originA.X()
|
4693
4693
|
y = originB.Y() - originA.Y()
|
@@ -5164,7 +5164,7 @@ class Topology():
|
|
5164
5164
|
return new_topology
|
5165
5165
|
|
5166
5166
|
@staticmethod
|
5167
|
-
def Rotate(topology, origin=None,
|
5167
|
+
def Rotate(topology, origin=None, axis: list = [0, 0, 1], angle: float = 0, angTolerance: float =0.001, tolerance: float =0.0001):
|
5168
5168
|
"""
|
5169
5169
|
Rotates the input topology
|
5170
5170
|
|
@@ -5173,14 +5173,10 @@ class Topology():
|
|
5173
5173
|
topology : topologic.Topology
|
5174
5174
|
The input topology.
|
5175
5175
|
origin : topologic.Vertex , optional
|
5176
|
-
The origin (center) of the rotation. If set to None, the world origin (0,0,0) is used. The default is None.
|
5177
|
-
|
5178
|
-
The
|
5179
|
-
|
5180
|
-
The 'y' component of the rotation axis. The default is 0.
|
5181
|
-
z : float , optional
|
5182
|
-
The 'z' component of the rotation axis. The default is 0.
|
5183
|
-
degree : float , optional
|
5176
|
+
The origin (center) of the rotation. If set to None, the world origin (0, 0, 0) is used. The default is None.
|
5177
|
+
axis : list , optional
|
5178
|
+
The vector representing the axis of rotation. The default is [0, 0, 1] which equates to the Z axis.
|
5179
|
+
angle : float , optional
|
5184
5180
|
The angle of rotation in degrees. The default is 0.
|
5185
5181
|
angTolerance : float , optional
|
5186
5182
|
The angle tolerance in degrees under which no rotation is carried out. The default is 0.001 degrees.
|
@@ -5224,22 +5220,22 @@ class Topology():
|
|
5224
5220
|
print("Topology.Rotate - Error: The input topology parameter is not a valid topologic topology. Returning None.")
|
5225
5221
|
return None
|
5226
5222
|
if not origin:
|
5227
|
-
origin = Vertex.ByCoordinates(0,0,0)
|
5223
|
+
origin = Vertex.ByCoordinates(0, 0, 0)
|
5228
5224
|
if not isinstance(origin, topologic.Vertex):
|
5229
5225
|
print("Topology.Rotate - Error: The input origin parameter is not a valid topologic vertex. Returning None.")
|
5230
5226
|
return None
|
5231
5227
|
returnTopology = topology
|
5232
|
-
if abs(
|
5228
|
+
if abs(angle) >= angTolerance:
|
5233
5229
|
try:
|
5234
|
-
|
5230
|
+
x, y, z = axis
|
5231
|
+
returnTopology = topologic.TopologyUtility.Rotate(topology, origin, x, y, z, angle)
|
5235
5232
|
except:
|
5236
5233
|
print("Topology.Rotate - Warning: (topologic.TopologyUtility.Rotate) operation failed. Trying a workaround.")
|
5237
5234
|
vertices = [Vertex.Coordinates(v) for v in Topology.Vertices(topology)]
|
5238
|
-
axis = [x,y,z]
|
5239
5235
|
origin = Vertex.Coordinates(origin)
|
5240
5236
|
rot_vertices = []
|
5241
5237
|
for v in vertices:
|
5242
|
-
rot_vertices.append(rotate_vertex_3d(v, axis,
|
5238
|
+
rot_vertices.append(rotate_vertex_3d(v, axis, angle, origin))
|
5243
5239
|
rot_vertices = [Vertex.ByCoordinates(rot_v) for rot_v in rot_vertices]
|
5244
5240
|
new_topology = Topology.ReplaceVertices(topology, verticesA=Topology.Vertices(topology), verticesB=rot_vertices)
|
5245
5241
|
new_topology = Topology.SelfMerge(new_topology, tolerance=tolerance)
|
@@ -5256,7 +5252,7 @@ class Topology():
|
|
5256
5252
|
topology : topologic.Topology
|
5257
5253
|
The input topology.
|
5258
5254
|
origin : topologic.Vertex , optional
|
5259
|
-
The origin (center) of the scaling. If set to None, the world origin (0,0,0) is used. The default is None.
|
5255
|
+
The origin (center) of the scaling. If set to None, the world origin (0, 0, 0) is used. The default is None.
|
5260
5256
|
x : float , optional
|
5261
5257
|
The 'x' component of the scaling factor. The default is 1.
|
5262
5258
|
y : float , optional
|
@@ -5274,7 +5270,7 @@ class Topology():
|
|
5274
5270
|
if not isinstance(topology, topologic.Topology):
|
5275
5271
|
return None
|
5276
5272
|
if not origin:
|
5277
|
-
origin = Vertex.ByCoordinates(0,0,0)
|
5273
|
+
origin = Vertex.ByCoordinates(0, 0, 0)
|
5278
5274
|
if not isinstance(origin, topologic.Vertex):
|
5279
5275
|
return None
|
5280
5276
|
newTopology = None
|
@@ -5808,11 +5804,11 @@ class Topology():
|
|
5808
5804
|
marginBottom : int , optional
|
5809
5805
|
The size in pixels of the bottom margin. The default value is 0.
|
5810
5806
|
camera : list , optional
|
5811
|
-
The desired location of the camera). The default is [-1.25
|
5807
|
+
The desired location of the camera). The default is [-1.25, -1.25, 1.25].
|
5812
5808
|
center : list , optional
|
5813
|
-
The desired center (camera target). The default is [0,0,0].
|
5809
|
+
The desired center (camera target). The default is [0, 0, 0].
|
5814
5810
|
up : list , optional
|
5815
|
-
The desired up vector. The default is [0,0,1].
|
5811
|
+
The desired up vector. The default is [0, 0, 1].
|
5816
5812
|
projection : str , optional
|
5817
5813
|
The desired type of projection. The options are "orthographic" or "perspective". It is case insensitive. The default is "perspective"
|
5818
5814
|
renderer : str , optional
|
@@ -5999,8 +5995,8 @@ class Topology():
|
|
5999
5995
|
return snapshots
|
6000
5996
|
|
6001
5997
|
@staticmethod
|
6002
|
-
def Spin(topology, origin=None, triangulate=True, direction=[0,0,1],
|
6003
|
-
tolerance=0.0001, silent=False):
|
5998
|
+
def Spin(topology, origin=None, triangulate: bool = True, direction: list = [0, 0, 1], angle: float = 360, sides: int = 16,
|
5999
|
+
tolerance: float = 0.0001, silent: bool = False):
|
6004
6000
|
"""
|
6005
6001
|
Spins the input topology around an axis to create a new topology.See https://en.wikipedia.org/wiki/Solid_of_revolution.
|
6006
6002
|
|
@@ -6013,8 +6009,8 @@ class Topology():
|
|
6013
6009
|
triangulate : bool , optional
|
6014
6010
|
If set to True, the result will be triangulated. The default is True.
|
6015
6011
|
direction : list , optional
|
6016
|
-
The vector representing the direction of the spin axis. The default is [0,0,1].
|
6017
|
-
|
6012
|
+
The vector representing the direction of the spin axis. The default is [0, 0, 1].
|
6013
|
+
angle : float , optional
|
6018
6014
|
The angle in degrees for the spin. The default is 360.
|
6019
6015
|
sides : int , optional
|
6020
6016
|
The desired number of sides. The default is 16.
|
@@ -6035,7 +6031,7 @@ class Topology():
|
|
6035
6031
|
from topologicpy.Cluster import Cluster
|
6036
6032
|
|
6037
6033
|
if not origin:
|
6038
|
-
origin = Vertex.ByCoordinates(0,0,0)
|
6034
|
+
origin = Vertex.ByCoordinates(0, 0, 0)
|
6039
6035
|
if not isinstance(topology, topologic.Topology):
|
6040
6036
|
if not silent:
|
6041
6037
|
print("Topology.Spin - Error: the input topology parameter is not a valid topology. Returning None.")
|
@@ -6045,9 +6041,9 @@ class Topology():
|
|
6045
6041
|
print("Topology.Spin - Error: the input origin parameter is not a valid vertex. Returning None.")
|
6046
6042
|
return None
|
6047
6043
|
topologies = []
|
6048
|
-
unit_degree =
|
6044
|
+
unit_degree = angle / float(sides)
|
6049
6045
|
for i in range(sides+1):
|
6050
|
-
tempTopology = Topology.Rotate(topology, origin, direction
|
6046
|
+
tempTopology = Topology.Rotate(topology, origin=origin, axis=direction, angle=unit_degree*i)
|
6051
6047
|
if tempTopology:
|
6052
6048
|
topologies.append(tempTopology)
|
6053
6049
|
returnTopology = None
|
@@ -6120,7 +6116,7 @@ class Topology():
|
|
6120
6116
|
return returnTopology
|
6121
6117
|
|
6122
6118
|
@staticmethod
|
6123
|
-
def Taper(topology, origin=None, ratioRange=[0,1], triangulate=False, tolerance=0.0001):
|
6119
|
+
def Taper(topology, origin=None, ratioRange=[0, 1], triangulate=False, tolerance=0.0001):
|
6124
6120
|
"""
|
6125
6121
|
Tapers the input topology. This method tapers the input geometry along its Z-axis based on the ratio range input.
|
6126
6122
|
|
@@ -6145,9 +6141,9 @@ class Topology():
|
|
6145
6141
|
"""
|
6146
6142
|
from topologicpy.Vertex import Vertex
|
6147
6143
|
ratioRange = [min(1,ratioRange[0]), min(1,ratioRange[1])]
|
6148
|
-
if ratioRange == [0,0]:
|
6144
|
+
if ratioRange == [0, 0]:
|
6149
6145
|
return topology
|
6150
|
-
if ratioRange == [1,1]:
|
6146
|
+
if ratioRange == [1, 1]:
|
6151
6147
|
print("Topology.Taper - Error: Degenerate result. Returning original topology.")
|
6152
6148
|
return topology
|
6153
6149
|
if triangulate == True:
|
@@ -6176,7 +6172,7 @@ class Topology():
|
|
6176
6172
|
return return_topology
|
6177
6173
|
|
6178
6174
|
@staticmethod
|
6179
|
-
def Twist(topology, origin=None,
|
6175
|
+
def Twist(topology, origin=None, angleRange=[45, 90], triangulate=False):
|
6180
6176
|
"""
|
6181
6177
|
Twists the input topology. This method twists the input geometry along its Z-axis based on the degree range input.
|
6182
6178
|
|
@@ -6186,7 +6182,7 @@ class Topology():
|
|
6186
6182
|
The input topology.
|
6187
6183
|
origin : topologic.Vertex , optional
|
6188
6184
|
The desired origin for tapering. If not specified, the centroid of the input topology is used. The tapering will use the X, Y coordinates of the specified origin, but will use the Z of the point being tapered. The default is None.
|
6189
|
-
|
6185
|
+
angleRange : list , optional
|
6190
6186
|
The desired angle range in degrees. This will specify a linear range from bottom to top for twisting the vertices. positive numbers mean a clockwise rotation.
|
6191
6187
|
triangulate : bool , optional
|
6192
6188
|
If set to true, the input topology is triangulated before tapering. Otherwise, it will not be traingulated. The default is False.
|
@@ -6199,7 +6195,7 @@ class Topology():
|
|
6199
6195
|
"""
|
6200
6196
|
from topologicpy.Vertex import Vertex
|
6201
6197
|
|
6202
|
-
if
|
6198
|
+
if angleRange == [0, 0]:
|
6203
6199
|
return topology
|
6204
6200
|
if triangulate == True:
|
6205
6201
|
topology = Topology.Triangulate(topology)
|
@@ -6214,15 +6210,15 @@ class Topology():
|
|
6214
6210
|
new_vertices = []
|
6215
6211
|
for v in vertices:
|
6216
6212
|
ht = (Vertex.Z(v)-minZ)/(maxZ - minZ)
|
6217
|
-
new_rot =
|
6213
|
+
new_rot = angleRange[0] + ht*(angleRange[1] - angleRange[0])
|
6218
6214
|
orig = Vertex.ByCoordinates(Vertex.X(origin), Vertex.Y(origin), Vertex.Z(v))
|
6219
|
-
new_vertices.append(Topology.Rotate(v, origin=orig,
|
6215
|
+
new_vertices.append(Topology.Rotate(v, origin=orig, axis=[0, 0, 1], angle=new_rot))
|
6220
6216
|
return_topology = Topology.ReplaceVertices(topology, vertices, new_vertices)
|
6221
6217
|
return_topology = Topology.Fix(return_topology, topologyType=Topology.TypeAsString(topology))
|
6222
6218
|
return return_topology
|
6223
6219
|
|
6224
6220
|
@staticmethod
|
6225
|
-
def Unflatten(topology, origin=None, direction=[0,0,1]):
|
6221
|
+
def Unflatten(topology, origin=None, direction=[0, 0, 1]):
|
6226
6222
|
"""
|
6227
6223
|
Unflattens the input topology such that the world origin is translated to the input origin and the input topology is rotated such that the Up direction (see Vector.Up()) is aligned with the input vector.
|
6228
6224
|
|
@@ -6738,7 +6734,7 @@ class Topology():
|
|
6738
6734
|
return topology
|
6739
6735
|
|
6740
6736
|
@staticmethod
|
6741
|
-
def TranslateByDirectionDistance(topology, direction=[0,0,0], distance=0):
|
6737
|
+
def TranslateByDirectionDistance(topology, direction: list = [0, 0, 0], distance: float = 0):
|
6742
6738
|
"""
|
6743
6739
|
Translates (moves) the input topology along the input direction by the specified distance.
|
6744
6740
|
|
@@ -6747,7 +6743,7 @@ class Topology():
|
|
6747
6743
|
topology : topologic.topology
|
6748
6744
|
The input topology.
|
6749
6745
|
direction : list , optional
|
6750
|
-
The direction vector in which the topology should be moved. The default is [0,0,0]
|
6746
|
+
The direction vector in which the topology should be moved. The default is [0, 0, 0]
|
6751
6747
|
distance : float , optional
|
6752
6748
|
The distance by which the toplogy should be moved. The default is 0.
|
6753
6749
|
|
topologicpy/Vector.py
CHANGED
@@ -112,7 +112,7 @@ class Vector(list):
|
|
112
112
|
@staticmethod
|
113
113
|
def AzimuthAltitude(vector, mantissa: int = 6):
|
114
114
|
"""
|
115
|
-
Returns a dictionary of azimuth and altitude angles in degrees for the input vector. North is assumed to be the positive Y axis [0,1,0]. Up is assumed to be the positive Z axis [0,0,1].
|
115
|
+
Returns a dictionary of azimuth and altitude angles in degrees for the input vector. North is assumed to be the positive Y axis [0, 1, 0]. Up is assumed to be the positive Z axis [0, 0, 1].
|
116
116
|
Azimuth is calculated in a counter-clockwise fashion from North where 0 is North, 90 is East, 180 is South, and 270 is West. Altitude is calculated in a counter-clockwise fashing where -90 is straight down (negative Z axis), 0 is in the XY plane, and 90 is straight up (positive Z axis).
|
117
117
|
If the altitude is -90 or 90, the azimuth is assumed to be 0.
|
118
118
|
|
@@ -218,9 +218,9 @@ class Vector(list):
|
|
218
218
|
from topologicpy.Vertex import Vertex
|
219
219
|
from topologicpy.Edge import Edge
|
220
220
|
from topologicpy.Topology import Topology
|
221
|
-
e = Edge.ByVertices([Vertex.Origin(), Vertex.ByCoordinates(0,1,0)], tolerance=tolerance)
|
222
|
-
e = Topology.Rotate(e, Vertex.Origin(), 1, 0, 0, altitude)
|
223
|
-
e = Topology.Rotate(e, Vertex.Origin(), 0, 0, 1,
|
221
|
+
e = Edge.ByVertices([Vertex.Origin(), Vertex.ByCoordinates(0, 1, 0)], tolerance=tolerance)
|
222
|
+
e = Topology.Rotate(e, origin=Vertex.Origin(), axis=[1, 0, 0], angle=altitude)
|
223
|
+
e = Topology.Rotate(e, origin=Vertex.Origin(), axis=[0, 0, 1], angle=-azimuth-north)
|
224
224
|
if reverse:
|
225
225
|
return Vector.Reverse(Edge.Direction(e))
|
226
226
|
return Edge.Direction(e)
|
@@ -245,7 +245,7 @@ class Vector(list):
|
|
245
245
|
The created vector.
|
246
246
|
|
247
247
|
"""
|
248
|
-
return [x,y,z]
|
248
|
+
return [x, y, z]
|
249
249
|
|
250
250
|
@staticmethod
|
251
251
|
def ByVertices(vertices, normalize=True):
|
@@ -341,10 +341,10 @@ class Vector(list):
|
|
341
341
|
x = round(vector[0], mantissa)
|
342
342
|
y = round(vector[1], mantissa)
|
343
343
|
z = round(vector[2], mantissa)
|
344
|
-
matrix = [[1,0,0,x],
|
345
|
-
[0,1,0,y],
|
346
|
-
[0,0,1,z],
|
347
|
-
[0,0,0,1]]
|
344
|
+
matrix = [[1, 0, 0, x],
|
345
|
+
[0, 1, 0, y],
|
346
|
+
[0, 0, 1, z],
|
347
|
+
[0, 0, 0, 1]]
|
348
348
|
output = []
|
349
349
|
outputType = outputType.lower()
|
350
350
|
if outputType == "matrix":
|
@@ -390,32 +390,32 @@ class Vector(list):
|
|
390
390
|
vecB = np.array(vectorB)
|
391
391
|
vecC = list(np.cross(vecA, vecB))
|
392
392
|
if Vector.Magnitude(vecC) < tolerance:
|
393
|
-
return [0,0,0]
|
393
|
+
return [0, 0, 0]
|
394
394
|
return [round(vecC[0], mantissa), round(vecC[1], mantissa), round(vecC[2], mantissa)]
|
395
395
|
|
396
396
|
@staticmethod
|
397
397
|
def Down():
|
398
398
|
"""
|
399
|
-
Returns the vector representing the *down* direction. In Topologic, the negative ZAxis direction is considered *down* ([0,0
|
399
|
+
Returns the vector representing the *down* direction. In Topologic, the negative ZAxis direction is considered *down* ([0, 0, -1]).
|
400
400
|
|
401
401
|
Returns
|
402
402
|
-------
|
403
403
|
list
|
404
404
|
The vector representing the *down* direction.
|
405
405
|
"""
|
406
|
-
return [0,0
|
406
|
+
return [0, 0, -1]
|
407
407
|
|
408
408
|
@staticmethod
|
409
409
|
def East():
|
410
410
|
"""
|
411
|
-
Returns the vector representing the *east* direction. In Topologic, the positive XAxis direction is considered *east* ([1,0,0]).
|
411
|
+
Returns the vector representing the *east* direction. In Topologic, the positive XAxis direction is considered *east* ([1, 0, 0]).
|
412
412
|
|
413
413
|
Returns
|
414
414
|
-------
|
415
415
|
list
|
416
416
|
The vector representing the *east* direction.
|
417
417
|
"""
|
418
|
-
return [1,0,0]
|
418
|
+
return [1, 0, 0]
|
419
419
|
|
420
420
|
@staticmethod
|
421
421
|
def IsAntiParallel(vectorA, vectorB):
|
@@ -632,38 +632,38 @@ class Vector(list):
|
|
632
632
|
@staticmethod
|
633
633
|
def North():
|
634
634
|
"""
|
635
|
-
Returns the vector representing the *north* direction. In Topologic, the positive YAxis direction is considered *north* ([0,1,0]).
|
635
|
+
Returns the vector representing the *north* direction. In Topologic, the positive YAxis direction is considered *north* ([0, 1, 0]).
|
636
636
|
|
637
637
|
Returns
|
638
638
|
-------
|
639
639
|
list
|
640
640
|
The vector representing the *north* direction.
|
641
641
|
"""
|
642
|
-
return [0,1,0]
|
642
|
+
return [0, 1, 0]
|
643
643
|
|
644
644
|
@staticmethod
|
645
645
|
def NorthEast():
|
646
646
|
"""
|
647
|
-
Returns the vector representing the *northeast* direction. In Topologic, the positive YAxis direction is considered *north* and the positive XAxis direction is considered *east*. Therefore *northeast* is ([1,1,0]).
|
647
|
+
Returns the vector representing the *northeast* direction. In Topologic, the positive YAxis direction is considered *north* and the positive XAxis direction is considered *east*. Therefore *northeast* is ([1, 1, 0]).
|
648
648
|
|
649
649
|
Returns
|
650
650
|
-------
|
651
651
|
list
|
652
652
|
The vector representing the *northeast* direction.
|
653
653
|
"""
|
654
|
-
return [1,1,0]
|
654
|
+
return [1, 1, 0]
|
655
655
|
|
656
656
|
@staticmethod
|
657
657
|
def NorthWest():
|
658
658
|
"""
|
659
|
-
Returns the vector representing the *northwest* direction. In Topologic, the positive YAxis direction is considered *north* and the negative XAxis direction is considered *west*. Therefore *northwest* is ([-1,1,0]).
|
659
|
+
Returns the vector representing the *northwest* direction. In Topologic, the positive YAxis direction is considered *north* and the negative XAxis direction is considered *west*. Therefore *northwest* is ([-1, 1, 0]).
|
660
660
|
|
661
661
|
Returns
|
662
662
|
-------
|
663
663
|
list
|
664
664
|
The vector representing the *northwest* direction.
|
665
665
|
"""
|
666
|
-
return [-1,1,0]
|
666
|
+
return [-1, 1, 0]
|
667
667
|
|
668
668
|
@staticmethod
|
669
669
|
def Reverse(vector):
|
@@ -706,38 +706,38 @@ class Vector(list):
|
|
706
706
|
@staticmethod
|
707
707
|
def South():
|
708
708
|
"""
|
709
|
-
Returns the vector representing the *south* direction. In Topologic, the negative YAxis direction is considered *south* ([0
|
709
|
+
Returns the vector representing the *south* direction. In Topologic, the negative YAxis direction is considered *south* ([0, -1, 0]).
|
710
710
|
|
711
711
|
Returns
|
712
712
|
-------
|
713
713
|
list
|
714
714
|
The vector representing the *south* direction.
|
715
715
|
"""
|
716
|
-
return [0
|
716
|
+
return [0, -1, 0]
|
717
717
|
|
718
718
|
@staticmethod
|
719
719
|
def SouthEast():
|
720
720
|
"""
|
721
|
-
Returns the vector representing the *southeast* direction. In Topologic, the negative YAxis direction is considered *south* and the positive XAxis direction is considered *east*. Therefore *southeast* is ([1
|
721
|
+
Returns the vector representing the *southeast* direction. In Topologic, the negative YAxis direction is considered *south* and the positive XAxis direction is considered *east*. Therefore *southeast* is ([1, -1, 0]).
|
722
722
|
|
723
723
|
Returns
|
724
724
|
-------
|
725
725
|
list
|
726
726
|
The vector representing the *southeast* direction.
|
727
727
|
"""
|
728
|
-
return [1
|
728
|
+
return [1, -1, 0]
|
729
729
|
|
730
730
|
@staticmethod
|
731
731
|
def SouthWest():
|
732
732
|
"""
|
733
|
-
Returns the vector representing the *southwest* direction. In Topologic, the negative YAxis direction is considered *south* and the negative XAxis direction is considered *west*. Therefore *southwest* is ([-1
|
733
|
+
Returns the vector representing the *southwest* direction. In Topologic, the negative YAxis direction is considered *south* and the negative XAxis direction is considered *west*. Therefore *southwest* is ([-1, -1, 0]).
|
734
734
|
|
735
735
|
Returns
|
736
736
|
-------
|
737
737
|
list
|
738
738
|
The vector representing the *southwest* direction.
|
739
739
|
"""
|
740
|
-
return [-1
|
740
|
+
return [-1, -1, 0]
|
741
741
|
|
742
742
|
@staticmethod
|
743
743
|
def Sum(vectors: list):
|
@@ -847,59 +847,59 @@ class Vector(list):
|
|
847
847
|
@staticmethod
|
848
848
|
def Up():
|
849
849
|
"""
|
850
|
-
Returns the vector representing the up direction. In Topologic, the positive ZAxis direction is considered "up" ([0,0,1]).
|
850
|
+
Returns the vector representing the up direction. In Topologic, the positive ZAxis direction is considered "up" ([0, 0, 1]).
|
851
851
|
|
852
852
|
Returns
|
853
853
|
-------
|
854
854
|
list
|
855
855
|
The vector representing the "up" direction.
|
856
856
|
"""
|
857
|
-
return [0,0,1]
|
857
|
+
return [0, 0, 1]
|
858
858
|
|
859
859
|
@staticmethod
|
860
860
|
def West():
|
861
861
|
"""
|
862
|
-
Returns the vector representing the *west* direction. In Topologic, the negative XAxis direction is considered *west* ([-1,0,0]).
|
862
|
+
Returns the vector representing the *west* direction. In Topologic, the negative XAxis direction is considered *west* ([-1, 0, 0]).
|
863
863
|
|
864
864
|
Returns
|
865
865
|
-------
|
866
866
|
list
|
867
867
|
The vector representing the *west* direction.
|
868
868
|
"""
|
869
|
-
return [-1,0,0]
|
869
|
+
return [-1, 0, 0]
|
870
870
|
|
871
871
|
@staticmethod
|
872
872
|
def XAxis():
|
873
873
|
"""
|
874
|
-
Returns the vector representing the XAxis ([1,0,0])
|
874
|
+
Returns the vector representing the XAxis ([1, 0, 0])
|
875
875
|
|
876
876
|
Returns
|
877
877
|
-------
|
878
878
|
list
|
879
879
|
The vector representing the XAxis.
|
880
880
|
"""
|
881
|
-
return [1,0,0]
|
881
|
+
return [1, 0, 0]
|
882
882
|
|
883
883
|
@staticmethod
|
884
884
|
def YAxis():
|
885
885
|
"""
|
886
|
-
Returns the vector representing the YAxis ([0,1,0])
|
886
|
+
Returns the vector representing the YAxis ([0, 1, 0])
|
887
887
|
|
888
888
|
Returns
|
889
889
|
-------
|
890
890
|
list
|
891
891
|
The vector representing the YAxis.
|
892
892
|
"""
|
893
|
-
return [0,1,0]
|
893
|
+
return [0, 1, 0]
|
894
894
|
|
895
895
|
@staticmethod
|
896
896
|
def ZAxis():
|
897
897
|
"""
|
898
|
-
Returns the vector representing the ZAxis ([0,0,1])
|
898
|
+
Returns the vector representing the ZAxis ([0, 0, 1])
|
899
899
|
|
900
900
|
Returns
|
901
901
|
-------
|
902
902
|
list
|
903
903
|
The vector representing the ZAxis.
|
904
904
|
"""
|
905
|
-
return [0,0,1]
|
905
|
+
return [0, 0, 1]
|