adze/README.md

45 lines
1.4 KiB
Markdown

# adze
**adze** is a Python package for accurate polyhedron clipping
and anti-aliased voxelization.
**Homepage:** https://mpxd.net/code/jan/adze
**Capabilities:**
- Clipping or splitting arbitrary polyhedra by a plane or a collection of planes (i.e. a convex polyhedron).
- Accurate anti-aliased voxelization of arbitrary polyhedra on non-uniform rectangular grids.
- Calculation of polynomial moments (volume, centroid, inertia, etc.) for clipped polyhedra.
## Installation
**Dependencies:**
* python 3.11 or newer
* numpy
* pytest (optional, testing)
* pytest-benchmark (optional, benchmarking)
Install with pip from PyPi (preferred):
```bash
pip install adze
```
Install directly from git repository:
```bash
uv pip install git+https://mpxd.net/code/jan/adze.git
```
## Documentation
Most functions and classes are documented inline.
Geometry helper input contracts:
- `build_tetrahedron()` and `planes_from_tetrahedron()` expect tetrahedron vertices in the helper's documented positive winding.
- `build_box()` and `planes_from_box()` expect `box_corners[0]` to be the per-axis minimum and `box_corners[1]` the per-axis maximum.
- `adze.transform.affine()` accepts a general 4x4 homogeneous transform and applies the perspective divide using the fourth row, so projective transforms are supported.
To read the inline help,
```python3
import adze
help(adze)
help(adze.split)
```