Exact and efficient occlusion determination for convex geometries under spherical occlusion
Project description
occlusion-geometry
A Python library for exact analytical and geometry-exact occlusion determination for convex bodies under spherical occlusion.
Overview
occlusion-geometry provides efficient and exact occlusion tests for the following setting:
- a point observer (A),
- a spherical occluder (S),
- a convex target body (B),
- and pure geometric occlusion only (no transparency, no radiometric effects).
The core idea is:
A convex body (B) is fully occluded by a spherical occluder (S) from observer (A) if and only if (B) is fully contained in the shadow cone (umbra) induced by (A) and (S), together with the required depth ordering.
For cylindrical targets, this library implements an exact analytical criterion derived from a quartic equation.
For polyhedral convex bodies, exact occlusion checking is performed through cone containment of the relevant extreme points.
This repository accompanies our research on fast and exact occlusion determination for convex geometries.
Features
- Exact analytical cylinder occlusion
- Reduces the continuous circle-extremum problem to quartic root finding.
- Exact geometric occlusion for polyhedral convex bodies
- Includes cuboids, prisms, frustums, and vertex-defined convex bodies.
- No sampling in core decision logic
- Sampling is used only in validation and benchmarking.
- Efficient coordinate normalization
- Automatically transforms scenes into a cone-aligned frame.
- Research-oriented implementation
- Includes tests, numerical validation, and benchmark scripts.
Installation
Install from PyPI
pip install occlusion-geometry
Install for development
git clone https://github.com/Bing-Yu-Research/occlusion-geometry.git
cd occlusion-geometry
pip install -e .[dev]
Quick Start
from occlusion_geometry import Point, Sphere, Cylinder, is_fully_occluded
observer = Point([0.0, 0.0, 0.0])
sphere = Sphere([0.0, 0.0, -10.0], 5.0)
cylinder = Cylinder(
center=[0.0, 0.0, -15.0],
axis=[0.0, 0.0, 1.0],
radius=2.0,
height=5.0,
)
is_occluded = is_fully_occluded(observer, sphere, cylinder)
print(is_occluded)
With diagnostic details
result, details = is_fully_occluded(observer, sphere, cylinder, return_details=True)
print("Occluded:", result)
print(details)
Supported Geometries
The current library supports:
PointSphereCylinderConeBodyCuboidPrismFrustumConvexBody
Typical usage entry point:
is_fully_occluded(observer, sphere, body, return_details=False)
Mathematical Notes
Shadow cone
Given observer (A) and spherical occluder (S) with center (C) and radius (R), the shadow cone is defined by:
- apex: (A)
- axis: direction from (A) to (C)
- half-angle: [ \alpha = \arcsin\left(\frac{R}{|C-A|}\right) ]
Cylinder criterion
For a cylinder, full occlusion reduces to checking whether both circular boundary rims are fully contained in the shadow cone.
After parameterizing a circular rim, [ P(\phi)=C + R(u\cos\phi + v\sin\phi), ] the extremal angular condition can be reduced to a quartic polynomial in the Weierstrass variable [ s=\tan(\phi/2). ]
This yields a closed-form algebraic decision pipeline rather than a sampling-based approximation.
Validation and Benchmarks
The implementation has been extensively tested through:
- unit tests,
- randomized numerical validation,
- dense surface sampling cross-checks,
- adversarial near-boundary benchmarks.
In ordinary random scenes, sampling-based methods may appear competitive.
However, in near-tangent and boundary-focused cases, analytical determination remains deterministic while sampling-based methods can suffer from discretization error.
Benchmark scripts are available in:
benchmarks/
Testing
Run the test suite:
pytest tests -v
Project Structure
occlusion-geometry/
├── src/occlusion_geometry/
│ ├── primitives/
│ ├── core/
│ ├── analytic/
│ ├── transforms/
│ └── occlusion.py
├── tests/
├── benchmarks/
└── README.md
Citation
If you use this library in academic work, please cite the accompanying paper.
@misc{occlusion_geometry_2025,
title={Exact Analytical Occlusion Determination for Convex Geometries under Spherical Occlusion},
author={Bing-Yu Research Team},
year={2025},
note={Software available at https://github.com/Bing-Yu-Research/occlusion-geometry}
}
License
This project is released under the MIT License.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file occlusion_geometry-0.1.1.tar.gz.
File metadata
- Download URL: occlusion_geometry-0.1.1.tar.gz
- Upload date:
- Size: 28.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
5825aca3668b0001fb108b18b1f2f141b3b9a3256da8c2489b37b01953f5d790
|
|
| MD5 |
8dcfcf4a5ec62f0f94e091238424fa5e
|
|
| BLAKE2b-256 |
538e1fb8b9260740f0cf9d7be04a68fe79b30055bfe53b16f30cd1ecb417afd0
|
File details
Details for the file occlusion_geometry-0.1.1-py3-none-any.whl.
File metadata
- Download URL: occlusion_geometry-0.1.1-py3-none-any.whl
- Upload date:
- Size: 41.6 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
f4c978c81a9c5edb81abc03dee3b665861eeb99a71e3bba9215d2b6b79121d7d
|
|
| MD5 |
52ae9007b61334568f4239562f2d964c
|
|
| BLAKE2b-256 |
513ea7e8a330eead821df6bbca76cdd67e34021e22c2ee6f8fefb6f203123ff1
|