topologicpy 0.5.3__py3-none-any.whl → 0.5.5__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/Vector.py CHANGED
@@ -112,7 +112,7 @@ class Vector(list):
112
112
  @staticmethod
113
113
  def AzimuthAltitude(vector, mantissa: int = 6):
114
114
  """
115
- Returns a dictionary of azimuth and altitude angles in degrees for the input vector. North is assumed to be the positive Y axis [0,1,0]. Up is assumed to be the positive Z axis [0,0,1].
115
+ Returns a dictionary of azimuth and altitude angles in degrees for the input vector. North is assumed to be the positive Y axis [0, 1, 0]. Up is assumed to be the positive Z axis [0, 0, 1].
116
116
  Azimuth is calculated in a counter-clockwise fashion from North where 0 is North, 90 is East, 180 is South, and 270 is West. Altitude is calculated in a counter-clockwise fashing where -90 is straight down (negative Z axis), 0 is in the XY plane, and 90 is straight up (positive Z axis).
117
117
  If the altitude is -90 or 90, the azimuth is assumed to be 0.
118
118
 
@@ -218,9 +218,9 @@ class Vector(list):
218
218
  from topologicpy.Vertex import Vertex
219
219
  from topologicpy.Edge import Edge
220
220
  from topologicpy.Topology import Topology
221
- e = Edge.ByVertices([Vertex.Origin(), Vertex.ByCoordinates(0,1,0)], tolerance=tolerance)
222
- e = Topology.Rotate(e, Vertex.Origin(), 1, 0, 0, altitude)
223
- e = Topology.Rotate(e, Vertex.Origin(), 0, 0, 1, -azimuth-north)
221
+ e = Edge.ByVertices([Vertex.Origin(), Vertex.ByCoordinates(0, 1, 0)], tolerance=tolerance)
222
+ e = Topology.Rotate(e, origin=Vertex.Origin(), axis=[1, 0, 0], angle=altitude)
223
+ e = Topology.Rotate(e, origin=Vertex.Origin(), axis=[0, 0, 1], angle=-azimuth-north)
224
224
  if reverse:
225
225
  return Vector.Reverse(Edge.Direction(e))
226
226
  return Edge.Direction(e)
@@ -245,7 +245,7 @@ class Vector(list):
245
245
  The created vector.
246
246
 
247
247
  """
248
- return [x,y,z]
248
+ return [x, y, z]
249
249
 
250
250
  @staticmethod
251
251
  def ByVertices(vertices, normalize=True):
@@ -341,10 +341,10 @@ class Vector(list):
341
341
  x = round(vector[0], mantissa)
342
342
  y = round(vector[1], mantissa)
343
343
  z = round(vector[2], mantissa)
344
- matrix = [[1,0,0,x],
345
- [0,1,0,y],
346
- [0,0,1,z],
347
- [0,0,0,1]]
344
+ matrix = [[1, 0, 0, x],
345
+ [0, 1, 0, y],
346
+ [0, 0, 1, z],
347
+ [0, 0, 0, 1]]
348
348
  output = []
349
349
  outputType = outputType.lower()
350
350
  if outputType == "matrix":
@@ -390,32 +390,32 @@ class Vector(list):
390
390
  vecB = np.array(vectorB)
391
391
  vecC = list(np.cross(vecA, vecB))
392
392
  if Vector.Magnitude(vecC) < tolerance:
393
- return [0,0,0]
393
+ return [0, 0, 0]
394
394
  return [round(vecC[0], mantissa), round(vecC[1], mantissa), round(vecC[2], mantissa)]
395
395
 
396
396
  @staticmethod
397
397
  def Down():
398
398
  """
399
- Returns the vector representing the *down* direction. In Topologic, the negative ZAxis direction is considered *down* ([0,0,-1]).
399
+ Returns the vector representing the *down* direction. In Topologic, the negative ZAxis direction is considered *down* ([0, 0, -1]).
400
400
 
401
401
  Returns
402
402
  -------
403
403
  list
404
404
  The vector representing the *down* direction.
405
405
  """
406
- return [0,0,-1]
406
+ return [0, 0, -1]
407
407
 
408
408
  @staticmethod
409
409
  def East():
410
410
  """
411
- Returns the vector representing the *east* direction. In Topologic, the positive XAxis direction is considered *east* ([1,0,0]).
411
+ Returns the vector representing the *east* direction. In Topologic, the positive XAxis direction is considered *east* ([1, 0, 0]).
412
412
 
413
413
  Returns
414
414
  -------
415
415
  list
416
416
  The vector representing the *east* direction.
417
417
  """
418
- return [1,0,0]
418
+ return [1, 0, 0]
419
419
 
420
420
  @staticmethod
421
421
  def IsAntiParallel(vectorA, vectorB):
@@ -632,38 +632,38 @@ class Vector(list):
632
632
  @staticmethod
633
633
  def North():
634
634
  """
635
- Returns the vector representing the *north* direction. In Topologic, the positive YAxis direction is considered *north* ([0,1,0]).
635
+ Returns the vector representing the *north* direction. In Topologic, the positive YAxis direction is considered *north* ([0, 1, 0]).
636
636
 
637
637
  Returns
638
638
  -------
639
639
  list
640
640
  The vector representing the *north* direction.
641
641
  """
642
- return [0,1,0]
642
+ return [0, 1, 0]
643
643
 
644
644
  @staticmethod
645
645
  def NorthEast():
646
646
  """
647
- Returns the vector representing the *northeast* direction. In Topologic, the positive YAxis direction is considered *north* and the positive XAxis direction is considered *east*. Therefore *northeast* is ([1,1,0]).
647
+ Returns the vector representing the *northeast* direction. In Topologic, the positive YAxis direction is considered *north* and the positive XAxis direction is considered *east*. Therefore *northeast* is ([1, 1, 0]).
648
648
 
649
649
  Returns
650
650
  -------
651
651
  list
652
652
  The vector representing the *northeast* direction.
653
653
  """
654
- return [1,1,0]
654
+ return [1, 1, 0]
655
655
 
656
656
  @staticmethod
657
657
  def NorthWest():
658
658
  """
659
- Returns the vector representing the *northwest* direction. In Topologic, the positive YAxis direction is considered *north* and the negative XAxis direction is considered *west*. Therefore *northwest* is ([-1,1,0]).
659
+ Returns the vector representing the *northwest* direction. In Topologic, the positive YAxis direction is considered *north* and the negative XAxis direction is considered *west*. Therefore *northwest* is ([-1, 1, 0]).
660
660
 
661
661
  Returns
662
662
  -------
663
663
  list
664
664
  The vector representing the *northwest* direction.
665
665
  """
666
- return [-1,1,0]
666
+ return [-1, 1, 0]
667
667
 
668
668
  @staticmethod
669
669
  def Reverse(vector):
@@ -706,38 +706,38 @@ class Vector(list):
706
706
  @staticmethod
707
707
  def South():
708
708
  """
709
- Returns the vector representing the *south* direction. In Topologic, the negative YAxis direction is considered *south* ([0,-1,0]).
709
+ Returns the vector representing the *south* direction. In Topologic, the negative YAxis direction is considered *south* ([0, -1, 0]).
710
710
 
711
711
  Returns
712
712
  -------
713
713
  list
714
714
  The vector representing the *south* direction.
715
715
  """
716
- return [0,-1,0]
716
+ return [0, -1, 0]
717
717
 
718
718
  @staticmethod
719
719
  def SouthEast():
720
720
  """
721
- Returns the vector representing the *southeast* direction. In Topologic, the negative YAxis direction is considered *south* and the positive XAxis direction is considered *east*. Therefore *southeast* is ([1,-1,0]).
721
+ Returns the vector representing the *southeast* direction. In Topologic, the negative YAxis direction is considered *south* and the positive XAxis direction is considered *east*. Therefore *southeast* is ([1, -1, 0]).
722
722
 
723
723
  Returns
724
724
  -------
725
725
  list
726
726
  The vector representing the *southeast* direction.
727
727
  """
728
- return [1,-1,0]
728
+ return [1, -1, 0]
729
729
 
730
730
  @staticmethod
731
731
  def SouthWest():
732
732
  """
733
- Returns the vector representing the *southwest* direction. In Topologic, the negative YAxis direction is considered *south* and the negative XAxis direction is considered *west*. Therefore *southwest* is ([-1,-1,0]).
733
+ Returns the vector representing the *southwest* direction. In Topologic, the negative YAxis direction is considered *south* and the negative XAxis direction is considered *west*. Therefore *southwest* is ([-1, -1, 0]).
734
734
 
735
735
  Returns
736
736
  -------
737
737
  list
738
738
  The vector representing the *southwest* direction.
739
739
  """
740
- return [-1,-1,0]
740
+ return [-1, -1, 0]
741
741
 
742
742
  @staticmethod
743
743
  def Sum(vectors: list):
@@ -847,59 +847,59 @@ class Vector(list):
847
847
  @staticmethod
848
848
  def Up():
849
849
  """
850
- Returns the vector representing the up direction. In Topologic, the positive ZAxis direction is considered "up" ([0,0,1]).
850
+ Returns the vector representing the up direction. In Topologic, the positive ZAxis direction is considered "up" ([0, 0, 1]).
851
851
 
852
852
  Returns
853
853
  -------
854
854
  list
855
855
  The vector representing the "up" direction.
856
856
  """
857
- return [0,0,1]
857
+ return [0, 0, 1]
858
858
 
859
859
  @staticmethod
860
860
  def West():
861
861
  """
862
- Returns the vector representing the *west* direction. In Topologic, the negative XAxis direction is considered *west* ([-1,0,0]).
862
+ Returns the vector representing the *west* direction. In Topologic, the negative XAxis direction is considered *west* ([-1, 0, 0]).
863
863
 
864
864
  Returns
865
865
  -------
866
866
  list
867
867
  The vector representing the *west* direction.
868
868
  """
869
- return [-1,0,0]
869
+ return [-1, 0, 0]
870
870
 
871
871
  @staticmethod
872
872
  def XAxis():
873
873
  """
874
- Returns the vector representing the XAxis ([1,0,0])
874
+ Returns the vector representing the XAxis ([1, 0, 0])
875
875
 
876
876
  Returns
877
877
  -------
878
878
  list
879
879
  The vector representing the XAxis.
880
880
  """
881
- return [1,0,0]
881
+ return [1, 0, 0]
882
882
 
883
883
  @staticmethod
884
884
  def YAxis():
885
885
  """
886
- Returns the vector representing the YAxis ([0,1,0])
886
+ Returns the vector representing the YAxis ([0, 1, 0])
887
887
 
888
888
  Returns
889
889
  -------
890
890
  list
891
891
  The vector representing the YAxis.
892
892
  """
893
- return [0,1,0]
893
+ return [0, 1, 0]
894
894
 
895
895
  @staticmethod
896
896
  def ZAxis():
897
897
  """
898
- Returns the vector representing the ZAxis ([0,0,1])
898
+ Returns the vector representing the ZAxis ([0, 0, 1])
899
899
 
900
900
  Returns
901
901
  -------
902
902
  list
903
903
  The vector representing the ZAxis.
904
904
  """
905
- return [0,0,1]
905
+ return [0, 0, 1]
topologicpy/Vertex.py CHANGED
@@ -380,10 +380,10 @@ class Vertex(Topology):
380
380
  x = round(vertex.X(), mantissa)
381
381
  y = round(vertex.Y(), mantissa)
382
382
  z = round(vertex.Z(), mantissa)
383
- matrix = [[1,0,0,x],
384
- [0,1,0,y],
385
- [0,0,1,z],
386
- [0,0,0,1]]
383
+ matrix = [[1, 0, 0, x],
384
+ [0, 1, 0, y],
385
+ [0, 0, 1, z],
386
+ [0, 0, 0, 1]]
387
387
  output = []
388
388
  outputType = outputType.lower()
389
389
  if outputType == "matrix":
@@ -526,7 +526,7 @@ class Vertex(Topology):
526
526
  def distance_to_vertex(vertexA, vertexB):
527
527
  a = (Vertex.X(vertexA), Vertex.Y(vertexA), Vertex.Z(vertexA))
528
528
  b = (Vertex.X(vertexB), Vertex.Y(vertexB), Vertex.Z(vertexB))
529
- return distance_point_to_point(a,b)
529
+ return distance_point_to_point(a, b)
530
530
 
531
531
  def distance_to_edge(vertex, edge):
532
532
  a = (Vertex.X(vertex), Vertex.Y(vertex), Vertex.Z(vertex))
@@ -1290,7 +1290,7 @@ class Vertex(Topology):
1290
1290
  @staticmethod
1291
1291
  def Origin() -> topologic.Vertex:
1292
1292
  """
1293
- Returns a vertex with coordinates (0,0,0)
1293
+ Returns a vertex with coordinates (0, 0, 0)
1294
1294
 
1295
1295
  Parameters
1296
1296
  -----------
@@ -1299,10 +1299,10 @@ class Vertex(Topology):
1299
1299
  -----------
1300
1300
  topologic.Vertex
1301
1301
  """
1302
- return Vertex.ByCoordinates(0,0,0)
1302
+ return Vertex.ByCoordinates(0, 0, 0)
1303
1303
 
1304
1304
  @staticmethod
1305
- def PerpendicularDistance(vertex: topologic.Vertex, face: topologic.Face, mantissa: int=4):
1305
+ def PerpendicularDistance(vertex: topologic.Vertex, face: topologic.Face, mantissa: int = 6):
1306
1306
  """
1307
1307
  Returns the perpendicular distance between the input vertex and the input face. The face is considered to be infinite.
1308
1308
 
@@ -1394,7 +1394,7 @@ class Vertex(Topology):
1394
1394
  Return
1395
1395
  -----------
1396
1396
  dict
1397
- The dictionary containing the values of a,b,c,d for the plane equation in the form of ax+by+cz+d=0.
1397
+ The dictionary containing the values of a, b, c, d for the plane equation in the form of ax+by+cz+d=0.
1398
1398
  The keys in the dictionary are ["a", "b", "c". "d"]
1399
1399
  """
1400
1400
 
@@ -1449,7 +1449,7 @@ class Vertex(Topology):
1449
1449
  topologic.Vertex
1450
1450
  """
1451
1451
 
1452
- return Vertex.ByCoordinates(x,y,z)
1452
+ return Vertex.ByCoordinates(x, y, z)
1453
1453
 
1454
1454
  @staticmethod
1455
1455
  def Project(vertex: topologic.Vertex, face: topologic.Face, direction: bool = None, mantissa: int = 6) -> topologic.Vertex:
@@ -1465,7 +1465,7 @@ class Vertex(Topology):
1465
1465
  direction : vector, optional
1466
1466
  The direction in which to project the input vertex unto the input face. If not specified, the direction of the projection is the normal of the input face. The default is None.
1467
1467
  mantissa : int , optional
1468
- The length of the desired mantissa. The default is 4.
1468
+ The length of the desired mantissa. The default is 6.
1469
1469
  tolerance : float , optional
1470
1470
  The desired tolerance. The default is 0.0001.
1471
1471
 
@@ -1513,7 +1513,7 @@ class Vertex(Topology):
1513
1513
  if not isinstance(face, topologic.Face):
1514
1514
  return None
1515
1515
  eq = Face.PlaneEquation(face, mantissa= mantissa)
1516
- if direction == None:
1516
+ if direction == None or direction == []:
1517
1517
  direction = Face.Normal(face)
1518
1518
  pt = project_point_onto_plane(Vertex.Coordinates(vertex), [eq["a"], eq["b"], eq["c"], eq["d"]], direction)
1519
1519
  return Vertex.ByCoordinates(pt[0], pt[1], pt[2])