topologicpy 0.3.1__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/Context.py +19 -19
- topologicpy/DGL.py +18 -8
- topologicpy/Edge.py +36 -31
- topologicpy/Face.py +120 -73
- topologicpy/Topology.py +16 -15
- topologicpy/Vertex.py +33 -21
- topologicpy/Wire.py +114 -44
- topologicpy/__init__.py +1 -1
- {topologicpy-0.3.1.dist-info → topologicpy-0.3.2.dist-info}/METADATA +1 -1
- {topologicpy-0.3.1.dist-info → topologicpy-0.3.2.dist-info}/RECORD +14 -14
- {topologicpy-0.3.1.dist-info → topologicpy-0.3.2.dist-info}/LICENSE +0 -0
- {topologicpy-0.3.1.dist-info → topologicpy-0.3.2.dist-info}/WHEEL +0 -0
- {topologicpy-0.3.1.dist-info → topologicpy-0.3.2.dist-info}/top_level.txt +0 -0
topologicpy/Topology.py
CHANGED
|
@@ -3605,19 +3605,20 @@ class Topology():
|
|
|
3605
3605
|
dy = y2 - y1
|
|
3606
3606
|
dz = z2 - z1
|
|
3607
3607
|
dist = math.sqrt(dx**2 + dy**2 + dz**2)
|
|
3608
|
+
world_origin = Vertex.ByCoordinates(0,0,0)
|
|
3609
|
+
|
|
3608
3610
|
phi = math.degrees(math.atan2(dy, dx)) # Rotation around Y-Axis
|
|
3609
|
-
if dist <
|
|
3611
|
+
if dist < 0.0001:
|
|
3610
3612
|
theta = 0
|
|
3611
3613
|
else:
|
|
3612
3614
|
theta = math.degrees(math.acos(dz/dist)) # Rotation around Z-Axis
|
|
3613
|
-
|
|
3614
|
-
returnTopology = Topology.Rotate(
|
|
3615
|
-
returnTopology = Topology.Rotate(returnTopology, world_origin, 0, 1, 0, -theta)
|
|
3615
|
+
returnTopology = Topology.Rotate(topology, world_origin, 0, 1, 0, theta)
|
|
3616
|
+
returnTopology = Topology.Rotate(returnTopology, world_origin, 0, 0, 1, phi)
|
|
3616
3617
|
returnTopology = Topology.Place(returnTopology, world_origin, origin)
|
|
3617
3618
|
return returnTopology
|
|
3618
3619
|
|
|
3619
3620
|
@staticmethod
|
|
3620
|
-
def Place(topology,
|
|
3621
|
+
def Place(topology, originA=None, originB=None):
|
|
3621
3622
|
"""
|
|
3622
3623
|
Places the input topology at the specified location.
|
|
3623
3624
|
|
|
@@ -3625,9 +3626,9 @@ class Topology():
|
|
|
3625
3626
|
----------
|
|
3626
3627
|
topology : topologic.Topology
|
|
3627
3628
|
The input topology.
|
|
3628
|
-
|
|
3629
|
+
originA : topologic.Vertex , optional
|
|
3629
3630
|
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.
|
|
3630
|
-
|
|
3631
|
+
originB : topologic.Vertex , optional
|
|
3631
3632
|
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.
|
|
3632
3633
|
|
|
3633
3634
|
Returns
|
|
@@ -3639,14 +3640,14 @@ class Topology():
|
|
|
3639
3640
|
from topologicpy.Vertex import Vertex
|
|
3640
3641
|
if not isinstance(topology, topologic.Topology):
|
|
3641
3642
|
return None
|
|
3642
|
-
if not isinstance(
|
|
3643
|
-
|
|
3644
|
-
if not isinstance(
|
|
3645
|
-
|
|
3646
|
-
|
|
3647
|
-
x =
|
|
3648
|
-
y =
|
|
3649
|
-
z =
|
|
3643
|
+
if not isinstance(originA, topologic.Vertex):
|
|
3644
|
+
originA = Topology.Centroid(topology)
|
|
3645
|
+
if not isinstance(originA, topologic.Vertex):
|
|
3646
|
+
originA = Vertex.ByCoordinates(0,0,0)
|
|
3647
|
+
|
|
3648
|
+
x = originB.X() - originA.X()
|
|
3649
|
+
y = originB.Y() - originA.Y()
|
|
3650
|
+
z = originB.Z() - originA.Z()
|
|
3650
3651
|
newTopology = None
|
|
3651
3652
|
try:
|
|
3652
3653
|
newTopology = Topology.Translate(topology, x, y, z)
|
topologicpy/Vertex.py
CHANGED
|
@@ -6,7 +6,7 @@ import collections
|
|
|
6
6
|
|
|
7
7
|
class Vertex(Topology):
|
|
8
8
|
@staticmethod
|
|
9
|
-
def AreIpsilateral(vertices, face):
|
|
9
|
+
def AreIpsilateral(vertices: list, face: topologic.Face) -> bool:
|
|
10
10
|
"""
|
|
11
11
|
Returns True if the two input vertices are on the same side of the input face. Returns False otherwise. If at least one of the vertices is on the face, this method return True.
|
|
12
12
|
|
|
@@ -62,7 +62,7 @@ class Vertex(Topology):
|
|
|
62
62
|
return True
|
|
63
63
|
|
|
64
64
|
@staticmethod
|
|
65
|
-
def AreOnSameSide(vertices, face):
|
|
65
|
+
def AreOnSameSide(vertices: list, face: topologicpy.Face.Face) -> bool:
|
|
66
66
|
"""
|
|
67
67
|
Returns True if the two input vertices are on the same side of the input face. Returns False otherwise. If at least one of the vertices is on the face, this method return True.
|
|
68
68
|
|
|
@@ -82,7 +82,7 @@ class Vertex(Topology):
|
|
|
82
82
|
return IsIpsileteral(vertices, face)
|
|
83
83
|
|
|
84
84
|
@staticmethod
|
|
85
|
-
def AreOnSameSideCluster(cluster, face):
|
|
85
|
+
def AreOnSameSideCluster(cluster: topologic.Cluster, face: topologic.Face) -> bool:
|
|
86
86
|
"""
|
|
87
87
|
Returns True if the two input vertices are on the same side of the input face. Returns False otherwise. If at least one of the vertices is on the face, this method return True.
|
|
88
88
|
|
|
@@ -106,18 +106,18 @@ class Vertex(Topology):
|
|
|
106
106
|
return AreIpsilateral(vertices, face)
|
|
107
107
|
|
|
108
108
|
@staticmethod
|
|
109
|
-
def ByCoordinates(x, y, z):
|
|
109
|
+
def ByCoordinates(x: float = 0, y: float = 0, z: float = 0) -> topologic.Vertex:
|
|
110
110
|
"""
|
|
111
111
|
Creates a vertex at the coordinates specified by the x, y, z inputs.
|
|
112
112
|
|
|
113
113
|
Parameters
|
|
114
114
|
----------
|
|
115
|
-
x : float
|
|
116
|
-
The X coordinate.
|
|
117
|
-
y : float
|
|
118
|
-
The Y coordinate.
|
|
119
|
-
z : float
|
|
120
|
-
The Z
|
|
115
|
+
x : float , optional
|
|
116
|
+
The X coordinate. The default is 0.
|
|
117
|
+
y : float , optional
|
|
118
|
+
The Y coordinate. The default is 0.
|
|
119
|
+
z : float , optional
|
|
120
|
+
The Z coordinate. The defaults is 0.
|
|
121
121
|
|
|
122
122
|
Returns
|
|
123
123
|
-------
|
|
@@ -133,7 +133,7 @@ class Vertex(Topology):
|
|
|
133
133
|
return vertex
|
|
134
134
|
|
|
135
135
|
@staticmethod
|
|
136
|
-
def Coordinates(vertex, outputType="xyz", mantissa=4):
|
|
136
|
+
def Coordinates(vertex: topologic.Vertex, outputType: str = "xyz", mantissa: int = 4) -> list:
|
|
137
137
|
"""
|
|
138
138
|
Returns the coordinates of the input vertex.
|
|
139
139
|
|
|
@@ -176,9 +176,8 @@ class Vertex(Topology):
|
|
|
176
176
|
output.append(z)
|
|
177
177
|
return output
|
|
178
178
|
|
|
179
|
-
|
|
180
179
|
@staticmethod
|
|
181
|
-
def Distance(vertex, topology, mantissa=4):
|
|
180
|
+
def Distance(vertex: topologic.Vertex, topology: topologic.Topology, mantissa: int = 4) -> float:
|
|
182
181
|
"""
|
|
183
182
|
Returns the distance between the input vertex and the input topology.
|
|
184
183
|
|
|
@@ -202,7 +201,7 @@ class Vertex(Topology):
|
|
|
202
201
|
return round(topologic.VertexUtility.Distance(vertex, topology), mantissa)
|
|
203
202
|
|
|
204
203
|
@staticmethod
|
|
205
|
-
def EnclosingCell(vertex, topology, exclusive=True, tolerance=0.0001):
|
|
204
|
+
def EnclosingCell(vertex: topologic.Vertex, topology: topologic.Topology, exclusive: bool = True, tolerance: float = 0.0001) -> list:
|
|
206
205
|
"""
|
|
207
206
|
Returns the list of Cells found in the input topology that enclose the input vertex.
|
|
208
207
|
|
|
@@ -257,7 +256,7 @@ class Vertex(Topology):
|
|
|
257
256
|
return enclosingCells
|
|
258
257
|
|
|
259
258
|
@staticmethod
|
|
260
|
-
def Index(vertex, vertices, strict=False, tolerance=0.0001):
|
|
259
|
+
def Index(vertex: topologic.Vertex, vertices: list, strict: bool = False, tolerance: float = 0.0001) -> int:
|
|
261
260
|
"""
|
|
262
261
|
Returns index of the input vertex in the input list of vertices
|
|
263
262
|
|
|
@@ -297,7 +296,7 @@ class Vertex(Topology):
|
|
|
297
296
|
return None
|
|
298
297
|
|
|
299
298
|
@staticmethod
|
|
300
|
-
def IsInside(vertex, topology, tolerance=0.0001):
|
|
299
|
+
def IsInside(vertex: topologic.Vertex, topology: topologic.Topology, tolerance: float = 0.0001) -> bool:
|
|
301
300
|
"""
|
|
302
301
|
Returns True if the input vertex is inside the input topology. Returns False otherwise.
|
|
303
302
|
|
|
@@ -373,7 +372,7 @@ class Vertex(Topology):
|
|
|
373
372
|
return False
|
|
374
373
|
|
|
375
374
|
@staticmethod
|
|
376
|
-
def NearestVertex(vertex, topology, useKDTree=True):
|
|
375
|
+
def NearestVertex(vertex: topologic.Vertex, topology: topologic.Topology, useKDTree: bool = True) -> topologic.Vertex:
|
|
377
376
|
"""
|
|
378
377
|
Returns the vertex found in the input topology that is the nearest to the input vertex.
|
|
379
378
|
|
|
@@ -515,9 +514,22 @@ class Vertex(Topology):
|
|
|
515
514
|
sorted_indices = [x for _, x in sorted(zip(distances, indices))]
|
|
516
515
|
return vertices[sorted_indices[0]]
|
|
517
516
|
|
|
517
|
+
@staticmethod
|
|
518
|
+
def Origin() -> topologic.Vertex:
|
|
519
|
+
"""
|
|
520
|
+
Returns a vertex with coordinates (0,0,0)
|
|
521
|
+
|
|
522
|
+
Parameters
|
|
523
|
+
-----------
|
|
524
|
+
|
|
525
|
+
Return
|
|
526
|
+
-----------
|
|
527
|
+
topologic.Vertex
|
|
528
|
+
"""
|
|
529
|
+
return Vertex.ByCoordinates(0,0,0)
|
|
518
530
|
|
|
519
531
|
@staticmethod
|
|
520
|
-
def Project(vertex, face, direction=None, mantissa=4, tolerance=0.0001):
|
|
532
|
+
def Project(vertex: topologic.Vertex, face: topologic.Face, direction: bool = None, mantissa: int = 4, tolerance: float = 0.0001) -> topologic.Vertex:
|
|
521
533
|
"""
|
|
522
534
|
Returns a vertex that is the projection of the input vertex unto the input face.
|
|
523
535
|
|
|
@@ -568,7 +580,7 @@ class Vertex(Topology):
|
|
|
568
580
|
return None
|
|
569
581
|
|
|
570
582
|
@staticmethod
|
|
571
|
-
def X(vertex, mantissa=4):
|
|
583
|
+
def X(vertex: topologic.Vertex, mantissa: int = 4) -> float:
|
|
572
584
|
"""
|
|
573
585
|
Returns the X coordinate of the input vertex.
|
|
574
586
|
|
|
@@ -590,7 +602,7 @@ class Vertex(Topology):
|
|
|
590
602
|
return round(vertex.X(), mantissa)
|
|
591
603
|
|
|
592
604
|
@staticmethod
|
|
593
|
-
def Y(vertex, mantissa=4):
|
|
605
|
+
def Y(vertex: topologic.Vertex, mantissa: int = 4) -> float:
|
|
594
606
|
"""
|
|
595
607
|
Returns the Y coordinate of the input vertex.
|
|
596
608
|
|
|
@@ -612,7 +624,7 @@ class Vertex(Topology):
|
|
|
612
624
|
return round(vertex.Y(), mantissa)
|
|
613
625
|
|
|
614
626
|
@staticmethod
|
|
615
|
-
def Z(vertex, mantissa=4):
|
|
627
|
+
def Z(vertex: topologic.Vertex, mantissa: int = 4) -> float:
|
|
616
628
|
"""
|
|
617
629
|
Returns the Z coordinate of the input vertex.
|
|
618
630
|
|
topologicpy/Wire.py
CHANGED
|
@@ -10,7 +10,7 @@ import numpy as np
|
|
|
10
10
|
|
|
11
11
|
class Wire(topologic.Wire):
|
|
12
12
|
@staticmethod
|
|
13
|
-
def BoundingRectangle(topology, optimize=0):
|
|
13
|
+
def BoundingRectangle(topology: topologic.Topology, optimize: int = 0) -> topologic.Wire:
|
|
14
14
|
"""
|
|
15
15
|
Returns a wire representing a bounding rectangle of the input topology. The returned wire contains a dictionary with key "zrot" that represents rotations around the Z axis. If applied the resulting wire will become axis-aligned.
|
|
16
16
|
|
|
@@ -132,7 +132,7 @@ class Wire(topologic.Wire):
|
|
|
132
132
|
return boundingRectangle
|
|
133
133
|
|
|
134
134
|
@staticmethod
|
|
135
|
-
def ByEdges(edges):
|
|
135
|
+
def ByEdges(edges: list) -> topologic.Wire:
|
|
136
136
|
"""
|
|
137
137
|
Creates a wire from the input list of edges.
|
|
138
138
|
|
|
@@ -167,7 +167,7 @@ class Wire(topologic.Wire):
|
|
|
167
167
|
return wire
|
|
168
168
|
|
|
169
169
|
@staticmethod
|
|
170
|
-
def ByEdgesCluster(cluster):
|
|
170
|
+
def ByEdgesCluster(cluster: topologic.Cluster) -> topologic.Wire:
|
|
171
171
|
"""
|
|
172
172
|
Creates a wire from the input cluster of edges.
|
|
173
173
|
|
|
@@ -189,7 +189,7 @@ class Wire(topologic.Wire):
|
|
|
189
189
|
return Wire.ByEdges(edges)
|
|
190
190
|
|
|
191
191
|
@staticmethod
|
|
192
|
-
def ByOffset(wire, offset=1.0, miter=False, miterThreshold=None, offsetKey=None, miterThresholdKey=None, step=True):
|
|
192
|
+
def ByOffset(wire: topologic.Wire, offset: float = 1.0, miter: bool = False, miterThreshold: float = None, offsetKey: str = None, miterThresholdKey: str = None, step: bool = True) -> topologic.Wire:
|
|
193
193
|
"""
|
|
194
194
|
Creates an offset wire from the input wire.
|
|
195
195
|
|
|
@@ -297,8 +297,6 @@ class Wire(topologic.Wire):
|
|
|
297
297
|
intV = Edge.Intersect2D(tempEdge1,tempEdge2)
|
|
298
298
|
newVertices.append(intV)
|
|
299
299
|
dupVertices.append(vertices[0])
|
|
300
|
-
|
|
301
|
-
|
|
302
300
|
else:
|
|
303
301
|
newVertices.append(Edge.StartVertex(newEdges[0]))
|
|
304
302
|
|
|
@@ -395,7 +393,7 @@ class Wire(topologic.Wire):
|
|
|
395
393
|
return newWire
|
|
396
394
|
|
|
397
395
|
@staticmethod
|
|
398
|
-
def ByVertices(vertices, close=True):
|
|
396
|
+
def ByVertices(vertices: list, close: bool = True) -> topologic.Wire:
|
|
399
397
|
"""
|
|
400
398
|
Creates a wire from the input list of vertices.
|
|
401
399
|
|
|
@@ -444,7 +442,7 @@ class Wire(topologic.Wire):
|
|
|
444
442
|
return Cluster.SelfMerge(c)
|
|
445
443
|
|
|
446
444
|
@staticmethod
|
|
447
|
-
def ByVerticesCluster(cluster, close=True):
|
|
445
|
+
def ByVerticesCluster(cluster: topologic.Cluster, close: bool = True) -> topologic.Wire:
|
|
448
446
|
"""
|
|
449
447
|
Creates a wire from the input cluster of vertices.
|
|
450
448
|
|
|
@@ -468,7 +466,7 @@ class Wire(topologic.Wire):
|
|
|
468
466
|
return Wire.ByVertices(vertices, close)
|
|
469
467
|
|
|
470
468
|
@staticmethod
|
|
471
|
-
def Circle(origin=None, radius=0.5, sides=16, fromAngle=0, toAngle=360, close=True, direction=[0,0,1], placement="center", tolerance=0.0001):
|
|
469
|
+
def Circle(origin: topologic.Vertex = None, radius: float = 0.5, sides: int = 16, fromAngle: float = 0.0, toAngle: float = 360.0, close: bool = True, direction: list = [0,0,1], placement: str = "center", tolerance: float = 0.0001) -> topologic.Wire:
|
|
472
470
|
"""
|
|
473
471
|
Creates a circle.
|
|
474
472
|
|
|
@@ -553,9 +551,8 @@ class Wire(topologic.Wire):
|
|
|
553
551
|
baseWire = topologic.TopologyUtility.Rotate(baseWire, origin, 0, 0, 1, phi)
|
|
554
552
|
return baseWire
|
|
555
553
|
|
|
556
|
-
|
|
557
554
|
@staticmethod
|
|
558
|
-
def Cycles(wire, maxVertices=4, tolerance=0.0001):
|
|
555
|
+
def Cycles(wire: topologic.Wire, maxVertices: int = 4, tolerance: float = 0.0001) -> list:
|
|
559
556
|
"""
|
|
560
557
|
Returns the closed circuits of wires found within the input wire.
|
|
561
558
|
|
|
@@ -671,7 +668,7 @@ class Wire(topologic.Wire):
|
|
|
671
668
|
return resultWires
|
|
672
669
|
|
|
673
670
|
@staticmethod
|
|
674
|
-
def Edges(wire):
|
|
671
|
+
def Edges(wire: topologic.Wire) -> list:
|
|
675
672
|
"""
|
|
676
673
|
Returns the edges of the input wire.
|
|
677
674
|
|
|
@@ -693,7 +690,59 @@ class Wire(topologic.Wire):
|
|
|
693
690
|
return edges
|
|
694
691
|
|
|
695
692
|
@staticmethod
|
|
696
|
-
def
|
|
693
|
+
def Einstein(origin: topologic.Vertex = None, radius: float = 0.5, direction: list = [0,0,1], placement: str = "center") -> topologic.Wire:
|
|
694
|
+
"""
|
|
695
|
+
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
|
|
696
|
+
|
|
697
|
+
Parameters
|
|
698
|
+
----------
|
|
699
|
+
origin : topologic.Vertex , optional
|
|
700
|
+
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).
|
|
701
|
+
radius : float , optional
|
|
702
|
+
The radius of the hexagon determining the size of the tile. The default is 0.5.
|
|
703
|
+
direction : list , optional
|
|
704
|
+
The vector representing the up direction of the ellipse. The default is [0,0,1].
|
|
705
|
+
placement : str , optional
|
|
706
|
+
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".
|
|
707
|
+
|
|
708
|
+
"""
|
|
709
|
+
from topologicpy.Vertex import Vertex
|
|
710
|
+
from topologicpy.Topology import Topology
|
|
711
|
+
import math
|
|
712
|
+
def cos(angle):
|
|
713
|
+
return math.cos(math.radians(angle))
|
|
714
|
+
def sin(angle):
|
|
715
|
+
return math.sin(math.radians(angle))
|
|
716
|
+
if not origin:
|
|
717
|
+
origin = Vertex.ByCoordinates(0,0,0)
|
|
718
|
+
d = cos(30)*radius
|
|
719
|
+
v1 = Vertex.ByCoordinates(0,0,0)
|
|
720
|
+
v2 = Vertex.ByCoordinates(cos(30)*d, sin(30)*d, 0)
|
|
721
|
+
v3 = Vertex.ByCoordinates(radius, 0)
|
|
722
|
+
v4 = Vertex.ByCoordinates(2*radius, 0)
|
|
723
|
+
v5 = Vertex.ByCoordinates(2*radius+cos(60)*radius*0.5, sin(30)*d, 0)
|
|
724
|
+
v6 = Vertex.ByCoordinates(1.5*radius, d)
|
|
725
|
+
v7 = Vertex.ByCoordinates(1.5*radius, 2*d)
|
|
726
|
+
v8 = Vertex.ByCoordinates(radius, 2*d)
|
|
727
|
+
v9 = Vertex.ByCoordinates(radius-cos(60)*0.5*radius, 2*d+sin(60)*0.5*radius)
|
|
728
|
+
v10 = Vertex.ByCoordinates(0, 2*d)
|
|
729
|
+
v11 = Vertex.ByCoordinates(0, d)
|
|
730
|
+
v12 = Vertex.ByCoordinates(-radius*0.5, d)
|
|
731
|
+
v13 = Vertex.ByCoordinates(-cos(30)*d, sin(30)*d, 0)
|
|
732
|
+
einstein = Wire.ByVertices([v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13], close=True)
|
|
733
|
+
|
|
734
|
+
if placement.lower() == "lowerleft":
|
|
735
|
+
einstein = Topology.Translate(einstein, radius, d, 0)
|
|
736
|
+
dx = Vertex.X(origin)
|
|
737
|
+
dy = Vertex.Y(origin)
|
|
738
|
+
dz = Vertex.Z(origin)
|
|
739
|
+
einstein = Topology.Translate(einstein, dx, dy, dz)
|
|
740
|
+
if direction != [0,0,1]:
|
|
741
|
+
einstein = Topology.Orient(einstein, origin=origin, dirA=[0,0,1], dirB=direction)
|
|
742
|
+
return einstein
|
|
743
|
+
|
|
744
|
+
@staticmethod
|
|
745
|
+
def Ellipse(origin: topologic.Vertex = None, inputMode: int = 1, width: float = 2.0, length: float = 1.0, focalLength: float = 0.866025, eccentricity: float = 0.866025, majorAxisLength: float = 1.0, minorAxisLength: float = 0.5, sides: float = 32, fromAngle: float = 0.0, toAngle: float = 360.0, close: bool = True, direction: list = [0,0,1], placement: str = "center", tolerance: float = 0.0001) -> topologic.Wire:
|
|
697
746
|
"""
|
|
698
747
|
Creates an ellipse and returns all its geometry and parameters.
|
|
699
748
|
|
|
@@ -745,7 +794,7 @@ class Wire(topologic.Wire):
|
|
|
745
794
|
return ellipseAll["ellipse"]
|
|
746
795
|
|
|
747
796
|
@staticmethod
|
|
748
|
-
def EllipseAll(origin=None, inputMode=1, width=2.0, length=1.0, focalLength= 0.866025, eccentricity=0.866025, majorAxisLength=1.0, minorAxisLength=0.5, sides=32, fromAngle=0, toAngle=360, close=True, direction=[0,0,1], placement="center", tolerance=0.0001):
|
|
797
|
+
def EllipseAll(origin: topologic.Vertex = None, inputMode: int = 1, width: float = 2.0, length: float = 1.0, focalLength: float = 0.866025, eccentricity: float = 0.866025, majorAxisLength: float = 1.0, minorAxisLength: float = 0.5, sides: int = 32, fromAngle: float = 0.0, toAngle: float = 360.0, close: bool = True, direction: list = [0,0,1], placement: str ="center", tolerance: float = 0.0001) -> topologic.Wire:
|
|
749
798
|
"""
|
|
750
799
|
Creates an ellipse and returns all its geometry and parameters.
|
|
751
800
|
|
|
@@ -914,7 +963,7 @@ class Wire(topologic.Wire):
|
|
|
914
963
|
return d
|
|
915
964
|
|
|
916
965
|
@staticmethod
|
|
917
|
-
def Flatten(wire, oldLocation=None, newLocation=None, direction=None):
|
|
966
|
+
def Flatten(wire: topologic.Wire, oldLocation: topologic.Vertex =None, newLocation: topologic.Vertex = None, direction: list = None):
|
|
918
967
|
"""
|
|
919
968
|
Flattens the input wire such that its center of mass is located at the origin and the specified direction is pointed in the positive Z axis.
|
|
920
969
|
|
|
@@ -986,7 +1035,7 @@ class Wire(topologic.Wire):
|
|
|
986
1035
|
return flatWire
|
|
987
1036
|
|
|
988
1037
|
@staticmethod
|
|
989
|
-
def Interpolate(wires: list, n: int = 5, outputType: str = "default", replication: str = "default"):
|
|
1038
|
+
def Interpolate(wires: list, n: int = 5, outputType: str = "default", replication: str = "default") -> topologic.Topology:
|
|
990
1039
|
"""
|
|
991
1040
|
Creates *n* number of wires that interpolate between wireA and wireB.
|
|
992
1041
|
|
|
@@ -1109,7 +1158,7 @@ class Wire(topologic.Wire):
|
|
|
1109
1158
|
return Topology.SelfMerge(Cluster.ByTopologies(finalWires+ridges))
|
|
1110
1159
|
|
|
1111
1160
|
@staticmethod
|
|
1112
|
-
def Invert(wire):
|
|
1161
|
+
def Invert(wire: topologic.Wire) -> topologic.Wire:
|
|
1113
1162
|
"""
|
|
1114
1163
|
Creates a wire that is an inverse (mirror) of the input wire.
|
|
1115
1164
|
|
|
@@ -1131,7 +1180,7 @@ class Wire(topologic.Wire):
|
|
|
1131
1180
|
return Wire.ByVertices(reversed_vertices)
|
|
1132
1181
|
|
|
1133
1182
|
@staticmethod
|
|
1134
|
-
def IsClosed(wire):
|
|
1183
|
+
def IsClosed(wire: topologic.Wire) -> bool:
|
|
1135
1184
|
"""
|
|
1136
1185
|
Returns True if the input wire is closed. Returns False otherwise.
|
|
1137
1186
|
|
|
@@ -1153,7 +1202,7 @@ class Wire(topologic.Wire):
|
|
|
1153
1202
|
return status
|
|
1154
1203
|
|
|
1155
1204
|
@staticmethod
|
|
1156
|
-
def IsInside(wire, vertex, tolerance=0.0001):
|
|
1205
|
+
def IsInside(wire: topologic.Wire, vertex: topologic.Vertex, tolerance: float = 0.0001) -> bool:
|
|
1157
1206
|
"""
|
|
1158
1207
|
Returns True if the input vertex is inside the input wire. Returns False otherwise.
|
|
1159
1208
|
|
|
@@ -1187,16 +1236,16 @@ class Wire(topologic.Wire):
|
|
|
1187
1236
|
return False
|
|
1188
1237
|
|
|
1189
1238
|
@staticmethod
|
|
1190
|
-
def Isovist(
|
|
1239
|
+
def Isovist(wire: topologic.Wire, viewPoint: topologic.Vertex, obstaclesCluster: topologic.Cluster, tolerance: float = 0.0001) -> list:
|
|
1191
1240
|
"""
|
|
1192
1241
|
Returns a list of faces representing the isovist projection from the input viewpoint.
|
|
1193
1242
|
|
|
1194
1243
|
Parameters
|
|
1195
1244
|
----------
|
|
1245
|
+
wire : topologic.Wire
|
|
1246
|
+
The wire representing the external boundary (border) of the isovist.
|
|
1196
1247
|
viewPoint : topologic.Vertex
|
|
1197
1248
|
The vertex representing the location of the viewpoint of the isovist.
|
|
1198
|
-
externalBoundary : topologic.Wire
|
|
1199
|
-
The wire representing the external boundary (border) of the isovist.
|
|
1200
1249
|
obstaclesCluster : topologic.Cluster
|
|
1201
1250
|
A cluster of wires representing the obstacles within the externalBoundary.
|
|
1202
1251
|
|
|
@@ -1220,13 +1269,13 @@ class Wire(topologic.Wire):
|
|
|
1220
1269
|
internalVertices = []
|
|
1221
1270
|
_ = obstaclesCluster.Vertices(None, internalVertices)
|
|
1222
1271
|
# 1. Create a Face with external and internal boundaries
|
|
1223
|
-
face = topologic.Face.ByExternalInternalBoundaries(
|
|
1272
|
+
face = topologic.Face.ByExternalInternalBoundaries(wire, internalBoundaries, False)
|
|
1224
1273
|
# 2. Draw Rays from viewpoint through each Vertex of the obstacles extending to the External Boundary
|
|
1225
1274
|
# 2.1 Get the Edges and Vertices of the External Boundary
|
|
1226
1275
|
exBoundaryEdges = []
|
|
1227
|
-
_ =
|
|
1276
|
+
_ = wire.Edges(None, exBoundaryEdges)
|
|
1228
1277
|
exBoundaryVertices = []
|
|
1229
|
-
_ =
|
|
1278
|
+
_ = wire.Vertices(None, exBoundaryVertices)
|
|
1230
1279
|
testTopologies = exBoundaryEdges+exBoundaryVertices
|
|
1231
1280
|
# 1.2 Find the maximum distance from the viewpoint to the edges and vertices of the external boundary
|
|
1232
1281
|
distances = []
|
|
@@ -1242,7 +1291,7 @@ class Wire(topologic.Wire):
|
|
|
1242
1291
|
newV = topologic.TopologyUtility.Scale(aVertex, viewPoint, scaleFactor, scaleFactor, scaleFactor)
|
|
1243
1292
|
try:
|
|
1244
1293
|
ray = topologic.Edge.ByStartVertexEndVertex(viewPoint, newV)
|
|
1245
|
-
topologyC = ray.Intersect(
|
|
1294
|
+
topologyC = ray.Intersect(wire, False)
|
|
1246
1295
|
vertices = []
|
|
1247
1296
|
_ = topologyC.Vertices(None, vertices)
|
|
1248
1297
|
if topologyC:
|
|
@@ -1293,9 +1342,8 @@ class Wire(topologic.Wire):
|
|
|
1293
1342
|
finalFaces.append(aFace)
|
|
1294
1343
|
return finalFaces
|
|
1295
1344
|
|
|
1296
|
-
|
|
1297
1345
|
@staticmethod
|
|
1298
|
-
def IsSimilar(wireA, wireB,
|
|
1346
|
+
def IsSimilar(wireA: topologic.Wire, wireB: topologic.Wire, angTolerance: float = 0.1, tolerance: float = 0.0001) -> bool:
|
|
1299
1347
|
"""
|
|
1300
1348
|
Returns True if the input wires are similar. Returns False otherwise. The wires must be closed.
|
|
1301
1349
|
|
|
@@ -1305,10 +1353,10 @@ class Wire(topologic.Wire):
|
|
|
1305
1353
|
The first input wire.
|
|
1306
1354
|
wireB : topologic.Wire
|
|
1307
1355
|
The second input wire.
|
|
1308
|
-
tolerance : float , optional
|
|
1309
|
-
The desired tolerance. The default is 0.0001.
|
|
1310
1356
|
angTolerance : float , optional
|
|
1311
1357
|
The desired angular tolerance. The default is 0.1.
|
|
1358
|
+
tolerance : float , optional
|
|
1359
|
+
The desired tolerance. The default is 0.0001.
|
|
1312
1360
|
|
|
1313
1361
|
Returns
|
|
1314
1362
|
-------
|
|
@@ -1393,9 +1441,8 @@ class Wire(topologic.Wire):
|
|
|
1393
1441
|
return True
|
|
1394
1442
|
return False
|
|
1395
1443
|
|
|
1396
|
-
|
|
1397
1444
|
@staticmethod
|
|
1398
|
-
def Length(wire, mantissa=4):
|
|
1445
|
+
def Length(wire: topologic.Wire, mantissa: int = 4) -> float:
|
|
1399
1446
|
"""
|
|
1400
1447
|
Returns the length of the input wire.
|
|
1401
1448
|
|
|
@@ -1429,7 +1476,7 @@ class Wire(topologic.Wire):
|
|
|
1429
1476
|
return totalLength
|
|
1430
1477
|
|
|
1431
1478
|
@staticmethod
|
|
1432
|
-
def Planarize(wire):
|
|
1479
|
+
def Planarize(wire: topologic.Wire) -> topologic.Wire:
|
|
1433
1480
|
"""
|
|
1434
1481
|
Returns a planarized version of the input wire.
|
|
1435
1482
|
|
|
@@ -1462,7 +1509,7 @@ class Wire(topologic.Wire):
|
|
|
1462
1509
|
return Wire.ByVertices(proj_verts, close=True)
|
|
1463
1510
|
|
|
1464
1511
|
@staticmethod
|
|
1465
|
-
def Project(wire, face, direction=None, mantissa=4
|
|
1512
|
+
def Project(wire: topologic.Wire, face: topologic.Face, direction: list = None, mantissa: int = 4) -> topologic.Wire:
|
|
1466
1513
|
"""
|
|
1467
1514
|
Creates a projection of the input wire unto the input face.
|
|
1468
1515
|
|
|
@@ -1523,7 +1570,7 @@ class Wire(topologic.Wire):
|
|
|
1523
1570
|
return w
|
|
1524
1571
|
|
|
1525
1572
|
@staticmethod
|
|
1526
|
-
def Rectangle(origin=None, width=1.0, length=1.0, direction=[0,0,1], placement="center", tolerance=0.0001):
|
|
1573
|
+
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.Wire:
|
|
1527
1574
|
"""
|
|
1528
1575
|
Creates a rectangle.
|
|
1529
1576
|
|
|
@@ -1536,7 +1583,7 @@ class Wire(topologic.Wire):
|
|
|
1536
1583
|
length : float , optional
|
|
1537
1584
|
The length of the rectangle. The default is 1.0.
|
|
1538
1585
|
direction : list , optional
|
|
1539
|
-
The
|
|
1586
|
+
The vector representing the up direction of the rectangle. The default is [0,0,1].
|
|
1540
1587
|
placement : str , optional
|
|
1541
1588
|
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".
|
|
1542
1589
|
tolerance : float , optional
|
|
@@ -1594,7 +1641,7 @@ class Wire(topologic.Wire):
|
|
|
1594
1641
|
return baseWire
|
|
1595
1642
|
|
|
1596
1643
|
@staticmethod
|
|
1597
|
-
def RemoveCollinearEdges(wire, angTolerance=0.1):
|
|
1644
|
+
def RemoveCollinearEdges(wire: topologic.Wire, angTolerance: float = 0.1) -> topologic.Wire:
|
|
1598
1645
|
"""
|
|
1599
1646
|
Removes any collinear edges in the input wire.
|
|
1600
1647
|
|
|
@@ -1670,9 +1717,8 @@ class Wire(topologic.Wire):
|
|
|
1670
1717
|
else:
|
|
1671
1718
|
return None
|
|
1672
1719
|
|
|
1673
|
-
|
|
1674
1720
|
@staticmethod
|
|
1675
|
-
def Split(wire):
|
|
1721
|
+
def Split(wire: topologic.Wire) -> list:
|
|
1676
1722
|
"""
|
|
1677
1723
|
Splits the input wire into segments at its intersections (i.e. at any vertex where more than two edges meet).
|
|
1678
1724
|
|
|
@@ -1749,9 +1795,34 @@ class Wire(topologic.Wire):
|
|
|
1749
1795
|
return [wire]
|
|
1750
1796
|
return wires
|
|
1751
1797
|
|
|
1798
|
+
@staticmethod
|
|
1799
|
+
def Square(origin: topologic.Vertex = None, size: float = 1.0, direction: list = [0,0,1], placement: str = "center", tolerance: float = 0.0001) -> topologic.Wire:
|
|
1800
|
+
"""
|
|
1801
|
+
Creates a square.
|
|
1802
|
+
|
|
1803
|
+
Parameters
|
|
1804
|
+
----------
|
|
1805
|
+
origin : topologic.Vertex , optional
|
|
1806
|
+
The location of the origin of the square. The default is None which results in the square being placed at (0,0,0).
|
|
1807
|
+
size : float , optional
|
|
1808
|
+
The size of the square. The default is 1.0.
|
|
1809
|
+
direction : list , optional
|
|
1810
|
+
The vector representing the up direction of the square. The default is [0,0,1].
|
|
1811
|
+
placement : str , optional
|
|
1812
|
+
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".
|
|
1813
|
+
tolerance : float , optional
|
|
1814
|
+
The desired tolerance. The default is 0.0001.
|
|
1815
|
+
|
|
1816
|
+
Returns
|
|
1817
|
+
-------
|
|
1818
|
+
topologic.Wire
|
|
1819
|
+
The created square.
|
|
1820
|
+
|
|
1821
|
+
"""
|
|
1822
|
+
return Wire.Rectangle(origin = origin, width = size, length = size, direction = direction, placement = placement, tolerance = tolerance)
|
|
1752
1823
|
|
|
1753
1824
|
@staticmethod
|
|
1754
|
-
def Star(origin=None, radiusA=1.0, radiusB=0.4, rays=5, direction=[0,0,1], placement="center", tolerance=0.0001):
|
|
1825
|
+
def Star(origin: topologic.Wire = None, radiusA: float = 1.0, radiusB: float = 0.4, rays: int = 5, direction: list = [0,0,1], placement: str = "center", tolerance: float = 0.0001) -> topologic.Wire:
|
|
1755
1826
|
"""
|
|
1756
1827
|
Creates a star.
|
|
1757
1828
|
|
|
@@ -1843,9 +1914,8 @@ class Wire(topologic.Wire):
|
|
|
1843
1914
|
baseWire = topologic.TopologyUtility.Rotate(baseWire, origin, 0, 0, 1, phi)
|
|
1844
1915
|
return baseWire
|
|
1845
1916
|
|
|
1846
|
-
|
|
1847
1917
|
@staticmethod
|
|
1848
|
-
def Trapezoid(origin=None, widthA=1.0, widthB=0.75, offsetA=0.0, offsetB=0.0, length=1.0, direction=[0,0,1], placement="center", tolerance=0.0001):
|
|
1918
|
+
def Trapezoid(origin: topologic.Vertex = None, widthA: float = 1.0, widthB: float = 0.75, offsetA: float = 0.0, offsetB: float = 0.0, length: float = 1.0, direction: list = [0,0,1], placement: str = "center", tolerance: float = 0.0001) -> topologic.Wire:
|
|
1849
1919
|
"""
|
|
1850
1920
|
Creates a trapezoid.
|
|
1851
1921
|
|
|
@@ -1922,9 +1992,9 @@ class Wire(topologic.Wire):
|
|
|
1922
1992
|
return baseWire
|
|
1923
1993
|
|
|
1924
1994
|
@staticmethod
|
|
1925
|
-
def Vertices(wire):
|
|
1995
|
+
def Vertices(wire: topologic.Wire) -> list:
|
|
1926
1996
|
"""
|
|
1927
|
-
Returns the vertices of the input wire.
|
|
1997
|
+
Returns the list of vertices of the input wire.
|
|
1928
1998
|
|
|
1929
1999
|
Parameters
|
|
1930
2000
|
----------
|
topologicpy/__init__.py
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: topologicpy
|
|
3
|
-
Version: 0.3.
|
|
3
|
+
Version: 0.3.2
|
|
4
4
|
Summary: An Advanced Spatial Modelling and Analysis Software Library for Architecture, Engineering, and Construction.
|
|
5
5
|
Author-email: Wassim Jabi <wassim.jabi@gmail.com>
|
|
6
6
|
Project-URL: Homepage, https://github.com/wassimj/TopologicPy
|