High-performance library for creating, evaluating, and manipulating NURBS and Bézier curves. A pure Rust computational core (core_rust) provides memory-safe geometry algorithms; a Python extension (ferrispline) exposes them through PyO3 and Maturin.
The sole public API is ferrispline.PyModel: a multi-curve store with stable string IDs and dirty-flag invalidation for downstream consumers.
Implemented
- Multi-curve store with UUID-based IDs (
curve-<uuid>) - Bézier curve evaluation (Bernstein basis), subdivision (De Casteljau), degree elevation
- NURBS/B-spline evaluation (Cox–De Boor, rational weighting)
- NURBS → Bézier segment extraction (Boehm knot-insertion matrix)
- Per-curve dirty tracking (
is_dirty) for cache invalidation - Zero-copy NumPy output on evaluation (
IntoPyArray)
In progress
- Knot insertion and removal on NURBS curves
- Spline control-point mutation and degree change
- Bézier → NURBS conversion
clear_dirtyPython binding (available in Rust, not yet exposed)
cd python
maturin developimport numpy as np
import ferrispline
model = ferrispline.PyModel()
cp = np.array([[0.0, 0.0, 0.0], [1.0, 1.0, 0.0], [2.0, 0.0, 0.0]], dtype=np.float64)
curve_id = model.create_bezier(2, cp)
assert model.is_dirty(curve_id)
points = model.evaluate(curve_id, 50) # shape (50, 3)- Rust toolchain (2024 edition)
- Python 3.8 or higher (the Makefile prefers
python3.14when available) - Maturin
For the sandbox visualisation environment, OpenGL libraries are required (libgl1 on Debian/Ubuntu).
cd python
maturin developmake buildThis creates sandbox_python/.venv, compiles a release wheel with Maturin, and installs it into the venv.
make testRuns cargo test (Rust core) and pytest sandbox_python/tests (Python sandbox).
Other Makefile targets: make venv, make run <file.vtk> [samples], make clean, make rebuild.
ferrispline/
├── Cargo.toml # Workspace: core_rust, python
├── core_rust/ # Pure Rust geometry engine
│ └── src/
│ ├── model.rs # Multi-curve store, dirty tracking
│ ├── ids.rs # CurveId, ControlPointId
│ └── geometry/ # bezier/, spline/
├── python/ # PyO3 bindings → import ferrispline
│ ├── pyproject.toml # Maturin configuration
│ └── src/
│ ├── lib.rs # Module entry point
│ └── model.rs # PyModel
├── sandbox_python/ # Reference Python impl + VTK demos
│ ├── src/nurbs_math/
│ └── tests/
├── docs/
│ └── technical_reference_v1.md
├── Makefile
├── Dockerfile
└── CONTRIBUTING.md
- Technical Reference V1 — architecture, API, dirty invalidation, CI/CD
- Contributing — development workflow and quality gates
Build a development image:
BRANCH_SLUG="$(git rev-parse --abbrev-ref HEAD | sed 's/[^a-zA-Z0-9._-]/-/g')"
docker build --build-arg USER="${USER}" \
--network=host \
--tag "ghcr.io/LIHPC-Computational-Geometry/ferrispline:${BRANCH_SLUG}" \
--target dev .The latest Docker target is used by CI; the dev target adds an interactive shell with Rust and Python tooling.
Licensed under either of:
- Apache License, Version 2.0 (LICENSE-APACHE)
- MIT License (LICENSE-MIT)
at your option.