Registry / ai-ml / rust-nurbs

rust-nurbs

JSON →
library0.28.0pypypi✓ verified 80d ago

A Python API for evaluation of Non-Uniform Rational B-Splines (NURBS) curves and surfaces, implemented in Rust for performance. Current version: 0.28.0. Released approximately every few months.

pip install rust-nurbs
INSTALL
IMPORT
SIG · RUST-NURBS
R
rust-nurbs
ai-mlpythonv0.28.0
harness data pending
Install & Compatibility
Where this runs

No compatibility data collected yet for this library.

Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

bernstein_poly
from rust_nurbs import bernstein_poly
from rust_nurbs import NurbsCurve
bezier_curve_eval
from rust_nurbs import bezier_curve_eval
from rust_nurbs import NurbsCurve
bezier_surf_d2sdu2
from rust_nurbs import bezier_surf_d2sdu2
from rust_nurbs import NurbsCurve

Create a NURBS curve, evaluate at a parameter.

from rust_nurbs import NurbsCurve import numpy as np # Define control points (4 points, 3D) control_points = np.array([[0.0, 0.0, 0.0], [1.0, 2.0, 0.0], [3.0, 3.0, 0.0], [4.0, 0.0, 0.0]]) # Create a degree 3 NURBS curve with uniform knot vector and weights curve = NurbsCurve(control_points, degree=3) # Evaluate at parameter u=0.5 point = curve.evaluate(0.5) print(point)
Debug
Known issues
gotchaAll input arrays (control_points, knots, weights) must be of type float (e.g., numpy float64). Integer arrays cause silent type coercion errors.
fix
Ensure control_points etc. are created with dtype=np.float64 or cast via .astype(float).
affects: <=0.28.0
gotchaThe evaluate method expects a single float or array-like of floats. Passing a Python list may work but using numpy array is recommended for performance.
fix
Use np.linspace(0,1,100) for multiple evaluations.
affects: <=0.28.0
gotchaKnot vector must be non-decreasing. If you supply a custom knot vector with duplicate knots at ends, ensure it is strictly non-decreasing. Errors are not descriptive.
fix
Check knot_vector[i+1] >= knot_vector[i]. Use np.sort if needed.
affects: <=0.28.0
Upgrade
Version history
0.28.0latest on PyPI · released Mar 19, 2025
Audit
Dependencies

No dependency data recorded yet.

Agent activity
25 hits · last 30 days
node
24
OpenAI (training)
1
Resources