pyviewfactor 0.1.17__tar.gz → 1.0.1__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.
- {pyviewfactor-0.1.17 → pyviewfactor-1.0.1}/PKG-INFO +7 -7
- {pyviewfactor-0.1.17 → pyviewfactor-1.0.1}/pyviewfactor/_version.py +1 -1
- {pyviewfactor-0.1.17 → pyviewfactor-1.0.1}/pyviewfactor/pvf_geometry_preprocess.py +12 -10
- {pyviewfactor-0.1.17 → pyviewfactor-1.0.1}/pyviewfactor/pvf_visibility_obstruction.py +14 -11
- {pyviewfactor-0.1.17 → pyviewfactor-1.0.1}/pyviewfactor.egg-info/PKG-INFO +7 -7
- pyviewfactor-1.0.1/pyviewfactor.egg-info/requires.txt +4 -0
- {pyviewfactor-0.1.17 → pyviewfactor-1.0.1}/setup.cfg +6 -6
- pyviewfactor-0.1.17/pyviewfactor.egg-info/requires.txt +0 -4
- {pyviewfactor-0.1.17 → pyviewfactor-1.0.1}/LICENSE.txt +0 -0
- {pyviewfactor-0.1.17 → pyviewfactor-1.0.1}/README.md +0 -0
- {pyviewfactor-0.1.17 → pyviewfactor-1.0.1}/pyviewfactor/__init__.py +0 -0
- {pyviewfactor-0.1.17 → pyviewfactor-1.0.1}/pyviewfactor/pvf_integrators.py +0 -0
- {pyviewfactor-0.1.17 → pyviewfactor-1.0.1}/pyviewfactor/pvf_plot.py +0 -0
- {pyviewfactor-0.1.17 → pyviewfactor-1.0.1}/pyviewfactor/pvf_viewfactor_computations.py +0 -0
- {pyviewfactor-0.1.17 → pyviewfactor-1.0.1}/pyviewfactor.egg-info/SOURCES.txt +0 -0
- {pyviewfactor-0.1.17 → pyviewfactor-1.0.1}/pyviewfactor.egg-info/dependency_links.txt +0 -0
- {pyviewfactor-0.1.17 → pyviewfactor-1.0.1}/pyviewfactor.egg-info/top_level.txt +0 -0
- {pyviewfactor-0.1.17 → pyviewfactor-1.0.1}/setup.py +0 -0
- {pyviewfactor-0.1.17 → pyviewfactor-1.0.1}/test/__init__.py +0 -0
- {pyviewfactor-0.1.17 → pyviewfactor-1.0.1}/test/test_geometry_preprocess.py +0 -0
- {pyviewfactor-0.1.17 → pyviewfactor-1.0.1}/test/test_plot.py +0 -0
- {pyviewfactor-0.1.17 → pyviewfactor-1.0.1}/test/test_view_factor.py +0 -0
- {pyviewfactor-0.1.17 → pyviewfactor-1.0.1}/test/test_visibility_obstruction.py +0 -0
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: pyviewfactor
|
|
3
|
-
Version: 0.1
|
|
4
|
-
Summary: A
|
|
3
|
+
Version: 1.0.1
|
|
4
|
+
Summary: "A lightweight open-source Python library for exact view-factor computations on polygonal meshes"
|
|
5
5
|
Home-page: https://gitlab.com/arep-dev/pyViewFactor/
|
|
6
6
|
Author: Mateusz BOGDAN, Edouard WALTHER, Marc ALECIAN, Mina CHAPON
|
|
7
7
|
Author-email: mateusz.bogdan@arep.fr
|
|
@@ -11,13 +11,13 @@ Classifier: Programming Language :: Python :: 3
|
|
|
11
11
|
Classifier: License :: OSI Approved :: MIT License
|
|
12
12
|
Classifier: Topic :: Scientific/Engineering :: Physics
|
|
13
13
|
Classifier: Operating System :: OS Independent
|
|
14
|
-
Requires-Python: >=3.
|
|
14
|
+
Requires-Python: >=3.9
|
|
15
15
|
Description-Content-Type: text/markdown
|
|
16
16
|
License-File: LICENSE.txt
|
|
17
|
-
Requires-Dist: numpy>=1.
|
|
18
|
-
Requires-Dist: scipy>=1.
|
|
19
|
-
Requires-Dist: numba>=0.
|
|
20
|
-
Requires-Dist: pyvista>=0.
|
|
17
|
+
Requires-Dist: numpy>=1.26
|
|
18
|
+
Requires-Dist: scipy>=1.11
|
|
19
|
+
Requires-Dist: numba>=0.61
|
|
20
|
+
Requires-Dist: pyvista>=0.45
|
|
21
21
|
|
|
22
22
|
# PyViewFactor
|
|
23
23
|
|
|
@@ -47,7 +47,7 @@ def fc_unstruc2poly(mesh_unstruc):
|
|
|
47
47
|
return pv.PolyData(points, faces)
|
|
48
48
|
|
|
49
49
|
|
|
50
|
-
def face_to_array(face):
|
|
50
|
+
def face_to_array(face,rounding_decimal=8):
|
|
51
51
|
"""
|
|
52
52
|
Extract the vertex coordinates of a single PolyData face as a NumPy array.
|
|
53
53
|
|
|
@@ -63,7 +63,7 @@ def face_to_array(face):
|
|
|
63
63
|
|
|
64
64
|
> The (x, y, z) coordinates of the face's vertices.
|
|
65
65
|
"""
|
|
66
|
-
return face.get_cell(0).points.astype(np.float64)
|
|
66
|
+
return face.get_cell(0).points.round(decimals=rounding_decimal).astype(np.float64)
|
|
67
67
|
|
|
68
68
|
|
|
69
69
|
@njit
|
|
@@ -295,7 +295,7 @@ class ProcessedGeometry:
|
|
|
295
295
|
# idxs = faces_i[1:1 + n_i]
|
|
296
296
|
raw = mesh.extract_cells(i)
|
|
297
297
|
face = fc_unstruc2poly(raw)
|
|
298
|
-
pts = face.get_cell(0).points.astype(np.float64)
|
|
298
|
+
pts = face.get_cell(0).points.round(rounding_decimal).astype(np.float64)
|
|
299
299
|
|
|
300
300
|
self.points.append(pts)
|
|
301
301
|
self.centroids[i] = polygon_centroid(pts)
|
|
@@ -356,10 +356,11 @@ class FaceMeshPreprocessor:
|
|
|
356
356
|
|
|
357
357
|
> Remove triangles that exactly match either pts1 or pts2.
|
|
358
358
|
"""
|
|
359
|
-
def __init__(self, mesh: pv.PolyData):
|
|
359
|
+
def __init__(self, mesh: pv.PolyData, rounding_decimal=8):
|
|
360
360
|
if not mesh.is_all_triangles:
|
|
361
361
|
mesh = mesh.triangulate()
|
|
362
|
-
self.
|
|
362
|
+
self.rounding_decimal = rounding_decimal
|
|
363
|
+
self.points = mesh.points.round(rounding_decimal).astype(np.float64)
|
|
363
364
|
# cells array is [n, i0, i1, i2, n, ...]
|
|
364
365
|
cells = mesh.faces.reshape(-1, 4)[:, 1:]
|
|
365
366
|
self.faces = cells # shape (n_cells,3)
|
|
@@ -372,14 +373,15 @@ class FaceMeshPreprocessor:
|
|
|
372
373
|
kept.append(tri)
|
|
373
374
|
return np.array(kept, dtype=np.float64)
|
|
374
375
|
|
|
375
|
-
def exclude_exact_match(self, pts1, pts2, tris):
|
|
376
|
+
def exclude_exact_match(self, pts1, pts2, tris, rounding_decimal=8):
|
|
376
377
|
# build frozensets of each vertex array
|
|
377
|
-
vs1 = frozenset(sorted(tuple(np.round(p,
|
|
378
|
-
vs2 = frozenset(sorted(tuple(np.round(p,
|
|
378
|
+
vs1 = frozenset(sorted(tuple(np.round(p, rounding_decimal)) for p in pts1))
|
|
379
|
+
vs2 = frozenset(sorted(tuple(np.round(p, rounding_decimal)) for p in pts2))
|
|
379
380
|
out = []
|
|
380
381
|
for tri in tris:
|
|
381
|
-
tri_set = frozenset(sorted(tuple(np.round(p,
|
|
382
|
-
if not tri_set.isdisjoint(vs1) or not tri_set.isdisjoint(vs2):
|
|
382
|
+
tri_set = frozenset(sorted(tuple(np.round(p, rounding_decimal)) for p in tri))
|
|
383
|
+
# if not tri_set.isdisjoint(vs1) or not tri_set.isdisjoint(vs2):
|
|
384
|
+
if tri_set == vs1 or tri_set == vs2:
|
|
383
385
|
continue
|
|
384
386
|
out.append(tri)
|
|
385
387
|
return np.array(out, dtype=np.float64)
|
|
@@ -260,11 +260,11 @@ def ray_intersects_triangle(orig, dest, v0, v1, v2, eps=1e-6):
|
|
|
260
260
|
> **False** otherwise.
|
|
261
261
|
|
|
262
262
|
"""
|
|
263
|
-
if ((orig[0]-v0[0])**2 + (orig[1]-v0[1])**2 + (orig[2]-v0[2])**2) < eps
|
|
263
|
+
if ((orig[0]-v0[0])**2 + (orig[1]-v0[1])**2 + (orig[2]-v0[2])**2) < eps/2:
|
|
264
264
|
return False
|
|
265
|
-
if ((orig[0]-v1[0])**2 + (orig[1]-v1[1])**2 + (orig[2]-v1[2])**2) < eps
|
|
265
|
+
if ((orig[0]-v1[0])**2 + (orig[1]-v1[1])**2 + (orig[2]-v1[2])**2) < eps/2:
|
|
266
266
|
return False
|
|
267
|
-
if ((orig[0]-v2[0])**2 + (orig[1]-v2[1])**2 + (orig[2]-v2[2])**2) < eps
|
|
267
|
+
if ((orig[0]-v2[0])**2 + (orig[1]-v2[1])**2 + (orig[2]-v2[2])**2) < eps/2:
|
|
268
268
|
return False
|
|
269
269
|
d = dest - orig
|
|
270
270
|
L = np.linalg.norm(d)
|
|
@@ -286,7 +286,7 @@ def ray_intersects_triangle(orig, dest, v0, v1, v2, eps=1e-6):
|
|
|
286
286
|
if v < 0 or u+v > 1:
|
|
287
287
|
return False
|
|
288
288
|
t = f * np.dot(edge2, q)
|
|
289
|
-
return (eps < t) and (t
|
|
289
|
+
return (eps < t) and (t > 1-eps)
|
|
290
290
|
|
|
291
291
|
|
|
292
292
|
@njit
|
|
@@ -331,7 +331,8 @@ def is_ray_blocked(start, end, triangles, eps=1e-6):
|
|
|
331
331
|
def get_obstruction(cell1, cell2, obstacle,
|
|
332
332
|
strict=False,
|
|
333
333
|
verbose=False,
|
|
334
|
-
eps=1e-6
|
|
334
|
+
eps=1e-6,
|
|
335
|
+
rounding_decimal=8
|
|
335
336
|
):
|
|
336
337
|
"""
|
|
337
338
|
Test for geometric obstruction (occlusion) between two facets and an obstacle mesh.
|
|
@@ -380,12 +381,12 @@ def get_obstruction(cell1, cell2, obstacle,
|
|
|
380
381
|
"""
|
|
381
382
|
# 1) Convert inputs to numpy arrays
|
|
382
383
|
if isinstance(cell1, pv.PolyData):
|
|
383
|
-
pts1 = face_to_array(cell1)
|
|
384
|
+
pts1 = face_to_array(cell1,rounding_decimal=rounding_decimal)
|
|
384
385
|
else:
|
|
385
386
|
pts1 = np.asarray(cell1, dtype=np.float64)
|
|
386
387
|
|
|
387
388
|
if isinstance(cell2, pv.PolyData):
|
|
388
|
-
pts2 = face_to_array(cell2)
|
|
389
|
+
pts2 = face_to_array(cell2,rounding_decimal=rounding_decimal)
|
|
389
390
|
else:
|
|
390
391
|
pts2 = np.asarray(cell2, dtype=np.float64)
|
|
391
392
|
|
|
@@ -393,7 +394,7 @@ def get_obstruction(cell1, cell2, obstacle,
|
|
|
393
394
|
if isinstance(obstacle, FaceMeshPreprocessor):
|
|
394
395
|
pre = obstacle
|
|
395
396
|
else:
|
|
396
|
-
pre = FaceMeshPreprocessor(obstacle)
|
|
397
|
+
pre = FaceMeshPreprocessor(obstacle, rounding_decimal=rounding_decimal)
|
|
397
398
|
# 3) AABB cull
|
|
398
399
|
# 2) Build combined AABB & cull triangles
|
|
399
400
|
# 3) AABB cull
|
|
@@ -402,17 +403,19 @@ def get_obstruction(cell1, cell2, obstacle,
|
|
|
402
403
|
cand = pre.aabb_filter(amin, amax)
|
|
403
404
|
|
|
404
405
|
# 4) Exclude self‐triangles
|
|
405
|
-
cand = pre.exclude_exact_match(pts1, pts2, cand)
|
|
406
|
+
cand = pre.exclude_exact_match(pts1, pts2, cand, rounding_decimal=rounding_decimal)
|
|
406
407
|
if cand.size == 0:
|
|
407
408
|
warning = "[PVF] [Obstruction] Unobstructed (no candidate within c1-c2 AABB)"
|
|
408
409
|
if verbose:
|
|
409
410
|
print(warning)
|
|
410
411
|
return True, warning
|
|
411
|
-
|
|
412
412
|
# 5) non‐strict: centroid ray
|
|
413
413
|
if not strict:
|
|
414
414
|
c1 = polygon_centroid(pts1)
|
|
415
|
+
# print(c1)
|
|
415
416
|
c2 = polygon_centroid(pts2)
|
|
417
|
+
# print(c2)
|
|
418
|
+
# print("\n")
|
|
416
419
|
if is_ray_blocked(c1, c2, cand, eps=eps):
|
|
417
420
|
warning = "[PVF] [Obstruction] strict=False, cells obstructed (centroid to centroid)"
|
|
418
421
|
if verbose:
|
|
@@ -438,7 +441,7 @@ def get_obstruction(cell1, cell2, obstacle,
|
|
|
438
441
|
|
|
439
442
|
|
|
440
443
|
def get_obstruction_from_cache(i, j, cache, obstacle_mesh, strict=False,
|
|
441
|
-
verbose=False, eps=1e-6):
|
|
444
|
+
verbose=False, eps=1e-6, rounding_decimal=8):
|
|
442
445
|
"""
|
|
443
446
|
Test for geometric obstruction between cached faces i and j, using a preprocessed
|
|
444
447
|
obstacle mesh.
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: pyviewfactor
|
|
3
|
-
Version: 0.1
|
|
4
|
-
Summary: A
|
|
3
|
+
Version: 1.0.1
|
|
4
|
+
Summary: "A lightweight open-source Python library for exact view-factor computations on polygonal meshes"
|
|
5
5
|
Home-page: https://gitlab.com/arep-dev/pyViewFactor/
|
|
6
6
|
Author: Mateusz BOGDAN, Edouard WALTHER, Marc ALECIAN, Mina CHAPON
|
|
7
7
|
Author-email: mateusz.bogdan@arep.fr
|
|
@@ -11,13 +11,13 @@ Classifier: Programming Language :: Python :: 3
|
|
|
11
11
|
Classifier: License :: OSI Approved :: MIT License
|
|
12
12
|
Classifier: Topic :: Scientific/Engineering :: Physics
|
|
13
13
|
Classifier: Operating System :: OS Independent
|
|
14
|
-
Requires-Python: >=3.
|
|
14
|
+
Requires-Python: >=3.9
|
|
15
15
|
Description-Content-Type: text/markdown
|
|
16
16
|
License-File: LICENSE.txt
|
|
17
|
-
Requires-Dist: numpy>=1.
|
|
18
|
-
Requires-Dist: scipy>=1.
|
|
19
|
-
Requires-Dist: numba>=0.
|
|
20
|
-
Requires-Dist: pyvista>=0.
|
|
17
|
+
Requires-Dist: numpy>=1.26
|
|
18
|
+
Requires-Dist: scipy>=1.11
|
|
19
|
+
Requires-Dist: numba>=0.61
|
|
20
|
+
Requires-Dist: pyvista>=0.45
|
|
21
21
|
|
|
22
22
|
# PyViewFactor
|
|
23
23
|
|
|
@@ -3,7 +3,7 @@ name = pyviewfactor
|
|
|
3
3
|
version = attr: pyviewfactor._version.__version__
|
|
4
4
|
author = Mateusz BOGDAN, Edouard WALTHER, Marc ALECIAN, Mina CHAPON
|
|
5
5
|
author_email = mateusz.bogdan@arep.fr
|
|
6
|
-
description = A
|
|
6
|
+
description = "A lightweight open-source Python library for exact view-factor computations on polygonal meshes"
|
|
7
7
|
long_description = file: README.md
|
|
8
8
|
long_description_content_type = text/markdown
|
|
9
9
|
url = https://gitlab.com/arep-dev/pyViewFactor/
|
|
@@ -24,11 +24,11 @@ classifiers =
|
|
|
24
24
|
[options]
|
|
25
25
|
packages = find:
|
|
26
26
|
install_requires =
|
|
27
|
-
numpy>=1.
|
|
28
|
-
scipy>=1.
|
|
29
|
-
numba>=0.
|
|
30
|
-
pyvista>=0.
|
|
31
|
-
python_requires = >=3.
|
|
27
|
+
numpy>=1.26
|
|
28
|
+
scipy>=1.11
|
|
29
|
+
numba>=0.61
|
|
30
|
+
pyvista>=0.45
|
|
31
|
+
python_requires = >=3.9
|
|
32
32
|
|
|
33
33
|
[options.packages.find]
|
|
34
34
|
where = .
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|