Metadata-Version: 2.5
Name: brepax
Version: 0.6.2
Summary: JAX-native differentiable geometry and STEP/B-Rep evaluation.
Project-URL: Homepage, https://github.com/lv416e/brepax
Project-URL: Documentation, https://lv416e.github.io/brepax
Project-URL: Repository, https://github.com/lv416e/brepax
Project-URL: Issues, https://github.com/lv416e/brepax/issues
Project-URL: Changelog, https://github.com/lv416e/brepax/blob/main/CHANGELOG.md
Author-email: lv416e <mary.lv416e@gmail.com>
License-Expression: Apache-2.0
License-File: LICENSE
Keywords: boolean,brep,cad,differentiable,geometry,jax,sdf
Classifier: Development Status :: 3 - Alpha
Classifier: Intended Audience :: Science/Research
Classifier: License :: OSI Approved :: Apache Software License
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Programming Language :: Python :: 3.13
Classifier: Topic :: Scientific/Engineering :: Mathematics
Classifier: Typing :: Typed
Requires-Python: <3.14,>=3.11
Requires-Dist: cadquery-ocp-novtk<8,>=7.9
Requires-Dist: equinox>=0.11
Requires-Dist: jax>=0.4.34
Requires-Dist: jaxlib>=0.4.34
Requires-Dist: jaxtyping>=0.2.34
Requires-Dist: numpy>=1.26
Provides-Extra: all
Requires-Dist: beartype; extra == 'all'
Requires-Dist: chex; extra == 'all'
Requires-Dist: gudhi>=3.10; extra == 'all'
Requires-Dist: hypothesis; extra == 'all'
Requires-Dist: ipywidgets; extra == 'all'
Requires-Dist: jupyter; extra == 'all'
Requires-Dist: lineax; extra == 'all'
Requires-Dist: matplotlib; extra == 'all'
Requires-Dist: mike; extra == 'all'
Requires-Dist: mkdocs-jupyter; extra == 'all'
Requires-Dist: mkdocs-material; extra == 'all'
Requires-Dist: mkdocstrings[python]; extra == 'all'
Requires-Dist: mypy; extra == 'all'
Requires-Dist: nbval; extra == 'all'
Requires-Dist: nox; extra == 'all'
Requires-Dist: optimistix; extra == 'all'
Requires-Dist: plotly; extra == 'all'
Requires-Dist: pytest; extra == 'all'
Requires-Dist: pytest-benchmark; extra == 'all'
Requires-Dist: pytest-cov; extra == 'all'
Requires-Dist: ruff; extra == 'all'
Requires-Dist: trimesh; extra == 'all'
Provides-Extra: dev
Requires-Dist: beartype; extra == 'dev'
Requires-Dist: chex; extra == 'dev'
Requires-Dist: hypothesis; extra == 'dev'
Requires-Dist: mypy; extra == 'dev'
Requires-Dist: nox; extra == 'dev'
Requires-Dist: pytest; extra == 'dev'
Requires-Dist: pytest-benchmark; extra == 'dev'
Requires-Dist: pytest-cov; extra == 'dev'
Requires-Dist: ruff; extra == 'dev'
Provides-Extra: docs
Requires-Dist: mike; extra == 'docs'
Requires-Dist: mkdocs-jupyter; extra == 'docs'
Requires-Dist: mkdocs-material; extra == 'docs'
Requires-Dist: mkdocstrings[python]; extra == 'docs'
Provides-Extra: examples
Requires-Dist: ipywidgets; extra == 'examples'
Requires-Dist: jupyter; extra == 'examples'
Requires-Dist: nbval; extra == 'examples'
Provides-Extra: mesh
Requires-Dist: trimesh; extra == 'mesh'
Provides-Extra: opt
Requires-Dist: lineax; extra == 'opt'
Requires-Dist: optimistix; extra == 'opt'
Provides-Extra: persistence
Requires-Dist: gudhi>=3.10; extra == 'persistence'
Provides-Extra: viz
Requires-Dist: matplotlib; extra == 'viz'
Requires-Dist: plotly; extra == 'viz'
Description-Content-Type: text/markdown

# BRepAX

[![CI](https://github.com/lv416e/brepax/actions/workflows/ci.yaml/badge.svg)](https://github.com/lv416e/brepax/actions/workflows/ci.yaml)
[![PyPI](https://img.shields.io/pypi/v/brepax.svg)](https://pypi.org/project/brepax/)
[![License](https://img.shields.io/badge/License-Apache_2.0-blue.svg)](https://opensource.org/licenses/Apache-2.0)
[![Python 3.11+](https://img.shields.io/badge/python-3.11+-blue.svg)](https://www.python.org/downloads/)

**JAX-native differentiable geometry and STEP/B-Rep evaluation.**

BRepAX combines host-side OCCT extraction with JAX numerical evaluation of
analytical primitives and B-spline surfaces. It provides mesh-based mass
properties, parameter gradients on fixed mesh topology, and experimental
stratum-dispatched Boolean measures.

## Installation

```bash
pip install brepax "cadquery-ocp-novtk>=7.9,<8"
```

The explicit OCCT bound is needed for the published 0.6.1 package, whose
metadata also allows incompatible OCCT 8 bindings.

## Quick Start

```python
import jax
from brepax.io.step import read_step
from brepax.brep.triangulate import (
    triangulate_shape, divergence_volume,
    mesh_surface_area, mesh_center_of_mass,
)

# Load STEP file and compute volume via divergence theorem
shape = read_step("part.step")
tris, params = triangulate_shape(shape)

vol = divergence_volume(tris)           # exact for watertight mesh
area = mesh_surface_area(tris)          # sum of triangle areas
com = mesh_center_of_mass(tris)         # surface integral (Eberly 2002)

# Gradient of volume w.r.t. all triangle vertices
grad = jax.grad(divergence_volume)(tris)
```

### Speeding up cold starts

BRepAX compiles one XLA artifact per surface type and per unique B-spline
signature on the first triangulation. On busy parts (e.g. NIST CTC-02, 664
faces) this is ~10 seconds of one-shot work per Python process. Enabling
the persistent compilation cache lets later process starts reuse those
compiled artifacts from disk:

```python
import brepax
from brepax.io.step import read_step
from brepax.brep.triangulate import triangulate_shape

brepax.enable_compilation_cache()  # defaults to ~/.cache/brepax/jax-compile

# First run populates the cache on disk, later runs load from it.
shape = read_step("part.step")
tris, _ = triangulate_shape(shape)
```

The cache directory can also be set explicitly or via the
`BREPAX_COMPILATION_CACHE_DIR` environment variable. In-process repeat
calls are unaffected — they already hit JAX's in-memory JIT cache.

## Capabilities and limits

See the [API overview](https://lv416e.github.io/brepax/reference/) for
supported STEP surfaces, the host/JAX boundary, mass-property assumptions,
and the scope of Boolean gradients. The
[integration report](https://lv416e.github.io/brepax/reference/benchmarks/)
records results on its fixture set; it is not a guarantee for arbitrary CAD.

## Documentation

Full documentation: [lv416e.github.io/brepax](https://lv416e.github.io/brepax)

## License

Apache License 2.0. See [LICENSE](LICENSE) for details.
