abspy: A Python package for 3D adaptive binary space partitioning and modeling

Zhaiyu ChenJ. Open Source Softw 2025 · DBLP

Introduction

The transition from raw, unstructured 3D data to clean, structured geometric models remains a significant hurdle in computer vision and engineering. While sensors like LiDAR generate dense point clouds, these datasets lack the topological structure required for advanced simulations, volumetric analysis, or high-quality rendering. abspy is a Python library designed to bridge this gap by providing a robust framework for adaptive binary space partitioning (BSP).

The Challenge of 3D Data Structuring

Standard approaches to spatial partitioning often struggle with a trade-off between resolution and efficiency. Voxel grids, while simple, suffer from aliasing and high memory consumption at fine scales. Conversely, exhaustive plane arrangements—which cut space with every detected planar primitive—frequently lead to a "combinatorial explosion," generating an unmanageable number of tiny, often redundant cells.

abspy addresses these issues by implementing an adaptive approach that partitions space based on the intrinsic geometric features of the data rather than a rigid, predefined grid.

Methodology: Adaptive Binary Space Partitioning

The core innovation of abspy lies in its recursive, local subdivision strategy. Instead of applying every planar primitive globally, the library performs "on-demand" splitting. A plane is only inserted into the specific "leaves" of the BSP-tree that it actually intersects. This ensures that the resulting cells remain convex and the overall structure stays compact.

Step-by-step adaptive binary space partitioning of a 2D 'A' shape, demonstrating local splitting based on geometric features.

This process transforms noisy point clouds into "linear cell complexes." By treating this spatial decomposition as a dynamic graph, users can leverage algorithms like graph cuts to distinguish between interior and exterior volumes, effectively "shrink-wrapping" complex data into watertight polygonal meshes.

Key Features and Robustness

Beyond its partitioning logic, abspy focuses on two critical areas for researchers:

  1. Exact Geometric Computation: Numerical instability is a common failure point in 3D modeling. abspy utilizes the rational ring from SageMath to perform exact arithmetic, eliminating the "cracks" and topological errors caused by floating-point inaccuracies.
  2. Pythonic Integration: While powerful geometry kernels exist in C++, they are often difficult to integrate into modern machine learning pipelines. abspy provides a high-level Python interface that is compatible with standard libraries like NetworkX for graph analysis and Open3D for visualization.

Applications and Limitations

abspy has already demonstrated its utility in 3D building reconstruction and as a feature extraction tool for graph neural networks (e.g., PolyGNN). However, its performance is inherently tied to the quality of the initial planar primitives. While highly effective for man-made environments with clear flat surfaces, its benefits may be less pronounced for highly organic or curved geometries. Additionally, the use of exact arithmetic introduces a computational overhead compared to standard floating-point operations, though this is often a necessary trade-off for model robustness.

Conclusion

By providing an accessible, feature-driven approach to spatial partitioning, abspy empowers researchers to move beyond raw point clouds toward structured, mathematically exact 3D models. Its focus on robustness and interoperability makes it a valuable addition to the Python 3D research ecosystem.

Summary updated

BibTeX
@article{chen2025abspy,
  author = {Zhaiyu Chen},
  title = {{abspy: A Python package for 3D adaptive binary space partitioning and modeling}},
  journal = {J. Open Source Softw.},
  year = {2025},
  doi = {10.21105/joss.07946},
}

Loading related content...

Figure