# flux-ffi
Unified C FFI layer for fleet math functions.
Provides C-compatible bindings (`#[no_mangle] extern "C"`) to core constraint-theory and geometry primitives used across the Cocapn fleet ecosystem.
## Functions
| `flux_eisenstein_norm` | Eisenstein integer norm: a² - ab + b² |
| `flux_laman_edges` | Laman graph edge count: 2n - 3 |
| `flux_is_rigid` | Laman rigidity check |
| `flux_holonomy_check` | Holonomy triviality via zero-sum |
| `flux_manhattan_distance` | L1 distance between integer vectors |
| `flux_pythagorean48_encode` | 48-cell lattice index encoding |
| `flux_constraint_check` | Count violated constraints |
| `flux_spline_interpolate` | Linear interpolation along control points |
| `flux_deadband_filter` | Deadband noise filter |
## Building
```bash
cargo build --release
```
This generates `include/flux_ffi.h` via cbindgen and produces both static and shared libraries.
## Using from C
```c
#include "flux_ffi.h"
int64_t norm = flux_eisenstein_norm(2, 3); // = 7
```
## Running Tests
```bash
cargo test
```
## License
MIT