topologicpy 0.7.9__py3-none-any.whl → 0.7.11__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/Edge.py +6 -2
- topologicpy/Face.py +91 -28
- topologicpy/Wire.py +13 -3
- topologicpy/version.py +1 -1
- {topologicpy-0.7.9.dist-info → topologicpy-0.7.11.dist-info}/METADATA +1 -1
- {topologicpy-0.7.9.dist-info → topologicpy-0.7.11.dist-info}/RECORD +9 -9
- {topologicpy-0.7.9.dist-info → topologicpy-0.7.11.dist-info}/LICENSE +0 -0
- {topologicpy-0.7.9.dist-info → topologicpy-0.7.11.dist-info}/WHEEL +0 -0
- {topologicpy-0.7.9.dist-info → topologicpy-0.7.11.dist-info}/top_level.txt +0 -0
topologicpy/Edge.py
CHANGED
@@ -221,7 +221,7 @@ class Edge():
|
|
221
221
|
"""
|
222
222
|
from topologicpy.Vertex import Vertex
|
223
223
|
from topologicpy.Topology import Topology
|
224
|
-
|
224
|
+
|
225
225
|
edge = None
|
226
226
|
if not Topology.IsInstance(vertexA, "Vertex"):
|
227
227
|
if not silent:
|
@@ -297,7 +297,11 @@ class Edge():
|
|
297
297
|
if not silent:
|
298
298
|
print("Edge.ByVertices - Error: The input vertices parameter has less than two vertices. Returning None.")
|
299
299
|
return None
|
300
|
-
|
300
|
+
edge = Edge.ByStartVertexEndVertex(vertexList[0], vertexList[-1], tolerance=tolerance, silent=silent)
|
301
|
+
if not edge:
|
302
|
+
if not silent:
|
303
|
+
print("Edge.ByVertices - Error: Could not create an edge. Returning None.")
|
304
|
+
return edge
|
301
305
|
|
302
306
|
@staticmethod
|
303
307
|
def ByVerticesCluster(cluster, tolerance: float = 0.0001):
|
topologicpy/Face.py
CHANGED
@@ -1254,7 +1254,7 @@ class Face():
|
|
1254
1254
|
return Vector.IsCollinear(dirA, dirB)
|
1255
1255
|
|
1256
1256
|
@staticmethod
|
1257
|
-
def Isovist(face, vertex, obstacles =
|
1257
|
+
def Isovist(face, vertex, obstacles: list = [], direction: list = [0,1,0], fov: float = 360, mantissa: int = 6, tolerance: float = 0.0001):
|
1258
1258
|
"""
|
1259
1259
|
Returns the face representing the isovist projection from the input viewpoint.
|
1260
1260
|
This method assumes all input is in 2D. Z coordinates are ignored.
|
@@ -1267,14 +1267,17 @@ class Face():
|
|
1267
1267
|
The vertex representing the location of the viewpoint of the isovist.
|
1268
1268
|
obstacles : list , optional
|
1269
1269
|
A list of wires representing the obstacles within the face. All obstacles are assumed to be within the
|
1270
|
-
boundary of the face.
|
1271
|
-
|
1272
|
-
The
|
1273
|
-
|
1274
|
-
positive Y
|
1275
|
-
|
1276
|
-
|
1277
|
-
|
1270
|
+
boundary of the face. The default is [].
|
1271
|
+
direction : list, optional
|
1272
|
+
The vector representing the direction (in the XY plane) in which the observer is facing. The Z component is ignored.
|
1273
|
+
The direction follows the Vector.CompassAngle convention where [0,1,0] (North) is considered to be
|
1274
|
+
in the positive Y direction, [1,0,0] (East) is considered to be in the positive X-direction.
|
1275
|
+
Angles are measured in a clockwise fashion. The default is [0,1,0] (North).
|
1276
|
+
fov : float , optional
|
1277
|
+
The horizontal field of view (fov) angle in degrees. See https://en.wikipedia.org/wiki/Field_of_view.
|
1278
|
+
The acceptable range is 1 to 360. The default is 360.
|
1279
|
+
mantissa : int , optional
|
1280
|
+
The desired length of the mantissa. The default is 6.
|
1278
1281
|
tolerance : float , optional:
|
1279
1282
|
The desired tolerance. The default is 0.0001.
|
1280
1283
|
|
@@ -1282,7 +1285,7 @@ class Face():
|
|
1282
1285
|
-------
|
1283
1286
|
topologic_core.Face
|
1284
1287
|
The face representing the isovist projection from the input viewpoint.
|
1285
|
-
|
1288
|
+
|
1286
1289
|
"""
|
1287
1290
|
from topologicpy.Vertex import Vertex
|
1288
1291
|
from topologicpy.Edge import Edge
|
@@ -1291,7 +1294,8 @@ class Face():
|
|
1291
1294
|
from topologicpy.Shell import Shell
|
1292
1295
|
from topologicpy.Cluster import Cluster
|
1293
1296
|
from topologicpy.Topology import Topology
|
1294
|
-
|
1297
|
+
from topologicpy.Vector import Vector
|
1298
|
+
|
1295
1299
|
def vertexPartofFace(vertex, face, tolerance):
|
1296
1300
|
vertices = []
|
1297
1301
|
_ = face.Vertices(None, vertices)
|
@@ -1299,45 +1303,104 @@ class Face():
|
|
1299
1303
|
if Vertex.Distance(vertex, v) < tolerance:
|
1300
1304
|
return True
|
1301
1305
|
return False
|
1302
|
-
|
1306
|
+
|
1303
1307
|
if not Topology.IsInstance(face, "Face"):
|
1304
1308
|
print("Face.Isovist - Error: The input boundary parameter is not a valid Face. Returning None")
|
1305
1309
|
return None
|
1306
1310
|
if not Topology.IsInstance(vertex, "Vertex"):
|
1307
1311
|
print("Face.Isovist - Error: The input viewPoint parameter is not a valid Vertex. Returning None")
|
1308
1312
|
return None
|
1313
|
+
if fov < 1 or fov > 360:
|
1314
|
+
print("Face.Isovist - Error: The input fov parameter is outside the acceptable range of 0 to 360 degrees. Returning None")
|
1315
|
+
return None
|
1309
1316
|
if isinstance(obstacles, list):
|
1310
1317
|
obstacles = [obs for obs in obstacles if Topology.IsInstance(obs, "Wire")]
|
1318
|
+
else:
|
1319
|
+
obstacles = []
|
1320
|
+
|
1321
|
+
origin = Vertex.Origin()
|
1322
|
+
normal = Face.Normal(face)
|
1323
|
+
flat_face = Topology.Flatten(face, origin=origin, direction=normal)
|
1324
|
+
flat_vertex = Topology.Flatten(vertex, origin=origin, direction=normal)
|
1325
|
+
eb = Face.ExternalBoundary(flat_face)
|
1326
|
+
vertices = Topology.Vertices(eb)
|
1327
|
+
coords = [Vertex.Coordinates(v, outputType="xy") for v in vertices]
|
1328
|
+
new_vertices = [Vertex.ByCoordinates(coord) for coord in coords]
|
1329
|
+
eb = Wire.ByVertices(new_vertices, close=True)
|
1330
|
+
|
1331
|
+
ib_list = Face.InternalBoundaries(flat_face)
|
1332
|
+
new_ib_list = []
|
1333
|
+
for ib in ib_list:
|
1334
|
+
vertices = Topology.Vertices(ib)
|
1335
|
+
coords = [Vertex.Coordinates(v, outputType="xy") for v in vertices]
|
1336
|
+
new_vertices = [Vertex.ByCoordinates(coord) for coord in coords]
|
1337
|
+
new_ib_list.append(Wire.ByVertices(new_vertices, close=True))
|
1338
|
+
|
1339
|
+
flat_face = Face.ByWires(eb, new_ib_list)
|
1311
1340
|
for obs in obstacles:
|
1312
|
-
|
1313
|
-
targets = Topology.Vertices(
|
1341
|
+
flat_face = Topology.Difference(flat_face, Face.ByWire(obs))
|
1342
|
+
targets = Topology.Vertices(flat_face)
|
1314
1343
|
distances = []
|
1315
1344
|
for target in targets:
|
1316
|
-
distances.append(Vertex.Distance(
|
1345
|
+
distances.append(Vertex.Distance(flat_vertex, target))
|
1317
1346
|
distances.sort()
|
1318
1347
|
max_d = distances[-1]*1.05
|
1319
1348
|
edges = []
|
1320
1349
|
for target in targets:
|
1321
|
-
if Vertex.Distance(
|
1322
|
-
e = Edge.ByVertices(
|
1323
|
-
e = Edge.SetLength(e, length=max_d, bothSides=False)
|
1350
|
+
if Vertex.Distance(flat_vertex, target) > tolerance:
|
1351
|
+
e = Edge.ByVertices(flat_vertex, target, silent=True)
|
1352
|
+
e = Edge.SetLength(e, length=max_d, bothSides=False, tolerance=tolerance)
|
1324
1353
|
edges.append(e)
|
1325
|
-
shell = Topology.Slice(
|
1354
|
+
shell = Topology.Slice(flat_face, Cluster.ByTopologies(edges))
|
1326
1355
|
faces = Topology.Faces(shell)
|
1327
1356
|
final_faces = []
|
1328
|
-
for
|
1329
|
-
if vertexPartofFace(
|
1330
|
-
final_faces.append(
|
1357
|
+
for f in faces:
|
1358
|
+
if vertexPartofFace(flat_vertex, f, tolerance=0.001):
|
1359
|
+
final_faces.append(f)
|
1331
1360
|
shell = Shell.ByFaces(final_faces)
|
1332
|
-
return_face = Topology.RemoveCoplanarFaces(shell)
|
1333
|
-
if
|
1361
|
+
return_face = Topology.RemoveCoplanarFaces(shell, epsilon=0.1)
|
1362
|
+
if not Topology.IsInstance(return_face, "face"):
|
1363
|
+
temp = Shell.ExternalBoundary(shell)
|
1364
|
+
if Topology.IsInstance(temp, "Wire"):
|
1365
|
+
return_face = Face.ByWire(temp)
|
1366
|
+
elif Topology.IsInstance(temp, "Cluster"):
|
1367
|
+
edges = Topology.Edges(temp)
|
1368
|
+
vertices = Topology.Vertices(temp)
|
1369
|
+
vertices = Vertex.Fuse(vertices, tolerance=0.01)
|
1370
|
+
new_edges = []
|
1371
|
+
for edge in edges:
|
1372
|
+
sv = vertices[Vertex.Index(Edge.StartVertex(edge), vertices, tolerance=0.01)]
|
1373
|
+
ev = vertices[Vertex.Index(Edge.EndVertex(edge), vertices, tolerance=0.01)]
|
1374
|
+
if Vertex.Distance(sv, ev) > tolerance:
|
1375
|
+
new_edges.append(Edge.ByVertices([sv,ev]))
|
1376
|
+
w = Wire.ByEdges(new_edges, tolerance=0.01)
|
1377
|
+
return_face = Face.ByWire(w)
|
1378
|
+
if not Topology.IsInstance(return_face, "Face"):
|
1379
|
+
print("Face.Isovist - Error: Could not create isovist. Returning None.")
|
1380
|
+
return None
|
1381
|
+
|
1382
|
+
compAngle = 0
|
1383
|
+
if fov == 360:
|
1384
|
+
pie = Face.Circle(origin= vertex, radius=max_d, sides=180)
|
1385
|
+
else:
|
1386
|
+
compAngle = Vector.CompassAngle(Vector.North(), direction, mantissa=mantissa, tolerance=tolerance) - 90
|
1387
|
+
fromAngle = -fov*0.5 - compAngle
|
1388
|
+
toAngle = fov*0.5 - compAngle
|
1334
1389
|
c = Wire.Circle(origin= vertex, radius=max_d, sides=180, fromAngle=fromAngle, toAngle=toAngle, close = False)
|
1335
|
-
e1 = Edge.ByVertices(Wire.StartVertex(c), vertex)
|
1336
|
-
e2 = Edge.ByVertices(Wire.EndVertex(c), vertex)
|
1390
|
+
e1 = Edge.ByVertices(Wire.StartVertex(c), vertex, silent=True)
|
1391
|
+
e2 = Edge.ByVertices(Wire.EndVertex(c), vertex, silent=True)
|
1337
1392
|
edges = Topology.Edges(c) + [e1,e2]
|
1338
1393
|
pie = Face.ByWire(Topology.SelfMerge(Cluster.ByTopologies(edges)))
|
1339
|
-
|
1340
|
-
|
1394
|
+
return_face = Topology.Intersect(pie, return_face)
|
1395
|
+
if not Topology.IsInstance(return_face, "face"):
|
1396
|
+
return_face = Topology.SelfMerge(return_face)
|
1397
|
+
if return_face == None:
|
1398
|
+
print("Face.Isovist - Error: Could not create isovist. Returning None.")
|
1399
|
+
return None
|
1400
|
+
simpler_face = Face.RemoveCollinearEdges(return_face)
|
1401
|
+
if Topology.IsInstance(simpler_face, "face"):
|
1402
|
+
return Topology.Unflatten(simpler_face, origin=origin, direction=normal)
|
1403
|
+
return Topology.Unflatten(return_face, origin=origin, direction=normal)
|
1341
1404
|
|
1342
1405
|
@staticmethod
|
1343
1406
|
def MedialAxis(face, resolution: int = 0, externalVertices: bool = False, internalVertices: bool = False, toLeavesOnly: bool = False, angTolerance: float = 0.1, tolerance: float = 0.0001):
|
topologicpy/Wire.py
CHANGED
@@ -1519,17 +1519,26 @@ class Wire(Topology):
|
|
1519
1519
|
normal = Face.Normal(f)
|
1520
1520
|
origin = Topology.Centroid(f)
|
1521
1521
|
w = Topology.Flatten(wire, origin=origin, direction=normal)
|
1522
|
+
flat_f = Topology.Flatten(f, origin=origin, direction=normal)
|
1523
|
+
flat_normal = Face.Normal(flat_f)
|
1524
|
+
if flat_normal[2] < 0:
|
1525
|
+
w = Topology.Rotate(w, origin=origin, axis=[1,0,0], angle=180)
|
1522
1526
|
angles = []
|
1523
1527
|
edges = Topology.Edges(w)
|
1524
1528
|
for i in range(len(edges)-1):
|
1525
1529
|
e1 = edges[i]
|
1526
1530
|
e2 = edges[i+1]
|
1527
|
-
a = round(
|
1531
|
+
a = round(Vector.Angle(Edge.Direction(e1), Vector.Reverse(Edge.Direction(e2))), mantissa)
|
1528
1532
|
angles.append(a)
|
1529
1533
|
e1 = edges[len(edges)-1]
|
1530
1534
|
e2 = edges[0]
|
1531
|
-
a = round(
|
1535
|
+
a = round(Vector.Angle(Edge.Direction(e1), Vector.Reverse(Edge.Direction(e2))), mantissa)
|
1532
1536
|
angles = [a]+angles
|
1537
|
+
# if abs(sum(angles)-(len(angles)-2)*180)<tolerance:
|
1538
|
+
# return angles
|
1539
|
+
# else:
|
1540
|
+
# angles = [360-ang for ang in angles]
|
1541
|
+
# return angles
|
1533
1542
|
return angles
|
1534
1543
|
|
1535
1544
|
@staticmethod
|
@@ -2203,7 +2212,8 @@ class Wire(Topology):
|
|
2203
2212
|
sv = vertices[Vertex.Index(sv, vertices)]
|
2204
2213
|
ev = Edge.EndVertex(edge)
|
2205
2214
|
ev = vertices[Vertex.Index(ev, vertices)]
|
2206
|
-
|
2215
|
+
if Vertex.Distance(sv, ev) > tolerance:
|
2216
|
+
new_edges.append(Edge.ByVertices([sv,ev]))
|
2207
2217
|
new_wire = Topology.SelfMerge(Cluster.ByTopologies(new_edges), tolerance=tolerance)
|
2208
2218
|
return new_wire
|
2209
2219
|
|
topologicpy/version.py
CHANGED
@@ -1 +1 @@
|
|
1
|
-
__version__ = '0.7.
|
1
|
+
__version__ = '0.7.11'
|
@@ -1,6 +1,6 @@
|
|
1
1
|
Metadata-Version: 2.1
|
2
2
|
Name: topologicpy
|
3
|
-
Version: 0.7.
|
3
|
+
Version: 0.7.11
|
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
|
License: MIT License
|
@@ -6,9 +6,9 @@ topologicpy/Color.py,sha256=UlmRcCSOhqcM_OyMWz4t3Kr75KcgXDhz3uctAJ2n7Ic,18031
|
|
6
6
|
topologicpy/Context.py,sha256=ppApYKngZZCQBFWaxIMi2z2dokY23c935IDCBosxDAE,3055
|
7
7
|
topologicpy/DGL.py,sha256=RpkLnAzjg6arY7cEMs2pDFYzRdkerVg1Wbm9hcE3QaM,138991
|
8
8
|
topologicpy/Dictionary.py,sha256=pMbfE2RYGCNpVr2x58qiHRc-aBWnp1jLlyzwS9nz6-w,25891
|
9
|
-
topologicpy/Edge.py,sha256=
|
9
|
+
topologicpy/Edge.py,sha256=EiOgg2HtuR-YtL5cpFcLcL1Y3A2Y-m4qPNtLjHGRZBQ,52407
|
10
10
|
topologicpy/EnergyModel.py,sha256=ni0H1JgvLl1-q90yK9Sm1qj5P1fTuidlimEIcwuj6qE,53287
|
11
|
-
topologicpy/Face.py,sha256=
|
11
|
+
topologicpy/Face.py,sha256=IiejcLoTDhY0C97I-2IQuOniHf7vDirpzjhG_rj4X5s,101031
|
12
12
|
topologicpy/Graph.py,sha256=IFEGU0MCE4_fPe2j8sx1vuXPKMjGaov5wTlgRAwB7ns,384631
|
13
13
|
topologicpy/Grid.py,sha256=2uDFDxg4NqROC-7bNi1BjK5Uz__BPH13afJ-VDBRW0M,18466
|
14
14
|
topologicpy/Helper.py,sha256=07V9IFu5ilMpvAdZVhIbdBOjBJSRTtJ0BfR1IoRaRXU,17743
|
@@ -23,11 +23,11 @@ topologicpy/Sun.py,sha256=3tYb8kssU882lE1gEWg2mxDvCCY_LAVElkyUT6wa-ZU,36935
|
|
23
23
|
topologicpy/Topology.py,sha256=sXvhiMShOjOp0aILjEU6uNDqKm3zEAEdrN_IJgDK47c,308819
|
24
24
|
topologicpy/Vector.py,sha256=2OXmty9CKZZzfsg5T4ckml-lPUUvgDvqokcKDsZVN9Y,29806
|
25
25
|
topologicpy/Vertex.py,sha256=WjQZf-r8h_Cjwkt_qNN483FCUql20fbv72Ymiq7ZYtw,67462
|
26
|
-
topologicpy/Wire.py,sha256=
|
26
|
+
topologicpy/Wire.py,sha256=Mr9FhiFmcdASjg85ylGTwQmlrcPJuMJh2XybGlg2JH0,139515
|
27
27
|
topologicpy/__init__.py,sha256=D7ky87CAQMiS2KE6YLvcTLkTgA2PY7rASe6Z23pjp9k,872
|
28
|
-
topologicpy/version.py,sha256=
|
29
|
-
topologicpy-0.7.
|
30
|
-
topologicpy-0.7.
|
31
|
-
topologicpy-0.7.
|
32
|
-
topologicpy-0.7.
|
33
|
-
topologicpy-0.7.
|
28
|
+
topologicpy/version.py,sha256=CRTpS8UXaJkuf-9u9BHiQMdmQOwD3_viBSxzJw8B4-8,23
|
29
|
+
topologicpy-0.7.11.dist-info/LICENSE,sha256=BRNw73R2WdDBICtwhI3wm3cxsaVqLTAGuRwrTltcfxs,1068
|
30
|
+
topologicpy-0.7.11.dist-info/METADATA,sha256=ZUyfq-XqWnusntlHekNjU8MbsQNOLQEa-9zfwi4GdFw,8405
|
31
|
+
topologicpy-0.7.11.dist-info/WHEEL,sha256=GJ7t_kWBFywbagK5eo9IoUwLW6oyOeTKmQ-9iHFVNxQ,92
|
32
|
+
topologicpy-0.7.11.dist-info/top_level.txt,sha256=J30bDzW92Ob7hw3zA8V34Jlp-vvsfIkGzkr8sqvb4Uw,12
|
33
|
+
topologicpy-0.7.11.dist-info/RECORD,,
|
File without changes
|
File without changes
|
File without changes
|