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.
@@ -53,14 +53,14 @@ class CellComplex(Topology):
53
53
  def Box(origin: topologic.Vertex = None,
54
54
  width: float = 1.0, length: float = 1.0, height: float = 1.0,
55
55
  uSides: int = 2, vSides: int = 2, wSides: int = 2,
56
- direction: list = [0,0,1], placement: str = "center", tolerance: float = 0.0001) -> topologic.CellComplex:
56
+ direction: list = [0, 0, 1], placement: str = "center", tolerance: float = 0.0001) -> topologic.CellComplex:
57
57
  """
58
58
  Creates a box with internal cells.
59
59
 
60
60
  Parameters
61
61
  ----------
62
62
  origin : topologic.Vertex , optional
63
- The origin location of the box. The default is None which results in the box being placed at (0,0,0).
63
+ The origin location of the box. The default is None which results in the box being placed at (0, 0, 0).
64
64
  width : float , optional
65
65
  The width of the box. The default is 1.
66
66
  length : float , optional
@@ -74,7 +74,7 @@ class CellComplex(Topology):
74
74
  wSides : int , optional
75
75
  The number of sides along the height. The default is 1.
76
76
  direction : list , optional
77
- The vector representing the up direction of the box. The default is [0,0,1].
77
+ The vector representing the up direction of the box. The default is [0, 0, 1].
78
78
  placement : str , optional
79
79
  The description of the placement of the origin of the box. This can be "bottom", "center", or "lowerleft". It is case insensitive. The default is "center".
80
80
  tolerance : float , optional
@@ -464,7 +464,6 @@ class CellComplex(Topology):
464
464
  from topologicpy.Vector import Vector
465
465
  from topologicpy.Aperture import Aperture
466
466
  from topologicpy.Topology import Topology
467
- from numpy import arctan, pi, signbit, arctan2, rad2deg
468
467
 
469
468
  def angleCode(f, up, tiltAngle):
470
469
  dirA = Face.NormalAtParameters(f)
@@ -511,7 +510,7 @@ class CellComplex(Topology):
511
510
  zList.append(f.Centroid().Z())
512
511
  zMin = min(zList)
513
512
  zMax = max(zList)
514
- up = [0,0,1]
513
+ up = [0, 0, 1]
515
514
  for aFace in faces:
516
515
  aCode = angleCode(aFace, up, tiltAngle)
517
516
  cells = []
@@ -575,7 +574,7 @@ class CellComplex(Topology):
575
574
  return d
576
575
 
577
576
  @staticmethod
578
- def Delaunay(vertices: list=None, tolerance: float = 0.0001) -> topologic.CellComplex:
577
+ def Delaunay(vertices: list = None, tolerance: float = 0.0001) -> topologic.CellComplex:
579
578
  """
580
579
  Triangulates the input vertices based on the Delaunay method. See https://en.wikipedia.org/wiki/Delaunay_triangulation.
581
580
 
@@ -761,7 +760,7 @@ class CellComplex(Topology):
761
760
 
762
761
  @staticmethod
763
762
  def Octahedron(origin: topologic.Vertex = None, radius: float = 0.5,
764
- direction: list = [0,0,1], placement: str ="center", tolerance: float = 0.0001) -> topologic.CellComplex:
763
+ direction: list = [0, 0, 1], placement: str ="center", tolerance: float = 0.0001) -> topologic.CellComplex:
765
764
  """
766
765
  Description
767
766
  ----------
@@ -770,11 +769,11 @@ class CellComplex(Topology):
770
769
  Parameters
771
770
  ----------
772
771
  origin : topologic.Vertex , optional
773
- The origin location of the octahedron. The default is None which results in the octahedron being placed at (0,0,0).
772
+ The origin location of the octahedron. The default is None which results in the octahedron being placed at (0, 0, 0).
774
773
  radius : float , optional
775
774
  The radius of the octahedron's circumscribed sphere. The default is 0.5.
776
775
  direction : list , optional
777
- The vector representing the up direction of the octahedron. The default is [0,0,1].
776
+ The vector representing the up direction of the octahedron. The default is [0, 0, 1].
778
777
  placement : str , optional
779
778
  The description of the placement of the origin of the octahedron. This can be "bottom", "center", or "lowerleft". It is case insensitive. The default is "center".
780
779
  tolerance : float , optional
@@ -792,7 +791,7 @@ class CellComplex(Topology):
792
791
  from topologicpy.Topology import Topology
793
792
 
794
793
  if not origin:
795
- origin = Vertex.ByCoordinates(0,0,0)
794
+ origin = Vertex.ByCoordinates(0, 0, 0)
796
795
  if not isinstance(origin, topologic.Vertex):
797
796
  print("CellComplex.Octahedron - Error: The input origin parameter is not a valid topologic vertex. Returning None.")
798
797
  return None
@@ -819,7 +818,7 @@ class CellComplex(Topology):
819
818
  octahedron = Topology.Translate(octahedron, 0, 0, radius)
820
819
  elif placement == "lowerleft":
821
820
  octahedron = Topology.Translate(octahedron, radius, radius, radius)
822
- octahedron = Topology.Orient(octahedron, origin=Vertex.Origin(), dirA=[0,0,1], dirB=direction)
821
+ octahedron = Topology.Orient(octahedron, origin=Vertex.Origin(), dirA=[0, 0, 1], dirB=direction)
823
822
  octahedron = Topology.Place(octahedron, originA=Vertex.Origin(), originB=origin)
824
823
  return octahedron
825
824
 
@@ -827,14 +826,14 @@ class CellComplex(Topology):
827
826
  def Prism(origin: topologic.Vertex = None,
828
827
  width: float = 1.0, length: float = 1.0, height: float = 1.0,
829
828
  uSides: int = 2, vSides: int = 2, wSides: int = 2,
830
- direction: list = [0,0,1], placement: str = "center", tolerance: float = 0.0001) -> topologic.CellComplex:
829
+ direction: list = [0, 0, 1], placement: str = "center", tolerance: float = 0.0001) -> topologic.CellComplex:
831
830
  """
832
831
  Creates a prismatic cellComplex with internal cells.
833
832
 
834
833
  Parameters
835
834
  ----------
836
835
  origin : topologic.Vertex , optional
837
- The origin location of the prism. The default is None which results in the prism being placed at (0,0,0).
836
+ The origin location of the prism. The default is None which results in the prism being placed at (0, 0, 0).
838
837
  width : float , optional
839
838
  The width of the prism. The default is 1.
840
839
  length : float , optional
@@ -848,7 +847,7 @@ class CellComplex(Topology):
848
847
  wSides : int , optional
849
848
  The number of sides along the height. The default is 1.
850
849
  direction : list , optional
851
- The vector representing the up direction of the prism. The default is [0,0,1].
850
+ The vector representing the up direction of the prism. The default is [0, 0, 1].
852
851
  placement : str , optional
853
852
  The description of the placement of the origin of the prism. This can be "bottom", "center", or "lowerleft". It is case insensitive. The default is "center".
854
853
  tolerance : float , optional
@@ -912,12 +911,12 @@ class CellComplex(Topology):
912
911
  else:
913
912
  return topologic.CellComplex.ByCells([topology])
914
913
  if not isinstance(origin, topologic.Vertex):
915
- origin = Vertex.ByCoordinates(0,0,0)
914
+ origin = Vertex.ByCoordinates(0, 0, 0)
916
915
 
917
916
  c = Cell.Prism(origin=origin, width=width, length=length, height=height, uSides=1, vSides=1, wSides=1, placement=placement, tolerance=tolerance)
918
917
  prism = slice(c, uSides=uSides, vSides=vSides, wSides=wSides)
919
918
  if prism:
920
- prism = Topology.Orient(prism, origin=origin, dirA=[0,0,1], dirB=direction)
919
+ prism = Topology.Orient(prism, origin=origin, dirA=[0, 0, 1], dirB=direction)
921
920
  return prism
922
921
  else:
923
922
  print("CellComplex.Prism - Error: Could not create a prism. Returning None.")
@@ -1102,8 +1101,6 @@ class CellComplex(Topology):
1102
1101
  if len(vertices) < 1:
1103
1102
  print("CellComplex.Voronoi - Error: The input vertices parame ter does not contain any vertices that are inside the input cell parameter. Returning None.")
1104
1103
  return None
1105
- #cell_vertices = Topology.Vertices(cell)
1106
- #all_vertices = cell_vertices + vertices
1107
1104
  voronoi_points = np.array([Vertex.Coordinates(v) for v in vertices])
1108
1105
  cluster = fracture_with_voronoi(voronoi_points)
1109
1106
  if cluster == None:
topologicpy/Cluster.py CHANGED
@@ -1081,7 +1081,7 @@ class Cluster(Topology):
1081
1081
  return Cluster.ByTopologies(cellComplexes+cells)
1082
1082
 
1083
1083
  @staticmethod
1084
- def MysticRose(wire: topologic.Wire = None, origin: topologic.Vertex = None, radius: float = 0.5, sides: int = 16, perimeter: bool = True, direction: list = [0,0,1], placement:str = "center", tolerance: float = 0.0001) -> topologic.Cluster:
1084
+ def MysticRose(wire: topologic.Wire = None, origin: topologic.Vertex = None, radius: float = 0.5, sides: int = 16, perimeter: bool = True, direction: list = [0, 0, 1], placement:str = "center", tolerance: float = 0.0001) -> topologic.Cluster:
1085
1085
  """
1086
1086
  Creates a mystic rose.
1087
1087
 
@@ -1090,7 +1090,7 @@ class Cluster(Topology):
1090
1090
  wire : topologic.Wire , optional
1091
1091
  The input Wire. if set to None, a circle with the input parameters is created. Otherwise, the input parameters are ignored.
1092
1092
  origin : topologic.Vertex , optional
1093
- The location of the origin of the circle. The default is None which results in the circle being placed at (0,0,0).
1093
+ The location of the origin of the circle. The default is None which results in the circle being placed at (0, 0, 0).
1094
1094
  radius : float , optional
1095
1095
  The radius of the mystic rose. The default is 1.
1096
1096
  sides : int , optional
@@ -1098,7 +1098,7 @@ class Cluster(Topology):
1098
1098
  perimeter : bool , optional
1099
1099
  If True, the perimeter edges are included in the output. The default is True.
1100
1100
  direction : list , optional
1101
- The vector representing the up direction of the mystic rose. The default is [0,0,1].
1101
+ The vector representing the up direction of the mystic rose. The default is [0, 0, 1].
1102
1102
  placement : str , optional
1103
1103
  The description of the placement of the origin of the mystic rose. This can be "center", or "lowerleft". It is case insensitive. The default is "center".
1104
1104
  tolerance : float , optional
topologicpy/Color.py CHANGED
@@ -33,7 +33,7 @@ class Color:
33
33
  Returns
34
34
  -------
35
35
  list
36
- The color expressed as an [r,g,b] or an [r,g,b,a] list.
36
+ The color expressed as an [r, g, b] or an [r, g, b, a] list.
37
37
  """
38
38
  import webcolors
39
39
  if not alpha == None:
@@ -66,7 +66,7 @@ class Color:
66
66
  Returns
67
67
  -------
68
68
  list
69
- The color expressed as an [r,g,b] or an [r,g,b,a] list.
69
+ The color expressed as an [r, g, b] or an [r, g, b, a] list.
70
70
 
71
71
  """
72
72
  if not isinstance(hex, str):
@@ -83,7 +83,7 @@ class Color:
83
83
  r = int(hex[0:2], 16)
84
84
  g = int(hex[2:4], 16)
85
85
  b = int(hex[4:6], 16)
86
- rgbList = [r,g,b]
86
+ rgbList = [r, g, b]
87
87
  if not alpha == None:
88
88
  rgbList.append(alpha)
89
89
  return rgbList
@@ -111,7 +111,7 @@ class Color:
111
111
  Returns
112
112
  -------
113
113
  list
114
- The color expressed as an [r,g,b] or an [r,g,b,a] list.
114
+ The color expressed as an [r, g, b] or an [r, g, b, a] list.
115
115
 
116
116
  """
117
117
  if not alpha == None:
@@ -250,12 +250,12 @@ class Color:
250
250
  def CSSNamedColor(color):
251
251
  """
252
252
  Returns the CSS Named color that most closely matches the input color. The input color is assumed to be
253
- in the format [r,g,b]. See https://developer.mozilla.org/en-US/docs/Web/CSS/named-color
253
+ in the format [r, g, b]. See https://developer.mozilla.org/en-US/docs/Web/CSS/named-color
254
254
 
255
255
  Parameters
256
256
  ----------
257
257
  color : list
258
- The input color. This is assumed to be in the format [r,g,b]
258
+ The input color. This is assumed to be in the format [r, g, b]
259
259
 
260
260
  Returns
261
261
  -------
@@ -271,12 +271,12 @@ class Color:
271
271
  return None
272
272
  color = [int(x) for x in color if isinstance(x, numbers.Real)]
273
273
  if len(color) < 3:
274
- print("Color.CSSNamedColor - Error: The input color parameter does not contain valid r,g,b values. Returning None.")
274
+ print("Color.CSSNamedColor - Error: The input color parameter does not contain valid r, g, b values. Returning None.")
275
275
  return None
276
276
  color = color[0:3]
277
277
  for x in color:
278
278
  if not (0 <= x <= 255):
279
- print("Color.CSSNamedColor - Error: The input color parameter does not contain valid r,g,b values. Returning None.")
279
+ print("Color.CSSNamedColor - Error: The input color parameter does not contain valid r, g, b values. Returning None.")
280
280
  return None
281
281
 
282
282
  def est_color(requested_color):
@@ -336,12 +336,12 @@ class Color:
336
336
  @staticmethod
337
337
  def PlotlyColor(color, alpha=1.0, useAlpha=False):
338
338
  """
339
- Returns a plotly color string based on the input list of [r,g,b] or [r,g,b,a]. If your list is [r,g,b], you can optionally specify an alpha value
339
+ Returns a plotly color string based on the input list of [r, g, b] or [r, g, b, a]. If your list is [r, g, b], you can optionally specify an alpha value
340
340
 
341
341
  Parameters
342
342
  ----------
343
343
  color : list
344
- The input color list. This is assumed to be in the format [r,g,b] or [r,g,b,a]
344
+ The input color list. This is assumed to be in the format [r, g, b] or [r, g, b, a]
345
345
  alpha : float , optional
346
346
  The transparency value. 0.0 means the color is fully transparent, 1.0 means the color is fully opaque. The default is 1.0.
347
347
  useAlpha : bool , optional
topologicpy/Edge.py CHANGED
@@ -696,7 +696,7 @@ class Edge(Topology):
696
696
  Parameters
697
697
  ----------
698
698
  origin : topologic.Vertex , optional
699
- The origin location of the box. The default is None which results in the edge being placed at (0,0,0).
699
+ The origin location of the box. The default is None which results in the edge being placed at (0, 0, 0).
700
700
  length : float , optional
701
701
  The desired length of the edge. The default is 1.0.
702
702
  direction : list , optional
@@ -751,7 +751,7 @@ class Edge(Topology):
751
751
  return None
752
752
 
753
753
  @staticmethod
754
- def Normal(edge: topologic.Edge, degree: float=0.0):
754
+ def Normal(edge: topologic.Edge, angle: float = 0.0):
755
755
  """
756
756
  Returns the normal (perpendicular) vector to the input edge.
757
757
 
@@ -759,6 +759,9 @@ class Edge(Topology):
759
759
  ----------
760
760
  edge : topologic.Edge
761
761
  The input edge.
762
+ angle : float , optional
763
+ The desired rotational offset angle in degrees for the normal edge. This rotates the normal edge
764
+ by the angle value around the axis defined by the input edge. The default is 0.0.
762
765
 
763
766
  Returns
764
767
  -------
@@ -769,11 +772,11 @@ class Edge(Topology):
769
772
  if not isinstance(edge, topologic.Edge):
770
773
  print("Edge.Normal - Error: The input edge parameter is not a valid edge. Returning None.")
771
774
  return None
772
- normal_edge = Edge.NormalAsEdge(edge, length=1.0, u=0.5, degree=degree)
775
+ normal_edge = Edge.NormalAsEdge(edge, length=1.0, u=0.5, angle=angle)
773
776
  return Edge.Direction(normal_edge)
774
777
 
775
778
  @staticmethod
776
- def NormalAsEdge(edge: topologic.Edge, length: float=1.0, u: float=0.5, degree: float=0.0):
779
+ def NormalAsEdge(edge: topologic.Edge, length: float = 1.0, u: float = 0.5, angle: float = 0.0):
777
780
  """
778
781
  Returns the normal (perpendicular) vector to the input edge as an edge.
779
782
 
@@ -788,14 +791,14 @@ class Edge(Topology):
788
791
  at the start vertex of the input edge, a value of 0.5 places the normal edge
789
792
  at the midpoint of the input edge, and a value of 1.0 places the normal edge
790
793
  at the end vertex of the input edge. The default is 0.5
791
- degree : float , optional
792
- The desired rotational offset in degrees for the normal edge. This rotates the normal edge
793
- by the degree value around the axis defined by the input edge. The default is 0.0.
794
+ angle : float , optional
795
+ The desired rotational offset angle in degrees for the normal edge. This rotates the normal edge
796
+ by the angle value around the axis defined by the input edge. The default is 0.0.
794
797
 
795
798
  Returns
796
799
  -------
797
800
  topologic.Edge
798
- The normal (perpendicular ) vector to the input edge as an edge.
801
+ The normal (perpendicular) vector to the input edge as an edge.
799
802
 
800
803
  """
801
804
  import numpy as np
@@ -844,7 +847,7 @@ class Edge(Topology):
844
847
  ev = Vertex.ByCoordinates(list(normal_line_end))
845
848
  normal_edge = Edge.ByVertices([sv, ev])
846
849
  normal_edge = Edge.SetLength(normal_edge, length, bothSides=False)
847
- normal_edge = Topology.Rotate(normal_edge, Edge.StartVertex(normal_edge), x=x, y=y, z=z, degree=degree)
850
+ normal_edge = Topology.Rotate(normal_edge, origin=Edge.StartVertex(normal_edge), axis=[x,y,z], angle=angle)
848
851
  dist = Edge.Length(edge)*u
849
852
  normal_edge = Topology.TranslateByDirectionDistance(normal_edge, edge_direction, dist)
850
853
  return normal_edge