topologicpy 0.4.71__tar.gz → 0.4.73__tar.gz

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.
Files changed (97) hide show
  1. {topologicpy-0.4.71/src/topologicpy.egg-info → topologicpy-0.4.73}/PKG-INFO +1 -1
  2. {topologicpy-0.4.71 → topologicpy-0.4.73}/pyproject.toml +1 -1
  3. {topologicpy-0.4.71 → topologicpy-0.4.73}/src/topologicpy/Cell.py +302 -102
  4. {topologicpy-0.4.71 → topologicpy-0.4.73}/src/topologicpy/CellComplex.py +64 -0
  5. {topologicpy-0.4.71 → topologicpy-0.4.73}/src/topologicpy/Topology.py +1 -1
  6. {topologicpy-0.4.71 → topologicpy-0.4.73}/src/topologicpy/__init__.py +1 -1
  7. {topologicpy-0.4.71 → topologicpy-0.4.73/src/topologicpy.egg-info}/PKG-INFO +1 -1
  8. {topologicpy-0.4.71 → topologicpy-0.4.73}/LICENSE +0 -0
  9. {topologicpy-0.4.71 → topologicpy-0.4.73}/MANIFEST.in +0 -0
  10. {topologicpy-0.4.71 → topologicpy-0.4.73}/README.md +0 -0
  11. {topologicpy-0.4.71 → topologicpy-0.4.73}/setup.cfg +0 -0
  12. {topologicpy-0.4.71 → topologicpy-0.4.73}/src/topologicpy/Aperture.py +0 -0
  13. {topologicpy-0.4.71 → topologicpy-0.4.73}/src/topologicpy/Cluster.py +0 -0
  14. {topologicpy-0.4.71 → topologicpy-0.4.73}/src/topologicpy/Color.py +0 -0
  15. {topologicpy-0.4.71 → topologicpy-0.4.73}/src/topologicpy/Context.py +0 -0
  16. {topologicpy-0.4.71 → topologicpy-0.4.73}/src/topologicpy/DGL.py +0 -0
  17. {topologicpy-0.4.71 → topologicpy-0.4.73}/src/topologicpy/Dictionary.py +0 -0
  18. {topologicpy-0.4.71 → topologicpy-0.4.73}/src/topologicpy/Edge.py +0 -0
  19. {topologicpy-0.4.71 → topologicpy-0.4.73}/src/topologicpy/EnergyModel.py +0 -0
  20. {topologicpy-0.4.71 → topologicpy-0.4.73}/src/topologicpy/Face.py +0 -0
  21. {topologicpy-0.4.71 → topologicpy-0.4.73}/src/topologicpy/Graph.py +0 -0
  22. {topologicpy-0.4.71 → topologicpy-0.4.73}/src/topologicpy/Grid.py +0 -0
  23. {topologicpy-0.4.71 → topologicpy-0.4.73}/src/topologicpy/Helper.py +0 -0
  24. {topologicpy-0.4.71 → topologicpy-0.4.73}/src/topologicpy/Honeybee.py +0 -0
  25. {topologicpy-0.4.71 → topologicpy-0.4.73}/src/topologicpy/Matrix.py +0 -0
  26. {topologicpy-0.4.71 → topologicpy-0.4.73}/src/topologicpy/Neo4j.py +0 -0
  27. {topologicpy-0.4.71 → topologicpy-0.4.73}/src/topologicpy/Plotly.py +0 -0
  28. {topologicpy-0.4.71 → topologicpy-0.4.73}/src/topologicpy/Polyskel.py +0 -0
  29. {topologicpy-0.4.71 → topologicpy-0.4.73}/src/topologicpy/Shell.py +0 -0
  30. {topologicpy-0.4.71 → topologicpy-0.4.73}/src/topologicpy/Speckle.py +0 -0
  31. {topologicpy-0.4.71 → topologicpy-0.4.73}/src/topologicpy/Vector.py +0 -0
  32. {topologicpy-0.4.71 → topologicpy-0.4.73}/src/topologicpy/Vertex.py +0 -0
  33. {topologicpy-0.4.71 → topologicpy-0.4.73}/src/topologicpy/Wire.py +0 -0
  34. {topologicpy-0.4.71 → topologicpy-0.4.73}/src/topologicpy/bin/linux/topologic/__init__.py +0 -0
  35. {topologicpy-0.4.71 → topologicpy-0.4.73}/src/topologicpy/bin/linux/topologic/libTKBO-6bdf205d.so.7.7.0 +0 -0
  36. {topologicpy-0.4.71 → topologicpy-0.4.73}/src/topologicpy/bin/linux/topologic/libTKBRep-2960a069.so.7.7.0 +0 -0
  37. {topologicpy-0.4.71 → topologicpy-0.4.73}/src/topologicpy/bin/linux/topologic/libTKBool-c44b74bd.so.7.7.0 +0 -0
  38. {topologicpy-0.4.71 → topologicpy-0.4.73}/src/topologicpy/bin/linux/topologic/libTKFillet-9a670ba0.so.7.7.0 +0 -0
  39. {topologicpy-0.4.71 → topologicpy-0.4.73}/src/topologicpy/bin/linux/topologic/libTKG2d-8f31849e.so.7.7.0 +0 -0
  40. {topologicpy-0.4.71 → topologicpy-0.4.73}/src/topologicpy/bin/linux/topologic/libTKG3d-4c6bce57.so.7.7.0 +0 -0
  41. {topologicpy-0.4.71 → topologicpy-0.4.73}/src/topologicpy/bin/linux/topologic/libTKGeomAlgo-26066fd9.so.7.7.0 +0 -0
  42. {topologicpy-0.4.71 → topologicpy-0.4.73}/src/topologicpy/bin/linux/topologic/libTKGeomBase-2116cabe.so.7.7.0 +0 -0
  43. {topologicpy-0.4.71 → topologicpy-0.4.73}/src/topologicpy/bin/linux/topologic/libTKMath-72572fa8.so.7.7.0 +0 -0
  44. {topologicpy-0.4.71 → topologicpy-0.4.73}/src/topologicpy/bin/linux/topologic/libTKMesh-2a060427.so.7.7.0 +0 -0
  45. {topologicpy-0.4.71 → topologicpy-0.4.73}/src/topologicpy/bin/linux/topologic/libTKOffset-6cab68ff.so.7.7.0 +0 -0
  46. {topologicpy-0.4.71 → topologicpy-0.4.73}/src/topologicpy/bin/linux/topologic/libTKPrim-eb1262b3.so.7.7.0 +0 -0
  47. {topologicpy-0.4.71 → topologicpy-0.4.73}/src/topologicpy/bin/linux/topologic/libTKShHealing-e67e5cc7.so.7.7.0 +0 -0
  48. {topologicpy-0.4.71 → topologicpy-0.4.73}/src/topologicpy/bin/linux/topologic/libTKTopAlgo-e4c96c33.so.7.7.0 +0 -0
  49. {topologicpy-0.4.71 → topologicpy-0.4.73}/src/topologicpy/bin/linux/topologic/libTKernel-fb7fe3b7.so.7.7.0 +0 -0
  50. {topologicpy-0.4.71 → topologicpy-0.4.73}/src/topologicpy/bin/linux/topologic/libgcc_s-32c1665e.so.1 +0 -0
  51. {topologicpy-0.4.71 → topologicpy-0.4.73}/src/topologicpy/bin/linux/topologic/libstdc++-672d7b41.so.6.0.30 +0 -0
  52. {topologicpy-0.4.71 → topologicpy-0.4.73}/src/topologicpy/bin/linux/topologic/topologic.cpython-310-x86_64-linux-gnu.so +0 -0
  53. {topologicpy-0.4.71 → topologicpy-0.4.73}/src/topologicpy/bin/linux/topologic/topologic.cpython-311-x86_64-linux-gnu.so +0 -0
  54. {topologicpy-0.4.71 → topologicpy-0.4.73}/src/topologicpy/bin/linux/topologic/topologic.cpython-38-x86_64-linux-gnu.so +0 -0
  55. {topologicpy-0.4.71 → topologicpy-0.4.73}/src/topologicpy/bin/linux/topologic/topologic.cpython-39-x86_64-linux-gnu.so +0 -0
  56. {topologicpy-0.4.71 → topologicpy-0.4.73}/src/topologicpy/bin/linux/topologic.libs/libTKBO-6bdf205d.so.7.7.0 +0 -0
  57. {topologicpy-0.4.71 → topologicpy-0.4.73}/src/topologicpy/bin/linux/topologic.libs/libTKBRep-2960a069.so.7.7.0 +0 -0
  58. {topologicpy-0.4.71 → topologicpy-0.4.73}/src/topologicpy/bin/linux/topologic.libs/libTKBool-c44b74bd.so.7.7.0 +0 -0
  59. {topologicpy-0.4.71 → topologicpy-0.4.73}/src/topologicpy/bin/linux/topologic.libs/libTKFillet-9a670ba0.so.7.7.0 +0 -0
  60. {topologicpy-0.4.71 → topologicpy-0.4.73}/src/topologicpy/bin/linux/topologic.libs/libTKG2d-8f31849e.so.7.7.0 +0 -0
  61. {topologicpy-0.4.71 → topologicpy-0.4.73}/src/topologicpy/bin/linux/topologic.libs/libTKG3d-4c6bce57.so.7.7.0 +0 -0
  62. {topologicpy-0.4.71 → topologicpy-0.4.73}/src/topologicpy/bin/linux/topologic.libs/libTKGeomAlgo-26066fd9.so.7.7.0 +0 -0
  63. {topologicpy-0.4.71 → topologicpy-0.4.73}/src/topologicpy/bin/linux/topologic.libs/libTKGeomBase-2116cabe.so.7.7.0 +0 -0
  64. {topologicpy-0.4.71 → topologicpy-0.4.73}/src/topologicpy/bin/linux/topologic.libs/libTKMath-72572fa8.so.7.7.0 +0 -0
  65. {topologicpy-0.4.71 → topologicpy-0.4.73}/src/topologicpy/bin/linux/topologic.libs/libTKMesh-2a060427.so.7.7.0 +0 -0
  66. {topologicpy-0.4.71 → topologicpy-0.4.73}/src/topologicpy/bin/linux/topologic.libs/libTKOffset-6cab68ff.so.7.7.0 +0 -0
  67. {topologicpy-0.4.71 → topologicpy-0.4.73}/src/topologicpy/bin/linux/topologic.libs/libTKPrim-eb1262b3.so.7.7.0 +0 -0
  68. {topologicpy-0.4.71 → topologicpy-0.4.73}/src/topologicpy/bin/linux/topologic.libs/libTKShHealing-e67e5cc7.so.7.7.0 +0 -0
  69. {topologicpy-0.4.71 → topologicpy-0.4.73}/src/topologicpy/bin/linux/topologic.libs/libTKTopAlgo-e4c96c33.so.7.7.0 +0 -0
  70. {topologicpy-0.4.71 → topologicpy-0.4.73}/src/topologicpy/bin/linux/topologic.libs/libTKernel-fb7fe3b7.so.7.7.0 +0 -0
  71. {topologicpy-0.4.71 → topologicpy-0.4.73}/src/topologicpy/bin/linux/topologic.libs/libgcc_s-32c1665e.so.1 +0 -0
  72. {topologicpy-0.4.71 → topologicpy-0.4.73}/src/topologicpy/bin/linux/topologic.libs/libstdc++-672d7b41.so.6.0.30 +0 -0
  73. {topologicpy-0.4.71 → topologicpy-0.4.73}/src/topologicpy/bin/macos/topologic/__init__.py +0 -0
  74. {topologicpy-0.4.71 → topologicpy-0.4.73}/src/topologicpy/bin/windows/topologic/TKBO-f6b191de.dll +0 -0
  75. {topologicpy-0.4.71 → topologicpy-0.4.73}/src/topologicpy/bin/windows/topologic/TKBRep-e56a600e.dll +0 -0
  76. {topologicpy-0.4.71 → topologicpy-0.4.73}/src/topologicpy/bin/windows/topologic/TKBool-7b8d47ae.dll +0 -0
  77. {topologicpy-0.4.71 → topologicpy-0.4.73}/src/topologicpy/bin/windows/topologic/TKFillet-0ddbf0a8.dll +0 -0
  78. {topologicpy-0.4.71 → topologicpy-0.4.73}/src/topologicpy/bin/windows/topologic/TKG2d-2e2dee3d.dll +0 -0
  79. {topologicpy-0.4.71 → topologicpy-0.4.73}/src/topologicpy/bin/windows/topologic/TKG3d-6674513d.dll +0 -0
  80. {topologicpy-0.4.71 → topologicpy-0.4.73}/src/topologicpy/bin/windows/topologic/TKGeomAlgo-d240e370.dll +0 -0
  81. {topologicpy-0.4.71 → topologicpy-0.4.73}/src/topologicpy/bin/windows/topologic/TKGeomBase-df87aba5.dll +0 -0
  82. {topologicpy-0.4.71 → topologicpy-0.4.73}/src/topologicpy/bin/windows/topologic/TKMath-45bd625a.dll +0 -0
  83. {topologicpy-0.4.71 → topologicpy-0.4.73}/src/topologicpy/bin/windows/topologic/TKMesh-d6e826b1.dll +0 -0
  84. {topologicpy-0.4.71 → topologicpy-0.4.73}/src/topologicpy/bin/windows/topologic/TKOffset-79b9cc94.dll +0 -0
  85. {topologicpy-0.4.71 → topologicpy-0.4.73}/src/topologicpy/bin/windows/topologic/TKPrim-aa430a86.dll +0 -0
  86. {topologicpy-0.4.71 → topologicpy-0.4.73}/src/topologicpy/bin/windows/topologic/TKShHealing-bb48be89.dll +0 -0
  87. {topologicpy-0.4.71 → topologicpy-0.4.73}/src/topologicpy/bin/windows/topologic/TKTopAlgo-7d0d1e22.dll +0 -0
  88. {topologicpy-0.4.71 → topologicpy-0.4.73}/src/topologicpy/bin/windows/topologic/TKernel-08c8cfbb.dll +0 -0
  89. {topologicpy-0.4.71 → topologicpy-0.4.73}/src/topologicpy/bin/windows/topologic/__init__.py +0 -0
  90. {topologicpy-0.4.71 → topologicpy-0.4.73}/src/topologicpy/bin/windows/topologic/topologic.cp310-win_amd64.pyd +0 -0
  91. {topologicpy-0.4.71 → topologicpy-0.4.73}/src/topologicpy/bin/windows/topologic/topologic.cp311-win_amd64.pyd +0 -0
  92. {topologicpy-0.4.71 → topologicpy-0.4.73}/src/topologicpy/bin/windows/topologic/topologic.cp38-win_amd64.pyd +0 -0
  93. {topologicpy-0.4.71 → topologicpy-0.4.73}/src/topologicpy/bin/windows/topologic/topologic.cp39-win_amd64.pyd +0 -0
  94. {topologicpy-0.4.71 → topologicpy-0.4.73}/src/topologicpy.egg-info/SOURCES.txt +0 -0
  95. {topologicpy-0.4.71 → topologicpy-0.4.73}/src/topologicpy.egg-info/dependency_links.txt +0 -0
  96. {topologicpy-0.4.71 → topologicpy-0.4.73}/src/topologicpy.egg-info/requires.txt +0 -0
  97. {topologicpy-0.4.71 → topologicpy-0.4.73}/src/topologicpy.egg-info/top_level.txt +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: topologicpy
3
- Version: 0.4.71
3
+ Version: 0.4.73
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
  Project-URL: Homepage, https://github.com/wassimj/TopologicPy
@@ -3,7 +3,7 @@ requires = ["setuptools>=61"]
3
3
  build-backend = "setuptools.build_meta"
4
4
  [project]
5
5
  name = "topologicpy"
6
- version = "0.4.71"
6
+ version = "0.4.73"
7
7
  authors = [
8
8
  { name="Wassim Jabi", email="wassim.jabi@gmail.com" },
9
9
  ]
@@ -681,23 +681,7 @@ class Cell(Topology):
681
681
  shell = Cell.Shells(cone)[0]
682
682
  shell = shell.Slice(cutting_planes_cluster)
683
683
  cone = Cell.ByShell(shell)
684
- x1 = origin.X()
685
- y1 = origin.Y()
686
- z1 = origin.Z()
687
- x2 = origin.X() + direction[0]
688
- y2 = origin.Y() + direction[1]
689
- z2 = origin.Z() + direction[2]
690
- dx = x2 - x1
691
- dy = y2 - y1
692
- dz = z2 - z1
693
- dist = math.sqrt(dx**2 + dy**2 + dz**2)
694
- phi = math.degrees(math.atan2(dy, dx)) # Rotation around Y-Axis
695
- if dist < 0.0001:
696
- theta = 0
697
- else:
698
- theta = math.degrees(math.acos(dz/dist)) # Rotation around Z-Axis
699
- cone = Topology.Rotate(cone, origin, 0, 1, 0, theta)
700
- cone = Topology.Rotate(cone, origin, 0, 0, 1, phi)
684
+ cone = Topology.Orient(cone, origin=origin, dirA=[0,0,1], dirB=direction)
701
685
  return cone
702
686
 
703
687
  @staticmethod
@@ -805,23 +789,7 @@ class Cell(Topology):
805
789
  cutting_planes_cluster = Cluster.ByTopologies(cutting_planes)
806
790
  cylinder = CellComplex.ExternalBoundary(cylinder.Slice(cutting_planes_cluster))
807
791
 
808
- x1 = origin.X()
809
- y1 = origin.Y()
810
- z1 = origin.Z()
811
- x2 = origin.X() + direction[0]
812
- y2 = origin.Y() + direction[1]
813
- z2 = origin.Z() + direction[2]
814
- dx = x2 - x1
815
- dy = y2 - y1
816
- dz = z2 - z1
817
- dist = math.sqrt(dx**2 + dy**2 + dz**2)
818
- phi = math.degrees(math.atan2(dy, dx)) # Rotation around Y-Axis
819
- if dist < 0.0001:
820
- theta = 0
821
- else:
822
- theta = math.degrees(math.acos(dz/dist)) # Rotation around Z-Axis
823
- cylinder = Topology.Rotate(cylinder, origin, 0, 1, 0, theta)
824
- cylinder = Topology.Rotate(cylinder, origin, 0, 0, 1, phi)
792
+ cylinder = Topology.Orient(cylinder, origin=origin, dirA=[0,0,1], dirB=direction)
825
793
  return cylinder
826
794
 
827
795
  @staticmethod
@@ -933,6 +901,75 @@ class Cell(Topology):
933
901
  }
934
902
  return d
935
903
 
904
+ @staticmethod
905
+ def Dodecahedron(origin: topologic.Vertex = None, radius: float = 0.5,
906
+ direction: list = [0,0,1], placement: str ="center", tolerance: float = 0.0001) -> topologic.Cell:
907
+ """
908
+ Description
909
+ ----------
910
+ Creates a dodecahedron. See https://en.wikipedia.org/wiki/Dodecahedron.
911
+
912
+ Parameters
913
+ ----------
914
+ origin : topologic.Vertex , optional
915
+ The origin location of the dodecahedron. The default is None which results in the dodecahedron being placed at (0,0,0).
916
+ radius : float , optional
917
+ The radius of the dodecahedron's circumscribed sphere. The default is 0.5.
918
+ direction : list , optional
919
+ The vector representing the up direction of the dodecahedron. The default is [0,0,1].
920
+ placement : str , optional
921
+ The description of the placement of the origin of the dodecahedron. This can be "bottom", "center", or "lowerleft". It is case insensitive. The default is "center".
922
+ tolerance : float , optional
923
+ The desired tolerance. The default is 0.0001.
924
+
925
+ Returns
926
+ -------
927
+ topologic.Cell
928
+ The created dodecahedron.
929
+
930
+ """
931
+ from topologicpy.Vertex import Vertex
932
+ from topologicpy.Edge import Edge
933
+ from topologicpy.Face import Face
934
+ from topologicpy.Cluster import Cluster
935
+ from topologicpy.Topology import Topology
936
+
937
+ if not origin:
938
+ origin = Vertex.ByCoordinates(0,0,0)
939
+ if not isinstance(origin, topologic.Vertex):
940
+ print("Cell.Dodecahedron - Error: The input origin parameter is not a valid topologic vertex. Returning None.")
941
+ return None
942
+ pen = Face.Circle(sides=5, radius=0.5)
943
+ pentagons = [pen]
944
+ edges = Topology.Edges(pen)
945
+ for edge in edges:
946
+ o = Topology.Centroid(edge)
947
+ e_dir = Edge.Direction(edge)
948
+ pentagons.append(Topology.Rotate(pen, origin=o, x=e_dir[0], y=e_dir[1], z=e_dir[2], degree=116.565))
949
+
950
+ cluster = Cluster.ByTopologies(pentagons)
951
+ vertices = Topology.Vertices(cluster)
952
+ zList = [Vertex.Z(v) for v in vertices]
953
+ zList = list(set(zList))
954
+ zList.sort()
955
+ zOffset = zList[1]+zList[2]
956
+ cluster2 = Topology.Rotate(cluster, origin=Vertex.Origin(), x=1,y=0,z=0,degree=180)
957
+ cluster2 = Topology.Translate(cluster2, 0, 0, zOffset)
958
+ pentagons += Topology.Faces(cluster2)
959
+ dodecahedron = Cell.ByFaces(pentagons, tolerance=tolerance)
960
+ centroid = Topology.Centroid(dodecahedron)
961
+ dodecahedron = Topology.Translate(dodecahedron, -Vertex.X(centroid), -Vertex.Y(centroid), -Vertex.Z(centroid))
962
+ vertices = Topology.Vertices(dodecahedron)
963
+ d = Vertex.Distance(Vertex.Origin(), vertices[0])
964
+ dodecahedron = Topology.Scale(dodecahedron, origin=Vertex.Origin(), x=radius/d, y=radius/d, z=radius/d)
965
+ if placement == "bottom":
966
+ dodecahedron = Topology.Translate(dodecahedron, 0, 0, radius)
967
+ elif placement == "lowerleft":
968
+ dodecahedron = Topology.Translate(dodecahedron, radius, radius, radius)
969
+ dodecahedron = Topology.Place(dodecahedron, originA=Vertex.Origin(), originB=origin)
970
+ dodecahedron = Topology.Orient(dodecahedron, origin=origin, dirA=[0,0,1], dirB=direction, tolerance=tolerance)
971
+ return dodecahedron
972
+
936
973
  @staticmethod
937
974
  def Edges(cell: topologic.Cell) -> list:
938
975
  """
@@ -1119,6 +1156,91 @@ class Cell(Topology):
1119
1156
  hyperboloid = Topology.Rotate(hyperboloid, origin, 0, 0, 1, phi)
1120
1157
  return hyperboloid
1121
1158
 
1159
+ @staticmethod
1160
+ def Icosahedron(origin: topologic.Vertex = None, radius: float = 0.5,
1161
+ direction: list = [0,0,1], placement: str ="center", tolerance: float = 0.0001) -> topologic.Cell:
1162
+ """
1163
+ Description
1164
+ ----------
1165
+ Creates an icosahedron. See https://en.wikipedia.org/wiki/Icosahedron.
1166
+
1167
+ Parameters
1168
+ ----------
1169
+ origin : topologic.Vertex , optional
1170
+ The origin location of the icosahedron. The default is None which results in the icosahedron being placed at (0,0,0).
1171
+ radius : float , optional
1172
+ The radius of the icosahedron's circumscribed sphere. The default is 0.5.
1173
+ direction : list , optional
1174
+ The vector representing the up direction of the icosahedron. The default is [0,0,1].
1175
+ placement : str , optional
1176
+ The description of the placement of the origin of the icosahedron. This can be "bottom", "center", or "lowerleft". It is case insensitive. The default is "center".
1177
+ tolerance : float , optional
1178
+ The desired tolerance. The default is 0.0001.
1179
+
1180
+ Returns
1181
+ -------
1182
+ topologic.Cell
1183
+ The created icosahedron.
1184
+
1185
+ """
1186
+ from topologicpy.Vertex import Vertex
1187
+ from topologicpy.Wire import Wire
1188
+ from topologicpy.Face import Face
1189
+ from topologicpy.Topology import Topology
1190
+ import math
1191
+
1192
+ if not origin:
1193
+ origin = Vertex.ByCoordinates(0,0,0)
1194
+ if not isinstance(origin, topologic.Vertex):
1195
+ print("Cell.Dodecahedron - Error: The input origin parameter is not a valid topologic vertex. Returning None.")
1196
+ return None
1197
+ rect1 = Wire.Rectangle(width=(1+math.sqrt(5))/2, length=1)
1198
+ rect2 = Wire.Rectangle(width=1, length=(1+math.sqrt(5))/2)
1199
+ rect2 = Topology.Rotate(rect2, x=1,y=0,z=0, degree=90)
1200
+ rect3 = Wire.Rectangle(width=1, length=(1+math.sqrt(5))/2)
1201
+ rect3 = Topology.Rotate(rect3, x=0,y=1,z=0, degree=90)
1202
+ vertices = Topology.Vertices(rect1)
1203
+ v1, v2, v3, v4 = vertices
1204
+ vertices = Topology.Vertices(rect2)
1205
+ v5, v6, v7, v8 = vertices
1206
+ vertices = Topology.Vertices(rect3)
1207
+ v9, v10, v11, v12 = vertices
1208
+ f1 = Face.ByVertices([v1,v8,v4])
1209
+ f2 = Face.ByVertices([v1,v4,v5])
1210
+ f3 = Face.ByVertices([v3,v2,v6])
1211
+ f4 = Face.ByVertices([v2,v3,v7])
1212
+ f5 = Face.ByVertices([v10,v9,v2])
1213
+ f6 = Face.ByVertices([v10,v9,v1])
1214
+ f7 = Face.ByVertices([v12,v11,v4])
1215
+ f8 = Face.ByVertices([v12,v11,v3])
1216
+ f9 = Face.ByVertices([v8,v7,v9])
1217
+ f10 = Face.ByVertices([v8,v7,v12])
1218
+ f11 = Face.ByVertices([v5,v6,v10])
1219
+ f12 = Face.ByVertices([v5,v6,v11])
1220
+ f13 = Face.ByVertices([v8,v1,v9])
1221
+ f14 = Face.ByVertices([v9,v2,v7])
1222
+ f15 = Face.ByVertices([v7,v3,v12])
1223
+ f16 = Face.ByVertices([v8,v12,v4])
1224
+ f17 = Face.ByVertices([v1,v5,v10])
1225
+ f18 = Face.ByVertices([v10,v2,v6])
1226
+ f19 = Face.ByVertices([v6,v3,v11])
1227
+ f20 = Face.ByVertices([v11,v4,v5])
1228
+
1229
+ icosahedron = Cell.ByFaces([f1,f2,f3,f4,f5,f6,f7,f8,f9,f10,
1230
+ f11,f12,f13,f14,f15,f16,f17,f18,f19,f20], tolerance=tolerance)
1231
+ sf = 1.051*0.5 # To insribe it in a sphere of radius 0.5
1232
+ icosahedron = Topology.Scale(icosahedron, origin=Vertex.Origin(), x=sf, y=sf, z=sf)
1233
+ sf = radius/0.5
1234
+ icosahedron = Topology.Scale(icosahedron, origin=Vertex.Origin(), x=sf, y=sf, z=sf)
1235
+ if placement == "bottom":
1236
+ icosahedron = Topology.Translate(icosahedron, 0, 0, radius)
1237
+ elif placement == "lowerleft":
1238
+ icosahedron = Topology.Translate(icosahedron, radius, radius, radius)
1239
+ icosahedron = Topology.Place(icosahedron, originA=Vertex.Origin(), originB=origin)
1240
+ icosahedron = Topology.Orient(icosahedron, origin=origin, dirA=[0,0,1], dirB=direction, tolerance=tolerance)
1241
+ return icosahedron
1242
+
1243
+
1122
1244
  @staticmethod
1123
1245
  def InternalBoundaries(cell: topologic.Cell) -> list:
1124
1246
  """
@@ -1272,7 +1394,70 @@ class Cell(Topology):
1272
1394
  except:
1273
1395
  print("Cell.IsOutside - Error: Could not determine if the input vertex is outside the input cell. Returning None.")
1274
1396
  return None
1275
-
1397
+
1398
+ @staticmethod
1399
+ def Octahedron(origin: topologic.Vertex = None, radius: float = 0.5,
1400
+ direction: list = [0,0,1], placement: str ="center", tolerance: float = 0.0001) -> topologic.Cell:
1401
+ """
1402
+ Description
1403
+ ----------
1404
+ Creates an octahedron. See https://en.wikipedia.org/wiki/Octahedron.
1405
+
1406
+ Parameters
1407
+ ----------
1408
+ origin : topologic.Vertex , optional
1409
+ The origin location of the octahedron. The default is None which results in the octahedron being placed at (0,0,0).
1410
+ radius : float , optional
1411
+ The radius of the octahedron's circumscribed sphere. The default is 0.5.
1412
+ direction : list , optional
1413
+ The vector representing the up direction of the octahedron. The default is [0,0,1].
1414
+ placement : str , optional
1415
+ 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".
1416
+ tolerance : float , optional
1417
+ The desired tolerance. The default is 0.0001.
1418
+
1419
+ Returns
1420
+ -------
1421
+ topologic.Cell
1422
+ The created octahedron.
1423
+
1424
+ """
1425
+
1426
+ from topologicpy.Vertex import Vertex
1427
+ from topologicpy.Face import Face
1428
+ from topologicpy.Topology import Topology
1429
+
1430
+ if not origin:
1431
+ origin = Vertex.ByCoordinates(0,0,0)
1432
+ if not isinstance(origin, topologic.Vertex):
1433
+ print("Cell.Octahedron - Error: The input origin parameter is not a valid topologic vertex. Returning None.")
1434
+ return None
1435
+
1436
+ vb1 = Vertex.ByCoordinates(-0.5,0,0)
1437
+ vb2 = Vertex.ByCoordinates(0,-0.5,0)
1438
+ vb3 = Vertex.ByCoordinates(0.5,0,0)
1439
+ vb4 = Vertex.ByCoordinates(0,0.5,0)
1440
+ top = Vertex.ByCoordinates(0, 0, 0.5)
1441
+ bottom = Vertex.ByCoordinates(0, 0, -0.5)
1442
+ f1 = Face.ByVertices([top,vb1,vb2])
1443
+ f2 = Face.ByVertices([top,vb2,vb3])
1444
+ f3 = Face.ByVertices([top,vb3,vb4])
1445
+ f4 = Face.ByVertices([top,vb4,vb1])
1446
+ f5 = Face.ByVertices([bottom,vb1,vb2])
1447
+ f6 = Face.ByVertices([bottom,vb2,vb3])
1448
+ f7 = Face.ByVertices([bottom,vb3,vb4])
1449
+ f8 = Face.ByVertices([bottom,vb4,vb1])
1450
+
1451
+ octahedron = Cell.ByFaces([f1,f2,f3,f4,f5,f6,f7,f8], tolerance=tolerance)
1452
+ octahedron = Topology.Scale(octahedron, origin=Vertex.Origin(), x=radius/0.5, y=radius/0.5, z=radius/0.5)
1453
+ if placement == "bottom":
1454
+ octahedron = Topology.Translate(octahedron, 0, 0, radius)
1455
+ elif placement == "lowerleft":
1456
+ octahedron = Topology.Translate(octahedron, radius, radius, radius)
1457
+ octahedron = Topology.Place(octahedron, originA=Vertex.Origin(), originB=origin)
1458
+ octahedron = Topology.Orient(octahedron, origin=origin, dirA=[0,0,1], dirB=direction)
1459
+ return octahedron
1460
+
1276
1461
  @staticmethod
1277
1462
  def Pipe(edge: topologic.Edge, profile: topologic.Wire = None, radius: float = 0.5, sides: int = 16, startOffset: float = 0, endOffset: float = 0, endcapA: topologic.Topology = None, endcapB: topologic.Topology = None) -> dict:
1278
1463
  """
@@ -1490,23 +1675,7 @@ class Cell(Topology):
1490
1675
 
1491
1676
  if uSides > 1 or vSides > 1 or wSides > 1:
1492
1677
  prism = sliceCell(prism, width, length, height, uSides, vSides, wSides)
1493
- x1 = origin.X()
1494
- y1 = origin.Y()
1495
- z1 = origin.Z()
1496
- x2 = origin.X() + direction[0]
1497
- y2 = origin.Y() + direction[1]
1498
- z2 = origin.Z() + direction[2]
1499
- dx = x2 - x1
1500
- dy = y2 - y1
1501
- dz = z2 - z1
1502
- dist = math.sqrt(dx**2 + dy**2 + dz**2)
1503
- phi = math.degrees(math.atan2(dy, dx)) # Rotation around Y-Axis
1504
- if dist < 0.0001:
1505
- theta = 0
1506
- else:
1507
- theta = math.degrees(math.acos(dz/dist)) # Rotation around Z-Axis
1508
- prism = Topology.Rotate(prism, origin, 0, 1, 0, theta)
1509
- prism = Topology.Rotate(prism, origin, 0, 0, 1, phi)
1678
+ prism = Topology.Orient(prism, origin=origin, dirA=[0,0,1], dirB=direction, tolerance=tolerance)
1510
1679
  return prism
1511
1680
 
1512
1681
  @staticmethod
@@ -1695,34 +1864,19 @@ class Cell(Topology):
1695
1864
  if not isinstance(origin, topologic.Vertex):
1696
1865
  print("Cell.Sphere - Error: The input origin parameter is not a valid topologic vertex. Returning None.")
1697
1866
  return None
1698
- c = Wire.Circle(origin=origin, radius=radius, sides=vSides, fromAngle=90, toAngle=270, close=False, direction=[0, 1, 0], placement="center")
1699
- s = Topology.Spin(c, origin=origin, triangulate=False, direction=[0,0,1], degree=360, sides=uSides, tolerance=tolerance)
1700
- if s.Type() == topologic.CellComplex.Type():
1701
- s = s.ExternalBoundary()
1702
- if s.Type() == topologic.Shell.Type():
1703
- s = topologic.Cell.ByShell(s)
1867
+ c = Wire.Circle(origin=Vertex.Origin(), radius=radius, sides=vSides, fromAngle=90, toAngle=270, close=False, direction=[0, 1, 0], placement="center")
1868
+ sphere = Topology.Spin(c, origin=Vertex.Origin(), triangulate=False, direction=[0,0,1], degree=360, sides=uSides, tolerance=tolerance)
1869
+ if sphere.Type() == topologic.CellComplex.Type():
1870
+ sphere = sphere.ExternalBoundary()
1871
+ if sphere.Type() == topologic.Shell.Type():
1872
+ sphere = topologic.Cell.ByShell(sphere)
1704
1873
  if placement.lower() == "bottom":
1705
- s = Topology.Translate(s, 0, 0, radius)
1874
+ sphere = Topology.Translate(sphere, 0, 0, radius)
1706
1875
  elif placement.lower() == "lowerleft":
1707
- s = Topology.Translate(s, radius, radius, radius)
1708
- x1 = origin.X()
1709
- y1 = origin.Y()
1710
- z1 = origin.Z()
1711
- x2 = origin.X() + direction[0]
1712
- y2 = origin.Y() + direction[1]
1713
- z2 = origin.Z() + direction[2]
1714
- dx = x2 - x1
1715
- dy = y2 - y1
1716
- dz = z2 - z1
1717
- dist = math.sqrt(dx**2 + dy**2 + dz**2)
1718
- phi = math.degrees(math.atan2(dy, dx)) # Rotation around Y-Axis
1719
- if dist < 0.0001:
1720
- theta = 0
1721
- else:
1722
- theta = math.degrees(math.acos(dz/dist)) # Rotation around Z-Axis
1723
- s = Topology.Rotate(s, origin, 0, 1, 0, theta)
1724
- s = Topology.Rotate(s, origin, 0, 0, 1, phi)
1725
- return s
1876
+ sphere = Topology.Translate(sphere, radius, radius, radius)
1877
+ sphere = Topology.Place(sphere, originA=Vertex.Origin(), originB=origin)
1878
+ sphere = Topology.Orient(sphere, origin=origin, dirA=[0,0,1], dirB=direction)
1879
+ return sphere
1726
1880
 
1727
1881
  @staticmethod
1728
1882
  def SurfaceArea(cell: topologic.Cell, mantissa: int = 6) -> float:
@@ -1743,7 +1897,67 @@ class Cell(Topology):
1743
1897
 
1744
1898
  """
1745
1899
  return Cell.Area(cell=cell, mantissa=mantissa)
1900
+
1901
+ @staticmethod
1902
+ def Tetrahedron(origin: topologic.Vertex = None, radius: float = 0.5,
1903
+ direction: list = [0,0,1], placement: str ="center", tolerance: float = 0.0001) -> topologic.Cell:
1904
+ """
1905
+ Description
1906
+ ----------
1907
+ Creates a tetrahedron. See https://en.wikipedia.org/wiki/Tetrahedron.
1908
+
1909
+ Parameters
1910
+ ----------
1911
+ origin : topologic.Vertex , optional
1912
+ The origin location of the tetrahedron. The default is None which results in the tetrahedron being placed at (0,0,0).
1913
+ radius : float , optional
1914
+ The radius of the tetrahedron's circumscribed sphere. The default is 0.5.
1915
+ direction : list , optional
1916
+ The vector representing the up direction of the tetrahedron. The default is [0,0,1].
1917
+ placement : str , optional
1918
+ The description of the placement of the origin of the tetrahedron. This can be "bottom", "center", or "lowerleft". It is case insensitive. The default is "center".
1919
+ tolerance : float , optional
1920
+ The desired tolerance. The default is 0.0001.
1921
+
1922
+ Returns
1923
+ -------
1924
+ topologic.Cell
1925
+ The created tetrahedron.
1926
+
1927
+ """
1928
+
1929
+ from topologicpy.Vertex import Vertex
1930
+ from topologicpy.Wire import Wire
1931
+ from topologicpy.Face import Face
1932
+ from topologicpy.Topology import Topology
1933
+ import math
1746
1934
 
1935
+ if not origin:
1936
+ origin = Vertex.ByCoordinates(0,0,0)
1937
+ if not isinstance(origin, topologic.Vertex):
1938
+ print("Cell.Tetrahedron - Error: The input origin parameter is not a valid topologic vertex. Returning None.")
1939
+ return None
1940
+
1941
+ vb1 = Vertex.ByCoordinates(math.sqrt(8/9), 0, -1/3)
1942
+ vb2 = Vertex.ByCoordinates(-math.sqrt(2/9), math.sqrt(2/3), -1/3)
1943
+ vb3 = Vertex.ByCoordinates(-math.sqrt(2/9), -math.sqrt(2/3), -1/3)
1944
+ vb4 = Vertex.ByCoordinates(0,0,1)
1945
+ f1 = Face.ByVertices([vb1,vb2,vb3])
1946
+ f2 = Face.ByVertices([vb4,vb1,vb2])
1947
+ f3 = Face.ByVertices([vb4,vb2,vb3])
1948
+ f4 = Face.ByVertices([vb4,vb3,vb1])
1949
+ tetrahedron = Cell.ByFaces([f1,f2,f3,f4])
1950
+ tetrahedron = Topology.Scale(tetrahedron, origin=Vertex.Origin(), x=0.5, y=0.5, z=0.5)
1951
+ tetrahedron = Topology.Scale(tetrahedron, origin=Vertex.Origin(), x=radius/0.5, y=radius/0.5, z=radius/0.5)
1952
+
1953
+ if placement.lower() == "lowerleft":
1954
+ tetrahedron = Topology.Translate(tetrahedron, radius, radius, radius)
1955
+ elif placement.lower() == "bottom":
1956
+ tetrahedron = Topology.Translate(tetrahedron, 0, 0, radius)
1957
+ tetrahedron = Topology.Place(tetrahedron, originA=Vertex.Origin(), originB=origin)
1958
+ tetrahedron = Topology.Orient(tetrahedron, origin=origin, dirA=[0,0,1], dirB=direction, tolerance=tolerance)
1959
+ return tetrahedron
1960
+
1747
1961
  @staticmethod
1748
1962
  def Torus(origin: topologic.Vertex = None, majorRadius: float = 0.5, minorRadius: float = 0.125, uSides: int = 16, vSides: int = 8, direction: list = [0,0,1], placement: str = "center", tolerance: float = 0.0001) -> topologic.Cell:
1749
1963
  """
@@ -1783,33 +1997,19 @@ class Cell(Topology):
1783
1997
  if not isinstance(origin, topologic.Vertex):
1784
1998
  print("Cell.Torus - Error: The input origin parameter is not a valid topologic vertex. Returning None.")
1785
1999
  return None
1786
- c = Wire.Circle(origin=origin, radius=minorRadius, sides=vSides, fromAngle=0, toAngle=360, close=False, direction=[0, 1, 0], placement="center")
2000
+ c = Wire.Circle(origin=Vertex.Origin(), radius=minorRadius, sides=vSides, fromAngle=0, toAngle=360, close=False, direction=[0, 1, 0], placement="center")
1787
2001
  c = Topology.Translate(c, abs(majorRadius-minorRadius), 0, 0)
1788
- s = Topology.Spin(c, origin=origin, triangulate=False, direction=[0,0,1], degree=360, sides=uSides, tolerance=tolerance)
1789
- if s.Type() == topologic.Shell.Type():
1790
- s = topologic.Cell.ByShell(s)
2002
+ torus = Topology.Spin(c, origin=Vertex.Origin(), triangulate=False, direction=[0,0,1], degree=360, sides=uSides, tolerance=tolerance)
2003
+ if torus.Type() == topologic.Shell.Type():
2004
+ torus = topologic.Cell.ByShell(torus)
1791
2005
  if placement.lower() == "bottom":
1792
- s = Topology.Translate(s, 0, 0, majorRadius)
2006
+ torus = Topology.Translate(torus, 0, 0, minorRadius)
1793
2007
  elif placement.lower() == "lowerleft":
1794
- s = Topology.Translate(s, majorRadius, majorRadius, minorRadius)
1795
- x1 = origin.X()
1796
- y1 = origin.Y()
1797
- z1 = origin.Z()
1798
- x2 = origin.X() + direction[0]
1799
- y2 = origin.Y() + direction[1]
1800
- z2 = origin.Z() + direction[2]
1801
- dx = x2 - x1
1802
- dy = y2 - y1
1803
- dz = z2 - z1
1804
- dist = math.sqrt(dx**2 + dy**2 + dz**2)
1805
- phi = math.degrees(math.atan2(dy, dx)) # Rotation around Y-Axis
1806
- if dist < 0.0001:
1807
- theta = 0
1808
- else:
1809
- theta = math.degrees(math.acos(dz/dist)) # Rotation around Z-Axis
1810
- s = Topology.Rotate(s, origin, 0, 1, 0, theta)
1811
- s = Topology.Rotate(s, origin, 0, 0, 1, phi)
1812
- return s
2008
+ torus = Topology.Translate(torus, majorRadius, majorRadius, minorRadius)
2009
+
2010
+ torus = Topology.Place(torus, originA=Vertex.Origin(), originB=origin)
2011
+ torus = Topology.Orient(torus, origin=origin, dirA=[0,0,1], dirB=direction)
2012
+ return torus
1813
2013
 
1814
2014
  @staticmethod
1815
2015
  def Vertices(cell: topologic.Cell) -> list:
@@ -681,6 +681,70 @@ class CellComplex(Topology):
681
681
  _ = cellComplex.NonManifoldFaces(faces)
682
682
  return faces
683
683
 
684
+ @staticmethod
685
+ def Octahedron(origin: topologic.Vertex = None, radius: float = 0.5,
686
+ direction: list = [0,0,1], placement: str ="center", tolerance: float = 0.0001) -> topologic.CellComplex:
687
+ """
688
+ Description
689
+ ----------
690
+ Creates an octahedron. See https://en.wikipedia.org/wiki/Octahedron.
691
+
692
+ Parameters
693
+ ----------
694
+ origin : topologic.Vertex , optional
695
+ The origin location of the octahedron. The default is None which results in the octahedron being placed at (0,0,0).
696
+ radius : float , optional
697
+ The radius of the octahedron's circumscribed sphere. The default is 0.5.
698
+ direction : list , optional
699
+ The vector representing the up direction of the octahedron. The default is [0,0,1].
700
+ placement : str , optional
701
+ 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".
702
+ tolerance : float , optional
703
+ The desired tolerance. The default is 0.0001.
704
+
705
+ Returns
706
+ -------
707
+ topologic.CellComplex
708
+ The created octahedron.
709
+
710
+ """
711
+
712
+ from topologicpy.Vertex import Vertex
713
+ from topologicpy.Face import Face
714
+ from topologicpy.Topology import Topology
715
+
716
+ if not origin:
717
+ origin = Vertex.ByCoordinates(0,0,0)
718
+ if not isinstance(origin, topologic.Vertex):
719
+ print("CellComplex.Octahedron - Error: The input origin parameter is not a valid topologic vertex. Returning None.")
720
+ return None
721
+
722
+ vb1 = Vertex.ByCoordinates(-0.5,0,0)
723
+ vb2 = Vertex.ByCoordinates(0,-0.5,0)
724
+ vb3 = Vertex.ByCoordinates(0.5,0,0)
725
+ vb4 = Vertex.ByCoordinates(0,0.5,0)
726
+ top = Vertex.ByCoordinates(0, 0, 0.5)
727
+ bottom = Vertex.ByCoordinates(0, 0, -0.5)
728
+ f1 = Face.ByVertices([top,vb1,vb2])
729
+ f2 = Face.ByVertices([top,vb2,vb3])
730
+ f3 = Face.ByVertices([top,vb3,vb4])
731
+ f4 = Face.ByVertices([top,vb4,vb1])
732
+ f5 = Face.ByVertices([bottom,vb1,vb2])
733
+ f6 = Face.ByVertices([bottom,vb2,vb3])
734
+ f7 = Face.ByVertices([bottom,vb3,vb4])
735
+ f8 = Face.ByVertices([bottom,vb4,vb1])
736
+ f9 = Face.ByVertices([vb1,vb2,vb3,vb4])
737
+
738
+ octahedron = CellComplex.ByFaces([f1,f2,f3,f4,f5,f6,f7,f8,f9], tolerance=tolerance)
739
+ octahedron = Topology.Scale(octahedron, origin=Vertex.Origin(), x=radius/0.5, y=radius/0.5, z=radius/0.5)
740
+ if placement == "bottom":
741
+ octahedron = Topology.Translate(octahedron, 0, 0, radius)
742
+ elif placement == "lowerleft":
743
+ octahedron = Topology.Translate(octahedron, radius, radius, radius)
744
+ octahedron = Topology.Place(octahedron, originA=Vertex.Origin(), originB=origin)
745
+ octahedron = Topology.Orient(octahedron, origin=origin, dirA=[0,0,1], dirB=direction)
746
+ return octahedron
747
+
684
748
  @staticmethod
685
749
  def Prism(origin: topologic.Vertex = None,
686
750
  width: float = 1.0, length: float = 1.0, height: float = 1.0,
@@ -3073,7 +3073,7 @@ class Topology():
3073
3073
  xT = newX - oldX
3074
3074
  yT = newY - oldY
3075
3075
  zT = newZ - oldZ
3076
- newTopology = Topology.Translate(aTopology, xT*300, yT, zT)
3076
+ newTopology = Topology.Translate(aTopology, xT, yT, zT)
3077
3077
  newTopologies.append(newTopology)
3078
3078
  return Cluster.ByTopologies(newTopologies)
3079
3079
 
@@ -18,7 +18,7 @@ import sys
18
18
  import os, re
19
19
  from sys import platform
20
20
 
21
- __version__ = '0.4.71'
21
+ __version__ = '0.4.73'
22
22
  __version_info__ = tuple([ int(num) for num in __version__.split('.')])
23
23
 
24
24
  if platform == 'win32':
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: topologicpy
3
- Version: 0.4.71
3
+ Version: 0.4.73
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
  Project-URL: Homepage, https://github.com/wassimj/TopologicPy
File without changes
File without changes
File without changes
File without changes