topologicpy 0.4.72__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.72/src/topologicpy.egg-info → topologicpy-0.4.73}/PKG-INFO +1 -1
  2. {topologicpy-0.4.72 → topologicpy-0.4.73}/pyproject.toml +1 -1
  3. {topologicpy-0.4.72 → topologicpy-0.4.73}/src/topologicpy/Cell.py +151 -203
  4. {topologicpy-0.4.72 → topologicpy-0.4.73}/src/topologicpy/CellComplex.py +20 -40
  5. {topologicpy-0.4.72 → topologicpy-0.4.73}/src/topologicpy/__init__.py +1 -1
  6. {topologicpy-0.4.72 → topologicpy-0.4.73/src/topologicpy.egg-info}/PKG-INFO +1 -1
  7. {topologicpy-0.4.72 → topologicpy-0.4.73}/LICENSE +0 -0
  8. {topologicpy-0.4.72 → topologicpy-0.4.73}/MANIFEST.in +0 -0
  9. {topologicpy-0.4.72 → topologicpy-0.4.73}/README.md +0 -0
  10. {topologicpy-0.4.72 → topologicpy-0.4.73}/setup.cfg +0 -0
  11. {topologicpy-0.4.72 → topologicpy-0.4.73}/src/topologicpy/Aperture.py +0 -0
  12. {topologicpy-0.4.72 → topologicpy-0.4.73}/src/topologicpy/Cluster.py +0 -0
  13. {topologicpy-0.4.72 → topologicpy-0.4.73}/src/topologicpy/Color.py +0 -0
  14. {topologicpy-0.4.72 → topologicpy-0.4.73}/src/topologicpy/Context.py +0 -0
  15. {topologicpy-0.4.72 → topologicpy-0.4.73}/src/topologicpy/DGL.py +0 -0
  16. {topologicpy-0.4.72 → topologicpy-0.4.73}/src/topologicpy/Dictionary.py +0 -0
  17. {topologicpy-0.4.72 → topologicpy-0.4.73}/src/topologicpy/Edge.py +0 -0
  18. {topologicpy-0.4.72 → topologicpy-0.4.73}/src/topologicpy/EnergyModel.py +0 -0
  19. {topologicpy-0.4.72 → topologicpy-0.4.73}/src/topologicpy/Face.py +0 -0
  20. {topologicpy-0.4.72 → topologicpy-0.4.73}/src/topologicpy/Graph.py +0 -0
  21. {topologicpy-0.4.72 → topologicpy-0.4.73}/src/topologicpy/Grid.py +0 -0
  22. {topologicpy-0.4.72 → topologicpy-0.4.73}/src/topologicpy/Helper.py +0 -0
  23. {topologicpy-0.4.72 → topologicpy-0.4.73}/src/topologicpy/Honeybee.py +0 -0
  24. {topologicpy-0.4.72 → topologicpy-0.4.73}/src/topologicpy/Matrix.py +0 -0
  25. {topologicpy-0.4.72 → topologicpy-0.4.73}/src/topologicpy/Neo4j.py +0 -0
  26. {topologicpy-0.4.72 → topologicpy-0.4.73}/src/topologicpy/Plotly.py +0 -0
  27. {topologicpy-0.4.72 → topologicpy-0.4.73}/src/topologicpy/Polyskel.py +0 -0
  28. {topologicpy-0.4.72 → topologicpy-0.4.73}/src/topologicpy/Shell.py +0 -0
  29. {topologicpy-0.4.72 → topologicpy-0.4.73}/src/topologicpy/Speckle.py +0 -0
  30. {topologicpy-0.4.72 → topologicpy-0.4.73}/src/topologicpy/Topology.py +0 -0
  31. {topologicpy-0.4.72 → topologicpy-0.4.73}/src/topologicpy/Vector.py +0 -0
  32. {topologicpy-0.4.72 → topologicpy-0.4.73}/src/topologicpy/Vertex.py +0 -0
  33. {topologicpy-0.4.72 → topologicpy-0.4.73}/src/topologicpy/Wire.py +0 -0
  34. {topologicpy-0.4.72 → topologicpy-0.4.73}/src/topologicpy/bin/linux/topologic/__init__.py +0 -0
  35. {topologicpy-0.4.72 → topologicpy-0.4.73}/src/topologicpy/bin/linux/topologic/libTKBO-6bdf205d.so.7.7.0 +0 -0
  36. {topologicpy-0.4.72 → topologicpy-0.4.73}/src/topologicpy/bin/linux/topologic/libTKBRep-2960a069.so.7.7.0 +0 -0
  37. {topologicpy-0.4.72 → topologicpy-0.4.73}/src/topologicpy/bin/linux/topologic/libTKBool-c44b74bd.so.7.7.0 +0 -0
  38. {topologicpy-0.4.72 → topologicpy-0.4.73}/src/topologicpy/bin/linux/topologic/libTKFillet-9a670ba0.so.7.7.0 +0 -0
  39. {topologicpy-0.4.72 → topologicpy-0.4.73}/src/topologicpy/bin/linux/topologic/libTKG2d-8f31849e.so.7.7.0 +0 -0
  40. {topologicpy-0.4.72 → topologicpy-0.4.73}/src/topologicpy/bin/linux/topologic/libTKG3d-4c6bce57.so.7.7.0 +0 -0
  41. {topologicpy-0.4.72 → topologicpy-0.4.73}/src/topologicpy/bin/linux/topologic/libTKGeomAlgo-26066fd9.so.7.7.0 +0 -0
  42. {topologicpy-0.4.72 → topologicpy-0.4.73}/src/topologicpy/bin/linux/topologic/libTKGeomBase-2116cabe.so.7.7.0 +0 -0
  43. {topologicpy-0.4.72 → topologicpy-0.4.73}/src/topologicpy/bin/linux/topologic/libTKMath-72572fa8.so.7.7.0 +0 -0
  44. {topologicpy-0.4.72 → topologicpy-0.4.73}/src/topologicpy/bin/linux/topologic/libTKMesh-2a060427.so.7.7.0 +0 -0
  45. {topologicpy-0.4.72 → topologicpy-0.4.73}/src/topologicpy/bin/linux/topologic/libTKOffset-6cab68ff.so.7.7.0 +0 -0
  46. {topologicpy-0.4.72 → topologicpy-0.4.73}/src/topologicpy/bin/linux/topologic/libTKPrim-eb1262b3.so.7.7.0 +0 -0
  47. {topologicpy-0.4.72 → topologicpy-0.4.73}/src/topologicpy/bin/linux/topologic/libTKShHealing-e67e5cc7.so.7.7.0 +0 -0
  48. {topologicpy-0.4.72 → topologicpy-0.4.73}/src/topologicpy/bin/linux/topologic/libTKTopAlgo-e4c96c33.so.7.7.0 +0 -0
  49. {topologicpy-0.4.72 → topologicpy-0.4.73}/src/topologicpy/bin/linux/topologic/libTKernel-fb7fe3b7.so.7.7.0 +0 -0
  50. {topologicpy-0.4.72 → topologicpy-0.4.73}/src/topologicpy/bin/linux/topologic/libgcc_s-32c1665e.so.1 +0 -0
  51. {topologicpy-0.4.72 → topologicpy-0.4.73}/src/topologicpy/bin/linux/topologic/libstdc++-672d7b41.so.6.0.30 +0 -0
  52. {topologicpy-0.4.72 → topologicpy-0.4.73}/src/topologicpy/bin/linux/topologic/topologic.cpython-310-x86_64-linux-gnu.so +0 -0
  53. {topologicpy-0.4.72 → topologicpy-0.4.73}/src/topologicpy/bin/linux/topologic/topologic.cpython-311-x86_64-linux-gnu.so +0 -0
  54. {topologicpy-0.4.72 → topologicpy-0.4.73}/src/topologicpy/bin/linux/topologic/topologic.cpython-38-x86_64-linux-gnu.so +0 -0
  55. {topologicpy-0.4.72 → topologicpy-0.4.73}/src/topologicpy/bin/linux/topologic/topologic.cpython-39-x86_64-linux-gnu.so +0 -0
  56. {topologicpy-0.4.72 → topologicpy-0.4.73}/src/topologicpy/bin/linux/topologic.libs/libTKBO-6bdf205d.so.7.7.0 +0 -0
  57. {topologicpy-0.4.72 → topologicpy-0.4.73}/src/topologicpy/bin/linux/topologic.libs/libTKBRep-2960a069.so.7.7.0 +0 -0
  58. {topologicpy-0.4.72 → topologicpy-0.4.73}/src/topologicpy/bin/linux/topologic.libs/libTKBool-c44b74bd.so.7.7.0 +0 -0
  59. {topologicpy-0.4.72 → topologicpy-0.4.73}/src/topologicpy/bin/linux/topologic.libs/libTKFillet-9a670ba0.so.7.7.0 +0 -0
  60. {topologicpy-0.4.72 → topologicpy-0.4.73}/src/topologicpy/bin/linux/topologic.libs/libTKG2d-8f31849e.so.7.7.0 +0 -0
  61. {topologicpy-0.4.72 → topologicpy-0.4.73}/src/topologicpy/bin/linux/topologic.libs/libTKG3d-4c6bce57.so.7.7.0 +0 -0
  62. {topologicpy-0.4.72 → topologicpy-0.4.73}/src/topologicpy/bin/linux/topologic.libs/libTKGeomAlgo-26066fd9.so.7.7.0 +0 -0
  63. {topologicpy-0.4.72 → topologicpy-0.4.73}/src/topologicpy/bin/linux/topologic.libs/libTKGeomBase-2116cabe.so.7.7.0 +0 -0
  64. {topologicpy-0.4.72 → topologicpy-0.4.73}/src/topologicpy/bin/linux/topologic.libs/libTKMath-72572fa8.so.7.7.0 +0 -0
  65. {topologicpy-0.4.72 → topologicpy-0.4.73}/src/topologicpy/bin/linux/topologic.libs/libTKMesh-2a060427.so.7.7.0 +0 -0
  66. {topologicpy-0.4.72 → topologicpy-0.4.73}/src/topologicpy/bin/linux/topologic.libs/libTKOffset-6cab68ff.so.7.7.0 +0 -0
  67. {topologicpy-0.4.72 → topologicpy-0.4.73}/src/topologicpy/bin/linux/topologic.libs/libTKPrim-eb1262b3.so.7.7.0 +0 -0
  68. {topologicpy-0.4.72 → topologicpy-0.4.73}/src/topologicpy/bin/linux/topologic.libs/libTKShHealing-e67e5cc7.so.7.7.0 +0 -0
  69. {topologicpy-0.4.72 → topologicpy-0.4.73}/src/topologicpy/bin/linux/topologic.libs/libTKTopAlgo-e4c96c33.so.7.7.0 +0 -0
  70. {topologicpy-0.4.72 → topologicpy-0.4.73}/src/topologicpy/bin/linux/topologic.libs/libTKernel-fb7fe3b7.so.7.7.0 +0 -0
  71. {topologicpy-0.4.72 → topologicpy-0.4.73}/src/topologicpy/bin/linux/topologic.libs/libgcc_s-32c1665e.so.1 +0 -0
  72. {topologicpy-0.4.72 → topologicpy-0.4.73}/src/topologicpy/bin/linux/topologic.libs/libstdc++-672d7b41.so.6.0.30 +0 -0
  73. {topologicpy-0.4.72 → topologicpy-0.4.73}/src/topologicpy/bin/macos/topologic/__init__.py +0 -0
  74. {topologicpy-0.4.72 → topologicpy-0.4.73}/src/topologicpy/bin/windows/topologic/TKBO-f6b191de.dll +0 -0
  75. {topologicpy-0.4.72 → topologicpy-0.4.73}/src/topologicpy/bin/windows/topologic/TKBRep-e56a600e.dll +0 -0
  76. {topologicpy-0.4.72 → topologicpy-0.4.73}/src/topologicpy/bin/windows/topologic/TKBool-7b8d47ae.dll +0 -0
  77. {topologicpy-0.4.72 → topologicpy-0.4.73}/src/topologicpy/bin/windows/topologic/TKFillet-0ddbf0a8.dll +0 -0
  78. {topologicpy-0.4.72 → topologicpy-0.4.73}/src/topologicpy/bin/windows/topologic/TKG2d-2e2dee3d.dll +0 -0
  79. {topologicpy-0.4.72 → topologicpy-0.4.73}/src/topologicpy/bin/windows/topologic/TKG3d-6674513d.dll +0 -0
  80. {topologicpy-0.4.72 → topologicpy-0.4.73}/src/topologicpy/bin/windows/topologic/TKGeomAlgo-d240e370.dll +0 -0
  81. {topologicpy-0.4.72 → topologicpy-0.4.73}/src/topologicpy/bin/windows/topologic/TKGeomBase-df87aba5.dll +0 -0
  82. {topologicpy-0.4.72 → topologicpy-0.4.73}/src/topologicpy/bin/windows/topologic/TKMath-45bd625a.dll +0 -0
  83. {topologicpy-0.4.72 → topologicpy-0.4.73}/src/topologicpy/bin/windows/topologic/TKMesh-d6e826b1.dll +0 -0
  84. {topologicpy-0.4.72 → topologicpy-0.4.73}/src/topologicpy/bin/windows/topologic/TKOffset-79b9cc94.dll +0 -0
  85. {topologicpy-0.4.72 → topologicpy-0.4.73}/src/topologicpy/bin/windows/topologic/TKPrim-aa430a86.dll +0 -0
  86. {topologicpy-0.4.72 → topologicpy-0.4.73}/src/topologicpy/bin/windows/topologic/TKShHealing-bb48be89.dll +0 -0
  87. {topologicpy-0.4.72 → topologicpy-0.4.73}/src/topologicpy/bin/windows/topologic/TKTopAlgo-7d0d1e22.dll +0 -0
  88. {topologicpy-0.4.72 → topologicpy-0.4.73}/src/topologicpy/bin/windows/topologic/TKernel-08c8cfbb.dll +0 -0
  89. {topologicpy-0.4.72 → topologicpy-0.4.73}/src/topologicpy/bin/windows/topologic/__init__.py +0 -0
  90. {topologicpy-0.4.72 → topologicpy-0.4.73}/src/topologicpy/bin/windows/topologic/topologic.cp310-win_amd64.pyd +0 -0
  91. {topologicpy-0.4.72 → topologicpy-0.4.73}/src/topologicpy/bin/windows/topologic/topologic.cp311-win_amd64.pyd +0 -0
  92. {topologicpy-0.4.72 → topologicpy-0.4.73}/src/topologicpy/bin/windows/topologic/topologic.cp38-win_amd64.pyd +0 -0
  93. {topologicpy-0.4.72 → topologicpy-0.4.73}/src/topologicpy/bin/windows/topologic/topologic.cp39-win_amd64.pyd +0 -0
  94. {topologicpy-0.4.72 → topologicpy-0.4.73}/src/topologicpy.egg-info/SOURCES.txt +0 -0
  95. {topologicpy-0.4.72 → topologicpy-0.4.73}/src/topologicpy.egg-info/dependency_links.txt +0 -0
  96. {topologicpy-0.4.72 → topologicpy-0.4.73}/src/topologicpy.egg-info/requires.txt +0 -0
  97. {topologicpy-0.4.72 → 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.72
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.72"
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
@@ -946,7 +914,7 @@ class Cell(Topology):
946
914
  origin : topologic.Vertex , optional
947
915
  The origin location of the dodecahedron. The default is None which results in the dodecahedron being placed at (0,0,0).
948
916
  radius : float , optional
949
- The radius of the dodecahedron. The default is 0.5.
917
+ The radius of the dodecahedron's circumscribed sphere. The default is 0.5.
950
918
  direction : list , optional
951
919
  The vector representing the up direction of the dodecahedron. The default is [0,0,1].
952
920
  placement : str , optional
@@ -976,8 +944,8 @@ class Cell(Topology):
976
944
  edges = Topology.Edges(pen)
977
945
  for edge in edges:
978
946
  o = Topology.Centroid(edge)
979
- direction = Edge.Direction(edge)
980
- pentagons.append(Topology.Rotate(pen, origin=o, x=direction[0], y=direction[1], z=direction[2], degree=116.565))
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))
981
949
 
982
950
  cluster = Cluster.ByTopologies(pentagons)
983
951
  vertices = Topology.Vertices(cluster)
@@ -988,33 +956,18 @@ class Cell(Topology):
988
956
  cluster2 = Topology.Rotate(cluster, origin=Vertex.Origin(), x=1,y=0,z=0,degree=180)
989
957
  cluster2 = Topology.Translate(cluster2, 0, 0, zOffset)
990
958
  pentagons += Topology.Faces(cluster2)
991
- dodecahedron = Cell.ByFaces(pentagons)
959
+ dodecahedron = Cell.ByFaces(pentagons, tolerance=tolerance)
992
960
  centroid = Topology.Centroid(dodecahedron)
993
961
  dodecahedron = Topology.Translate(dodecahedron, -Vertex.X(centroid), -Vertex.Y(centroid), -Vertex.Z(centroid))
994
962
  vertices = Topology.Vertices(dodecahedron)
995
- centroid = Topology.Centroid(dodecahedron)
996
- d = Vertex.Distance(centroid, vertices[0])
997
- p = Cell.Prism(origin=origin, width=radius*2, length=radius*2, height=radius*2)
998
- s = Cell.Sphere(origin=origin, radius=radius)
999
- dodecahedron = Topology.Scale(dodecahedron, origin=centroid, x=radius/d, y=radius/d, z=radius/d)
1000
- dodecahedron = Topology.Translate(dodecahedron, Vertex.X(origin), Vertex.Y(origin), Vertex.Z(origin))
1001
- x1 = origin.X()
1002
- y1 = origin.Y()
1003
- z1 = origin.Z()
1004
- x2 = origin.X() + direction[0]
1005
- y2 = origin.Y() + direction[1]
1006
- z2 = origin.Z() + direction[2]
1007
- dx = x2 - x1
1008
- dy = y2 - y1
1009
- dz = z2 - z1
1010
- dist = math.sqrt(dx**2 + dy**2 + dz**2)
1011
- phi = math.degrees(math.atan2(dy, dx)) # Rotation around Y-Axis
1012
- if dist < 0.0001:
1013
- theta = 0
1014
- else:
1015
- theta = math.degrees(math.acos(dz/dist)) # Rotation around Z-Axis
1016
- dodecahedron = Topology.Rotate(dodecahedron, origin, 0, 1, 0, theta)
1017
- dodecahedron = Topology.Rotate(dodecahedron, origin, 0, 0, 1, phi)
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)
1018
971
  return dodecahedron
1019
972
 
1020
973
  @staticmethod
@@ -1203,6 +1156,91 @@ class Cell(Topology):
1203
1156
  hyperboloid = Topology.Rotate(hyperboloid, origin, 0, 0, 1, phi)
1204
1157
  return hyperboloid
1205
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
+
1206
1244
  @staticmethod
1207
1245
  def InternalBoundaries(cell: topologic.Cell) -> list:
1208
1246
  """
@@ -1370,7 +1408,7 @@ class Cell(Topology):
1370
1408
  origin : topologic.Vertex , optional
1371
1409
  The origin location of the octahedron. The default is None which results in the octahedron being placed at (0,0,0).
1372
1410
  radius : float , optional
1373
- The radius of the octahedron. The default is 0.5.
1411
+ The radius of the octahedron's circumscribed sphere. The default is 0.5.
1374
1412
  direction : list , optional
1375
1413
  The vector representing the up direction of the octahedron. The default is [0,0,1].
1376
1414
  placement : str , optional
@@ -1392,25 +1430,15 @@ class Cell(Topology):
1392
1430
  if not origin:
1393
1431
  origin = Vertex.ByCoordinates(0,0,0)
1394
1432
  if not isinstance(origin, topologic.Vertex):
1395
- print("CellComplex.Octahedron - Error: The input origin parameter is not a valid topologic vertex. Returning None.")
1433
+ print("Cell.Octahedron - Error: The input origin parameter is not a valid topologic vertex. Returning None.")
1396
1434
  return None
1397
- xOffset = 0
1398
- yOffset = 0
1399
- zOffset = 0
1400
- if placement.lower() == "center":
1401
- zOffset = 0
1402
- elif placement.lower() == "lowerleft":
1403
- xOffset = radius/math.sqrt(2)
1404
- yOffset = radius/math.sqrt(2)
1405
- zOffset = radius
1406
- elif placement.lower() == "bottom":
1407
- zOffset = radius
1408
- vb1 = Vertex.ByCoordinates(origin.X()-radius/math.sqrt(2)+xOffset,origin.Y()-radius/math.sqrt(2)+yOffset,origin.Z()+zOffset)
1409
- vb2 = Vertex.ByCoordinates(origin.X()+radius/math.sqrt(2)+xOffset,origin.Y()-radius/math.sqrt(2)+yOffset,origin.Z()+zOffset)
1410
- vb3 = Vertex.ByCoordinates(origin.X()+radius/math.sqrt(2)+xOffset,origin.Y()+radius/math.sqrt(2)+yOffset,origin.Z()+zOffset)
1411
- vb4 = Vertex.ByCoordinates(origin.X()-radius/math.sqrt(2)+xOffset,origin.Y()+radius/math.sqrt(2)+yOffset,origin.Z()+zOffset)
1412
- top = Vertex.ByCoordinates(origin.X()+xOffset, origin.Y()+yOffset, origin.Z()+radius+zOffset)
1413
- bottom = Vertex.ByCoordinates(origin.X()+xOffset, origin.Y()+yOffset, origin.Z()-radius+zOffset)
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)
1414
1442
  f1 = Face.ByVertices([top,vb1,vb2])
1415
1443
  f2 = Face.ByVertices([top,vb2,vb3])
1416
1444
  f3 = Face.ByVertices([top,vb3,vb4])
@@ -1421,24 +1449,13 @@ class Cell(Topology):
1421
1449
  f8 = Face.ByVertices([bottom,vb4,vb1])
1422
1450
 
1423
1451
  octahedron = Cell.ByFaces([f1,f2,f3,f4,f5,f6,f7,f8], tolerance=tolerance)
1424
-
1425
- x1 = origin.X()
1426
- y1 = origin.Y()
1427
- z1 = origin.Z()
1428
- x2 = origin.X() + direction[0]
1429
- y2 = origin.Y() + direction[1]
1430
- z2 = origin.Z() + direction[2]
1431
- dx = x2 - x1
1432
- dy = y2 - y1
1433
- dz = z2 - z1
1434
- dist = math.sqrt(dx**2 + dy**2 + dz**2)
1435
- phi = math.degrees(math.atan2(dy, dx)) # Rotation around Y-Axis
1436
- if dist < 0.0001:
1437
- theta = 0
1438
- else:
1439
- theta = math.degrees(math.acos(dz/dist)) # Rotation around Z-Axis
1440
- octahedron = Topology.Rotate(octahedron, origin, 0, 1, 0, theta)
1441
- octahedron = Topology.Rotate(octahedron, origin, 0, 0, 1, phi)
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)
1442
1459
  return octahedron
1443
1460
 
1444
1461
  @staticmethod
@@ -1658,23 +1675,7 @@ class Cell(Topology):
1658
1675
 
1659
1676
  if uSides > 1 or vSides > 1 or wSides > 1:
1660
1677
  prism = sliceCell(prism, width, length, height, uSides, vSides, wSides)
1661
- x1 = origin.X()
1662
- y1 = origin.Y()
1663
- z1 = origin.Z()
1664
- x2 = origin.X() + direction[0]
1665
- y2 = origin.Y() + direction[1]
1666
- z2 = origin.Z() + direction[2]
1667
- dx = x2 - x1
1668
- dy = y2 - y1
1669
- dz = z2 - z1
1670
- dist = math.sqrt(dx**2 + dy**2 + dz**2)
1671
- phi = math.degrees(math.atan2(dy, dx)) # Rotation around Y-Axis
1672
- if dist < 0.0001:
1673
- theta = 0
1674
- else:
1675
- theta = math.degrees(math.acos(dz/dist)) # Rotation around Z-Axis
1676
- prism = Topology.Rotate(prism, origin, 0, 1, 0, theta)
1677
- prism = Topology.Rotate(prism, origin, 0, 0, 1, phi)
1678
+ prism = Topology.Orient(prism, origin=origin, dirA=[0,0,1], dirB=direction, tolerance=tolerance)
1678
1679
  return prism
1679
1680
 
1680
1681
  @staticmethod
@@ -1863,34 +1864,19 @@ class Cell(Topology):
1863
1864
  if not isinstance(origin, topologic.Vertex):
1864
1865
  print("Cell.Sphere - Error: The input origin parameter is not a valid topologic vertex. Returning None.")
1865
1866
  return None
1866
- c = Wire.Circle(origin=origin, radius=radius, sides=vSides, fromAngle=90, toAngle=270, close=False, direction=[0, 1, 0], placement="center")
1867
- s = Topology.Spin(c, origin=origin, triangulate=False, direction=[0,0,1], degree=360, sides=uSides, tolerance=tolerance)
1868
- if s.Type() == topologic.CellComplex.Type():
1869
- s = s.ExternalBoundary()
1870
- if s.Type() == topologic.Shell.Type():
1871
- 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)
1872
1873
  if placement.lower() == "bottom":
1873
- s = Topology.Translate(s, 0, 0, radius)
1874
+ sphere = Topology.Translate(sphere, 0, 0, radius)
1874
1875
  elif placement.lower() == "lowerleft":
1875
- s = Topology.Translate(s, radius, radius, radius)
1876
- x1 = origin.X()
1877
- y1 = origin.Y()
1878
- z1 = origin.Z()
1879
- x2 = origin.X() + direction[0]
1880
- y2 = origin.Y() + direction[1]
1881
- z2 = origin.Z() + direction[2]
1882
- dx = x2 - x1
1883
- dy = y2 - y1
1884
- dz = z2 - z1
1885
- dist = math.sqrt(dx**2 + dy**2 + dz**2)
1886
- phi = math.degrees(math.atan2(dy, dx)) # Rotation around Y-Axis
1887
- if dist < 0.0001:
1888
- theta = 0
1889
- else:
1890
- theta = math.degrees(math.acos(dz/dist)) # Rotation around Z-Axis
1891
- s = Topology.Rotate(s, origin, 0, 1, 0, theta)
1892
- s = Topology.Rotate(s, origin, 0, 0, 1, phi)
1893
- 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
1894
1880
 
1895
1881
  @staticmethod
1896
1882
  def SurfaceArea(cell: topologic.Cell, mantissa: int = 6) -> float:
@@ -1925,7 +1911,7 @@ class Cell(Topology):
1925
1911
  origin : topologic.Vertex , optional
1926
1912
  The origin location of the tetrahedron. The default is None which results in the tetrahedron being placed at (0,0,0).
1927
1913
  radius : float , optional
1928
- The radius of the tetrahedron. The default is 0.5.
1914
+ The radius of the tetrahedron's circumscribed sphere. The default is 0.5.
1929
1915
  direction : list , optional
1930
1916
  The vector representing the up direction of the tetrahedron. The default is [0,0,1].
1931
1917
  placement : str , optional
@@ -1941,6 +1927,7 @@ class Cell(Topology):
1941
1927
  """
1942
1928
 
1943
1929
  from topologicpy.Vertex import Vertex
1930
+ from topologicpy.Wire import Wire
1944
1931
  from topologicpy.Face import Face
1945
1932
  from topologicpy.Topology import Topology
1946
1933
  import math
@@ -1950,50 +1937,25 @@ class Cell(Topology):
1950
1937
  if not isinstance(origin, topologic.Vertex):
1951
1938
  print("Cell.Tetrahedron - Error: The input origin parameter is not a valid topologic vertex. Returning None.")
1952
1939
  return None
1953
- xOffset = 0
1954
- yOffset = 0
1955
- zOffset = 0
1956
- if placement.lower() == "center":
1957
- zOffset = 0
1958
- elif placement.lower() == "lowerleft":
1959
- xOffset = radius*0.5
1960
- yOffset = radius*0.5
1961
- zOffset = radius*0.5
1962
- elif placement.lower() == "bottom":
1963
- zOffset = radius*0.5
1964
- vb1 = Vertex.ByCoordinates(origin.X()+math.sqrt(8/9)*0.5, origin.Y(), origin.Z()-1/6)
1965
- vb2 = Vertex.ByCoordinates(origin.X()-math.sqrt(2/9)*0.5, origin.Y()+math.sqrt(2/3)*0.5, origin.Z()-1/6)
1966
- vb3 = Vertex.ByCoordinates(origin.X()-math.sqrt(2/9)*0.5, origin.Y()-math.sqrt(2/3)*0.5, origin.Z()-1/6)
1967
- vb4 = Vertex.ByCoordinates(origin.X(),origin.Y(),origin.Z()+0.5)
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)
1968
1945
  f1 = Face.ByVertices([vb1,vb2,vb3])
1969
1946
  f2 = Face.ByVertices([vb4,vb1,vb2])
1970
1947
  f3 = Face.ByVertices([vb4,vb2,vb3])
1971
1948
  f4 = Face.ByVertices([vb4,vb3,vb1])
1972
-
1973
1949
  tetrahedron = Cell.ByFaces([f1,f2,f3,f4])
1974
- tetrahedron = Topology.Scale(tetrahedron, origin=origin, x=radius*2, y=radius*2, z=radius*2)
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
+
1975
1953
  if placement.lower() == "lowerleft":
1976
- tetrahedron = Topology.Translate(tetrahedron, math.sqrt(2/9)*radius, math.sqrt(2/3)*radius, 1/3*radius)
1954
+ tetrahedron = Topology.Translate(tetrahedron, radius, radius, radius)
1977
1955
  elif placement.lower() == "bottom":
1978
- tetrahedron = Topology.Translate(tetrahedron, 0, 0, 1/3*radius)
1979
-
1980
- x1 = origin.X()
1981
- y1 = origin.Y()
1982
- z1 = origin.Z()
1983
- x2 = origin.X() + direction[0]
1984
- y2 = origin.Y() + direction[1]
1985
- z2 = origin.Z() + direction[2]
1986
- dx = x2 - x1
1987
- dy = y2 - y1
1988
- dz = z2 - z1
1989
- dist = math.sqrt(dx**2 + dy**2 + dz**2)
1990
- phi = math.degrees(math.atan2(dy, dx)) # Rotation around Y-Axis
1991
- if dist < 0.0001:
1992
- theta = 0
1993
- else:
1994
- theta = math.degrees(math.acos(dz/dist)) # Rotation around Z-Axis
1995
- tetrahedron = Topology.Rotate(tetrahedron, origin, 0, 1, 0, theta)
1996
- tetrahedron = Topology.Rotate(tetrahedron, origin, 0, 0, 1, phi)
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)
1997
1959
  return tetrahedron
1998
1960
 
1999
1961
  @staticmethod
@@ -2035,33 +1997,19 @@ class Cell(Topology):
2035
1997
  if not isinstance(origin, topologic.Vertex):
2036
1998
  print("Cell.Torus - Error: The input origin parameter is not a valid topologic vertex. Returning None.")
2037
1999
  return None
2038
- 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")
2039
2001
  c = Topology.Translate(c, abs(majorRadius-minorRadius), 0, 0)
2040
- s = Topology.Spin(c, origin=origin, triangulate=False, direction=[0,0,1], degree=360, sides=uSides, tolerance=tolerance)
2041
- if s.Type() == topologic.Shell.Type():
2042
- 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)
2043
2005
  if placement.lower() == "bottom":
2044
- s = Topology.Translate(s, 0, 0, majorRadius)
2006
+ torus = Topology.Translate(torus, 0, 0, minorRadius)
2045
2007
  elif placement.lower() == "lowerleft":
2046
- s = Topology.Translate(s, majorRadius, majorRadius, minorRadius)
2047
- x1 = origin.X()
2048
- y1 = origin.Y()
2049
- z1 = origin.Z()
2050
- x2 = origin.X() + direction[0]
2051
- y2 = origin.Y() + direction[1]
2052
- z2 = origin.Z() + direction[2]
2053
- dx = x2 - x1
2054
- dy = y2 - y1
2055
- dz = z2 - z1
2056
- dist = math.sqrt(dx**2 + dy**2 + dz**2)
2057
- phi = math.degrees(math.atan2(dy, dx)) # Rotation around Y-Axis
2058
- if dist < 0.0001:
2059
- theta = 0
2060
- else:
2061
- theta = math.degrees(math.acos(dz/dist)) # Rotation around Z-Axis
2062
- s = Topology.Rotate(s, origin, 0, 1, 0, theta)
2063
- s = Topology.Rotate(s, origin, 0, 0, 1, phi)
2064
- 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
2065
2013
 
2066
2014
  @staticmethod
2067
2015
  def Vertices(cell: topologic.Cell) -> list:
@@ -694,7 +694,7 @@ class CellComplex(Topology):
694
694
  origin : topologic.Vertex , optional
695
695
  The origin location of the octahedron. The default is None which results in the octahedron being placed at (0,0,0).
696
696
  radius : float , optional
697
- The radius of the octahedron. The default is 1.
697
+ The radius of the octahedron's circumscribed sphere. The default is 0.5.
698
698
  direction : list , optional
699
699
  The vector representing the up direction of the octahedron. The default is [0,0,1].
700
700
  placement : str , optional
@@ -705,7 +705,7 @@ class CellComplex(Topology):
705
705
  Returns
706
706
  -------
707
707
  topologic.CellComplex
708
- The created octahedron. The octahedron will have two cells in it.
708
+ The created octahedron.
709
709
 
710
710
  """
711
711
 
@@ -718,24 +718,13 @@ class CellComplex(Topology):
718
718
  if not isinstance(origin, topologic.Vertex):
719
719
  print("CellComplex.Octahedron - Error: The input origin parameter is not a valid topologic vertex. Returning None.")
720
720
  return None
721
- xOffset = 0
722
- yOffset = 0
723
- zOffset = 0
724
- if placement.lower() == "center":
725
- zOffset = 0
726
- elif placement.lower() == "lowerleft":
727
- xOffset = radius/math.sqrt(2)
728
- yOffset = radius/math.sqrt(2)
729
- zOffset = radius
730
- elif placement.lower() == "bottom":
731
- zOffset = radius
732
- vb1 = Vertex.ByCoordinates(origin.X()-radius/math.sqrt(2)+xOffset,origin.Y()-radius/math.sqrt(2)+yOffset,origin.Z()+zOffset)
733
- vb2 = Vertex.ByCoordinates(origin.X()+radius/math.sqrt(2)+xOffset,origin.Y()-radius/math.sqrt(2)+yOffset,origin.Z()+zOffset)
734
- vb3 = Vertex.ByCoordinates(origin.X()+radius/math.sqrt(2)+xOffset,origin.Y()+radius/math.sqrt(2)+yOffset,origin.Z()+zOffset)
735
- vb4 = Vertex.ByCoordinates(origin.X()-radius/math.sqrt(2)+xOffset,origin.Y()+radius/math.sqrt(2)+yOffset,origin.Z()+zOffset)
736
- top = Vertex.ByCoordinates(origin.X()+xOffset, origin.Y()+yOffset, origin.Z()+radius+zOffset)
737
- bottom = Vertex.ByCoordinates(origin.X()+xOffset, origin.Y()+yOffset, origin.Z()-radius+zOffset)
738
- f0 = Face.ByVertices([vb1,vb2,vb3,vb4])
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)
739
728
  f1 = Face.ByVertices([top,vb1,vb2])
740
729
  f2 = Face.ByVertices([top,vb2,vb3])
741
730
  f3 = Face.ByVertices([top,vb3,vb4])
@@ -744,27 +733,18 @@ class CellComplex(Topology):
744
733
  f6 = Face.ByVertices([bottom,vb2,vb3])
745
734
  f7 = Face.ByVertices([bottom,vb3,vb4])
746
735
  f8 = Face.ByVertices([bottom,vb4,vb1])
747
-
748
- octahedron = CellComplex.ByFaces([f0,f1,f2,f3,f4,f5,f6,f7,f8], tolerance=tolerance)
749
-
750
- x1 = origin.X()
751
- y1 = origin.Y()
752
- z1 = origin.Z()
753
- x2 = origin.X() + direction[0]
754
- y2 = origin.Y() + direction[1]
755
- z2 = origin.Z() + direction[2]
756
- dx = x2 - x1
757
- dy = y2 - y1
758
- dz = z2 - z1
759
- dist = math.sqrt(dx**2 + dy**2 + dz**2)
760
- phi = math.degrees(math.atan2(dy, dx)) # Rotation around Y-Axis
761
- if dist < 0.0001:
762
- theta = 0
763
- else:
764
- theta = math.degrees(math.acos(dz/dist)) # Rotation around Z-Axis
765
- octahedron = Topology.Rotate(octahedron, origin, 0, 1, 0, theta)
766
- octahedron = Topology.Rotate(octahedron, origin, 0, 0, 1, phi)
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)
767
746
  return octahedron
747
+
768
748
  @staticmethod
769
749
  def Prism(origin: topologic.Vertex = None,
770
750
  width: float = 1.0, length: float = 1.0, height: float = 1.0,
@@ -18,7 +18,7 @@ import sys
18
18
  import os, re
19
19
  from sys import platform
20
20
 
21
- __version__ = '0.4.72'
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.72
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