pyviewfactor 1.0.2__tar.gz → 1.0.3__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.0.3/PKG-INFO +183 -0
- pyviewfactor-1.0.3/README.md +161 -0
- {pyviewfactor-1.0.2 → pyviewfactor-1.0.3}/pyviewfactor/_version.py +1 -1
- pyviewfactor-1.0.3/pyviewfactor.egg-info/PKG-INFO +183 -0
- {pyviewfactor-1.0.2 → pyviewfactor-1.0.3}/setup.cfg +1 -1
- pyviewfactor-1.0.2/PKG-INFO +0 -374
- pyviewfactor-1.0.2/README.md +0 -353
- pyviewfactor-1.0.2/pyviewfactor.egg-info/PKG-INFO +0 -374
- {pyviewfactor-1.0.2 → pyviewfactor-1.0.3}/LICENSE.txt +0 -0
- {pyviewfactor-1.0.2 → pyviewfactor-1.0.3}/pyviewfactor/__init__.py +0 -0
- {pyviewfactor-1.0.2 → pyviewfactor-1.0.3}/pyviewfactor/pvf_geometry_preprocess.py +0 -0
- {pyviewfactor-1.0.2 → pyviewfactor-1.0.3}/pyviewfactor/pvf_integrators.py +0 -0
- {pyviewfactor-1.0.2 → pyviewfactor-1.0.3}/pyviewfactor/pvf_plot.py +0 -0
- {pyviewfactor-1.0.2 → pyviewfactor-1.0.3}/pyviewfactor/pvf_viewfactor_computations.py +0 -0
- {pyviewfactor-1.0.2 → pyviewfactor-1.0.3}/pyviewfactor/pvf_visibility_obstruction.py +0 -0
- {pyviewfactor-1.0.2 → pyviewfactor-1.0.3}/pyviewfactor.egg-info/SOURCES.txt +0 -0
- {pyviewfactor-1.0.2 → pyviewfactor-1.0.3}/pyviewfactor.egg-info/dependency_links.txt +0 -0
- {pyviewfactor-1.0.2 → pyviewfactor-1.0.3}/pyviewfactor.egg-info/requires.txt +0 -0
- {pyviewfactor-1.0.2 → pyviewfactor-1.0.3}/pyviewfactor.egg-info/top_level.txt +0 -0
- {pyviewfactor-1.0.2 → pyviewfactor-1.0.3}/setup.py +0 -0
- {pyviewfactor-1.0.2 → pyviewfactor-1.0.3}/test/__init__.py +0 -0
- {pyviewfactor-1.0.2 → pyviewfactor-1.0.3}/test/test_geometry_preprocess.py +0 -0
- {pyviewfactor-1.0.2 → pyviewfactor-1.0.3}/test/test_plot.py +0 -0
- {pyviewfactor-1.0.2 → pyviewfactor-1.0.3}/test/test_view_factor.py +0 -0
- {pyviewfactor-1.0.2 → pyviewfactor-1.0.3}/test/test_visibility_obstruction.py +0 -0
- {pyviewfactor-1.0.2 → pyviewfactor-1.0.3}/test/test_visibility_obstruction_semantics.py +0 -0
|
@@ -0,0 +1,183 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: pyviewfactor
|
|
3
|
+
Version: 1.0.3
|
|
4
|
+
Summary: "A lightweight open-source Python library for exact view-factor computations on polygonal meshes"
|
|
5
|
+
Home-page: https://gitlab.com/arep-dev/pyViewFactor/
|
|
6
|
+
Author: Mateusz BOGDAN, Edouard WALTHER
|
|
7
|
+
Author-email: mateusz.bogdan@arep.fr
|
|
8
|
+
License: MIT
|
|
9
|
+
Keywords: radiative-transfer,radiation,vtk,geometry,viewfactor,visibility
|
|
10
|
+
Classifier: Programming Language :: Python :: 3
|
|
11
|
+
Classifier: License :: OSI Approved :: MIT License
|
|
12
|
+
Classifier: Topic :: Scientific/Engineering :: Physics
|
|
13
|
+
Classifier: Operating System :: OS Independent
|
|
14
|
+
Requires-Python: >=3.10
|
|
15
|
+
Description-Content-Type: text/markdown
|
|
16
|
+
License-File: LICENSE.txt
|
|
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
|
+
Dynamic: license-file
|
|
22
|
+
|
|
23
|
+
# PyViewFactor
|
|
24
|
+
|
|
25
|
+
|
|
26
|
+
<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"/>
|
|
28
|
+
</div>
|
|
29
|
+
|
|
30
|
+
|
|
31
|
+
> `pyViewFactor` is a lightweight open-source Python library for exact view-factor computations on polygonal meshes.
|
|
32
|
+
> It provides robust tools for:
|
|
33
|
+
> - geometric visibility analysis,
|
|
34
|
+
> - obstruction detection,
|
|
35
|
+
> - accurate view factor computation.
|
|
36
|
+
|
|
37
|
+
*Full documentation available [here](https://arep-dev.gitlab.io/pyViewFactor/).*
|
|
38
|
+
|
|
39
|
+
|
|
40
|
+
<img src="https://gitlab.com/arep-dev/pyViewFactor/-/raw/3d40d1804eccbaefbc8b1736ff30d0d9f08141ad/img/FF_sceneUrbaine_cyl_RT.png" alt="Urban View Factor" width="800" />
|
|
41
|
+
|
|
42
|
+
[](https://gitlab.com/arep-dev/pyViewFactor/-/releases)
|
|
43
|
+
[](https://gitlab.com/arep-dev/pyViewFactor/pipelines)
|
|
44
|
+
[](https://codecov.io/gl/arep-dev/pyViewFactor)
|
|
45
|
+
[](https://opensource.org/licenses/MIT)
|
|
46
|
+
[](https://pypi.org/project/pyviewfactor/)
|
|
47
|
+
[](https://pypi.org/project/pyviewfactor/)
|
|
48
|
+
|
|
49
|
+
|
|
50
|
+
|
|
51
|
+
## Features
|
|
52
|
+
|
|
53
|
+
* This library enables the computation of radiation view factors between planar polygons using an **accurate** double‐contour integration method described in
|
|
54
|
+
[(Mazumder and Ravishankar 2012)](https://www.academia.edu/download/77459051/Viewfactor_paper_IJHMT.pdf)
|
|
55
|
+
with insights from [(Schmid 2016)](https://hal.archives-ouvertes.fr/tel-01734545/).
|
|
56
|
+
* It uses the handy [`Pyvista`](https://docs.pyvista.org/) package to deal with geometry imports (`*.stl`, `*.vtk`, `*.obj`, ...),
|
|
57
|
+
geometry creations, and some other mesh functionalities under the hood.
|
|
58
|
+
* It enables:
|
|
59
|
+
- 🔺 View factor computation between planar polygons
|
|
60
|
+
- 👁️ Visibility checks based on face orientation
|
|
61
|
+
- 🚧 Obstruction detection using ray-triangle intersection
|
|
62
|
+
- ⚙️ Strict / non-strict modes for robustness control
|
|
63
|
+
- ⚡ Optimized full matrix computation with caching
|
|
64
|
+
- 📦 Built on `numpy`, `scipy`, `pyvista`, `numba`
|
|
65
|
+
|
|
66
|
+
|
|
67
|
+
|
|
68
|
+
## Installation
|
|
69
|
+
`pyViewFactor` can be installed from [PyPi](https://pypi.org/project/pyviewfactor/)
|
|
70
|
+
using `pip` on Python >= 3.10:
|
|
71
|
+
```shell
|
|
72
|
+
pip install pyviewfactor
|
|
73
|
+
```
|
|
74
|
+
You can also visit [PyPi](https://pypi.org/project/pyviewfactor/) or
|
|
75
|
+
[Gitlab](https://gitlab.com/arep-dev/pyViewFactor) to download the sources.
|
|
76
|
+
|
|
77
|
+
Requirements:
|
|
78
|
+
```
|
|
79
|
+
numpy==1.26.4
|
|
80
|
+
pyvista==0.45
|
|
81
|
+
scipy==1.11.4
|
|
82
|
+
numba==0.61.2
|
|
83
|
+
tqdm==4.65.0
|
|
84
|
+
|
|
85
|
+
```
|
|
86
|
+
The code will probably work with lower versions of the required packages, however this has not been tested.
|
|
87
|
+
|
|
88
|
+
> [!NOTE]
|
|
89
|
+
> If you are alergic to `numba`, you may `pip install pyviewfactor==0.0.10` that works (and give up the times 3+ speed-up in view factor computation).
|
|
90
|
+
|
|
91
|
+
|
|
92
|
+
## Quick Start
|
|
93
|
+
|
|
94
|
+
Suppose we want to compute the radiation view factor between a triangle
|
|
95
|
+
and a rectangle facing each other:
|
|
96
|
+
|
|
97
|
+
<img src="https://gitlab.com/arep-dev/pyViewFactor/-/raw/9dbd31d124eb898cc5d17913cfc1f010116e2245/img/mwe.png" alt="Triangle and rectangle configuration" width="260"/>
|
|
98
|
+
|
|
99
|
+
You are few lines of code away from your first view factor computation:
|
|
100
|
+
|
|
101
|
+
```python
|
|
102
|
+
import pyvista as pv
|
|
103
|
+
import pyviewfactor as pvf
|
|
104
|
+
|
|
105
|
+
# Create a rectangle and a triangle facing each other
|
|
106
|
+
pointa1 = [0.0, 0.0, 0.0]
|
|
107
|
+
pointb1 = [1.0, 0.0, 0.0]
|
|
108
|
+
pointc1 = [0.0, 1.0, 0.0]
|
|
109
|
+
rectangle = pv.Rectangle([pointa1, pointb1, pointc1])
|
|
110
|
+
|
|
111
|
+
pointa2 = [0.0, 0.0, 1.0]
|
|
112
|
+
pointb2 = [0.0, 1.0, 1.0]
|
|
113
|
+
pointc2 = [1.0, 1.0, 1.0]
|
|
114
|
+
triangle = pv.Triangle([pointa2, pointb2, pointc2])
|
|
115
|
+
|
|
116
|
+
if pvf.get_visibility(rectangle, triangle)[0]:
|
|
117
|
+
F = pvf.compute_viewfactor(triangle, rectangle)
|
|
118
|
+
print("VF from rectangle to triangle :", F)
|
|
119
|
+
else:
|
|
120
|
+
print("Not facing each other")
|
|
121
|
+
|
|
122
|
+
pl = pv.Plotter()
|
|
123
|
+
pl.add_mesh(rectangle, color="lightblue", opacity=0.7)
|
|
124
|
+
pl.add_mesh(triangle, color="salmon", opacity=0.7)
|
|
125
|
+
|
|
126
|
+
# compute and glyph normals for mesh1
|
|
127
|
+
n1 = rectangle.compute_normals(cell_normals=True, point_normals=False)
|
|
128
|
+
arrows1 = n1.glyph(orient="Normals", factor=0.1)
|
|
129
|
+
pl.add_mesh(arrows1, color="blue")
|
|
130
|
+
# similarly for mesh2
|
|
131
|
+
n2 = triangle.compute_normals(cell_normals=True, point_normals=False)
|
|
132
|
+
arrows2 = n2.glyph(orient="Normals", factor=0.1)
|
|
133
|
+
pl.add_mesh(arrows2, color="darkred")
|
|
134
|
+
|
|
135
|
+
pl.show()
|
|
136
|
+
```
|
|
137
|
+
|
|
138
|
+
You usually get your geometry from a different format?
|
|
139
|
+
(`*.dat`, `*.idf`, ...)
|
|
140
|
+
|
|
141
|
+
Check pyvista's documentation on [how to generate a PolyData facet from points](https://docs.pyvista.org/examples/00-load/create-poly.html).
|
|
142
|
+
|
|
143
|
+
## Documentation
|
|
144
|
+
|
|
145
|
+
For detailed explanations and advanced usage, see:
|
|
146
|
+
|
|
147
|
+
https://arep-dev.gitlab.io/pyViewFactor/pyviewfactor.html
|
|
148
|
+
|
|
149
|
+
The documentation includes:
|
|
150
|
+
* Visibility and obstruction semantics,
|
|
151
|
+
* Strict vs non-strict modes,
|
|
152
|
+
* Geometry preprocessing utilities,
|
|
153
|
+
* Numerical robustness guidelines,
|
|
154
|
+
* Extended examples (that can also be found in the `examples/` folder of the repository).
|
|
155
|
+
|
|
156
|
+
|
|
157
|
+
## Citation & Acknowledgments
|
|
158
|
+
* Main contributors:
|
|
159
|
+
* Mateusz BOGDAN,
|
|
160
|
+
* Edouard WALTHER.
|
|
161
|
+
* Acknowledgment: The authors would like to acknowledge *M. Alecian* for his initial work on the quadrature
|
|
162
|
+
code and *M. Chapon* for her contribution to the code validation.
|
|
163
|
+
|
|
164
|
+
There is even a [conference paper](https://www.researchgate.net/publication/360835982_Calcul_des_facteurs_de_forme_entre_polygones_-Application_a_la_thermique_urbaine_et_aux_etudes_de_confort), showing analytical validations.
|
|
165
|
+
|
|
166
|
+
So if you use `pyViewFactor` in your work, please cite:
|
|
167
|
+
> [!IMPORTANT] Citation:
|
|
168
|
+
> Mateusz BOGDAN, Edouard WALTHER, Marc ALECIAN and Mina CHAPON. *Calcul des facteurs de forme entre polygones - Application à la thermique urbaine et aux études de confort*. IBPSA France 2022, Châlons-en-Champagne.
|
|
169
|
+
|
|
170
|
+
Bibtex entry:
|
|
171
|
+
``` latex
|
|
172
|
+
@inproceedings{pyViewFactor22bogdan,
|
|
173
|
+
authors = "Mateusz BOGDAN and Edouard WALTHER and Marc ALECIAN and Mina CHAPON",
|
|
174
|
+
title = "Calcul des facteurs de forme entre polygones - Application à la thermique urbaine et aux études de confort",
|
|
175
|
+
year = "2022",
|
|
176
|
+
organization = "IBPSA France",
|
|
177
|
+
venue = "Châlons-en-Champagne, France"
|
|
178
|
+
note = "IBPSA France 2022",
|
|
179
|
+
}
|
|
180
|
+
```
|
|
181
|
+
|
|
182
|
+
## License
|
|
183
|
+
MIT License - Copyright (c) AREP 2025
|
|
@@ -0,0 +1,161 @@
|
|
|
1
|
+
# PyViewFactor
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
<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"/>
|
|
6
|
+
</div>
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
> `pyViewFactor` is a lightweight open-source Python library for exact view-factor computations on polygonal meshes.
|
|
10
|
+
> It provides robust tools for:
|
|
11
|
+
> - geometric visibility analysis,
|
|
12
|
+
> - obstruction detection,
|
|
13
|
+
> - accurate view factor computation.
|
|
14
|
+
|
|
15
|
+
*Full documentation available [here](https://arep-dev.gitlab.io/pyViewFactor/).*
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
<img src="https://gitlab.com/arep-dev/pyViewFactor/-/raw/3d40d1804eccbaefbc8b1736ff30d0d9f08141ad/img/FF_sceneUrbaine_cyl_RT.png" alt="Urban View Factor" width="800" />
|
|
19
|
+
|
|
20
|
+
[](https://gitlab.com/arep-dev/pyViewFactor/-/releases)
|
|
21
|
+
[](https://gitlab.com/arep-dev/pyViewFactor/pipelines)
|
|
22
|
+
[](https://codecov.io/gl/arep-dev/pyViewFactor)
|
|
23
|
+
[](https://opensource.org/licenses/MIT)
|
|
24
|
+
[](https://pypi.org/project/pyviewfactor/)
|
|
25
|
+
[](https://pypi.org/project/pyviewfactor/)
|
|
26
|
+
|
|
27
|
+
|
|
28
|
+
|
|
29
|
+
## Features
|
|
30
|
+
|
|
31
|
+
* This library enables the computation of radiation view factors between planar polygons using an **accurate** double‐contour integration method described in
|
|
32
|
+
[(Mazumder and Ravishankar 2012)](https://www.academia.edu/download/77459051/Viewfactor_paper_IJHMT.pdf)
|
|
33
|
+
with insights from [(Schmid 2016)](https://hal.archives-ouvertes.fr/tel-01734545/).
|
|
34
|
+
* It uses the handy [`Pyvista`](https://docs.pyvista.org/) package to deal with geometry imports (`*.stl`, `*.vtk`, `*.obj`, ...),
|
|
35
|
+
geometry creations, and some other mesh functionalities under the hood.
|
|
36
|
+
* It enables:
|
|
37
|
+
- 🔺 View factor computation between planar polygons
|
|
38
|
+
- 👁️ Visibility checks based on face orientation
|
|
39
|
+
- 🚧 Obstruction detection using ray-triangle intersection
|
|
40
|
+
- ⚙️ Strict / non-strict modes for robustness control
|
|
41
|
+
- ⚡ Optimized full matrix computation with caching
|
|
42
|
+
- 📦 Built on `numpy`, `scipy`, `pyvista`, `numba`
|
|
43
|
+
|
|
44
|
+
|
|
45
|
+
|
|
46
|
+
## Installation
|
|
47
|
+
`pyViewFactor` can be installed from [PyPi](https://pypi.org/project/pyviewfactor/)
|
|
48
|
+
using `pip` on Python >= 3.10:
|
|
49
|
+
```shell
|
|
50
|
+
pip install pyviewfactor
|
|
51
|
+
```
|
|
52
|
+
You can also visit [PyPi](https://pypi.org/project/pyviewfactor/) or
|
|
53
|
+
[Gitlab](https://gitlab.com/arep-dev/pyViewFactor) to download the sources.
|
|
54
|
+
|
|
55
|
+
Requirements:
|
|
56
|
+
```
|
|
57
|
+
numpy==1.26.4
|
|
58
|
+
pyvista==0.45
|
|
59
|
+
scipy==1.11.4
|
|
60
|
+
numba==0.61.2
|
|
61
|
+
tqdm==4.65.0
|
|
62
|
+
|
|
63
|
+
```
|
|
64
|
+
The code will probably work with lower versions of the required packages, however this has not been tested.
|
|
65
|
+
|
|
66
|
+
> [!NOTE]
|
|
67
|
+
> If you are alergic to `numba`, you may `pip install pyviewfactor==0.0.10` that works (and give up the times 3+ speed-up in view factor computation).
|
|
68
|
+
|
|
69
|
+
|
|
70
|
+
## Quick Start
|
|
71
|
+
|
|
72
|
+
Suppose we want to compute the radiation view factor between a triangle
|
|
73
|
+
and a rectangle facing each other:
|
|
74
|
+
|
|
75
|
+
<img src="https://gitlab.com/arep-dev/pyViewFactor/-/raw/9dbd31d124eb898cc5d17913cfc1f010116e2245/img/mwe.png" alt="Triangle and rectangle configuration" width="260"/>
|
|
76
|
+
|
|
77
|
+
You are few lines of code away from your first view factor computation:
|
|
78
|
+
|
|
79
|
+
```python
|
|
80
|
+
import pyvista as pv
|
|
81
|
+
import pyviewfactor as pvf
|
|
82
|
+
|
|
83
|
+
# Create a rectangle and a triangle facing each other
|
|
84
|
+
pointa1 = [0.0, 0.0, 0.0]
|
|
85
|
+
pointb1 = [1.0, 0.0, 0.0]
|
|
86
|
+
pointc1 = [0.0, 1.0, 0.0]
|
|
87
|
+
rectangle = pv.Rectangle([pointa1, pointb1, pointc1])
|
|
88
|
+
|
|
89
|
+
pointa2 = [0.0, 0.0, 1.0]
|
|
90
|
+
pointb2 = [0.0, 1.0, 1.0]
|
|
91
|
+
pointc2 = [1.0, 1.0, 1.0]
|
|
92
|
+
triangle = pv.Triangle([pointa2, pointb2, pointc2])
|
|
93
|
+
|
|
94
|
+
if pvf.get_visibility(rectangle, triangle)[0]:
|
|
95
|
+
F = pvf.compute_viewfactor(triangle, rectangle)
|
|
96
|
+
print("VF from rectangle to triangle :", F)
|
|
97
|
+
else:
|
|
98
|
+
print("Not facing each other")
|
|
99
|
+
|
|
100
|
+
pl = pv.Plotter()
|
|
101
|
+
pl.add_mesh(rectangle, color="lightblue", opacity=0.7)
|
|
102
|
+
pl.add_mesh(triangle, color="salmon", opacity=0.7)
|
|
103
|
+
|
|
104
|
+
# compute and glyph normals for mesh1
|
|
105
|
+
n1 = rectangle.compute_normals(cell_normals=True, point_normals=False)
|
|
106
|
+
arrows1 = n1.glyph(orient="Normals", factor=0.1)
|
|
107
|
+
pl.add_mesh(arrows1, color="blue")
|
|
108
|
+
# similarly for mesh2
|
|
109
|
+
n2 = triangle.compute_normals(cell_normals=True, point_normals=False)
|
|
110
|
+
arrows2 = n2.glyph(orient="Normals", factor=0.1)
|
|
111
|
+
pl.add_mesh(arrows2, color="darkred")
|
|
112
|
+
|
|
113
|
+
pl.show()
|
|
114
|
+
```
|
|
115
|
+
|
|
116
|
+
You usually get your geometry from a different format?
|
|
117
|
+
(`*.dat`, `*.idf`, ...)
|
|
118
|
+
|
|
119
|
+
Check pyvista's documentation on [how to generate a PolyData facet from points](https://docs.pyvista.org/examples/00-load/create-poly.html).
|
|
120
|
+
|
|
121
|
+
## Documentation
|
|
122
|
+
|
|
123
|
+
For detailed explanations and advanced usage, see:
|
|
124
|
+
|
|
125
|
+
https://arep-dev.gitlab.io/pyViewFactor/pyviewfactor.html
|
|
126
|
+
|
|
127
|
+
The documentation includes:
|
|
128
|
+
* Visibility and obstruction semantics,
|
|
129
|
+
* Strict vs non-strict modes,
|
|
130
|
+
* Geometry preprocessing utilities,
|
|
131
|
+
* Numerical robustness guidelines,
|
|
132
|
+
* Extended examples (that can also be found in the `examples/` folder of the repository).
|
|
133
|
+
|
|
134
|
+
|
|
135
|
+
## Citation & Acknowledgments
|
|
136
|
+
* Main contributors:
|
|
137
|
+
* Mateusz BOGDAN,
|
|
138
|
+
* Edouard WALTHER.
|
|
139
|
+
* Acknowledgment: The authors would like to acknowledge *M. Alecian* for his initial work on the quadrature
|
|
140
|
+
code and *M. Chapon* for her contribution to the code validation.
|
|
141
|
+
|
|
142
|
+
There is even a [conference paper](https://www.researchgate.net/publication/360835982_Calcul_des_facteurs_de_forme_entre_polygones_-Application_a_la_thermique_urbaine_et_aux_etudes_de_confort), showing analytical validations.
|
|
143
|
+
|
|
144
|
+
So if you use `pyViewFactor` in your work, please cite:
|
|
145
|
+
> [!IMPORTANT] Citation:
|
|
146
|
+
> Mateusz BOGDAN, Edouard WALTHER, Marc ALECIAN and Mina CHAPON. *Calcul des facteurs de forme entre polygones - Application à la thermique urbaine et aux études de confort*. IBPSA France 2022, Châlons-en-Champagne.
|
|
147
|
+
|
|
148
|
+
Bibtex entry:
|
|
149
|
+
``` latex
|
|
150
|
+
@inproceedings{pyViewFactor22bogdan,
|
|
151
|
+
authors = "Mateusz BOGDAN and Edouard WALTHER and Marc ALECIAN and Mina CHAPON",
|
|
152
|
+
title = "Calcul des facteurs de forme entre polygones - Application à la thermique urbaine et aux études de confort",
|
|
153
|
+
year = "2022",
|
|
154
|
+
organization = "IBPSA France",
|
|
155
|
+
venue = "Châlons-en-Champagne, France"
|
|
156
|
+
note = "IBPSA France 2022",
|
|
157
|
+
}
|
|
158
|
+
```
|
|
159
|
+
|
|
160
|
+
## License
|
|
161
|
+
MIT License - Copyright (c) AREP 2025
|
|
@@ -0,0 +1,183 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: pyviewfactor
|
|
3
|
+
Version: 1.0.3
|
|
4
|
+
Summary: "A lightweight open-source Python library for exact view-factor computations on polygonal meshes"
|
|
5
|
+
Home-page: https://gitlab.com/arep-dev/pyViewFactor/
|
|
6
|
+
Author: Mateusz BOGDAN, Edouard WALTHER
|
|
7
|
+
Author-email: mateusz.bogdan@arep.fr
|
|
8
|
+
License: MIT
|
|
9
|
+
Keywords: radiative-transfer,radiation,vtk,geometry,viewfactor,visibility
|
|
10
|
+
Classifier: Programming Language :: Python :: 3
|
|
11
|
+
Classifier: License :: OSI Approved :: MIT License
|
|
12
|
+
Classifier: Topic :: Scientific/Engineering :: Physics
|
|
13
|
+
Classifier: Operating System :: OS Independent
|
|
14
|
+
Requires-Python: >=3.10
|
|
15
|
+
Description-Content-Type: text/markdown
|
|
16
|
+
License-File: LICENSE.txt
|
|
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
|
+
Dynamic: license-file
|
|
22
|
+
|
|
23
|
+
# PyViewFactor
|
|
24
|
+
|
|
25
|
+
|
|
26
|
+
<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"/>
|
|
28
|
+
</div>
|
|
29
|
+
|
|
30
|
+
|
|
31
|
+
> `pyViewFactor` is a lightweight open-source Python library for exact view-factor computations on polygonal meshes.
|
|
32
|
+
> It provides robust tools for:
|
|
33
|
+
> - geometric visibility analysis,
|
|
34
|
+
> - obstruction detection,
|
|
35
|
+
> - accurate view factor computation.
|
|
36
|
+
|
|
37
|
+
*Full documentation available [here](https://arep-dev.gitlab.io/pyViewFactor/).*
|
|
38
|
+
|
|
39
|
+
|
|
40
|
+
<img src="https://gitlab.com/arep-dev/pyViewFactor/-/raw/3d40d1804eccbaefbc8b1736ff30d0d9f08141ad/img/FF_sceneUrbaine_cyl_RT.png" alt="Urban View Factor" width="800" />
|
|
41
|
+
|
|
42
|
+
[](https://gitlab.com/arep-dev/pyViewFactor/-/releases)
|
|
43
|
+
[](https://gitlab.com/arep-dev/pyViewFactor/pipelines)
|
|
44
|
+
[](https://codecov.io/gl/arep-dev/pyViewFactor)
|
|
45
|
+
[](https://opensource.org/licenses/MIT)
|
|
46
|
+
[](https://pypi.org/project/pyviewfactor/)
|
|
47
|
+
[](https://pypi.org/project/pyviewfactor/)
|
|
48
|
+
|
|
49
|
+
|
|
50
|
+
|
|
51
|
+
## Features
|
|
52
|
+
|
|
53
|
+
* This library enables the computation of radiation view factors between planar polygons using an **accurate** double‐contour integration method described in
|
|
54
|
+
[(Mazumder and Ravishankar 2012)](https://www.academia.edu/download/77459051/Viewfactor_paper_IJHMT.pdf)
|
|
55
|
+
with insights from [(Schmid 2016)](https://hal.archives-ouvertes.fr/tel-01734545/).
|
|
56
|
+
* It uses the handy [`Pyvista`](https://docs.pyvista.org/) package to deal with geometry imports (`*.stl`, `*.vtk`, `*.obj`, ...),
|
|
57
|
+
geometry creations, and some other mesh functionalities under the hood.
|
|
58
|
+
* It enables:
|
|
59
|
+
- 🔺 View factor computation between planar polygons
|
|
60
|
+
- 👁️ Visibility checks based on face orientation
|
|
61
|
+
- 🚧 Obstruction detection using ray-triangle intersection
|
|
62
|
+
- ⚙️ Strict / non-strict modes for robustness control
|
|
63
|
+
- ⚡ Optimized full matrix computation with caching
|
|
64
|
+
- 📦 Built on `numpy`, `scipy`, `pyvista`, `numba`
|
|
65
|
+
|
|
66
|
+
|
|
67
|
+
|
|
68
|
+
## Installation
|
|
69
|
+
`pyViewFactor` can be installed from [PyPi](https://pypi.org/project/pyviewfactor/)
|
|
70
|
+
using `pip` on Python >= 3.10:
|
|
71
|
+
```shell
|
|
72
|
+
pip install pyviewfactor
|
|
73
|
+
```
|
|
74
|
+
You can also visit [PyPi](https://pypi.org/project/pyviewfactor/) or
|
|
75
|
+
[Gitlab](https://gitlab.com/arep-dev/pyViewFactor) to download the sources.
|
|
76
|
+
|
|
77
|
+
Requirements:
|
|
78
|
+
```
|
|
79
|
+
numpy==1.26.4
|
|
80
|
+
pyvista==0.45
|
|
81
|
+
scipy==1.11.4
|
|
82
|
+
numba==0.61.2
|
|
83
|
+
tqdm==4.65.0
|
|
84
|
+
|
|
85
|
+
```
|
|
86
|
+
The code will probably work with lower versions of the required packages, however this has not been tested.
|
|
87
|
+
|
|
88
|
+
> [!NOTE]
|
|
89
|
+
> If you are alergic to `numba`, you may `pip install pyviewfactor==0.0.10` that works (and give up the times 3+ speed-up in view factor computation).
|
|
90
|
+
|
|
91
|
+
|
|
92
|
+
## Quick Start
|
|
93
|
+
|
|
94
|
+
Suppose we want to compute the radiation view factor between a triangle
|
|
95
|
+
and a rectangle facing each other:
|
|
96
|
+
|
|
97
|
+
<img src="https://gitlab.com/arep-dev/pyViewFactor/-/raw/9dbd31d124eb898cc5d17913cfc1f010116e2245/img/mwe.png" alt="Triangle and rectangle configuration" width="260"/>
|
|
98
|
+
|
|
99
|
+
You are few lines of code away from your first view factor computation:
|
|
100
|
+
|
|
101
|
+
```python
|
|
102
|
+
import pyvista as pv
|
|
103
|
+
import pyviewfactor as pvf
|
|
104
|
+
|
|
105
|
+
# Create a rectangle and a triangle facing each other
|
|
106
|
+
pointa1 = [0.0, 0.0, 0.0]
|
|
107
|
+
pointb1 = [1.0, 0.0, 0.0]
|
|
108
|
+
pointc1 = [0.0, 1.0, 0.0]
|
|
109
|
+
rectangle = pv.Rectangle([pointa1, pointb1, pointc1])
|
|
110
|
+
|
|
111
|
+
pointa2 = [0.0, 0.0, 1.0]
|
|
112
|
+
pointb2 = [0.0, 1.0, 1.0]
|
|
113
|
+
pointc2 = [1.0, 1.0, 1.0]
|
|
114
|
+
triangle = pv.Triangle([pointa2, pointb2, pointc2])
|
|
115
|
+
|
|
116
|
+
if pvf.get_visibility(rectangle, triangle)[0]:
|
|
117
|
+
F = pvf.compute_viewfactor(triangle, rectangle)
|
|
118
|
+
print("VF from rectangle to triangle :", F)
|
|
119
|
+
else:
|
|
120
|
+
print("Not facing each other")
|
|
121
|
+
|
|
122
|
+
pl = pv.Plotter()
|
|
123
|
+
pl.add_mesh(rectangle, color="lightblue", opacity=0.7)
|
|
124
|
+
pl.add_mesh(triangle, color="salmon", opacity=0.7)
|
|
125
|
+
|
|
126
|
+
# compute and glyph normals for mesh1
|
|
127
|
+
n1 = rectangle.compute_normals(cell_normals=True, point_normals=False)
|
|
128
|
+
arrows1 = n1.glyph(orient="Normals", factor=0.1)
|
|
129
|
+
pl.add_mesh(arrows1, color="blue")
|
|
130
|
+
# similarly for mesh2
|
|
131
|
+
n2 = triangle.compute_normals(cell_normals=True, point_normals=False)
|
|
132
|
+
arrows2 = n2.glyph(orient="Normals", factor=0.1)
|
|
133
|
+
pl.add_mesh(arrows2, color="darkred")
|
|
134
|
+
|
|
135
|
+
pl.show()
|
|
136
|
+
```
|
|
137
|
+
|
|
138
|
+
You usually get your geometry from a different format?
|
|
139
|
+
(`*.dat`, `*.idf`, ...)
|
|
140
|
+
|
|
141
|
+
Check pyvista's documentation on [how to generate a PolyData facet from points](https://docs.pyvista.org/examples/00-load/create-poly.html).
|
|
142
|
+
|
|
143
|
+
## Documentation
|
|
144
|
+
|
|
145
|
+
For detailed explanations and advanced usage, see:
|
|
146
|
+
|
|
147
|
+
https://arep-dev.gitlab.io/pyViewFactor/pyviewfactor.html
|
|
148
|
+
|
|
149
|
+
The documentation includes:
|
|
150
|
+
* Visibility and obstruction semantics,
|
|
151
|
+
* Strict vs non-strict modes,
|
|
152
|
+
* Geometry preprocessing utilities,
|
|
153
|
+
* Numerical robustness guidelines,
|
|
154
|
+
* Extended examples (that can also be found in the `examples/` folder of the repository).
|
|
155
|
+
|
|
156
|
+
|
|
157
|
+
## Citation & Acknowledgments
|
|
158
|
+
* Main contributors:
|
|
159
|
+
* Mateusz BOGDAN,
|
|
160
|
+
* Edouard WALTHER.
|
|
161
|
+
* Acknowledgment: The authors would like to acknowledge *M. Alecian* for his initial work on the quadrature
|
|
162
|
+
code and *M. Chapon* for her contribution to the code validation.
|
|
163
|
+
|
|
164
|
+
There is even a [conference paper](https://www.researchgate.net/publication/360835982_Calcul_des_facteurs_de_forme_entre_polygones_-Application_a_la_thermique_urbaine_et_aux_etudes_de_confort), showing analytical validations.
|
|
165
|
+
|
|
166
|
+
So if you use `pyViewFactor` in your work, please cite:
|
|
167
|
+
> [!IMPORTANT] Citation:
|
|
168
|
+
> Mateusz BOGDAN, Edouard WALTHER, Marc ALECIAN and Mina CHAPON. *Calcul des facteurs de forme entre polygones - Application à la thermique urbaine et aux études de confort*. IBPSA France 2022, Châlons-en-Champagne.
|
|
169
|
+
|
|
170
|
+
Bibtex entry:
|
|
171
|
+
``` latex
|
|
172
|
+
@inproceedings{pyViewFactor22bogdan,
|
|
173
|
+
authors = "Mateusz BOGDAN and Edouard WALTHER and Marc ALECIAN and Mina CHAPON",
|
|
174
|
+
title = "Calcul des facteurs de forme entre polygones - Application à la thermique urbaine et aux études de confort",
|
|
175
|
+
year = "2022",
|
|
176
|
+
organization = "IBPSA France",
|
|
177
|
+
venue = "Châlons-en-Champagne, France"
|
|
178
|
+
note = "IBPSA France 2022",
|
|
179
|
+
}
|
|
180
|
+
```
|
|
181
|
+
|
|
182
|
+
## License
|
|
183
|
+
MIT License - Copyright (c) AREP 2025
|