topologicpy 0.7.5__py3-none-any.whl → 0.7.8__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 +62 -53
- topologicpy/CellComplex.py +10 -8
- topologicpy/Edge.py +21 -16
- topologicpy/EnergyModel.py +20 -13
- topologicpy/Face.py +23 -25
- topologicpy/Graph.py +385 -217
- topologicpy/Grid.py +23 -11
- topologicpy/Honeybee.py +16 -15
- topologicpy/Neo4j.py +22 -10
- topologicpy/Plotly.py +49 -62
- topologicpy/Shell.py +79 -54
- topologicpy/Topology.py +95 -50
- topologicpy/Vector.py +4 -2
- topologicpy/Vertex.py +64 -42
- topologicpy/Wire.py +23 -12
- topologicpy/version.py +1 -1
- {topologicpy-0.7.5.dist-info → topologicpy-0.7.8.dist-info}/METADATA +1 -1
- topologicpy-0.7.8.dist-info/RECORD +33 -0
- topologicpy-0.7.5.dist-info/RECORD +0 -33
- {topologicpy-0.7.5.dist-info → topologicpy-0.7.8.dist-info}/LICENSE +0 -0
- {topologicpy-0.7.5.dist-info → topologicpy-0.7.8.dist-info}/WHEEL +0 -0
- {topologicpy-0.7.5.dist-info → topologicpy-0.7.8.dist-info}/top_level.txt +0 -0
topologicpy/Grid.py
CHANGED
@@ -18,7 +18,7 @@ import topologic_core as topologic
|
|
18
18
|
|
19
19
|
class Grid():
|
20
20
|
@staticmethod
|
21
|
-
def EdgesByDistances(face=None, uOrigin=None, vOrigin=None, uRange=[-0.5,-0.25,0, 0.25,0.5], vRange=[-0.5,-0.25,0, 0.25,0.5], clip=False, tolerance=0.0001):
|
21
|
+
def EdgesByDistances(face=None, uOrigin=None, vOrigin=None, uRange=[-0.5,-0.25,0, 0.25,0.5], vRange=[-0.5,-0.25,0, 0.25,0.5], clip=False, mantissa: int = 6, tolerance=0.0001):
|
22
22
|
"""
|
23
23
|
Creates a grid (cluster of edges).
|
24
24
|
|
@@ -36,6 +36,8 @@ class Grid():
|
|
36
36
|
A list of distances for the *v* grid lines from the vOrigin. The default is [-0.5,-0.25,0, 0.25,0.5].
|
37
37
|
clip : bool , optional
|
38
38
|
If True the grid will be clipped by the shape of the input face. The default is False.
|
39
|
+
mantissa : int , optional
|
40
|
+
The desired length of the mantissa. The default is 6.
|
39
41
|
tolerance : float , optional
|
40
42
|
The desired tolerance. The default is 0.0001.
|
41
43
|
|
@@ -52,6 +54,7 @@ class Grid():
|
|
52
54
|
from topologicpy.Topology import Topology
|
53
55
|
from topologicpy.Dictionary import Dictionary
|
54
56
|
from topologicpy.Vector import Vector
|
57
|
+
|
55
58
|
if len(uRange) < 1 or len(vRange) < 1:
|
56
59
|
return None
|
57
60
|
if not uOrigin:
|
@@ -76,16 +79,16 @@ class Grid():
|
|
76
79
|
v3 = Vertex.ByCoordinates(0, 0, 0)
|
77
80
|
v4 = Vertex.ByCoordinates(0,max(vRange),0)
|
78
81
|
|
79
|
-
uVector = [
|
80
|
-
vVector = [
|
82
|
+
uVector = [Vertex.X(v2, mantissa=mantissa)-Vertex.X(v1, mantissa=mantissa), Vertex.Y(v2, mantissa=mantissa)-Vertex.Y(v1, mantissa=mantissa),Vertex.Z(v2, mantissa=mantissa)-Vertex.Z(v1, mantissa=mantissa)]
|
83
|
+
vVector = [Vertex.X(v4, mantissa=mantissa)-Vertex.X(v3, mantissa=mantissa), Vertex.Y(v4, mantissa=mantissa)-Vertex.Y(v3, mantissa=mantissa),Vertex.Z(v4, mantissa=mantissa)-Vertex.Z(v3, mantissa=mantissa)]
|
81
84
|
gridEdges = []
|
82
85
|
if len(uRange) > 0:
|
83
86
|
uRange.sort()
|
84
87
|
uuVector = Vector.Normalize(uVector)
|
85
88
|
for u in uRange:
|
86
89
|
tempVec = Vector.Multiply(uuVector, u, tolerance)
|
87
|
-
v1 = Vertex.ByCoordinates(
|
88
|
-
v2 = Vertex.ByCoordinates(
|
90
|
+
v1 = Vertex.ByCoordinates(Vertex.X(uOrigin, mantissa=mantissa)+tempVec[0], Vertex.Y(uOrigin, mantissa=mantissa)+tempVec[1], Vertex.Z(uOrigin, mantissa=mantissa)+tempVec[2])
|
91
|
+
v2 = Vertex.ByCoordinates(Vertex.X(v1, mantissa=mantissa)+vVector[0], Vertex.Y(v1, mantissa=mantissa)+vVector[1], Vertex.Z(v1, mantissa=mantissa)+vVector[2])
|
89
92
|
e = Edge.ByVertices([v1, v2], tolerance=tolerance)
|
90
93
|
if clip and Topology.IsInstance(face, "Face"):
|
91
94
|
e = e.Intersect(face, False)
|
@@ -105,8 +108,8 @@ class Grid():
|
|
105
108
|
uvVector = Vector.Normalize(vVector)
|
106
109
|
for v in vRange:
|
107
110
|
tempVec = Vector.Multiply(uvVector, v, tolerance)
|
108
|
-
v1 = Vertex.ByCoordinates(
|
109
|
-
v2 = Vertex.ByCoordinates(
|
111
|
+
v1 = Vertex.ByCoordinates(Vertex.X(vOrigin, mantissa=mantissa)+tempVec[0], Vertex.Y(vOrigin, mantissa=mantissa)+tempVec[1], Vertex.Z(vOrigin, mantissa=mantissa)+tempVec[2])
|
112
|
+
v2 = Vertex.ByCoordinates(Vertex.X(v1, mantissa=mantissa)+uVector[0], Vertex.Y(v1, mantissa=mantissa)+uVector[1], Vertex.Z(v1, mantissa=mantissa)+uVector[2])
|
110
113
|
e = Edge.ByVertices([v1, v2], tolerance=tolerance)
|
111
114
|
if clip and Topology.IsInstance(face, "Face"):
|
112
115
|
e = e.Intersect(face, False)
|
@@ -212,7 +215,13 @@ class Grid():
|
|
212
215
|
|
213
216
|
|
214
217
|
@staticmethod
|
215
|
-
def VerticesByDistances(face=None,
|
218
|
+
def VerticesByDistances(face=None,
|
219
|
+
origin=None,
|
220
|
+
uRange: list = [-0.5,-0.25,0, 0.25,0.5],
|
221
|
+
vRange: list = [-0.5,-0.25,0,0.25,0.5],
|
222
|
+
clip: bool = False,
|
223
|
+
mantissa: int = 6,
|
224
|
+
tolerance: float = 0.0001):
|
216
225
|
"""
|
217
226
|
Creates a grid (cluster of vertices).
|
218
227
|
|
@@ -228,6 +237,8 @@ class Grid():
|
|
228
237
|
A list of distances for the *v* grid lines from the vOrigin. The default is [-0.5,-0.25,0, 0.25,0.5].
|
229
238
|
clip : bool , optional
|
230
239
|
If True the grid will be clipped by the shape of the input face. The default is False.
|
240
|
+
mantissa : int , optional
|
241
|
+
The desired length of the mantissa. The default is 6.
|
231
242
|
tolerance : float , optional
|
232
243
|
The desired tolerance. The default is 0.0001.
|
233
244
|
|
@@ -244,6 +255,7 @@ class Grid():
|
|
244
255
|
from topologicpy.Topology import Topology
|
245
256
|
from topologicpy.Dictionary import Dictionary
|
246
257
|
from topologicpy.Vector import Vector
|
258
|
+
|
247
259
|
if len(uRange) < 1 or len(vRange) < 1:
|
248
260
|
return None
|
249
261
|
if not origin:
|
@@ -263,8 +275,8 @@ class Grid():
|
|
263
275
|
v3 = Vertex.ByCoordinates(0, 0, 0)
|
264
276
|
v4 = Vertex.ByCoordinates(0,max(vRange),0)
|
265
277
|
|
266
|
-
uVector = [
|
267
|
-
vVector = [
|
278
|
+
uVector = [Vertex.X(v2, mantissa=mantissa)-Vertex.X(v1, mantissa=mantissa), Vertex.Y(v2, mantissa=mantissa)-Vertex.Y(v1, mantissa=mantissa),Vertex.Z(v2, mantissa=mantissa)-Vertex.Z(v1, mantissa=mantissa)]
|
279
|
+
vVector = [Vertex.X(v4, mantissa=mantissa)-Vertex.X(v3, mantissa=mantissa), Vertex.Y(v4, mantissa=mantissa)-Vertex.Y(v3, mantissa=mantissa),Vertex.Z(v4, mantissa=mantissa)-Vertex.Z(v3, mantissa=mantissa)]
|
268
280
|
gridVertices = []
|
269
281
|
if len(uRange) > 0:
|
270
282
|
uRange.sort()
|
@@ -274,7 +286,7 @@ class Grid():
|
|
274
286
|
for v in vRange:
|
275
287
|
uTempVec = Vector.Multiply(uuVector, u, tolerance)
|
276
288
|
vTempVec = Vector.Multiply(uvVector, v, tolerance)
|
277
|
-
gridVertex = Vertex.ByCoordinates(
|
289
|
+
gridVertex = Vertex.ByCoordinates(Vertex.X(origin, mantissa=mantissa)+uTempVec[0], Vertex.Y(origin, mantissa=mantissa)+vTempVec[1], Vertex.Z(origin, mantissa=mantissa)+uTempVec[2])
|
278
290
|
if clip and Topology.IsInstance(face, "Face"):
|
279
291
|
gridVertex = gridVertex.Intersect(face, False)
|
280
292
|
if Topology.IsInstance(gridVertex, "Vertex"):
|
topologicpy/Honeybee.py
CHANGED
@@ -195,17 +195,18 @@ class Honeybee:
|
|
195
195
|
@staticmethod
|
196
196
|
def ModelByTopology(tpBuilding,
|
197
197
|
tpShadingFacesCluster = None,
|
198
|
-
buildingName = "Generic_Building",
|
199
|
-
defaultProgramIdentifier = "Generic Office Program",
|
200
|
-
defaultConstructionSetIdentifier = "Default Generic Construction Set",
|
201
|
-
coolingSetpoint = 25.0,
|
202
|
-
heatingSetpoint = 20.0,
|
203
|
-
humidifyingSetpoint = 30.0,
|
204
|
-
dehumidifyingSetpoint = 55.0,
|
205
|
-
roomNameKey = "TOPOLOGIC_name",
|
206
|
-
roomTypeKey = "TOPOLOGIC_type",
|
207
|
-
apertureTypeKey = "TOPOLOGIC_type",
|
208
|
-
addSensorGrid = False
|
198
|
+
buildingName: str = "Generic_Building",
|
199
|
+
defaultProgramIdentifier: str = "Generic Office Program",
|
200
|
+
defaultConstructionSetIdentifier: str = "Default Generic Construction Set",
|
201
|
+
coolingSetpoint: float = 25.0,
|
202
|
+
heatingSetpoint: float = 20.0,
|
203
|
+
humidifyingSetpoint: float = 30.0,
|
204
|
+
dehumidifyingSetpoint: float = 55.0,
|
205
|
+
roomNameKey: str = "TOPOLOGIC_name",
|
206
|
+
roomTypeKey: str = "TOPOLOGIC_type",
|
207
|
+
apertureTypeKey: str = "TOPOLOGIC_type",
|
208
|
+
addSensorGrid: bool = False,
|
209
|
+
mantissa: int = 6):
|
209
210
|
"""
|
210
211
|
Creates an HB Model from the input Topology.
|
211
212
|
|
@@ -330,11 +331,11 @@ class Honeybee:
|
|
330
331
|
if tpCellFaces:
|
331
332
|
hbRoomFaces = []
|
332
333
|
for tpFaceNumber, tpCellFace in enumerate(tpCellFaces):
|
333
|
-
tpCellFaceNormal = Face.
|
334
|
+
tpCellFaceNormal = Face.Normal(tpCellFace, mantissa=mantissa)
|
334
335
|
hbRoomFacePoints = []
|
335
336
|
tpFaceVertices = Wire.Vertices(Face.ExternalBoundary(tpCellFace))
|
336
337
|
for tpVertex in tpFaceVertices:
|
337
|
-
hbRoomFacePoints.append(Point3D(
|
338
|
+
hbRoomFacePoints.append(Point3D(Vertex.X(tpVertex, mantissa=mantissa), Vertex.Y(tpVertex, mantissa=mantissa), Vertex.Z(tpVertex, mantissa=mantissa)))
|
338
339
|
hbRoomFace = HBFace(tpCellName+'_Face_'+str(tpFaceNumber+1), Face3D(hbRoomFacePoints))
|
339
340
|
tpFaceApertures = []
|
340
341
|
_ = tpCellFace.Apertures(tpFaceApertures)
|
@@ -349,7 +350,7 @@ class Honeybee:
|
|
349
350
|
tpFaceApertureVertices = []
|
350
351
|
tpFaceApertureVertices = Wire.Vertices(Face.ExternalBoundary(apertureTopology))
|
351
352
|
for tpFaceApertureVertex in tpFaceApertureVertices:
|
352
|
-
hbFaceAperturePoints.append(Point3D(
|
353
|
+
hbFaceAperturePoints.append(Point3D(Vertex.X(tpFaceApertureVertex, mantissa=mantissa), Vertex.Y(tpFaceApertureVertex, mantissa=mantissa), Vertex.Z(tpFaceApertureVertex, mantissa=mantissa)))
|
353
354
|
if(tpFaceApertureType):
|
354
355
|
if ("door" in tpFaceApertureType.lower()):
|
355
356
|
hbFaceAperture = HBDoor(tpCellName+'_Face_'+str(tpFaceNumber+1)+'_Door_'+str(tpFaceApertureNumber), Face3D(hbFaceAperturePoints))
|
@@ -398,7 +399,7 @@ class Honeybee:
|
|
398
399
|
faceVertices = Wire.Vertices(Face.ExternalBoundary(tpShadingFace))
|
399
400
|
facePoints = []
|
400
401
|
for aVertex in faceVertices:
|
401
|
-
facePoints.append(Point3D(
|
402
|
+
facePoints.append(Point3D(Vertex.X(aVertex, mantissa=mantissa), Vertex.Y(aVertex, mantissa=mantissa), Vertex.Z(aVertex, mantissa=mantissa)))
|
402
403
|
hbShadingFace = Face3D(facePoints, None, [])
|
403
404
|
hbShade = HBShade("SHADINGSURFACE_" + str(faceIndex+1), hbShadingFace)
|
404
405
|
hbShades.append(hbShade)
|
topologicpy/Neo4j.py
CHANGED
@@ -276,7 +276,7 @@ class Neo4j:
|
|
276
276
|
return Graph.ByVerticesEdges(vertices,edges)
|
277
277
|
|
278
278
|
@staticmethod
|
279
|
-
def AddGraph(neo4jGraph, graph, labelKey=None, relationshipKey=None, bidirectional=True, deleteAll=True, tolerance=0.0001):
|
279
|
+
def AddGraph(neo4jGraph, graph, labelKey=None, relationshipKey=None, bidirectional=True, deleteAll=True, mantissa: int = 6, tolerance: float = 0.0001):
|
280
280
|
"""
|
281
281
|
Adds the input topologic graph to the input neo4j graph
|
282
282
|
|
@@ -288,6 +288,8 @@ class Neo4j:
|
|
288
288
|
The input topologic graph.
|
289
289
|
categoryKey : str
|
290
290
|
The category key in the dictionary under which to look for the category value.
|
291
|
+
mantissa : int, optional
|
292
|
+
The desired length of the mantissa. The default is 6.
|
291
293
|
tolerance : float , optional
|
292
294
|
The desired tolerance. The default is 0.0001.
|
293
295
|
|
@@ -301,6 +303,7 @@ class Neo4j:
|
|
301
303
|
from topologicpy.Topology import Topology
|
302
304
|
from topologicpy.Graph import Graph
|
303
305
|
from topologicpy.Dictionary import Dictionary
|
306
|
+
|
304
307
|
gmt = time.gmtime()
|
305
308
|
timestamp = str(gmt.tm_zone)+"_"+str(gmt.tm_year)+"_"+str(gmt.tm_mon)+"_"+str(gmt.tm_wday)+"_"+str(gmt.tm_hour)+"_"+str(gmt.tm_min)+"_"+str(gmt.tm_sec)
|
306
309
|
vertices = Graph.Vertices(graph)
|
@@ -316,11 +319,11 @@ class Neo4j:
|
|
316
319
|
keys.append("z")
|
317
320
|
keys.append("timestamp")
|
318
321
|
keys.append("location")
|
319
|
-
values.append(vertices[i]
|
320
|
-
values.append(vertices[i]
|
321
|
-
values.append(vertices[i]
|
322
|
+
values.append(Vertex.X(vertices[i], mantissa=mantissa))
|
323
|
+
values.append(Vertex.Y(vertices[i], mantissa=mantissa))
|
324
|
+
values.append(Vertex.Z(vertices[i], mantissa=mantissa))
|
322
325
|
values.append(timestamp)
|
323
|
-
values.append(sp.CartesianPoint([
|
326
|
+
values.append(sp.CartesianPoint([Vertex.X(vertices[i], mantissa=mantissa), Vertex.Y(vertices[i], mantissa=mantissa), Vertex.Z(vertices[i], mantissa=mantissa)]))
|
324
327
|
zip_iterator = zip(keys, values)
|
325
328
|
pydict = dict(zip_iterator)
|
326
329
|
if labelKey == 'None':
|
@@ -427,7 +430,14 @@ class Neo4j:
|
|
427
430
|
return list(neo4jGraph.schema.relationship_types)
|
428
431
|
|
429
432
|
@staticmethod
|
430
|
-
def SetGraph(neo4jGraph,
|
433
|
+
def SetGraph(neo4jGraph,
|
434
|
+
graph,
|
435
|
+
labelKey: str = None,
|
436
|
+
relationshipKey: str = None,
|
437
|
+
bidirectional: bool = True,
|
438
|
+
deleteAll: bool = True,
|
439
|
+
mantissa: int = 6,
|
440
|
+
tolerance: float = 0.0001):
|
431
441
|
"""
|
432
442
|
Sets the input topologic graph to the input neo4jGraph.
|
433
443
|
|
@@ -445,6 +455,8 @@ class Neo4j:
|
|
445
455
|
If set to True, the edges in the neo4j graph are set to be bi-drectional.
|
446
456
|
deleteAll : bool , optional
|
447
457
|
If set to True, all previous entities are deleted before adding the new entities.
|
458
|
+
mantissa : int , optional
|
459
|
+
The desired length of the mantissa. The default is 6.
|
448
460
|
tolerance : float , optional
|
449
461
|
The desired tolerance. The default is 0.0001.
|
450
462
|
|
@@ -484,11 +496,11 @@ class Neo4j:
|
|
484
496
|
keys.append("z")
|
485
497
|
keys.append("timestamp")
|
486
498
|
keys.append("location")
|
487
|
-
values.append(vertices[i]
|
488
|
-
values.append(vertices[i]
|
489
|
-
values.append(vertices[i]
|
499
|
+
values.append(Vertex.X(vertices[i], mantissa=mantissa))
|
500
|
+
values.append(Vertex.Y(vertices[i], mantissa=mantissa))
|
501
|
+
values.append(Vertex.Z(vertices[i], mantissa=mantissa))
|
490
502
|
values.append(timestamp)
|
491
|
-
values.append(sp.CartesianPoint([
|
503
|
+
values.append(sp.CartesianPoint([Vertex.X(vertices[i], mantissa=mantissa), Vertex.Y(vertices[i], mantissa=mantissa), Vertex.Z(vertices[i], mantissa=mantissa)]))
|
492
504
|
zip_iterator = zip(keys, values)
|
493
505
|
pydict = dict(zip_iterator)
|
494
506
|
if (labelKey == 'None') or (not (labelKey)):
|
topologicpy/Plotly.py
CHANGED
@@ -272,7 +272,23 @@ class Plotly:
|
|
272
272
|
return df
|
273
273
|
|
274
274
|
@staticmethod
|
275
|
-
def DataByGraph(graph,
|
275
|
+
def DataByGraph(graph,
|
276
|
+
vertexColor: str = "black",
|
277
|
+
vertexSize: float = 6,
|
278
|
+
vertexLabelKey: str = None,
|
279
|
+
vertexGroupKey: str = None,
|
280
|
+
vertexGroups: list = [],
|
281
|
+
showVertices: bool = True,
|
282
|
+
showVertexLegend: bool = False,
|
283
|
+
edgeColor: str = "black",
|
284
|
+
edgeWidth: float = 1,
|
285
|
+
edgeLabelKey: str = None,
|
286
|
+
edgeGroupKey: str = None,
|
287
|
+
edgeGroups: list = [],
|
288
|
+
showEdges: bool = True,
|
289
|
+
showEdgeLegend: bool = False,
|
290
|
+
colorScale: str = "viridis",
|
291
|
+
mantissa: int = 6):
|
276
292
|
"""
|
277
293
|
Creates plotly vertex and edge data from the input graph.
|
278
294
|
|
@@ -344,9 +360,9 @@ class Plotly:
|
|
344
360
|
vertices = Graph.Vertices(graph)
|
345
361
|
if vertexLabelKey or vertexGroupKey:
|
346
362
|
for v in vertices:
|
347
|
-
Xn=[
|
348
|
-
Yn=[
|
349
|
-
Zn=[
|
363
|
+
Xn=[Vertex.X(v, mantissa=mantissa) for v in vertices] # x-coordinates of nodes
|
364
|
+
Yn=[Vertex.Y(v, mantissa=mantissa) for v in vertices] # y-coordinates of nodes
|
365
|
+
Zn=[Vertex.Z(v, mantissa=mantissa) for v in vertices] # x-coordinates of nodes
|
350
366
|
v_label = ""
|
351
367
|
v_group = ""
|
352
368
|
d = Topology.Dictionary(v)
|
@@ -371,9 +387,9 @@ class Plotly:
|
|
371
387
|
v_labels.append(v_label)
|
372
388
|
else:
|
373
389
|
for v in vertices:
|
374
|
-
Xn=[
|
375
|
-
Yn=[
|
376
|
-
Zn=[
|
390
|
+
Xn=[Vertex.X(v, mantissa=mantissa) for v in vertices] # x-coordinates of nodes
|
391
|
+
Yn=[Vertex.Y(v, mantissa=mantissa) for v in vertices] # y-coordinates of nodes
|
392
|
+
Zn=[Vertex.Z(v, mantissa=mantissa) for v in vertices] # x-coordinates of nodes
|
377
393
|
if len(list(set(v_groupList))) < 2:
|
378
394
|
v_groupList = vertexColor
|
379
395
|
if len(v_labels) < 1:
|
@@ -409,9 +425,9 @@ class Plotly:
|
|
409
425
|
for e in edges:
|
410
426
|
sv = Edge.StartVertex(e)
|
411
427
|
ev = Edge.EndVertex(e)
|
412
|
-
Xe+=[
|
413
|
-
Ye+=[
|
414
|
-
Ze+=[
|
428
|
+
Xe+=[Vertex.X(sv, mantissa=mantissa), Vertex.X(ev, mantissa=mantissa), None] # x-coordinates of edge ends
|
429
|
+
Ye+=[Vertex.Y(sv, mantissa=mantissa), Vertex.Y(ev, mantissa=mantissa), None] # y-coordinates of edge ends
|
430
|
+
Ze+=[Vertex.Z(sv, mantissa=mantissa), Vertex.Z(ev, mantissa=mantissa), None] # z-coordinates of edge ends
|
415
431
|
e_label = ""
|
416
432
|
e_group = ""
|
417
433
|
d = Topology.Dictionary(e)
|
@@ -435,9 +451,9 @@ class Plotly:
|
|
435
451
|
for e in edges:
|
436
452
|
sv = Edge.StartVertex(e)
|
437
453
|
ev = Edge.EndVertex(e)
|
438
|
-
Xe+=[
|
439
|
-
Ye+=[
|
440
|
-
Ze+=[
|
454
|
+
Xe+=[Vertex.X(sv, mantissa=mantissa), Vertex.X(ev, mantissa=mantissa), None] # x-coordinates of edge ends
|
455
|
+
Ye+=[Vertex.Y(sv, mantissa=mantissa), Vertex.Y(ev, mantissa=mantissa), None] # y-coordinates of edge ends
|
456
|
+
Ze+=[Vertex.Z(sv, mantissa=mantissa), Vertex.Z(ev, mantissa=mantissa), None] # z-coordinates of edge ends
|
441
457
|
|
442
458
|
if len(list(set(e_groupList))) < 2:
|
443
459
|
e_groupList = edgeColor
|
@@ -460,14 +476,6 @@ class Plotly:
|
|
460
476
|
|
461
477
|
return data
|
462
478
|
|
463
|
-
|
464
|
-
|
465
|
-
|
466
|
-
|
467
|
-
|
468
|
-
|
469
|
-
|
470
|
-
|
471
479
|
@staticmethod
|
472
480
|
def DataByTopology(topology,
|
473
481
|
showVertices=True, vertexSize=1.1, vertexColor="black",
|
@@ -603,6 +611,9 @@ class Plotly:
|
|
603
611
|
The vertex, edge, and face data list.
|
604
612
|
|
605
613
|
"""
|
614
|
+
from topologicpy.Vertex import Vertex
|
615
|
+
from topologicpy.Face import Face
|
616
|
+
from topologicpy.Cluster import Cluster
|
606
617
|
from topologicpy.Topology import Topology
|
607
618
|
from topologicpy.Dictionary import Dictionary
|
608
619
|
from topologicpy.Color import Color
|
@@ -634,9 +645,9 @@ class Plotly:
|
|
634
645
|
minGroup = 0
|
635
646
|
maxGroup = 1
|
636
647
|
for m, v in enumerate(vertices):
|
637
|
-
x.append(
|
638
|
-
y.append(
|
639
|
-
z.append(
|
648
|
+
x.append(v[0])
|
649
|
+
y.append(v[1])
|
650
|
+
z.append(v[2])
|
640
651
|
label = ""
|
641
652
|
group = ""
|
642
653
|
if len(dictionaries) > 0:
|
@@ -666,9 +677,9 @@ class Plotly:
|
|
666
677
|
labels.append(label)
|
667
678
|
else:
|
668
679
|
for v in vertices:
|
669
|
-
x.append(
|
670
|
-
y.append(
|
671
|
-
z.append(
|
680
|
+
x.append(v[0])
|
681
|
+
y.append(v[1])
|
682
|
+
z.append(v[2])
|
672
683
|
|
673
684
|
if len(list(set(groupList))) < 2:
|
674
685
|
groupList = color
|
@@ -714,9 +725,9 @@ class Plotly:
|
|
714
725
|
for m, e in enumerate(edges):
|
715
726
|
sv = vertices[e[0]]
|
716
727
|
ev = vertices[e[1]]
|
717
|
-
x+=[
|
718
|
-
y+=[
|
719
|
-
z+=[
|
728
|
+
x+=[sv[0], ev[0], None] # x-coordinates of edge ends
|
729
|
+
y+=[sv[1], ev[1], None] # y-coordinates of edge ends
|
730
|
+
z+=[sv[2], ev[2], None] # z-coordinates of edge ends
|
720
731
|
label = ""
|
721
732
|
group = ""
|
722
733
|
if len(dictionaries) > 0:
|
@@ -748,9 +759,9 @@ class Plotly:
|
|
748
759
|
for e in edges:
|
749
760
|
sv = vertices[e[0]]
|
750
761
|
ev = vertices[e[1]]
|
751
|
-
x+=[
|
752
|
-
y+=[
|
753
|
-
z+=[
|
762
|
+
x+=[sv[0], ev[0], None] # x-coordinates of edge ends
|
763
|
+
y+=[sv[1], ev[1], None] # y-coordinates of edge ends
|
764
|
+
z+=[sv[2], ev[2], None] # z-coordinates of edge ends
|
754
765
|
|
755
766
|
if len(list(set(groupList))) < 2:
|
756
767
|
groupList = color
|
@@ -779,9 +790,9 @@ class Plotly:
|
|
779
790
|
y = []
|
780
791
|
z = []
|
781
792
|
for v in vertices:
|
782
|
-
x.append(
|
783
|
-
y.append(
|
784
|
-
z.append(
|
793
|
+
x.append(v[0])
|
794
|
+
y.append(v[1])
|
795
|
+
z.append(v[2])
|
785
796
|
i = []
|
786
797
|
j = []
|
787
798
|
k = []
|
@@ -870,12 +881,6 @@ class Plotly:
|
|
870
881
|
lighting = {"facenormalsepsilon": 0},
|
871
882
|
)
|
872
883
|
return fData
|
873
|
-
|
874
|
-
from topologicpy.Face import Face
|
875
|
-
from topologicpy.Cluster import Cluster
|
876
|
-
from topologicpy.Topology import Topology
|
877
|
-
from topologicpy.Dictionary import Dictionary
|
878
|
-
from time import time
|
879
884
|
|
880
885
|
if not Topology.IsInstance(topology, "Topology"):
|
881
886
|
return None
|
@@ -901,7 +906,7 @@ class Plotly:
|
|
901
906
|
|
902
907
|
if intensityKey:
|
903
908
|
for i, tp_v in enumerate(tp_vertices):
|
904
|
-
vertices.append([
|
909
|
+
vertices.append([Vertex.X(tp_v, mantissa=mantissa), Vertex.Y(tp_v, mantissa=mantissa), Vertex.Z(tp_v, mantissa=mantissa)])
|
905
910
|
d = Topology.Dictionary(tp_v)
|
906
911
|
if d:
|
907
912
|
v = Dictionary.ValueAtKey(d, key=intensityKey)
|
@@ -938,7 +943,7 @@ class Plotly:
|
|
938
943
|
if vertexLabelKey or vertexGroupKey:
|
939
944
|
d = Topology.Dictionary(tp_v)
|
940
945
|
v_dictionaries.append(d)
|
941
|
-
vertices.append([
|
946
|
+
vertices.append([Vertex.X(tp_v, mantissa=mantissa), Vertex.Y(tp_v, mantissa=mantissa), Vertex.Z(tp_v, mantissa=mantissa)])
|
942
947
|
data.append(vertexData(vertices, dictionaries=v_dictionaries, color=vertexColor, size=vertexSize, labelKey=vertexLabelKey, groupKey=vertexGroupKey, minGroup=vertexMinGroup, maxGroup=vertexMaxGroup, groups=vertexGroups, legendLabel=vertexLegendLabel, legendGroup=vertexLegendGroup, legendRank=vertexLegendRank, showLegend=showVertexLegend, colorScale=colorScale))
|
943
948
|
|
944
949
|
if showEdges and Topology.Type(topology) > Topology.TypeID("Vertex"):
|
@@ -963,24 +968,6 @@ class Plotly:
|
|
963
968
|
else:
|
964
969
|
tp_faces = Topology.Faces(topology)
|
965
970
|
if not(tp_faces == None or tp_faces == []):
|
966
|
-
# rebuild faces to remove any degenerate faces
|
967
|
-
#new_faces = []
|
968
|
-
#for i, f in enumerate(tp_faces):
|
969
|
-
#eb = Face.ExternalBoundary(f)
|
970
|
-
#eb = Topology.RemoveCollinearEdges(eb)
|
971
|
-
#if not eb == None:
|
972
|
-
#ibList = Face.InternalBoundaries(f)
|
973
|
-
#ibList = [Wire.RemoveCollinearEdges(ib) for ib in ibList]
|
974
|
-
#ibList = [ib for ib in ibList if not ib == None]
|
975
|
-
#new_f = Face.ByWires(eb, ibList, silent=False)
|
976
|
-
#if Topology.IsInstance(new_f, "Face"):
|
977
|
-
#if faceLabelKey or faceGroupKey:
|
978
|
-
#d = Topology.Dictionary(tp_faces[i])
|
979
|
-
#keys = Dictionary.Keys(d)
|
980
|
-
#if len(keys) > 0:
|
981
|
-
#new_f = Topology.SetDictionary(new_f, d)
|
982
|
-
#new_faces.append(new_f)
|
983
|
-
|
984
971
|
f_dictionaries = []
|
985
972
|
all_triangles = []
|
986
973
|
for tp_face in tp_faces:
|