pyviewfactor 1.1.0__tar.gz → 1.1.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-1.1.0 → pyviewfactor-1.1.1}/PKG-INFO +3 -6
- {pyviewfactor-1.1.0 → pyviewfactor-1.1.1}/README.md +2 -5
- {pyviewfactor-1.1.0 → pyviewfactor-1.1.1}/pyviewfactor/_version.py +1 -1
- {pyviewfactor-1.1.0 → pyviewfactor-1.1.1}/pyviewfactor/pvf_geometry_preprocess.py +16 -5
- {pyviewfactor-1.1.0 → pyviewfactor-1.1.1}/pyviewfactor/pvf_visibility_obstruction.py +20 -10
- {pyviewfactor-1.1.0 → pyviewfactor-1.1.1}/pyviewfactor.egg-info/PKG-INFO +3 -6
- {pyviewfactor-1.1.0 → pyviewfactor-1.1.1}/test/test_visibility_obstruction.py +29 -1
- {pyviewfactor-1.1.0 → pyviewfactor-1.1.1}/LICENSE.txt +0 -0
- {pyviewfactor-1.1.0 → pyviewfactor-1.1.1}/pyviewfactor/__init__.py +0 -0
- {pyviewfactor-1.1.0 → pyviewfactor-1.1.1}/pyviewfactor/pvf_integrators.py +0 -0
- {pyviewfactor-1.1.0 → pyviewfactor-1.1.1}/pyviewfactor/pvf_plot.py +0 -0
- {pyviewfactor-1.1.0 → pyviewfactor-1.1.1}/pyviewfactor/pvf_viewfactor_computations.py +0 -0
- {pyviewfactor-1.1.0 → pyviewfactor-1.1.1}/pyviewfactor.egg-info/SOURCES.txt +0 -0
- {pyviewfactor-1.1.0 → pyviewfactor-1.1.1}/pyviewfactor.egg-info/dependency_links.txt +0 -0
- {pyviewfactor-1.1.0 → pyviewfactor-1.1.1}/pyviewfactor.egg-info/requires.txt +0 -0
- {pyviewfactor-1.1.0 → pyviewfactor-1.1.1}/pyviewfactor.egg-info/top_level.txt +0 -0
- {pyviewfactor-1.1.0 → pyviewfactor-1.1.1}/setup.cfg +0 -0
- {pyviewfactor-1.1.0 → pyviewfactor-1.1.1}/setup.py +0 -0
- {pyviewfactor-1.1.0 → pyviewfactor-1.1.1}/test/__init__.py +0 -0
- {pyviewfactor-1.1.0 → pyviewfactor-1.1.1}/test/test_geometry_preprocess.py +0 -0
- {pyviewfactor-1.1.0 → pyviewfactor-1.1.1}/test/test_new_kernels.py +0 -0
- {pyviewfactor-1.1.0 → pyviewfactor-1.1.1}/test/test_plot.py +0 -0
- {pyviewfactor-1.1.0 → pyviewfactor-1.1.1}/test/test_view_factor.py +0 -0
- {pyviewfactor-1.1.0 → pyviewfactor-1.1.1}/test/test_visibility_obstruction_semantics.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: pyviewfactor
|
|
3
|
-
Version: 1.1.
|
|
3
|
+
Version: 1.1.1
|
|
4
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
|
|
@@ -20,11 +20,8 @@ Requires-Dist: numba>=0.61
|
|
|
20
20
|
Requires-Dist: pyvista>=0.45
|
|
21
21
|
Dynamic: license-file
|
|
22
22
|
|
|
23
|
-
# PyViewFactor
|
|
24
|
-
|
|
25
|
-
|
|
26
23
|
<div align="center">
|
|
27
|
-
<img src="
|
|
24
|
+
<img src="./docs/assets/logo_full.png" alt="pvf_logo" width="512px"/>
|
|
28
25
|
</div>
|
|
29
26
|
|
|
30
27
|
|
|
@@ -178,4 +175,4 @@ Bibtex entry:
|
|
|
178
175
|
```
|
|
179
176
|
|
|
180
177
|
## License
|
|
181
|
-
MIT License -
|
|
178
|
+
MIT License - 2026
|
|
@@ -1,8 +1,5 @@
|
|
|
1
|
-
# PyViewFactor
|
|
2
|
-
|
|
3
|
-
|
|
4
1
|
<div align="center">
|
|
5
|
-
<img src="
|
|
2
|
+
<img src="./docs/assets/logo_full.png" alt="pvf_logo" width="512px"/>
|
|
6
3
|
</div>
|
|
7
4
|
|
|
8
5
|
|
|
@@ -156,4 +153,4 @@ Bibtex entry:
|
|
|
156
153
|
```
|
|
157
154
|
|
|
158
155
|
## License
|
|
159
|
-
MIT License -
|
|
156
|
+
MIT License - 2026
|
|
@@ -373,8 +373,13 @@ def _mt_hit(orig, dest, v0, v1, v2, eps=1e-6):
|
|
|
373
373
|
Triangle vertices.
|
|
374
374
|
|
|
375
375
|
eps : float, optional
|
|
376
|
-
|
|
377
|
-
vertex are skipped to avoid
|
|
376
|
+
Relative (scale-free) tolerance. Segment endpoints within
|
|
377
|
+
``eps * |dest - orig|`` of a vertex are skipped to avoid
|
|
378
|
+
self-intersection false positives; rays with
|
|
379
|
+
``|sin(angle to triangle plane)| < eps`` are treated as parallel;
|
|
380
|
+
hits with parametric ``t`` within ``eps`` of either endpoint are
|
|
381
|
+
ignored. All tests are invariant under uniform scaling of the
|
|
382
|
+
geometry.
|
|
378
383
|
|
|
379
384
|
Returns
|
|
380
385
|
-------
|
|
@@ -382,9 +387,11 @@ def _mt_hit(orig, dest, v0, v1, v2, eps=1e-6):
|
|
|
382
387
|
*True* if the segment intersects the triangle interior.
|
|
383
388
|
"""
|
|
384
389
|
d = dest - orig
|
|
385
|
-
|
|
386
|
-
if
|
|
390
|
+
dd = d[0] * d[0] + d[1] * d[1] + d[2] * d[2]
|
|
391
|
+
if dd == 0.0:
|
|
387
392
|
return False
|
|
393
|
+
# Endpoint/vertex coincidence tolerance, relative to the segment length
|
|
394
|
+
e2 = eps * eps * dd
|
|
388
395
|
for a in range(3):
|
|
389
396
|
ov = orig - (v0 if a == 0 else v1 if a == 1 else v2)
|
|
390
397
|
if ov[0] * ov[0] + ov[1] * ov[1] + ov[2] * ov[2] < e2:
|
|
@@ -396,7 +403,11 @@ def _mt_hit(orig, dest, v0, v1, v2, eps=1e-6):
|
|
|
396
403
|
edge2 = v2 - v0
|
|
397
404
|
h = np.cross(d, edge2)
|
|
398
405
|
a0 = edge1[0] * h[0] + edge1[1] * h[1] + edge1[2] * h[2]
|
|
399
|
-
|
|
406
|
+
# Parallel / degenerate test: a0 scales as length**3, so compare it with
|
|
407
|
+
# |d| |edge1| |edge2| (i.e. a sine-like, dimensionless criterion).
|
|
408
|
+
n1 = edge1[0] * edge1[0] + edge1[1] * edge1[1] + edge1[2] * edge1[2]
|
|
409
|
+
n2 = edge2[0] * edge2[0] + edge2[1] * edge2[1] + edge2[2] * edge2[2]
|
|
410
|
+
if a0 * a0 <= eps * eps * dd * n1 * n2:
|
|
400
411
|
return False
|
|
401
412
|
f = 1.0 / a0
|
|
402
413
|
s = orig - v0
|
|
@@ -320,7 +320,11 @@ def ray_intersects_triangle(orig, dest, v0, v1, v2, eps=1e-6):
|
|
|
320
320
|
Coordinates of the triangle vertices.
|
|
321
321
|
|
|
322
322
|
eps : float, optional
|
|
323
|
-
|
|
323
|
+
Relative (scale-free) tolerance for intersection and vertex
|
|
324
|
+
matching: endpoint/vertex distances are compared with
|
|
325
|
+
``eps * |dest - orig|`` and the parallel test is
|
|
326
|
+
``|sin(angle to triangle plane)| < eps``, so the result is invariant
|
|
327
|
+
under uniform scaling of the geometry.
|
|
324
328
|
|
|
325
329
|
Returns
|
|
326
330
|
-------
|
|
@@ -333,18 +337,23 @@ def ray_intersects_triangle(orig, dest, v0, v1, v2, eps=1e-6):
|
|
|
333
337
|
d = dest - orig
|
|
334
338
|
|
|
335
339
|
# Skip si segment dégénéré
|
|
336
|
-
|
|
340
|
+
dlen = np.linalg.norm(d)
|
|
341
|
+
if dlen == 0.0:
|
|
337
342
|
return False
|
|
338
343
|
|
|
344
|
+
# Tolérance de coïncidence relative à la longueur du segment
|
|
345
|
+
# (indépendante de l'unité de longueur)
|
|
346
|
+
tol = eps * dlen
|
|
347
|
+
|
|
339
348
|
# Skip si départ ou arrivée sur triangle (évite faux positifs)
|
|
340
|
-
if (np.linalg.norm(orig - v0) <
|
|
341
|
-
or np.linalg.norm(orig - v1) <
|
|
342
|
-
or np.linalg.norm(orig - v2) <
|
|
349
|
+
if (np.linalg.norm(orig - v0) < tol
|
|
350
|
+
or np.linalg.norm(orig - v1) < tol
|
|
351
|
+
or np.linalg.norm(orig - v2) < tol):
|
|
343
352
|
return False
|
|
344
353
|
|
|
345
|
-
if (np.linalg.norm(dest - v0) <
|
|
346
|
-
or np.linalg.norm(dest - v1) <
|
|
347
|
-
or np.linalg.norm(dest - v2) <
|
|
354
|
+
if (np.linalg.norm(dest - v0) < tol
|
|
355
|
+
or np.linalg.norm(dest - v1) < tol
|
|
356
|
+
or np.linalg.norm(dest - v2) < tol):
|
|
348
357
|
return False
|
|
349
358
|
|
|
350
359
|
edge1 = v1 - v0
|
|
@@ -353,8 +362,9 @@ def ray_intersects_triangle(orig, dest, v0, v1, v2, eps=1e-6):
|
|
|
353
362
|
h = np.cross(d, edge2)
|
|
354
363
|
a = np.dot(edge1, h)
|
|
355
364
|
|
|
356
|
-
# Rayon parallèle au triangle
|
|
357
|
-
|
|
365
|
+
# Rayon parallèle au triangle (ou triangle dégénéré) : a ~ longueur**3,
|
|
366
|
+
# on compare donc à |d| |edge1| |edge2| (critère adimensionnel)
|
|
367
|
+
if abs(a) <= eps * dlen * np.linalg.norm(edge1) * np.linalg.norm(edge2):
|
|
358
368
|
return False
|
|
359
369
|
|
|
360
370
|
f = 1.0 / a
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: pyviewfactor
|
|
3
|
-
Version: 1.1.
|
|
3
|
+
Version: 1.1.1
|
|
4
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
|
|
@@ -20,11 +20,8 @@ Requires-Dist: numba>=0.61
|
|
|
20
20
|
Requires-Dist: pyvista>=0.45
|
|
21
21
|
Dynamic: license-file
|
|
22
22
|
|
|
23
|
-
# PyViewFactor
|
|
24
|
-
|
|
25
|
-
|
|
26
23
|
<div align="center">
|
|
27
|
-
<img src="
|
|
24
|
+
<img src="./docs/assets/logo_full.png" alt="pvf_logo" width="512px"/>
|
|
28
25
|
</div>
|
|
29
26
|
|
|
30
27
|
|
|
@@ -178,4 +175,4 @@ Bibtex entry:
|
|
|
178
175
|
```
|
|
179
176
|
|
|
180
177
|
## License
|
|
181
|
-
MIT License -
|
|
178
|
+
MIT License - 2026
|
|
@@ -540,4 +540,32 @@ def test_get_obstruction_obstacle_beyond_target_is_not_blocking():
|
|
|
540
540
|
obs.triangulate(inplace=True)
|
|
541
541
|
|
|
542
542
|
vis, warn = pvf.get_obstruction(tri1, tri2, obs, strict=False, verbose=False)
|
|
543
|
-
assert vis is True
|
|
543
|
+
assert vis is True
|
|
544
|
+
|
|
545
|
+
# SCALE INVARIANCE (issue #13): obstruction must not depend on length unit
|
|
546
|
+
|
|
547
|
+
def _scaled_blocked_pair(s):
|
|
548
|
+
def quad(p):
|
|
549
|
+
return pv.PolyData(np.array(p, float), faces=[4, 0, 1, 2, 3])
|
|
550
|
+
em = quad([[0, 0, 0], [s, 0, 0], [s, s, 0], [0, s, 0]])
|
|
551
|
+
rc = quad([[0, 0, 2 * s], [0, s, 2 * s], [s, s, 2 * s], [s, 0, 2 * s]])
|
|
552
|
+
bl = quad([[-s / 2, -s / 2, s], [1.5 * s, -s / 2, s],
|
|
553
|
+
[1.5 * s, 1.5 * s, s], [-s / 2, 1.5 * s, s]])
|
|
554
|
+
return em, rc, bl
|
|
555
|
+
|
|
556
|
+
|
|
557
|
+
def test_obstruction_scale_invariant_matrix():
|
|
558
|
+
for s in (1e3, 1.0, 1e-2, 1e-3, 1e-5):
|
|
559
|
+
em, rc, bl = _scaled_blocked_pair(s)
|
|
560
|
+
F = pvf.compute_viewfactor_matrix(em.merge(rc), obstacles=[bl])
|
|
561
|
+
assert F[1, 0] == 0.0, f"not blocked at scale {s}"
|
|
562
|
+
assert F[0, 1] == 0.0, f"not blocked at scale {s}"
|
|
563
|
+
|
|
564
|
+
|
|
565
|
+
def test_obstruction_scale_invariant_reference_path():
|
|
566
|
+
for s in (1e3, 1.0, 1e-2, 1e-3, 1e-5):
|
|
567
|
+
em, rc, bl = _scaled_blocked_pair(s)
|
|
568
|
+
vis, _ = pvf.get_obstruction(rc, em, bl)
|
|
569
|
+
assert not vis, f"not blocked at scale {s}"
|
|
570
|
+
vis, _ = pvf.get_obstruction(rc, em, bl, strict=True)
|
|
571
|
+
assert not vis, f"not blocked (strict) at scale {s}"
|
|
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
|
|
File without changes
|
|
File without changes
|