topologicpy 0.7.10__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/Face.py CHANGED
@@ -1317,32 +1317,71 @@ class Face():
1317
1317
  obstacles = [obs for obs in obstacles if Topology.IsInstance(obs, "Wire")]
1318
1318
  else:
1319
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)
1320
1340
  for obs in obstacles:
1321
- face = Topology.Difference(face, Face.ByWire(obs))
1322
- targets = Topology.Vertices(face)
1341
+ flat_face = Topology.Difference(flat_face, Face.ByWire(obs))
1342
+ targets = Topology.Vertices(flat_face)
1323
1343
  distances = []
1324
1344
  for target in targets:
1325
- distances.append(Vertex.Distance(vertex, target))
1345
+ distances.append(Vertex.Distance(flat_vertex, target))
1326
1346
  distances.sort()
1327
1347
  max_d = distances[-1]*1.05
1328
1348
  edges = []
1329
1349
  for target in targets:
1330
- if Vertex.Distance(vertex, target) > tolerance:
1331
- e = Edge.ByVertices(vertex, target, silent=True)
1350
+ if Vertex.Distance(flat_vertex, target) > tolerance:
1351
+ e = Edge.ByVertices(flat_vertex, target, silent=True)
1332
1352
  e = Edge.SetLength(e, length=max_d, bothSides=False, tolerance=tolerance)
1333
1353
  edges.append(e)
1334
- shell = Topology.Slice(face, Cluster.ByTopologies(edges))
1354
+ shell = Topology.Slice(flat_face, Cluster.ByTopologies(edges))
1335
1355
  faces = Topology.Faces(shell)
1336
1356
  final_faces = []
1337
- for face in faces:
1338
- if vertexPartofFace(vertex, face, tolerance=0.001):
1339
- final_faces.append(face)
1357
+ for f in faces:
1358
+ if vertexPartofFace(flat_vertex, f, tolerance=0.001):
1359
+ final_faces.append(f)
1340
1360
  shell = Shell.ByFaces(final_faces)
1341
- return_face = Topology.RemoveCoplanarFaces(shell)
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
+
1342
1382
  compAngle = 0
1343
1383
  if fov == 360:
1344
- c = Wire.Circle(origin= vertex, radius=max_d, sides=180, close = True)
1345
- pie = Face.ByWire(c)
1384
+ pie = Face.Circle(origin= vertex, radius=max_d, sides=180)
1346
1385
  else:
1347
1386
  compAngle = Vector.CompassAngle(Vector.North(), direction, mantissa=mantissa, tolerance=tolerance) - 90
1348
1387
  fromAngle = -fov*0.5 - compAngle
@@ -1358,7 +1397,10 @@ class Face():
1358
1397
  if return_face == None:
1359
1398
  print("Face.Isovist - Error: Could not create isovist. Returning None.")
1360
1399
  return None
1361
- return return_face
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)
1362
1404
 
1363
1405
  @staticmethod
1364
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(360 - Vector.CompassAngle(Edge.Direction(e1), Edge.Direction(e2)), mantissa)
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(360 - Vector.CompassAngle(Edge.Direction(e1), Edge.Direction(e2)), mantissa)
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
topologicpy/version.py CHANGED
@@ -1 +1 @@
1
- __version__ = '0.7.10'
1
+ __version__ = '0.7.11'
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: topologicpy
3
- Version: 0.7.10
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
@@ -8,7 +8,7 @@ topologicpy/DGL.py,sha256=RpkLnAzjg6arY7cEMs2pDFYzRdkerVg1Wbm9hcE3QaM,138991
8
8
  topologicpy/Dictionary.py,sha256=pMbfE2RYGCNpVr2x58qiHRc-aBWnp1jLlyzwS9nz6-w,25891
9
9
  topologicpy/Edge.py,sha256=EiOgg2HtuR-YtL5cpFcLcL1Y3A2Y-m4qPNtLjHGRZBQ,52407
10
10
  topologicpy/EnergyModel.py,sha256=ni0H1JgvLl1-q90yK9Sm1qj5P1fTuidlimEIcwuj6qE,53287
11
- topologicpy/Face.py,sha256=XqBi_wrR8qhxE8UdT-GhIoRnmaxo64E9Etm9iELjX5A,98729
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=TTGVySZAbo0cY_Ykoqyv6FiQHBBHzRGOKITjRNkdzSg,139107
26
+ topologicpy/Wire.py,sha256=Mr9FhiFmcdASjg85ylGTwQmlrcPJuMJh2XybGlg2JH0,139515
27
27
  topologicpy/__init__.py,sha256=D7ky87CAQMiS2KE6YLvcTLkTgA2PY7rASe6Z23pjp9k,872
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,,
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,,