topologicpy 0.7.71__py3-none-any.whl → 0.7.73__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/Wire.py CHANGED
@@ -90,8 +90,19 @@ class Wire():
90
90
  # Calculate radius
91
91
  radius = np.linalg.norm(circumcenter - p1)
92
92
 
93
+ # Helper function to rotate a point around an arbitrary axis
94
+ def rotation_matrix_around_axis(axis, theta):
95
+ cos_theta = np.cos(theta)
96
+ sin_theta = np.sin(theta)
97
+ x, y, z = axis
98
+ return np.array([
99
+ [cos_theta + x*x*(1 - cos_theta), x*y*(1 - cos_theta) - z*sin_theta, x*z*(1 - cos_theta) + y*sin_theta],
100
+ [y*x*(1 - cos_theta) + z*sin_theta, cos_theta + y*y*(1 - cos_theta), y*z*(1 - cos_theta) - x*sin_theta],
101
+ [z*x*(1 - cos_theta) - y*sin_theta, z*y*(1 - cos_theta) + x*sin_theta, cos_theta + z*z*(1 - cos_theta)]
102
+ ])
103
+
93
104
  # Generate points along the arc
94
- def interpolate_on_arc(p_start, p_end, center, radius, n_points):
105
+ def interpolate_on_arc(p_start, p_end, center, n_points):
95
106
  v_start = p_start - center
96
107
  v_end = p_end - center
97
108
 
@@ -99,31 +110,25 @@ class Wire():
99
110
  axis = np.cross(v_start, v_end)
100
111
  axis = axis / np.linalg.norm(axis)
101
112
 
102
- angles = np.linspace(0, angle_between, n_points)
103
- arc_points = []
104
-
105
- for angle in angles:
106
- rotation_matrix = rotation_matrix_around_axis(axis, angle)
107
- point_on_arc = center + np.dot(rotation_matrix, v_start)
108
- arc_points.append(point_on_arc)
109
-
110
- return arc_points
111
-
112
- # Helper function to rotate a point around an arbitrary axis
113
- def rotation_matrix_around_axis(axis, theta):
114
- cos_theta = np.cos(theta)
115
- sin_theta = np.sin(theta)
116
- x, y, z = axis
117
- return np.array([
118
- [cos_theta + x*x*(1-cos_theta), x*y*(1-cos_theta) - z*sin_theta, x*z*(1-cos_theta) + y*sin_theta],
119
- [y*x*(1-cos_theta) + z*sin_theta, cos_theta + y*y*(1-cos_theta), y*z*(1-cos_theta) - x*sin_theta],
120
- [z*x*(1-cos_theta) - y*sin_theta, z*y*(1-cos_theta) + x*sin_theta, cos_theta + z*z*(1-cos_theta)]
121
- ])
113
+ # Adjust for symmetry if n_points is even or odd
114
+ if n_points % 2 == 0:
115
+ # For even n_points, generate n_points + 1 and skip the first point for symmetry
116
+ angles = np.linspace(0, angle_between, n_points + 1)
117
+ arc_points = [center + np.dot(rotation_matrix_around_axis(axis, angle), v_start) for angle in angles]
118
+ return [p_start]+arc_points[1:] # Skip the first point
119
+ else:
120
+ # For odd n_points, include both start, apex, and end points symmetrically
121
+ angles = np.linspace(0, angle_between, n_points)
122
+ arc_points = [center + np.dot(rotation_matrix_around_axis(axis, angle), v_start) for angle in angles]
123
+ return arc_points
122
124
 
123
125
  # Get points on the arc from p1 to p3 via p2
124
- arc1 = interpolate_on_arc(p1, p2, circumcenter, radius, n//2)
125
- arc2 = interpolate_on_arc(p2, p3, circumcenter, radius, n//2)
126
-
126
+ if n <= 1: # Special case for number of edges == 1 or less.
127
+ return [p1, p3]
128
+ if n == 2: # Special case for number of edges == 2.
129
+ return [p1, p2, p3]
130
+ arc1 = interpolate_on_arc(p1, p2, circumcenter, (n+1) // 2)
131
+ arc2 = interpolate_on_arc(p2, p3, circumcenter, (n+1) // 2)
127
132
  return np.vstack([arc1, arc2])
128
133
 
129
134
  if not Topology.IsInstance(startVertex, "Vertex"):
@@ -143,17 +148,6 @@ class Wire():
143
148
  for arc_point in arc_points:
144
149
  vertices.append(Vertex.ByCoordinates(list(arc_point)))
145
150
  arc = Wire.ByVertices(vertices, close=False)
146
- if not Topology.IsInstance(arc, "Wire"):
147
- if not silent:
148
- print("Wire.Arc - Error: Could not create an arc. Returning None.")
149
- return None
150
- # Reinterpolate the arc with equal segments
151
- vertices = []
152
- for i in range(0,sides+1,1):
153
- u = i/sides
154
- v = Wire.VertexByParameter(arc, u)
155
- vertices.append(v)
156
- arc = Wire.ByVertices(vertices, close=close)
157
151
  if not Topology.IsInstance(arc, "Wire"):
158
152
  if not silent:
159
153
  print("Wire.Arc - Error: Could not create an arc. Returning None.")
@@ -253,11 +247,11 @@ class Wire():
253
247
  for aVertex in vertices:
254
248
  x.append(Vertex.X(aVertex, mantissa=mantissa))
255
249
  y.append(Vertex.Y(aVertex, mantissa=mantissa))
256
- minX = min(x)
257
- minY = min(y)
250
+ x_min = min(x)
251
+ y_min = min(y)
258
252
  maxX = max(x)
259
253
  maxY = max(y)
260
- return [minX, minY, maxX, maxY]
254
+ return [x_min, y_min, maxX, maxY]
261
255
 
262
256
  if not Topology.IsInstance(topology, "Topology"):
263
257
  return None
@@ -290,12 +284,12 @@ class Wire():
290
284
  topology = Topology.Flatten(topology, origin=f_origin, direction=normal)
291
285
 
292
286
  boundingRectangle = br(topology)
293
- minX = boundingRectangle[0]
294
- minY = boundingRectangle[1]
287
+ x_min = boundingRectangle[0]
288
+ y_min = boundingRectangle[1]
295
289
  maxX = boundingRectangle[2]
296
290
  maxY = boundingRectangle[3]
297
- w = abs(maxX - minX)
298
- l = abs(maxY - minY)
291
+ w = abs(maxX - x_min)
292
+ l = abs(maxY - y_min)
299
293
  best_area = l*w
300
294
  orig_area = best_area
301
295
  best_z = 0
@@ -315,28 +309,28 @@ class Wire():
315
309
  if flag:
316
310
  break
317
311
  t = Topology.Rotate(topology, origin=origin, axis=[0, 0, 1], angle=z)
318
- minX, minY, maxX, maxY = br(t)
319
- w = abs(maxX - minX)
320
- l = abs(maxY - minY)
312
+ x_min, y_min, maxX, maxY = br(t)
313
+ w = abs(maxX - x_min)
314
+ l = abs(maxY - y_min)
321
315
  area = l*w
322
316
  if area <= orig_area*factor: # If new area is less than or equal to a certain percentage of the original area then break. e.g. if area is less than or qual to 50% of original area then break.
323
317
  best_area = area
324
318
  best_z = z
325
- best_br = [minX, minY, maxX, maxY]
319
+ best_br = [x_min, y_min, maxX, maxY]
326
320
  flag = True
327
321
  break
328
322
  if area < best_area:
329
323
  best_area = area
330
324
  best_z = z
331
- best_br = [minX, minY, maxX, maxY]
325
+ best_br = [x_min, y_min, maxX, maxY]
332
326
 
333
327
  else:
334
328
  best_br = boundingRectangle
335
- minX, minY, maxX, maxY = best_br
336
- vb1 = Vertex.ByCoordinates(minX, minY, 0)
337
- vb2 = Vertex.ByCoordinates(maxX, minY, 0)
329
+ x_min, y_min, maxX, maxY = best_br
330
+ vb1 = Vertex.ByCoordinates(x_min, y_min, 0)
331
+ vb2 = Vertex.ByCoordinates(maxX, y_min, 0)
338
332
  vb3 = Vertex.ByCoordinates(maxX, maxY, 0)
339
- vb4 = Vertex.ByCoordinates(minX, maxY, 0)
333
+ vb4 = Vertex.ByCoordinates(x_min, maxY, 0)
340
334
 
341
335
  boundingRectangle = Wire.ByVertices([vb1, vb2, vb3, vb4], close=True)
342
336
  boundingRectangle = Topology.Rotate(boundingRectangle, origin=origin, axis=[0, 0, 1], angle=-best_z)
@@ -3463,20 +3457,20 @@ class Wire():
3463
3457
  vertices.append(Vertex.ByCoordinates(x, y, z))
3464
3458
  ang = ang + angOffset
3465
3459
 
3466
- minX = min(xList)
3460
+ x_min = min(xList)
3467
3461
  maxX = max(xList)
3468
- minY = min(yList)
3462
+ y_min = min(yList)
3469
3463
  maxY = max(yList)
3470
3464
  radius = radiusA + radiusB*turns*0.5
3471
3465
  baseWire = Wire.ByVertices(vertices, close=False)
3472
3466
  if placement.lower() == "center":
3473
3467
  baseWire = Topology.Translate(baseWire, 0, 0, -height*0.5)
3474
3468
  if placement.lower() == "lowerleft":
3475
- baseWire = Topology.Translate(baseWire, -minX, -minY, 0)
3469
+ baseWire = Topology.Translate(baseWire, -x_min, -y_min, 0)
3476
3470
  elif placement.lower() == "upperleft":
3477
- baseWire = Topology.Translate(baseWire, -minX, -maxY, 0)
3471
+ baseWire = Topology.Translate(baseWire, -x_min, -maxY, 0)
3478
3472
  elif placement.lower() == "lowerright":
3479
- baseWire = Topology.Translate(baseWire, -maxX, -minY, 0)
3473
+ baseWire = Topology.Translate(baseWire, -maxX, -y_min, 0)
3480
3474
  elif placement.lower() == "upperright":
3481
3475
  baseWire = Topology.Translate(baseWire, -maxX, -maxY, 0)
3482
3476
  if direction != [0, 0, 1]:
topologicpy/version.py CHANGED
@@ -1 +1 @@
1
- __version__ = '0.7.71'
1
+ __version__ = '0.7.73'
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: topologicpy
3
- Version: 0.7.71
3
+ Version: 0.7.73
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
@@ -0,0 +1,36 @@
1
+ topologicpy/ANN.py,sha256=XAuUjNvDRK1hhXfo82S-zXmnAPZGEdHJMRdfpu0aJ8I,47901
2
+ topologicpy/Aperture.py,sha256=p9pUzTQSBWoUaDiug1V1R1hnEIEwYSXFg2t7iRAmNRY,2723
3
+ topologicpy/BVH.py,sha256=mKVCAu9K8qzcWXtPDVH5usXZV1DNNNJl4n3rU5Lh1ZM,12931
4
+ topologicpy/Cell.py,sha256=2izd-YGqy897_JHHgrGlIo5WwUeEIWVD3KspV1z_sj8,107860
5
+ topologicpy/CellComplex.py,sha256=5PtnRrDx_3zmtt4aTosxK9XBzZtayzaOC50pkJiIlFY,51170
6
+ topologicpy/Cluster.py,sha256=51q5G1L5xAzRMfVU8YBXhq0g3g2X9aVNcahU-vYZRrI,55672
7
+ topologicpy/Color.py,sha256=wPhA7rLr9BTZsWYUUVnQpbmL5ZMkGlDSsa8f3S5B-d4,20250
8
+ topologicpy/Context.py,sha256=ppApYKngZZCQBFWaxIMi2z2dokY23c935IDCBosxDAE,3055
9
+ topologicpy/DGL.py,sha256=Dd6O08D-vSxpjHYgKm45JpKiaeGvWlg1BRMzYMAXGNc,138991
10
+ topologicpy/Dictionary.py,sha256=0AsGoz48pGTye_F4KcJopNjD9STeQ50LHc6PPvERFaA,31932
11
+ topologicpy/Edge.py,sha256=9u9SdUxuenLUIK26xwFvPoYV34p0dCfXmHHBxdgvAdM,67164
12
+ topologicpy/EnergyModel.py,sha256=AqTtmXE35SxvRXhG3vYAQd7GQDW-6HtjYPHua6ME4Eg,53762
13
+ topologicpy/Face.py,sha256=q7x6auTju6IS3mdOhhXZdU3rqKSuJCE-5EOfxofDDMI,124348
14
+ topologicpy/Graph.py,sha256=ULniT6Notyt9D-2AGws1B87FiVCV0qQp1bxgD0qpLQY,390517
15
+ topologicpy/Grid.py,sha256=9N6PE84qCm40TRi2WtlVZSBwXXr47zHpscEpZHg_JW4,18205
16
+ topologicpy/Helper.py,sha256=Sv35czP_j0oLDeJcN8usswUm4U3auiK1LQ_Z_HBvxxg,21716
17
+ topologicpy/Honeybee.py,sha256=HfTaEV1R8K1xOVQQy9sBOhBTF_ap8A2RxZOYhirp_Mw,21835
18
+ topologicpy/Matrix.py,sha256=umgR7An919-wGInXJ1wpqnoQ2jCPdyMe2rcWTZ16upk,8079
19
+ topologicpy/Neo4j.py,sha256=t52hgE9cVsqkGc7m7fjRsLnyfRHakVHwdvF4ms7ow78,22342
20
+ topologicpy/Plotly.py,sha256=-Ewc-MPR7wI0Ml_NHoBOMLAJQjFTZRAPbSvVcv9q_Wg,118227
21
+ topologicpy/Polyskel.py,sha256=EFsuh2EwQJGPLiFUjvtXmAwdX-A4r_DxP5hF7Qd3PaU,19829
22
+ topologicpy/PyG.py,sha256=LU9LCCzjxGPUM31qbaJXZsTvniTtgugxJY7y612t4A4,109757
23
+ topologicpy/Shell.py,sha256=8OJjlWk9eCZ3uGOTht6ZVrcMczCafw-YWoDGueaz7eg,87673
24
+ topologicpy/Speckle.py,sha256=rUS6PCaxIjEF5_fUruxvMH47FMKg-ohcoU0qAUb-yNM,14267
25
+ topologicpy/Sun.py,sha256=42tDWMYpwRG7Z2Qjtp94eRgBuqySq7k8TgNUZDK7QxQ,36837
26
+ topologicpy/Topology.py,sha256=J1eTBp8esd9jwcQ4fY82uTjJtj6r9WiaGIZmevRxxDQ,406736
27
+ topologicpy/Vector.py,sha256=A1g83zDHep58iVPY8WQ8iHNrSOfGWFEzvVeDuMnjDNY,33078
28
+ topologicpy/Vertex.py,sha256=ZS6xK89JKokBKc0W8frdRhhuzR8c-dI1TTLt7pTf1iA,71032
29
+ topologicpy/Wire.py,sha256=eVet2OToVsXi9AkDYo35LpfMPqJ6aKGD6QkiU4-Jvs8,182271
30
+ topologicpy/__init__.py,sha256=vlPCanUbxe5NifC4pHcnhSzkmmYcs_UrZrTlVMsxcFs,928
31
+ topologicpy/version.py,sha256=_EZM97Nx9ZHcqJT-3j_L8-CxcswiiAnQpZx_aTh--Yc,23
32
+ topologicpy-0.7.73.dist-info/LICENSE,sha256=FK0vJ73LuE8PYJAn7LutsReWR47-Ooovw2dnRe5yV6Q,681
33
+ topologicpy-0.7.73.dist-info/METADATA,sha256=DXCQK7AXT5405KD8O3PBcTDNL0gEjLfwM802I_H8QH4,10493
34
+ topologicpy-0.7.73.dist-info/WHEEL,sha256=a7TGlA-5DaHMRrarXjVbQagU3Man_dCnGIWMJr5kRWo,91
35
+ topologicpy-0.7.73.dist-info/top_level.txt,sha256=J30bDzW92Ob7hw3zA8V34Jlp-vvsfIkGzkr8sqvb4Uw,12
36
+ topologicpy-0.7.73.dist-info/RECORD,,
@@ -1,5 +1,5 @@
1
1
  Wheel-Version: 1.0
2
- Generator: setuptools (75.2.0)
2
+ Generator: setuptools (75.4.0)
3
3
  Root-Is-Purelib: true
4
4
  Tag: py3-none-any
5
5
 
@@ -1,36 +0,0 @@
1
- topologicpy/ANN.py,sha256=XAuUjNvDRK1hhXfo82S-zXmnAPZGEdHJMRdfpu0aJ8I,47901
2
- topologicpy/Aperture.py,sha256=p9pUzTQSBWoUaDiug1V1R1hnEIEwYSXFg2t7iRAmNRY,2723
3
- topologicpy/BVH.py,sha256=dfVQyn5OPN1_50nusS0AxAcmUfqTzpl0vWT7RBEz-WM,12870
4
- topologicpy/Cell.py,sha256=2izd-YGqy897_JHHgrGlIo5WwUeEIWVD3KspV1z_sj8,107860
5
- topologicpy/CellComplex.py,sha256=ecGrxnczeBOaTTiYiVRsUpfGaYHhydyf_KhlxNk4t3w,47611
6
- topologicpy/Cluster.py,sha256=nuJtXpmwBtT8j9HeRORv0c4NIvqt7DcheY0nxB3nTq8,55664
7
- topologicpy/Color.py,sha256=FrxX2yILqWvYrqD8kBaknfMfOR_phJOmhvTvFc07bY4,18065
8
- topologicpy/Context.py,sha256=ppApYKngZZCQBFWaxIMi2z2dokY23c935IDCBosxDAE,3055
9
- topologicpy/DGL.py,sha256=Dd6O08D-vSxpjHYgKm45JpKiaeGvWlg1BRMzYMAXGNc,138991
10
- topologicpy/Dictionary.py,sha256=cURg452wwk2WeSxWY46ncgAUo5XD1c2c5EtO6ESZHaY,27304
11
- topologicpy/Edge.py,sha256=--D035FBJa9hfPSPrPsNQluq1NHx7d3IGnklxbH-9qo,66928
12
- topologicpy/EnergyModel.py,sha256=AqTtmXE35SxvRXhG3vYAQd7GQDW-6HtjYPHua6ME4Eg,53762
13
- topologicpy/Face.py,sha256=vKtqoXmxLCC23QNg7Mk5PfFZACnbKh04vWRDoFCz1jw,124344
14
- topologicpy/Graph.py,sha256=CfyYvm-oFCURM3XpctekI-4qsOG2B6lZxgjD3WZlysQ,385478
15
- topologicpy/Grid.py,sha256=9N6PE84qCm40TRi2WtlVZSBwXXr47zHpscEpZHg_JW4,18205
16
- topologicpy/Helper.py,sha256=i-AfI29NMsZXBaymjilfvxQbuS3wpYbpPw4RWu1YCHs,16358
17
- topologicpy/Honeybee.py,sha256=HfTaEV1R8K1xOVQQy9sBOhBTF_ap8A2RxZOYhirp_Mw,21835
18
- topologicpy/Matrix.py,sha256=umgR7An919-wGInXJ1wpqnoQ2jCPdyMe2rcWTZ16upk,8079
19
- topologicpy/Neo4j.py,sha256=t52hgE9cVsqkGc7m7fjRsLnyfRHakVHwdvF4ms7ow78,22342
20
- topologicpy/Plotly.py,sha256=cs0LBOVm6WerT_F4IcFvQSRq_fYB9eVwRKiH2ogBgAI,109785
21
- topologicpy/Polyskel.py,sha256=EFsuh2EwQJGPLiFUjvtXmAwdX-A4r_DxP5hF7Qd3PaU,19829
22
- topologicpy/PyG.py,sha256=LU9LCCzjxGPUM31qbaJXZsTvniTtgugxJY7y612t4A4,109757
23
- topologicpy/Shell.py,sha256=CyMXuHoua_-lGGOr-1bgZa1VGpNsBGOe-dmkwhek-xY,87639
24
- topologicpy/Speckle.py,sha256=rUS6PCaxIjEF5_fUruxvMH47FMKg-ohcoU0qAUb-yNM,14267
25
- topologicpy/Sun.py,sha256=42tDWMYpwRG7Z2Qjtp94eRgBuqySq7k8TgNUZDK7QxQ,36837
26
- topologicpy/Topology.py,sha256=9DPTumt9kr9Su5b3RE8l_gLQSRalYHqf79tVHiy_aQM,400055
27
- topologicpy/Vector.py,sha256=A1g83zDHep58iVPY8WQ8iHNrSOfGWFEzvVeDuMnjDNY,33078
28
- topologicpy/Vertex.py,sha256=ZS6xK89JKokBKc0W8frdRhhuzR8c-dI1TTLt7pTf1iA,71032
29
- topologicpy/Wire.py,sha256=Ci2RSYCL4JPEBDKjP9B-yFfxI73TnPVxY_1eDzy1Iog,182073
30
- topologicpy/__init__.py,sha256=vlPCanUbxe5NifC4pHcnhSzkmmYcs_UrZrTlVMsxcFs,928
31
- topologicpy/version.py,sha256=szrQeCdVCeZvANqYLZIpNzGjG1Hr4s6VgJvFSRkblPk,23
32
- topologicpy-0.7.71.dist-info/LICENSE,sha256=FK0vJ73LuE8PYJAn7LutsReWR47-Ooovw2dnRe5yV6Q,681
33
- topologicpy-0.7.71.dist-info/METADATA,sha256=X-lNLlqlnoe8kwm3_KNuE6y5MzmnSDTxTHcKplvOlTw,10493
34
- topologicpy-0.7.71.dist-info/WHEEL,sha256=OVMc5UfuAQiSplgO0_WdW7vXVGAt9Hdd6qtN4HotdyA,91
35
- topologicpy-0.7.71.dist-info/top_level.txt,sha256=J30bDzW92Ob7hw3zA8V34Jlp-vvsfIkGzkr8sqvb4Uw,12
36
- topologicpy-0.7.71.dist-info/RECORD,,