Skip to main content

PyViewFactor

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.

[!NOTE] numba is 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:

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:

[!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

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)

Source distribution for pyviewfactor 1.1.0
File Size Uploaded
pyviewfactor-1.1.0.tar.gz 35.4 kB Details

Built distribution (wheel)

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

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

Release history Release notifications | RSS feed

This release

1.1.0 This release

2 release files

1.0.3

2 release files

1.0.2

2 release files

1.0.1

2 release files

1.0.0

2 release files

0.1.17

2 release files

0.1.16

2 release files

0.1.15

2 release files

0.1.14

2 release files

0.1.13

2 release files

0.1.12

2 release files

0.1.11

2 release files

0.1.10

2 release files

0.1.8

2 release files

0.1.7

2 release files

0.1.6

2 release files

0.1.5

2 release files

0.1.4

2 release files

0.1.3

2 release files

0.1.2

2 release files

0.1.1

2 release files

0.1.0

1 release file

0.0.16

1 release file

0.0.15

1 release file

0.0.14

1 release file

0.0.13

1 release file

0.0.12

1 release file

0.0.11

1 release file

0.0.10

1 release file

0.0.9

1 release file

0.0.8

1 release file

0.0.7

1 release file

0.0.6

1 release file

0.0.5

1 release file

0.0.4

1 release file

0.0.3

1 release file

0.0.2

1 release file

0.0.1

1 release file

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