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.
Files changed (24) hide show
  1. {pyviewfactor-1.1.0 → pyviewfactor-1.1.1}/PKG-INFO +3 -6
  2. {pyviewfactor-1.1.0 → pyviewfactor-1.1.1}/README.md +2 -5
  3. {pyviewfactor-1.1.0 → pyviewfactor-1.1.1}/pyviewfactor/_version.py +1 -1
  4. {pyviewfactor-1.1.0 → pyviewfactor-1.1.1}/pyviewfactor/pvf_geometry_preprocess.py +16 -5
  5. {pyviewfactor-1.1.0 → pyviewfactor-1.1.1}/pyviewfactor/pvf_visibility_obstruction.py +20 -10
  6. {pyviewfactor-1.1.0 → pyviewfactor-1.1.1}/pyviewfactor.egg-info/PKG-INFO +3 -6
  7. {pyviewfactor-1.1.0 → pyviewfactor-1.1.1}/test/test_visibility_obstruction.py +29 -1
  8. {pyviewfactor-1.1.0 → pyviewfactor-1.1.1}/LICENSE.txt +0 -0
  9. {pyviewfactor-1.1.0 → pyviewfactor-1.1.1}/pyviewfactor/__init__.py +0 -0
  10. {pyviewfactor-1.1.0 → pyviewfactor-1.1.1}/pyviewfactor/pvf_integrators.py +0 -0
  11. {pyviewfactor-1.1.0 → pyviewfactor-1.1.1}/pyviewfactor/pvf_plot.py +0 -0
  12. {pyviewfactor-1.1.0 → pyviewfactor-1.1.1}/pyviewfactor/pvf_viewfactor_computations.py +0 -0
  13. {pyviewfactor-1.1.0 → pyviewfactor-1.1.1}/pyviewfactor.egg-info/SOURCES.txt +0 -0
  14. {pyviewfactor-1.1.0 → pyviewfactor-1.1.1}/pyviewfactor.egg-info/dependency_links.txt +0 -0
  15. {pyviewfactor-1.1.0 → pyviewfactor-1.1.1}/pyviewfactor.egg-info/requires.txt +0 -0
  16. {pyviewfactor-1.1.0 → pyviewfactor-1.1.1}/pyviewfactor.egg-info/top_level.txt +0 -0
  17. {pyviewfactor-1.1.0 → pyviewfactor-1.1.1}/setup.cfg +0 -0
  18. {pyviewfactor-1.1.0 → pyviewfactor-1.1.1}/setup.py +0 -0
  19. {pyviewfactor-1.1.0 → pyviewfactor-1.1.1}/test/__init__.py +0 -0
  20. {pyviewfactor-1.1.0 → pyviewfactor-1.1.1}/test/test_geometry_preprocess.py +0 -0
  21. {pyviewfactor-1.1.0 → pyviewfactor-1.1.1}/test/test_new_kernels.py +0 -0
  22. {pyviewfactor-1.1.0 → pyviewfactor-1.1.1}/test/test_plot.py +0 -0
  23. {pyviewfactor-1.1.0 → pyviewfactor-1.1.1}/test/test_view_factor.py +0 -0
  24. {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.0
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="https://gitlab.com/arep-dev/pyViewFactor/-/raw/da36d4a0b08308009d9e71876091492ecb97d476/img/Logo%20pVF%20512x512%20v3%20transparent%20crop.png" alt="pvf_logo" width="256px"/>
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 - Copyright (c) AREP 2025
178
+ MIT License - 2026
@@ -1,8 +1,5 @@
1
- # PyViewFactor
2
-
3
-
4
1
  <div align="center">
5
- <img src="https://gitlab.com/arep-dev/pyViewFactor/-/raw/da36d4a0b08308009d9e71876091492ecb97d476/img/Logo%20pVF%20512x512%20v3%20transparent%20crop.png" alt="pvf_logo" width="256px"/>
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 - Copyright (c) AREP 2025
156
+ MIT License - 2026
@@ -1,5 +1,5 @@
1
1
  """Version info for pyViewFactor"""
2
- version_info = 1, 1, 0
2
+ version_info = 1, 1, 1
3
3
 
4
4
  # Nice string for the version
5
5
 
@@ -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
- Intersection tolerance; segment endpoints within ``eps`` of a
377
- vertex are skipped to avoid self-intersection false positives.
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
- e2 = eps * eps
386
- if d[0] * d[0] + d[1] * d[1] + d[2] * d[2] < e2:
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
- if abs(a0) < eps:
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
- Numerical tolerance for intersection and vertex matching.
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
- if np.linalg.norm(d) < eps:
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) < eps
341
- or np.linalg.norm(orig - v1) < eps
342
- or np.linalg.norm(orig - v2) < eps):
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) < eps
346
- or np.linalg.norm(dest - v1) < eps
347
- or np.linalg.norm(dest - v2) < eps):
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
- if abs(a) < eps:
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.0
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="https://gitlab.com/arep-dev/pyViewFactor/-/raw/da36d4a0b08308009d9e71876091492ecb97d476/img/Logo%20pVF%20512x512%20v3%20transparent%20crop.png" alt="pvf_logo" width="256px"/>
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 - Copyright (c) AREP 2025
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