topologicpy 0.8.51__py3-none-any.whl → 0.8.52__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- topologicpy/Cell.py +85 -15
- topologicpy/Topology.py +10 -2
- topologicpy/version.py +1 -1
- {topologicpy-0.8.51.dist-info → topologicpy-0.8.52.dist-info}/METADATA +1 -1
- {topologicpy-0.8.51.dist-info → topologicpy-0.8.52.dist-info}/RECORD +8 -8
- {topologicpy-0.8.51.dist-info → topologicpy-0.8.52.dist-info}/WHEEL +0 -0
- {topologicpy-0.8.51.dist-info → topologicpy-0.8.52.dist-info}/licenses/LICENSE +0 -0
- {topologicpy-0.8.51.dist-info → topologicpy-0.8.52.dist-info}/top_level.txt +0 -0
topologicpy/Cell.py
CHANGED
@@ -1567,6 +1567,8 @@ class Cell():
|
|
1567
1567
|
vertices = Topology.Vertices(dodecahedron)
|
1568
1568
|
d = Vertex.Distance(Vertex.Origin(), vertices[0])
|
1569
1569
|
dodecahedron = Topology.Scale(dodecahedron, origin=Vertex.Origin(), x=radius/d, y=radius/d, z=radius/d)
|
1570
|
+
verts = Topology.Vertices(dodecahedron)
|
1571
|
+
print("Dodec: Distance", Vertex.Distance(Vertex.Origin(), verts[0]))
|
1570
1572
|
if placement == "bottom":
|
1571
1573
|
dodecahedron = Topology.Translate(dodecahedron, 0, 0, radius)
|
1572
1574
|
elif placement == "lowerleft":
|
@@ -3091,9 +3093,9 @@ class Cell():
|
|
3091
3093
|
|
3092
3094
|
@staticmethod
|
3093
3095
|
def Sphere(origin= None, radius: float = 0.5, uSides: int = 16, vSides: int = 8, direction: list = [0, 0, 1],
|
3094
|
-
placement: str = "center", tolerance: float = 0.0001):
|
3096
|
+
placement: str = "center", tolerance: float = 0.0001, silent: bool = False):
|
3095
3097
|
"""
|
3096
|
-
Creates a sphere.
|
3098
|
+
Creates an approximation of a sphere using a UV grid of triangular faces.
|
3097
3099
|
|
3098
3100
|
Parameters
|
3099
3101
|
----------
|
@@ -3111,6 +3113,9 @@ class Cell():
|
|
3111
3113
|
The description of the placement of the origin of the sphere. This can be "bottom", "center", or "lowerleft". It is case insensitive. Default is "center".
|
3112
3114
|
tolerance : float , optional
|
3113
3115
|
The desired tolerance. Default is 0.0001.
|
3116
|
+
silent : bool, optional
|
3117
|
+
If set to True, suppresses warning and error messages. Default is False.
|
3118
|
+
|
3114
3119
|
|
3115
3120
|
Returns
|
3116
3121
|
-------
|
@@ -3118,24 +3123,89 @@ class Cell():
|
|
3118
3123
|
The created sphere.
|
3119
3124
|
|
3120
3125
|
"""
|
3121
|
-
|
3126
|
+
|
3127
|
+
import math
|
3122
3128
|
from topologicpy.Vertex import Vertex
|
3123
|
-
from topologicpy.
|
3124
|
-
from topologicpy.
|
3129
|
+
from topologicpy.Face import Face
|
3130
|
+
from topologicpy.Cell import Cell
|
3125
3131
|
from topologicpy.Topology import Topology
|
3126
3132
|
|
3127
|
-
|
3133
|
+
# Validate inputs
|
3134
|
+
if radius <= 0 or uSides < 3 or vSides < 2:
|
3135
|
+
if not silent:
|
3136
|
+
print("Sphere - Error: radius must be > 0, uSides >= 3, vSides >= 2. Returning None.")
|
3137
|
+
return None
|
3138
|
+
|
3139
|
+
# Center
|
3140
|
+
if origin is None:
|
3128
3141
|
origin = Vertex.ByCoordinates(0, 0, 0)
|
3129
|
-
|
3130
|
-
|
3142
|
+
ox = Vertex.X(origin)
|
3143
|
+
oy = Vertex.Y(origin)
|
3144
|
+
oz = Vertex.Z(origin)
|
3145
|
+
|
3146
|
+
# Poles
|
3147
|
+
top_pole = Vertex.ByCoordinates(ox, oy, oz + radius)
|
3148
|
+
bottom_pole = Vertex.ByCoordinates(ox, oy, oz - radius)
|
3149
|
+
|
3150
|
+
# Latitude rings (exclude poles)
|
3151
|
+
rings = [] # list of list[Vertex]
|
3152
|
+
for vi in range(1, vSides):
|
3153
|
+
phi = math.pi * vi / vSides # 0..pi
|
3154
|
+
sin_phi = math.sin(phi)
|
3155
|
+
cos_phi = math.cos(phi)
|
3156
|
+
ring = []
|
3157
|
+
for ui in range(uSides):
|
3158
|
+
theta = 2.0 * math.pi * ui / uSides
|
3159
|
+
x = ox + radius * sin_phi * math.cos(theta)
|
3160
|
+
y = oy + radius * sin_phi * math.sin(theta)
|
3161
|
+
z = oz + radius * cos_phi
|
3162
|
+
ring.append(Vertex.ByCoordinates(x, y, z))
|
3163
|
+
rings.append(ring)
|
3164
|
+
|
3165
|
+
faces = []
|
3166
|
+
|
3167
|
+
# Top cap: triangles from top pole to first ring
|
3168
|
+
first_ring = rings[0]
|
3169
|
+
for u in range(uSides):
|
3170
|
+
v1 = first_ring[u]
|
3171
|
+
v2 = first_ring[(u + 1) % uSides]
|
3172
|
+
f = Face.ByVertices([top_pole, v1, v2], tolerance=tolerance)
|
3173
|
+
if f:
|
3174
|
+
faces.append(f)
|
3175
|
+
|
3176
|
+
# Middle bands: split quads into two triangles
|
3177
|
+
for i in range(len(rings) - 1):
|
3178
|
+
curr = rings[i]
|
3179
|
+
nxt = rings[i + 1]
|
3180
|
+
for u in range(uSides):
|
3181
|
+
a = curr[u]
|
3182
|
+
b = nxt[u]
|
3183
|
+
c = nxt[(u + 1) % uSides]
|
3184
|
+
d = curr[(u + 1) % uSides]
|
3185
|
+
f1 = Face.ByVertices([a, b, c], tolerance=tolerance)
|
3186
|
+
if f1:
|
3187
|
+
faces.append(f1)
|
3188
|
+
f2 = Face.ByVertices([a, c, d], tolerance=tolerance)
|
3189
|
+
if f2:
|
3190
|
+
faces.append(f2)
|
3191
|
+
|
3192
|
+
# Bottom cap: triangles from last ring to bottom pole
|
3193
|
+
last_ring = rings[-1]
|
3194
|
+
for u in range(uSides):
|
3195
|
+
v1 = last_ring[(u + 1) % uSides]
|
3196
|
+
v2 = last_ring[u]
|
3197
|
+
f = Face.ByVertices([bottom_pole, v1, v2], tolerance=tolerance)
|
3198
|
+
if f:
|
3199
|
+
faces.append(f)
|
3200
|
+
|
3201
|
+
# Sew faces into a shell
|
3202
|
+
sphere = None
|
3203
|
+
try:
|
3204
|
+
sphere = Cell.ByFaces(faces, tolerance=tolerance)
|
3205
|
+
except Exception:
|
3206
|
+
if not silent:
|
3207
|
+
print("Cell.Sphere - Error: could not create a sphere. Returning None.")
|
3131
3208
|
return None
|
3132
|
-
c = Wire.Circle(origin=Vertex.Origin(), radius=radius, sides=vSides, fromAngle=0, toAngle=180, close=False, direction=[0, 0, 1], placement="center")
|
3133
|
-
c = Topology.Rotate(c, origin=Vertex.Origin(), axis=[1, 0, 0], angle=90)
|
3134
|
-
sphere = Topology.Spin(c, origin=Vertex.Origin(), triangulate=False, direction=[0, 0, 1], angle=360, sides=uSides, tolerance=tolerance)
|
3135
|
-
if Topology.Type(sphere) == Topology.TypeID("CellComplex"):
|
3136
|
-
sphere = CellComplex.ExternalBoundary(sphere)
|
3137
|
-
if Topology.Type(sphere) == Topology.TypeID("Shell"):
|
3138
|
-
sphere = Cell.ByShell(sphere)
|
3139
3209
|
if placement.lower() == "bottom":
|
3140
3210
|
sphere = Topology.Translate(sphere, 0, 0, radius)
|
3141
3211
|
elif placement.lower() == "lowerleft":
|
topologicpy/Topology.py
CHANGED
@@ -8320,6 +8320,8 @@ class Topology():
|
|
8320
8320
|
absolute=False,
|
8321
8321
|
sides=8,
|
8322
8322
|
angle=0,
|
8323
|
+
|
8324
|
+
showFigure=True,
|
8323
8325
|
mantissa=6,
|
8324
8326
|
tolerance=0.0001,
|
8325
8327
|
silent=False):
|
@@ -8507,6 +8509,8 @@ class Topology():
|
|
8507
8509
|
The units used in the colorbar. Default is ""
|
8508
8510
|
colorScale : str , optional
|
8509
8511
|
The desired type of plotly color scales to use (e.g. "viridis", "plasma"). Default is "viridis". For a full list of names, see https://plotly.com/python/builtin-colorscales/.
|
8512
|
+
showFigure : bool , optional
|
8513
|
+
If set to True, the figure will be shown and a None is returned. If not, the figure will be returned, but not shown. Default is True.
|
8510
8514
|
mantissa : int , optional
|
8511
8515
|
The desired length of the mantissa for the values listed on the colorbar. Default is 6.
|
8512
8516
|
tolerance : float , optional
|
@@ -8516,7 +8520,8 @@ class Topology():
|
|
8516
8520
|
|
8517
8521
|
Returns
|
8518
8522
|
-------
|
8519
|
-
|
8523
|
+
Plotly figure
|
8524
|
+
The created plotly figure.
|
8520
8525
|
|
8521
8526
|
"""
|
8522
8527
|
|
@@ -8691,7 +8696,10 @@ class Topology():
|
|
8691
8696
|
tolerance=tolerance)
|
8692
8697
|
if showScale:
|
8693
8698
|
figure = Plotly.AddColorBar(figure, values=cbValues, nTicks=cbTicks, xPosition=cbX, width=cbWidth, outlineWidth=cbOutlineWidth, title=cbTitle, subTitle=cbSubTitle, units=cbUnits, colorScale=colorScale, mantissa=mantissa)
|
8694
|
-
|
8699
|
+
if showFigure:
|
8700
|
+
Plotly.Show(figure=figure, renderer=renderer, camera=camera, center=center, up=up, projection=projection)
|
8701
|
+
return None
|
8702
|
+
return figure
|
8695
8703
|
|
8696
8704
|
@staticmethod
|
8697
8705
|
def SmallestFaces(topology, removeCoplanarFaces: bool = False, epsilon: float = 0.001, tolerance: float = 0.0001, silent: bool = False):
|
topologicpy/version.py
CHANGED
@@ -1 +1 @@
|
|
1
|
-
__version__ = '0.8.
|
1
|
+
__version__ = '0.8.52'
|
@@ -1,6 +1,6 @@
|
|
1
1
|
Metadata-Version: 2.4
|
2
2
|
Name: topologicpy
|
3
|
-
Version: 0.8.
|
3
|
+
Version: 0.8.52
|
4
4
|
Summary: An AI-Powered Spatial Modelling and Analysis Software Library for Architecture, Engineering, and Construction.
|
5
5
|
Author-email: Wassim Jabi <wassim.jabi@gmail.com>
|
6
6
|
License: AGPL v3 License
|
@@ -2,7 +2,7 @@ topologicpy/ANN.py,sha256=gpflv4lFypOW789vO7mSkMLaMF_ZftVOCqCvtGr6-JA,47873
|
|
2
2
|
topologicpy/Aperture.py,sha256=wNn5miB_IrGCBYuQ18HXQYRva20dUC3id4AJCulL7to,2723
|
3
3
|
topologicpy/BVH.py,sha256=JA4bb-9hgMfVZ_syzmSmTL3ueCq-0vMUGMPZxNcawAY,13023
|
4
4
|
topologicpy/CSG.py,sha256=09la1-xzS9vr-WnV7tpJ0I-mkZ-XY0MRSd5iB50Nfgw,15556
|
5
|
-
topologicpy/Cell.py,sha256
|
5
|
+
topologicpy/Cell.py,sha256=-QoKvAsLjKp4xXO1bXCIpKdKNrPF7o232QTj60WCADE,177462
|
6
6
|
topologicpy/CellComplex.py,sha256=Kbz63rGeE08bJfMXFvB-AptoKHiaCK5OtiV1wz8Y-Fk,68081
|
7
7
|
topologicpy/Cluster.py,sha256=G49AuhJHQ1s819cB5MtVdmAGgkag19IC3dRP1ub1Wh4,58608
|
8
8
|
topologicpy/Color.py,sha256=hzSmgBWhiuYc55RSipkQNIgGtgyhC5BqY8AakNYEK-U,24486
|
@@ -25,14 +25,14 @@ topologicpy/ShapeGrammar.py,sha256=KYsKDLXWdflAcYMAIz84AUF-GMkbTmaBDd2-ovbilqU,2
|
|
25
25
|
topologicpy/Shell.py,sha256=ioO4raCJfXtYldQg-adpcLVeJPEA6od6cAA5ro7t6r4,96792
|
26
26
|
topologicpy/Speckle.py,sha256=-eiTqJugd7pHiHpD3pDUcDO6CGhVyPV14HFRzaqEoaw,18187
|
27
27
|
topologicpy/Sun.py,sha256=8S6dhCKfOhUGVny-jEk87Q08anLYMB1JEBKRGCklvbQ,36670
|
28
|
-
topologicpy/Topology.py,sha256=
|
28
|
+
topologicpy/Topology.py,sha256=Oz6I0jerzgXJaOEAS-WZVko5wj4_PYq67UH707jpwE0,471685
|
29
29
|
topologicpy/Vector.py,sha256=pEC8YY3TeHGfGdeNgvdHjgMDwxGabp5aWjwYC1HSvMk,42236
|
30
30
|
topologicpy/Vertex.py,sha256=0f6HouARKaCuxhdxsUEYi8T9giJycnWhQ8Cn70YILBA,84885
|
31
31
|
topologicpy/Wire.py,sha256=gjgQUGHdBdXUIijgZc_VIW0E39w-smaVhhdl0jF63fQ,230466
|
32
32
|
topologicpy/__init__.py,sha256=RMftibjgAnHB1vdL-muo71RwMS4972JCxHuRHOlU428,928
|
33
|
-
topologicpy/version.py,sha256=
|
34
|
-
topologicpy-0.8.
|
35
|
-
topologicpy-0.8.
|
36
|
-
topologicpy-0.8.
|
37
|
-
topologicpy-0.8.
|
38
|
-
topologicpy-0.8.
|
33
|
+
topologicpy/version.py,sha256=KGLw5DoKAzuYOCwcR3luB2Dw4oq0tDBaQ67alLPVna8,23
|
34
|
+
topologicpy-0.8.52.dist-info/licenses/LICENSE,sha256=FK0vJ73LuE8PYJAn7LutsReWR47-Ooovw2dnRe5yV6Q,681
|
35
|
+
topologicpy-0.8.52.dist-info/METADATA,sha256=haOTIpPxEwBfVeLm4SOIow_qanvOQ-4bzWRFNCGnWPg,10535
|
36
|
+
topologicpy-0.8.52.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
|
37
|
+
topologicpy-0.8.52.dist-info/top_level.txt,sha256=J30bDzW92Ob7hw3zA8V34Jlp-vvsfIkGzkr8sqvb4Uw,12
|
38
|
+
topologicpy-0.8.52.dist-info/RECORD,,
|
File without changes
|
File without changes
|
File without changes
|