PyViewFactor
pyViewFactoris a lightweight open-source Python library for exact view-factor computations on polygonal meshes. It provides robust tools for:
- geometric visibility analysis,
- obstruction detection,
- accurate view factor computation.
Full documentation available at arep-dev.gitlab.io/pyViewFactor.
Features
- This library enables the computation of radiation view factors between planar polygons using an accurate double‐contour integration method described in (Mazumder and Ravishankar 2012) with insights from (Schmid 2016).
- It uses the handy
Pyvistapackage to deal with geometry imports (*.stl,*.vtk,*.obj, ...), geometry creations, and some other mesh functionalities under the hood. - It enables:
- 🔺 View factor computation between planar polygons via the SA-30 semi-analytic kernel — handles touching and coplanar faces analytically, no epsilon shift
- 👁️ Visibility checks based on face orientation
- 🚧 Obstruction detection using Möller–Trumbore ray-triangle intersection, BVH-accelerated (O(log N) per ray)
- ⚙️ Strict / non-strict modes for robustness control
- ⚡ Full N×N view-factor matrix with Numba
prangeparallelism (~33× faster than v1.0) - 📦 Built on
numpy,scipy,pyvista,numba
Installation
pyViewFactor can be installed from PyPi
using pip on Python >= 3.10:
pip install pyviewfactor
You can also visit PyPi or Gitlab to download the sources.
Requirements:
numpy==1.26.4
pyvista==0.45
scipy==1.11.4
numba==0.61.2
tqdm==4.65.0
The code will probably work with lower versions of the required packages, however this has not been tested.
[!NOTE]
numbais optional but strongly recommended. Without it, all kernels fall back to sequential pure-Python with identical results — no need to pin an older version.
Quick Start
Suppose we want to compute the radiation view factor between a triangle and a rectangle facing each other:
You are few lines of code away from your first view factor computation:
import pyvista as pv
import pyviewfactor as pvf
# Create a rectangle and a triangle facing each other
pointa1 = [0.0, 0.0, 0.0]
pointb1 = [1.0, 0.0, 0.0]
pointc1 = [0.0, 1.0, 0.0]
rectangle = pv.Rectangle([pointa1, pointb1, pointc1])
pointa2 = [0.0, 0.0, 1.0]
pointb2 = [0.0, 1.0, 1.0]
pointc2 = [1.0, 1.0, 1.0]
triangle = pv.Triangle([pointa2, pointb2, pointc2])
if pvf.get_visibility(rectangle, triangle)[0]:
F = pvf.compute_viewfactor(triangle, rectangle)
print("VF from rectangle to triangle :", F)
else:
print("Not facing each other")
pl = pv.Plotter()
pl.add_mesh(rectangle, color="lightblue", opacity=0.7)
pl.add_mesh(triangle, color="salmon", opacity=0.7)
# compute and glyph normals for mesh1
n1 = rectangle.compute_normals(cell_normals=True, point_normals=False)
arrows1 = n1.glyph(orient="Normals", factor=0.1)
pl.add_mesh(arrows1, color="blue")
# similarly for mesh2
n2 = triangle.compute_normals(cell_normals=True, point_normals=False)
arrows2 = n2.glyph(orient="Normals", factor=0.1)
pl.add_mesh(arrows2, color="darkred")
pl.show()
You want to import your own geometry from a different format?
(*.dat, *.idf, *.stl, ...)
Check pyvista's documentation on how to generate a PolyData facet from points.
Documentation
For detailed explanations and advanced usage, see:
https://arep-dev.gitlab.io/pyViewFactor/
The documentation includes:
- Theory: view factor integral, SA-30 semi-analytic kernel, BVH obstruction engine,
- Implementation: architecture, visibility & obstruction semantics, performance guide,
- Extended examples with analytical validations.
Citation & Acknowledgments
- Main contributors:
- Mateusz BOGDAN,
- Edouard WALTHER.
- Acknowledgment: The authors would like to acknowledge M. Alecian for his initial work on the quadrature code and M. Chapon for her contribution to the code validation.
There is even a conference paper, showing analytical validations.
So if you use pyViewFactor in your work, please cite:
[!IMPORTANT] Citation: 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.
Bibtex entry:
@inproceedings{pyViewFactor22bogdan,
author = "Mateusz BOGDAN and Edouard WALTHER and Marc ALECIAN and Mina CHAPON",
title = "Calcul des facteurs de forme entre polygones - Application à la thermique urbaine et aux études de confort",
year = "2022",
organization = "IBPSA France",
venue = "Châlons-en-Champagne, France"
note = "IBPSA France 2022",
}
License
MIT License - Copyright (c) AREP 2025
Metadata
Release files for pyviewfactor 1.1.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| pyviewfactor-1.1.0.tar.gz | 35.4 kB | Without provenance | Details for pyviewfactor-1.1.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| pyviewfactor-1.1.0-py3-none-any.whl | Python 3 | none | any | Details for pyviewfactor-1.1.0-py3-none-any.whl |
Total release size: 73.6 kB
Release files / pyviewfactor-1.1.0.tar.gz
| Download URL | pyviewfactor-1.1.0.tar.gz |
|---|---|
| Size | 35.4 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
fc00f7f89aa4418366bf28b113c1fbe9551eebdd270361b0fc7cc62aef8973d1
|
|
BLAKE2b-256 checksum How to use checksums |
be7babaac1a2cf0cda13ffec9285443cf501e13384933ab78be594edbe96b39b
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.11.15
|
Release files / pyviewfactor-1.1.0-py3-none-any.whl
| Download URL | pyviewfactor-1.1.0-py3-none-any.whl |
|---|---|
| Size | 38.3 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
26730c72b912207b360f74038a22f6a7b7efc59348019515ab58340358d5db92
|
|
BLAKE2b-256 checksum How to use checksums |
fa2be072bb410c83cca6304dd0bcbded6329d7a83fb174b370fd950b6f16bcf7
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.11.15
|
Security for pyviewfactor 1.1.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.