topologicpy 0.7.9__py3-none-any.whl → 0.7.10__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 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
- return Edge.ByStartVertexEndVertex(vertexList[0], vertexList[-1], tolerance=tolerance, silent=silent)
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 = None, fromAngle=0, toAngle=360, tolerance: float = 0.0001):
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
- fromAngle : float , optional
1272
- The angle in degrees from which to start creating the arc of the circle. The default is 0.
1273
- 0 is considered to be in the positive X-axis direction. 90 is considered to be in the
1274
- positive Y-axis direction.
1275
- toAngle : float , optional
1276
- The angle in degrees at which to end creating the arc of the circle. The default is 360.
1277
- Angles are measured in an anti-clockwise fashion.
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,15 +1303,20 @@ 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 = []
1311
1320
  for obs in obstacles:
1312
1321
  face = Topology.Difference(face, Face.ByWire(obs))
1313
1322
  targets = Topology.Vertices(face)
@@ -1319,8 +1328,8 @@ class Face():
1319
1328
  edges = []
1320
1329
  for target in targets:
1321
1330
  if Vertex.Distance(vertex, target) > tolerance:
1322
- e = Edge.ByVertices(vertex, target)
1323
- e = Edge.SetLength(e, length=max_d, bothSides=False)
1331
+ e = Edge.ByVertices(vertex, target, silent=True)
1332
+ e = Edge.SetLength(e, length=max_d, bothSides=False, tolerance=tolerance)
1324
1333
  edges.append(e)
1325
1334
  shell = Topology.Slice(face, Cluster.ByTopologies(edges))
1326
1335
  faces = Topology.Faces(shell)
@@ -1330,13 +1339,25 @@ class Face():
1330
1339
  final_faces.append(face)
1331
1340
  shell = Shell.ByFaces(final_faces)
1332
1341
  return_face = Topology.RemoveCoplanarFaces(shell)
1333
- if abs(360 - toAngle - fromAngle) > tolerance:
1342
+ compAngle = 0
1343
+ if fov == 360:
1344
+ c = Wire.Circle(origin= vertex, radius=max_d, sides=180, close = True)
1345
+ pie = Face.ByWire(c)
1346
+ else:
1347
+ compAngle = Vector.CompassAngle(Vector.North(), direction, mantissa=mantissa, tolerance=tolerance) - 90
1348
+ fromAngle = -fov*0.5 - compAngle
1349
+ toAngle = fov*0.5 - compAngle
1334
1350
  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)
1351
+ e1 = Edge.ByVertices(Wire.StartVertex(c), vertex, silent=True)
1352
+ e2 = Edge.ByVertices(Wire.EndVertex(c), vertex, silent=True)
1337
1353
  edges = Topology.Edges(c) + [e1,e2]
1338
1354
  pie = Face.ByWire(Topology.SelfMerge(Cluster.ByTopologies(edges)))
1339
- return_face = Topology.Intersect(pie, return_face)
1355
+ return_face = Topology.Intersect(pie, return_face)
1356
+ if not Topology.IsInstance(return_face, "face"):
1357
+ return_face = Topology.SelfMerge(return_face)
1358
+ if return_face == None:
1359
+ print("Face.Isovist - Error: Could not create isovist. Returning None.")
1360
+ return None
1340
1361
  return return_face
1341
1362
 
1342
1363
  @staticmethod
topologicpy/Wire.py CHANGED
@@ -2203,7 +2203,8 @@ class Wire(Topology):
2203
2203
  sv = vertices[Vertex.Index(sv, vertices)]
2204
2204
  ev = Edge.EndVertex(edge)
2205
2205
  ev = vertices[Vertex.Index(ev, vertices)]
2206
- new_edges.append(Edge.ByVertices([sv,ev]))
2206
+ if Vertex.Distance(sv, ev) > tolerance:
2207
+ new_edges.append(Edge.ByVertices([sv,ev]))
2207
2208
  new_wire = Topology.SelfMerge(Cluster.ByTopologies(new_edges), tolerance=tolerance)
2208
2209
  return new_wire
2209
2210
 
topologicpy/version.py CHANGED
@@ -1 +1 @@
1
- __version__ = '0.7.9'
1
+ __version__ = '0.7.10'
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: topologicpy
3
- Version: 0.7.9
3
+ Version: 0.7.10
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=KCQm9QfwjsYO4yKE4p4elpha9c4MY6EWAEaK_6mTAjo,52239
9
+ topologicpy/Edge.py,sha256=EiOgg2HtuR-YtL5cpFcLcL1Y3A2Y-m4qPNtLjHGRZBQ,52407
10
10
  topologicpy/EnergyModel.py,sha256=ni0H1JgvLl1-q90yK9Sm1qj5P1fTuidlimEIcwuj6qE,53287
11
- topologicpy/Face.py,sha256=uPVVFF6CLzEW2JaTllQJp7nBsS2w3wAz7qwfujWTQAk,97474
11
+ topologicpy/Face.py,sha256=XqBi_wrR8qhxE8UdT-GhIoRnmaxo64E9Etm9iELjX5A,98729
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=efqePp91BvAdj4JitSW_f-xeGoTFg_AxP5g5pmbBVFw,139047
26
+ topologicpy/Wire.py,sha256=TTGVySZAbo0cY_Ykoqyv6FiQHBBHzRGOKITjRNkdzSg,139107
27
27
  topologicpy/__init__.py,sha256=D7ky87CAQMiS2KE6YLvcTLkTgA2PY7rASe6Z23pjp9k,872
28
- topologicpy/version.py,sha256=zKmTTl0oKv8UEnjDkiAKOUL5t2pURpcJX_sqiJZHBIc,22
29
- topologicpy-0.7.9.dist-info/LICENSE,sha256=BRNw73R2WdDBICtwhI3wm3cxsaVqLTAGuRwrTltcfxs,1068
30
- topologicpy-0.7.9.dist-info/METADATA,sha256=tHxNNM7xU92yefkBRv_hIHib5vZyWKzyazZCTIJeE0s,8404
31
- topologicpy-0.7.9.dist-info/WHEEL,sha256=GJ7t_kWBFywbagK5eo9IoUwLW6oyOeTKmQ-9iHFVNxQ,92
32
- topologicpy-0.7.9.dist-info/top_level.txt,sha256=J30bDzW92Ob7hw3zA8V34Jlp-vvsfIkGzkr8sqvb4Uw,12
33
- topologicpy-0.7.9.dist-info/RECORD,,
28
+ topologicpy/version.py,sha256=yDniQ0XMYyXTl9AyH9Sr2sBx5o3HhQZmldHel-_qTEc,23
29
+ topologicpy-0.7.10.dist-info/LICENSE,sha256=BRNw73R2WdDBICtwhI3wm3cxsaVqLTAGuRwrTltcfxs,1068
30
+ topologicpy-0.7.10.dist-info/METADATA,sha256=VxeJ8w5ZkcWATvgpOBWfYR3qdsZGmU0EAeYavY7JjUI,8405
31
+ topologicpy-0.7.10.dist-info/WHEEL,sha256=GJ7t_kWBFywbagK5eo9IoUwLW6oyOeTKmQ-9iHFVNxQ,92
32
+ topologicpy-0.7.10.dist-info/top_level.txt,sha256=J30bDzW92Ob7hw3zA8V34Jlp-vvsfIkGzkr8sqvb4Uw,12
33
+ topologicpy-0.7.10.dist-info/RECORD,,