topologicpy 0.3.0__py3-none-any.whl → 0.3.2__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/Aperture.py +3 -3
- topologicpy/Cluster.py +24 -6
- topologicpy/Context.py +19 -19
- topologicpy/DGL.py +620 -453
- topologicpy/Edge.py +36 -31
- topologicpy/Face.py +120 -73
- topologicpy/Graph.py +338 -64
- topologicpy/Plotly.py +122 -16
- topologicpy/Topology.py +26 -23
- topologicpy/Vertex.py +35 -22
- topologicpy/Wire.py +114 -44
- topologicpy/__init__.py +1 -1
- {topologicpy-0.3.0.dist-info → topologicpy-0.3.2.dist-info}/METADATA +1 -1
- {topologicpy-0.3.0.dist-info → topologicpy-0.3.2.dist-info}/RECORD +17 -17
- {topologicpy-0.3.0.dist-info → topologicpy-0.3.2.dist-info}/LICENSE +0 -0
- {topologicpy-0.3.0.dist-info → topologicpy-0.3.2.dist-info}/WHEEL +0 -0
- {topologicpy-0.3.0.dist-info → topologicpy-0.3.2.dist-info}/top_level.txt +0 -0
topologicpy/Edge.py
CHANGED
|
@@ -5,7 +5,7 @@ from topologicpy.Vector import Vector
|
|
|
5
5
|
|
|
6
6
|
class Edge():
|
|
7
7
|
@staticmethod
|
|
8
|
-
def Angle(edgeA, edgeB, mantissa=4, bracket=False):
|
|
8
|
+
def Angle(edgeA: topologic.Edge, edgeB: topologic.Edge, mantissa: int = 4, bracket: bool = False) -> float:
|
|
9
9
|
"""
|
|
10
10
|
Returns the angle in degrees between the two input edges.
|
|
11
11
|
|
|
@@ -38,7 +38,7 @@ class Edge():
|
|
|
38
38
|
return round(ang, mantissa)
|
|
39
39
|
|
|
40
40
|
@staticmethod
|
|
41
|
-
def Bisect(edgeA, edgeB, length=1.0, placement=0, tolerance=0.0001):
|
|
41
|
+
def Bisect(edgeA: topologic.Edge, edgeB: topologic.Edge, length: float = 1.0, placement: int = 0, tolerance: float = 0.0001) -> topologic.Edge:
|
|
42
42
|
"""
|
|
43
43
|
Creates a bisecting edge between edgeA and edgeB.
|
|
44
44
|
|
|
@@ -91,7 +91,7 @@ class Edge():
|
|
|
91
91
|
return bisectingEdge
|
|
92
92
|
|
|
93
93
|
@staticmethod
|
|
94
|
-
def ByFaceNormal(face, origin=None, length=1):
|
|
94
|
+
def ByFaceNormal(face: topologic.Face, origin: topologic.Vertex = None, length: float = 1.0) -> topologic.Edge:
|
|
95
95
|
"""
|
|
96
96
|
Creates a straight edge representing the normal to the input face.
|
|
97
97
|
|
|
@@ -126,7 +126,7 @@ class Edge():
|
|
|
126
126
|
return edge
|
|
127
127
|
|
|
128
128
|
@staticmethod
|
|
129
|
-
def ByOffset(edge, offset=1, tolerance=0.0001):
|
|
129
|
+
def ByOffset(edge: topologic.Edge, offset: float = 1.0, tolerance: float = 0.0001) -> topologic.Edge:
|
|
130
130
|
"""
|
|
131
131
|
Creates and edge offset from the input edge
|
|
132
132
|
|
|
@@ -154,7 +154,7 @@ class Edge():
|
|
|
154
154
|
|
|
155
155
|
|
|
156
156
|
@staticmethod
|
|
157
|
-
def ByStartVertexEndVertex(vertexA, vertexB, tolerance=0.0001):
|
|
157
|
+
def ByStartVertexEndVertex(vertexA: topologic.Vertex, vertexB: topologic.Vertex, tolerance: float = 0.0001) -> topologic.Edge:
|
|
158
158
|
"""
|
|
159
159
|
Creates a straight edge that connects the input vertices.
|
|
160
160
|
|
|
@@ -189,7 +189,7 @@ class Edge():
|
|
|
189
189
|
return edge
|
|
190
190
|
|
|
191
191
|
@staticmethod
|
|
192
|
-
def ByVertices(vertices, tolerance=0.0001):
|
|
192
|
+
def ByVertices(vertices: list, tolerance: float = 0.0001) -> topologic.Edge:
|
|
193
193
|
"""
|
|
194
194
|
Creates a straight edge that connects the input list of vertices.
|
|
195
195
|
|
|
@@ -214,7 +214,7 @@ class Edge():
|
|
|
214
214
|
return Edge.ByStartVertexEndVertex(vertexList[0], vertexList[-1], tolerance)
|
|
215
215
|
|
|
216
216
|
@staticmethod
|
|
217
|
-
def ByVerticesCluster(cluster, tolerance=0.0001):
|
|
217
|
+
def ByVerticesCluster(cluster: topologic.Cluster, tolerance: float = 0.0001) -> topologic.Edge:
|
|
218
218
|
"""
|
|
219
219
|
Creates a straight edge that connects the input cluster of vertices.
|
|
220
220
|
|
|
@@ -241,9 +241,9 @@ class Edge():
|
|
|
241
241
|
return Edge.ByStartVertexEndVertex(vertexList[0], vertexList[-1], tolerance)
|
|
242
242
|
|
|
243
243
|
@staticmethod
|
|
244
|
-
def Direction(edge, mantissa=4):
|
|
244
|
+
def Direction(edge: topologic.Edge, mantissa: int = 4) -> list:
|
|
245
245
|
"""
|
|
246
|
-
Returns the direction of the input edge.
|
|
246
|
+
Returns the direction of the input edge expressed as a list of three numbers.
|
|
247
247
|
|
|
248
248
|
Parameters
|
|
249
249
|
----------
|
|
@@ -258,6 +258,9 @@ class Edge():
|
|
|
258
258
|
The direction of the input edge.
|
|
259
259
|
|
|
260
260
|
"""
|
|
261
|
+
|
|
262
|
+
from topologic.Vector import Vector
|
|
263
|
+
|
|
261
264
|
if not isinstance(edge, topologic.Edge):
|
|
262
265
|
return None
|
|
263
266
|
ev = edge.EndVertex()
|
|
@@ -272,7 +275,7 @@ class Edge():
|
|
|
272
275
|
return [x, y, z]
|
|
273
276
|
|
|
274
277
|
@staticmethod
|
|
275
|
-
def EndVertex(edge):
|
|
278
|
+
def EndVertex(edge: topologic.Edge) -> topologic.Vertex:
|
|
276
279
|
"""
|
|
277
280
|
Returns the end vertex of the input edge.
|
|
278
281
|
|
|
@@ -297,7 +300,7 @@ class Edge():
|
|
|
297
300
|
return vert
|
|
298
301
|
|
|
299
302
|
@staticmethod
|
|
300
|
-
def Extend(edge, distance=1, bothSides=True, reverse=False, tolerance=0.0001):
|
|
303
|
+
def Extend(edge: topologic.Edge, distance: float = 1.0, bothSides: bool = True, reverse: bool = False, tolerance: float = 0.0001) -> topologic.Edge:
|
|
301
304
|
"""
|
|
302
305
|
Extends the input edge by the input distance.
|
|
303
306
|
|
|
@@ -339,7 +342,7 @@ class Edge():
|
|
|
339
342
|
return Edge.ByVertices([sve, eve])
|
|
340
343
|
|
|
341
344
|
@staticmethod
|
|
342
|
-
def ExtendToEdge2D(edgeA, edgeB):
|
|
345
|
+
def ExtendToEdge2D(edgeA: topologic.Edge, edgeB: topologic.Edge) -> topologic.Edge:
|
|
343
346
|
"""
|
|
344
347
|
Extends the first input edge to meet the second input edge. This works only in the XY plane. Z coordinates are ignored.
|
|
345
348
|
|
|
@@ -376,9 +379,9 @@ class Edge():
|
|
|
376
379
|
return None
|
|
377
380
|
|
|
378
381
|
@staticmethod
|
|
379
|
-
def Intersect2D(edgeA, edgeB):
|
|
382
|
+
def Intersect2D(edgeA: topologic.Edge, edgeB: topologic.Edge) -> topologic.Vertex:
|
|
380
383
|
"""
|
|
381
|
-
Returns the intersection of the two input edges. This works only in the XY plane. Z coordinates are ignored.
|
|
384
|
+
Returns the intersection of the two input edges as a topologic.Vertex. This works only in the XY plane. Z coordinates are ignored.
|
|
382
385
|
|
|
383
386
|
Parameters
|
|
384
387
|
----------
|
|
@@ -426,9 +429,9 @@ class Edge():
|
|
|
426
429
|
|
|
427
430
|
|
|
428
431
|
@staticmethod
|
|
429
|
-
def IsCollinear(edgeA, edgeB, mantissa=4, angTolerance=0.1, tolerance=0.0001):
|
|
432
|
+
def IsCollinear(edgeA: topologic.Edge, edgeB: topologic.Edge, mantissa: int = 4, angTolerance: float = 0.1, tolerance: float = 0.0001) -> bool:
|
|
430
433
|
"""
|
|
431
|
-
|
|
434
|
+
Return True if the two input edges are collinear. Returns False otherwise.
|
|
432
435
|
|
|
433
436
|
Parameters
|
|
434
437
|
----------
|
|
@@ -465,9 +468,9 @@ class Edge():
|
|
|
465
468
|
return False
|
|
466
469
|
|
|
467
470
|
@staticmethod
|
|
468
|
-
def IsParallel(edgeA, edgeB, mantissa=4, angTolerance=0.1):
|
|
471
|
+
def IsParallel(edgeA: topologic.Edge, edgeB: topologic.Edge, mantissa: int = 4, angTolerance: float = 0.1) -> bool:
|
|
469
472
|
"""
|
|
470
|
-
|
|
473
|
+
Return True if the two input edges are parallel. Returns False otherwise.
|
|
471
474
|
|
|
472
475
|
Parameters
|
|
473
476
|
----------
|
|
@@ -494,7 +497,7 @@ class Edge():
|
|
|
494
497
|
return False
|
|
495
498
|
|
|
496
499
|
@staticmethod
|
|
497
|
-
def Length(edge, mantissa=4):
|
|
500
|
+
def Length(edge: topologic.Edge, mantissa: int = 4) -> float:
|
|
498
501
|
"""
|
|
499
502
|
Returns the length of the input edge.
|
|
500
503
|
|
|
@@ -521,7 +524,7 @@ class Edge():
|
|
|
521
524
|
return length
|
|
522
525
|
|
|
523
526
|
@staticmethod
|
|
524
|
-
def Normal(edge):
|
|
527
|
+
def Normal(edge: topologic.Edge) -> list:
|
|
525
528
|
"""
|
|
526
529
|
Returns the normal (perpendicular) vector to the input edge. This method is intended for edges that are in the XY plane. Z is assumed to be zero and ignored.
|
|
527
530
|
|
|
@@ -536,7 +539,9 @@ class Edge():
|
|
|
536
539
|
The normal (perpendicular ) vector to the input edge.
|
|
537
540
|
|
|
538
541
|
"""
|
|
542
|
+
|
|
539
543
|
from topologicpy.Vector import Vector
|
|
544
|
+
|
|
540
545
|
sv = Edge.StartVertex(edge)
|
|
541
546
|
ev = Edge.EndVertex(edge)
|
|
542
547
|
x1 = Vertex.X(sv)
|
|
@@ -550,7 +555,7 @@ class Edge():
|
|
|
550
555
|
return Vector.Normalize([-dy, dx, 0])
|
|
551
556
|
|
|
552
557
|
@staticmethod
|
|
553
|
-
def Normalize(edge, useEndVertex=False):
|
|
558
|
+
def Normalize(edge: topologic.Edge, useEndVertex: bool = False) -> topologic.Edge:
|
|
554
559
|
"""
|
|
555
560
|
Creates a normalized edge that has the same direction as the input edge, but a length of 1.
|
|
556
561
|
|
|
@@ -578,7 +583,7 @@ class Edge():
|
|
|
578
583
|
return Edge.ByVertices([sv, ev])
|
|
579
584
|
|
|
580
585
|
@staticmethod
|
|
581
|
-
def ParameterAtVertex(edge, vertex, mantissa=4):
|
|
586
|
+
def ParameterAtVertex(edge: topologic.Edge, vertex: topologic.Vertex, mantissa: int = 4) -> float:
|
|
582
587
|
"""
|
|
583
588
|
Returns the *u* parameter along the input edge based on the location of the input vertex.
|
|
584
589
|
|
|
@@ -607,7 +612,7 @@ class Edge():
|
|
|
607
612
|
return round(parameter, mantissa)
|
|
608
613
|
|
|
609
614
|
@staticmethod
|
|
610
|
-
def Reverse(edge):
|
|
615
|
+
def Reverse(edge: topologic.Edge) -> topologic.Edge:
|
|
611
616
|
"""
|
|
612
617
|
Creates an edge that has the reverse direction of the input edge.
|
|
613
618
|
|
|
@@ -627,7 +632,7 @@ class Edge():
|
|
|
627
632
|
return Edge.ByVertices([edge.EndVertex(), edge.StartVertex()])
|
|
628
633
|
|
|
629
634
|
@staticmethod
|
|
630
|
-
def SetLength(edge , length=1.0, bothSides=True, reverse=False, tolerance=0.0001):
|
|
635
|
+
def SetLength(edge: topologic.Edge , length: float = 1.0, bothSides: bool = True, reverse: bool = False, tolerance: float = 0.0001) -> topologic.Edge:
|
|
631
636
|
"""
|
|
632
637
|
Returns an edge with the new length in the same direction as the input edge.
|
|
633
638
|
|
|
@@ -658,7 +663,7 @@ class Edge():
|
|
|
658
663
|
return Edge.Trim(edge=edge, distance=distance, bothSides=bothSides, reverse=reverse, tolerance=tolerance)
|
|
659
664
|
|
|
660
665
|
@staticmethod
|
|
661
|
-
def StartVertex(edge):
|
|
666
|
+
def StartVertex(edge: topologic.Edge) -> topologic.Vertex:
|
|
662
667
|
"""
|
|
663
668
|
Returns the start vertex of the input edge.
|
|
664
669
|
|
|
@@ -683,7 +688,7 @@ class Edge():
|
|
|
683
688
|
return vert
|
|
684
689
|
|
|
685
690
|
@staticmethod
|
|
686
|
-
def Trim(edge, distance=0, bothSides=True, reverse=False, tolerance=0.0001):
|
|
691
|
+
def Trim(edge: topologic.Edge, distance: float = 0.0, bothSides: bool = True, reverse: bool = False, tolerance: float = 0.0001) -> topologic.Edge:
|
|
687
692
|
"""
|
|
688
693
|
Trims the input edge by the input distance.
|
|
689
694
|
|
|
@@ -725,7 +730,7 @@ class Edge():
|
|
|
725
730
|
return Edge.ByVertices([sve, eve])
|
|
726
731
|
|
|
727
732
|
@staticmethod
|
|
728
|
-
def TrimByEdge2D(edgeA, edgeB, reverse=False):
|
|
733
|
+
def TrimByEdge2D(edgeA: topologic.Edge, edgeB: topologic.Edge, reverse: bool = False) -> topologic.Edge:
|
|
729
734
|
"""
|
|
730
735
|
Trims the first input edge by the second input edge. This works only in the XY plane. Z coordinates are ignored.
|
|
731
736
|
|
|
@@ -758,7 +763,7 @@ class Edge():
|
|
|
758
763
|
return edgeA
|
|
759
764
|
|
|
760
765
|
@staticmethod
|
|
761
|
-
def VertexByDistance(edge, distance=0, origin=None, tolerance=0.0001):
|
|
766
|
+
def VertexByDistance(edge: topologic.Edge, distance: float = 0.0, origin: topologic.Vertex = None, tolerance: float = 0.0001) -> topologic.Vertex:
|
|
762
767
|
"""
|
|
763
768
|
Creates a vertex along the input edge offset by the input distance from the input origin.
|
|
764
769
|
|
|
@@ -796,7 +801,7 @@ class Edge():
|
|
|
796
801
|
return topologic.Vertex.ByCoordinates(origin.X()+vector[0], origin.Y()+vector[1], origin.Z()+vector[2])
|
|
797
802
|
|
|
798
803
|
@staticmethod
|
|
799
|
-
def VertexByParameter(edge, parameter=0):
|
|
804
|
+
def VertexByParameter(edge: topologic.Vertex, parameter: float = 0.0) -> topologic.Vertex:
|
|
800
805
|
"""
|
|
801
806
|
Creates a vertex along the input edge offset by the input *u* parameter.
|
|
802
807
|
|
|
@@ -828,9 +833,9 @@ class Edge():
|
|
|
828
833
|
return vertex
|
|
829
834
|
|
|
830
835
|
@staticmethod
|
|
831
|
-
def Vertices(edge):
|
|
836
|
+
def Vertices(edge: topologic.Edge) -> list:
|
|
832
837
|
"""
|
|
833
|
-
Returns the vertices of the input edge.
|
|
838
|
+
Returns the list of vertices of the input edge.
|
|
834
839
|
|
|
835
840
|
Parameters
|
|
836
841
|
----------
|
topologicpy/Face.py
CHANGED
|
@@ -6,7 +6,7 @@ import math
|
|
|
6
6
|
|
|
7
7
|
class Face(topologic.Face):
|
|
8
8
|
@staticmethod
|
|
9
|
-
def AddInternalBoundaries(face, wires):
|
|
9
|
+
def AddInternalBoundaries(face: topologic.Face, wires: list) -> topologic.Face:
|
|
10
10
|
"""
|
|
11
11
|
Adds internal boundaries (closed wires) to the input face. Internal boundaries are considered holes in the input face.
|
|
12
12
|
|
|
@@ -42,7 +42,7 @@ class Face(topologic.Face):
|
|
|
42
42
|
return topologic.Face.ByExternalInternalBoundaries(faceeb, faceibList)
|
|
43
43
|
|
|
44
44
|
@staticmethod
|
|
45
|
-
def AddInternalBoundariesCluster(face, cluster):
|
|
45
|
+
def AddInternalBoundariesCluster(face: topologic.Face, cluster: topologic.Cluster) -> topologic.Face:
|
|
46
46
|
"""
|
|
47
47
|
Adds the input cluster of internal boundaries (closed wires) to the input face. Internal boundaries are considered holes in the input face.
|
|
48
48
|
|
|
@@ -72,7 +72,7 @@ class Face(topologic.Face):
|
|
|
72
72
|
return Face.AddInternalBoundaries(face, wires)
|
|
73
73
|
|
|
74
74
|
@staticmethod
|
|
75
|
-
def Angle(faceA, faceB, mantissa=4):
|
|
75
|
+
def Angle(faceA: topologic.Face, faceB: topologic.Face, mantissa: int = 4) -> float:
|
|
76
76
|
"""
|
|
77
77
|
Returns the angle in degrees between the two input faces.
|
|
78
78
|
|
|
@@ -101,7 +101,34 @@ class Face(topologic.Face):
|
|
|
101
101
|
return round((Vector.Angle(dirA, dirB)), mantissa)
|
|
102
102
|
|
|
103
103
|
@staticmethod
|
|
104
|
-
def
|
|
104
|
+
def Area(face: topologic.Face, mantissa, int = 4) -> float:
|
|
105
|
+
"""
|
|
106
|
+
Returns the area of the input face.
|
|
107
|
+
|
|
108
|
+
Parameters
|
|
109
|
+
----------
|
|
110
|
+
face : topologic.Face
|
|
111
|
+
The input face.
|
|
112
|
+
mantissa : int , optional
|
|
113
|
+
The desired length of the mantissa. The default is 4.
|
|
114
|
+
|
|
115
|
+
Returns
|
|
116
|
+
-------
|
|
117
|
+
float
|
|
118
|
+
The area of the input face.
|
|
119
|
+
|
|
120
|
+
"""
|
|
121
|
+
if not isinstance(face, topologic.Face):
|
|
122
|
+
return None
|
|
123
|
+
area = None
|
|
124
|
+
try:
|
|
125
|
+
area = round(topologic.FaceUtility.Area(face), mantissa)
|
|
126
|
+
except:
|
|
127
|
+
area = None
|
|
128
|
+
return area
|
|
129
|
+
|
|
130
|
+
@staticmethod
|
|
131
|
+
def BoundingRectangle(topology: topologic.Topology, optimize: int = 0) -> topologic.Face:
|
|
105
132
|
"""
|
|
106
133
|
Returns a face representing a bounding rectangle of the input topology. The returned face contains a dictionary with key "zrot" that represents rotations around the Z axis. If applied the resulting face will become axis-aligned.
|
|
107
134
|
|
|
@@ -199,7 +226,7 @@ class Face(topologic.Face):
|
|
|
199
226
|
return baseFace
|
|
200
227
|
|
|
201
228
|
@staticmethod
|
|
202
|
-
def CompassAngle(face, north: list = None, mantissa: int = 4):
|
|
229
|
+
def CompassAngle(face: topologic.Face, north: list = None, mantissa: int = 4) -> float:
|
|
203
230
|
"""
|
|
204
231
|
Returns the horizontal compass angle in degrees between the normal vector of the input face and the input vector. The angle is measured in counter-clockwise fashion. Only the first two elements of the vectors are considered.
|
|
205
232
|
|
|
@@ -227,65 +254,9 @@ class Face(topologic.Face):
|
|
|
227
254
|
north = Vector.North()
|
|
228
255
|
dirA = Face.NormalAtParameters(face,mantissa=mantissa)
|
|
229
256
|
return Vector.CompassAngle(vectorA=dirA, vectorB=north, mantissa=mantissa)
|
|
230
|
-
|
|
231
|
-
@staticmethod
|
|
232
|
-
def Area(face, mantissa=4):
|
|
233
|
-
"""
|
|
234
|
-
Returns the area of the input face.
|
|
235
|
-
|
|
236
|
-
Parameters
|
|
237
|
-
----------
|
|
238
|
-
face : topologic.Face
|
|
239
|
-
The input face.
|
|
240
|
-
mantissa : int , optional
|
|
241
|
-
The desired length of the mantissa. The default is 4.
|
|
242
|
-
|
|
243
|
-
Returns
|
|
244
|
-
-------
|
|
245
|
-
float
|
|
246
|
-
The area of the input face.
|
|
247
|
-
|
|
248
|
-
"""
|
|
249
|
-
if not isinstance(face, topologic.Face):
|
|
250
|
-
return None
|
|
251
|
-
area = None
|
|
252
|
-
try:
|
|
253
|
-
area = round(topologic.FaceUtility.Area(face), mantissa)
|
|
254
|
-
except:
|
|
255
|
-
area = None
|
|
256
|
-
return area
|
|
257
|
-
|
|
258
|
-
@staticmethod
|
|
259
|
-
def BoundingFace(face):
|
|
260
|
-
"""
|
|
261
|
-
Returns the bounding face of the input face.
|
|
262
|
-
|
|
263
|
-
Parameters
|
|
264
|
-
----------
|
|
265
|
-
face : topologic.Face
|
|
266
|
-
The input face.
|
|
267
|
-
|
|
268
|
-
Returns
|
|
269
|
-
-------
|
|
270
|
-
topologic.Face
|
|
271
|
-
The bounding face of the input face.
|
|
272
|
-
|
|
273
|
-
"""
|
|
274
|
-
if not isinstance(face, topologic.Face):
|
|
275
|
-
return None
|
|
276
|
-
bfv1 = topologic.FaceUtility.VertexAtParameters(face,0,0)
|
|
277
|
-
bfv2 = topologic.FaceUtility.VertexAtParameters(face,1,0)
|
|
278
|
-
bfv3 = topologic.FaceUtility.VertexAtParameters(face,1,1)
|
|
279
|
-
bfv4 = topologic.FaceUtility.VertexAtParameters(face,0,1)
|
|
280
|
-
bfe1 = topologic.Edge.ByStartVertexEndVertex(bfv1,bfv2)
|
|
281
|
-
bfe2 = topologic.Edge.ByStartVertexEndVertex(bfv2,bfv3)
|
|
282
|
-
bfe3 = topologic.Edge.ByStartVertexEndVertex(bfv3,bfv4)
|
|
283
|
-
bfe4 = topologic.Edge.ByStartVertexEndVertex(bfv4,bfv1)
|
|
284
|
-
bfw1 = topologic.Wire.ByEdges([bfe1,bfe2,bfe3,bfe4])
|
|
285
|
-
return topologic.Face.ByExternalBoundary(bfw1)
|
|
286
257
|
|
|
287
258
|
@staticmethod
|
|
288
|
-
def ByEdges(edges):
|
|
259
|
+
def ByEdges(edges: list) -> topologic.Face:
|
|
289
260
|
"""
|
|
290
261
|
Creates a face from the input list of edges.
|
|
291
262
|
|
|
@@ -309,7 +280,7 @@ class Face(topologic.Face):
|
|
|
309
280
|
return Face.ByWire(wire)
|
|
310
281
|
|
|
311
282
|
@staticmethod
|
|
312
|
-
def ByEdgesCluster(cluster):
|
|
283
|
+
def ByEdgesCluster(cluster: topologic.Cluster) -> topologic.Face:
|
|
313
284
|
"""
|
|
314
285
|
Creates a face from the input cluster of edges.
|
|
315
286
|
|
|
@@ -331,20 +302,45 @@ class Face(topologic.Face):
|
|
|
331
302
|
return Face.ByEdges(edges)
|
|
332
303
|
|
|
333
304
|
@staticmethod
|
|
334
|
-
def ByOffset(face, offset=1, miter=False, miterThreshold=None):
|
|
305
|
+
def ByOffset(face: topologic.Face, offset: float = 1.0, miter: bool = False, miterThreshold: float = None, offsetKey: str = None, miterThresholdKey: str = None, step: bool = True) -> topologic.Face:
|
|
306
|
+
"""
|
|
307
|
+
Creates an offset wire from the input wire.
|
|
308
|
+
|
|
309
|
+
Parameters
|
|
310
|
+
----------
|
|
311
|
+
wire : topologic.Wire
|
|
312
|
+
The input wire.
|
|
313
|
+
offset : float , optional
|
|
314
|
+
The desired offset distance. The default is 1.0.
|
|
315
|
+
miter : bool , optional
|
|
316
|
+
if set to True, the corners will be mitered. The default is False.
|
|
317
|
+
miterThreshold : float , optional
|
|
318
|
+
The distance beyond which a miter should be added. The default is None which means the miter threshold is set to the offset distance multiplied by the square root of 2.
|
|
319
|
+
offsetKey : str , optional
|
|
320
|
+
If specified, the dictionary of the edges will be queried for this key to sepcify the desired offset. The default is None.
|
|
321
|
+
miterThresholdKey : str , optional
|
|
322
|
+
If specified, the dictionary of the vertices will be queried for this key to sepcify the desired miter threshold distance. The default is None.
|
|
323
|
+
step : bool , optional
|
|
324
|
+
If set to True, The transition between collinear edges with different offsets will be a step. Otherwise, it will be a continous edge. The default is True.
|
|
325
|
+
|
|
326
|
+
Returns
|
|
327
|
+
-------
|
|
328
|
+
topologic.Wire
|
|
329
|
+
The created wire.
|
|
330
|
+
|
|
331
|
+
"""
|
|
335
332
|
from topologicpy.Wire import Wire
|
|
336
333
|
|
|
337
|
-
|
|
338
|
-
internal_boundaries =
|
|
339
|
-
|
|
340
|
-
offset_external_boundary = Wire.ByOffset(external_boundary, offset=offset, miter=miter, miterThreshold=miterThreshold)
|
|
334
|
+
eb = Face.Wire(face)
|
|
335
|
+
internal_boundaries = Face.InternalBoundaries(face)
|
|
336
|
+
offset_external_boundary = Wire.ByOffset(wire=eb, offset=offset, miter=miter, miterThreshold=miterThreshold, offsetKey=offsetKey, miterThresholdKey=miterThresholdKey, step=step)
|
|
341
337
|
offset_internal_boundaries = []
|
|
342
338
|
for internal_boundary in internal_boundaries:
|
|
343
|
-
offset_internal_boundaries.append(Wire.ByOffset(internal_boundary,
|
|
339
|
+
offset_internal_boundaries.append(Wire.ByOffset(wire=internal_boundary, offset=offset, miter=miter, miterThreshold=miterThreshold, offsetKey=offsetKey, miterThresholdKey=miterThresholdKey, step=step))
|
|
344
340
|
return Face.ByWires(offset_external_boundary, offset_internal_boundaries)
|
|
345
341
|
|
|
346
342
|
@staticmethod
|
|
347
|
-
def ByShell(shell, angTolerance=0.1):
|
|
343
|
+
def ByShell(shell: topologic.Shell, angTolerance: float = 0.1)-> topologic.Face:
|
|
348
344
|
"""
|
|
349
345
|
Creates a face by merging the faces of the input shell.
|
|
350
346
|
|
|
@@ -420,7 +416,8 @@ class Face(topologic.Face):
|
|
|
420
416
|
return None
|
|
421
417
|
|
|
422
418
|
@staticmethod
|
|
423
|
-
def ByVertices(vertices):
|
|
419
|
+
def ByVertices(vertices: list) -> topologic.Face:
|
|
420
|
+
|
|
424
421
|
"""
|
|
425
422
|
Creates a face from the input list of vertices.
|
|
426
423
|
|
|
@@ -471,7 +468,7 @@ class Face(topologic.Face):
|
|
|
471
468
|
else:
|
|
472
469
|
return None
|
|
473
470
|
"""
|
|
474
|
-
def ByVerticesCluster(cluster):
|
|
471
|
+
def ByVerticesCluster(cluster: topologic.Cluster) -> topologic.Face:
|
|
475
472
|
"""
|
|
476
473
|
Creates a face from the input cluster of vertices.
|
|
477
474
|
|
|
@@ -718,6 +715,30 @@ class Face(topologic.Face):
|
|
|
718
715
|
_ = face.Edges(None, edges)
|
|
719
716
|
return edges
|
|
720
717
|
|
|
718
|
+
@staticmethod
|
|
719
|
+
def Einstein(origin: topologic.Vertex = None, radius: float = 0.5, direction: list = [0,0,1], placement: str = "center") -> topologic.Face:
|
|
720
|
+
"""
|
|
721
|
+
Creates an aperiodic monotile, also called an 'einstein' tile (meaning one tile in German, not the name of the famous physist). See https://arxiv.org/abs/2303.10798
|
|
722
|
+
|
|
723
|
+
Parameters
|
|
724
|
+
----------
|
|
725
|
+
origin : topologic.Vertex , optional
|
|
726
|
+
The location of the origin of the tile. The default is None which results in the tiles first vertex being placed at (0,0,0).
|
|
727
|
+
radius : float , optional
|
|
728
|
+
The radius of the hexagon determining the size of the tile. The default is 0.5.
|
|
729
|
+
direction : list , optional
|
|
730
|
+
The vector representing the up direction of the ellipse. The default is [0,0,1].
|
|
731
|
+
placement : str , optional
|
|
732
|
+
The description of the placement of the origin of the hexagon determining the location of the tile. This can be "center", or "lowerleft". It is case insensitive. The default is "center".
|
|
733
|
+
|
|
734
|
+
"""
|
|
735
|
+
from topologicpy.Wire import Wire
|
|
736
|
+
wire = Wire.Einstein(origin=origin, radius=radius, direction=direction, placement=placement)
|
|
737
|
+
if not isinstance(wire, topologic.Wire):
|
|
738
|
+
return None
|
|
739
|
+
return Face.ByWire(wire)
|
|
740
|
+
|
|
741
|
+
@staticmethod
|
|
721
742
|
def ExternalBoundary(face):
|
|
722
743
|
"""
|
|
723
744
|
Returns the external boundary (closed wire) of the input face.
|
|
@@ -1471,7 +1492,7 @@ class Face(topologic.Face):
|
|
|
1471
1492
|
return Face.ByWires(p_eb, p_ib_list)
|
|
1472
1493
|
|
|
1473
1494
|
@staticmethod
|
|
1474
|
-
def Rectangle(origin=None, width=1.0, length=1.0, direction=[0,0,1], placement="center", tolerance=0.0001):
|
|
1495
|
+
def Rectangle(origin: topologic.Vertex = None, width: float = 1.0, length: float = 1.0, direction: list = [0,0,1], placement: str = "center", tolerance: float = 0.0001) -> topologic.Face:
|
|
1475
1496
|
"""
|
|
1476
1497
|
Creates a rectangle.
|
|
1477
1498
|
|
|
@@ -1501,6 +1522,32 @@ class Face(topologic.Face):
|
|
|
1501
1522
|
return None
|
|
1502
1523
|
return Face.ByWire(wire)
|
|
1503
1524
|
|
|
1525
|
+
@staticmethod
|
|
1526
|
+
def Square(origin: topologic.Vertex = None, size: float = 1.0, direction: list = [0,0,1], placement: str = "center", tolerance: float = 0.0001) -> topologic.Face:
|
|
1527
|
+
"""
|
|
1528
|
+
Creates a square.
|
|
1529
|
+
|
|
1530
|
+
Parameters
|
|
1531
|
+
----------
|
|
1532
|
+
origin : topologic.Vertex , optional
|
|
1533
|
+
The location of the origin of the square. The default is None which results in the square being placed at (0,0,0).
|
|
1534
|
+
size : float , optional
|
|
1535
|
+
The size of the square. The default is 1.0.
|
|
1536
|
+
direction : list , optional
|
|
1537
|
+
The vector representing the up direction of the square. The default is [0,0,1].
|
|
1538
|
+
placement : str , optional
|
|
1539
|
+
The description of the placement of the origin of the square. This can be "center", or "lowerleft". It is case insensitive. The default is "center".
|
|
1540
|
+
tolerance : float , optional
|
|
1541
|
+
The desired tolerance. The default is 0.0001.
|
|
1542
|
+
|
|
1543
|
+
Returns
|
|
1544
|
+
-------
|
|
1545
|
+
topologic.Wire
|
|
1546
|
+
The created square.
|
|
1547
|
+
|
|
1548
|
+
"""
|
|
1549
|
+
return Face.Rectangle(origin = origin, width = size, length = size, direction = direction, placement = placement, tolerance = tolerance)
|
|
1550
|
+
|
|
1504
1551
|
@staticmethod
|
|
1505
1552
|
def Star(origin=None, radiusA=1.0, radiusB=0.4, rays=5, direction=[0,0,1], placement="center", tolerance=0.0001):
|
|
1506
1553
|
"""
|