Skip to main content
pvf_logo

pyViewFactor is 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.

Urban View Factor

Latest Release pipeline status codecov License: MIT Pypi Version Pypi Downloads status

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 Pyvista package 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 prange parallelism (~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.

Quick Start

Suppose we want to compute the radiation view factor between a triangle and a rectangle facing each other:

Triangle and rectangle configuration

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:

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 - 2026

Metadata

Release files for pyviewfactor 1.1.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for pyviewfactor 1.1.1
File Size Uploaded Provenance Actions
pyviewfactor-1.1.1.tar.gz 36.3 kB Without provenance Details for pyviewfactor-1.1.1.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for pyviewfactor 1.1.1
File Interpreter ABI Platform Actions
pyviewfactor-1.1.1-py3-none-any.whl Python 3 none any Details for pyviewfactor-1.1.1-py3-none-any.whl

Total release size: 75.4 kB

Release files / pyviewfactor-1.1.1.tar.gz

Download URL pyviewfactor-1.1.1.tar.gz
Size 36.3 kB
Tags Source
SHA-256 checksum
How to use checksums
1f33e1a648516532d66d36c64b7f387f71a09c1f65465ccb0932543f3b27bb37
BLAKE2b-256 checksum
How to use checksums
a0ffca68e1f96ab62fd7d3a4ab772ac728249059d124fc2c15e12a2a8072a7ec
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.1-py3-none-any.whl

Download URL pyviewfactor-1.1.1-py3-none-any.whl
Size 39.1 kB
Tags Python 3
SHA-256 checksum
How to use checksums
9cabd14113a42d4d39880790d52a5e5e86f64d50bd8057f905e4208c87eaf216
BLAKE2b-256 checksum
How to use checksums
6a5ff88690bf06deab684edcba84c3c76306c3ced6a7e03900822660bc3a330e
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.1

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.

Release history Release notifications | RSS feed

This release

1.1.1 This release

2 release files No provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page