neco-nurbs
2D and 3D rational NURBS curves, surfaces, and regions for CAD boundaries, profile geometry, and exact smooth-curve work.
A Japanese mathematical note is available in MATH-ja.md.
Curve and region operations
NurbsCurve2D represents weighted B-spline curves and supports validation, evaluation, sampling, knot insertion, Bezier decomposition, and splitting. Rational circles are provided out of the box, so exact circular profiles can stay analytic.
NurbsRegion groups piecewise closed curves into an outer boundary plus optional holes. It works well for 2D CAD domains and as input to meshing or B-Rep construction.
Usage
Create and evaluate a curve
use NurbsCurve2D;
let curve = new;
curve.validate.unwrap;
let point = curve.evaluate;
Sample and refine a curve
let uniform = curve.sample;
let adaptive = curve.adaptive_sample;
let refined = curve.insert_knot;
let = refined.split_at;
# let _ = ;
Build a region
use ;
let region = NurbsRegion ;
let points = region.outer_adaptive_sample;
# let _ = points;
API
| Item | Description |
|---|---|
NurbsCurve2D |
Rational 2D NURBS curve |
NurbsCurve3D / NurbsSurface3D |
Rational 3D NURBS curve and surface types |
NurbsCurve2D::new / new_rational |
Construct non-rational or rational curves |
NurbsCurve2D::circle |
Create an exact circle |
validate / evaluate |
Check consistency and evaluate a point |
sample / adaptive_sample / evaluate_samples |
Uniform, adaptive, and batched evaluation |
insert_knot / split_at / split_at_params |
Refine or split a curve |
to_bezier_spans / reverse / bounding_box / is_closed |
Curve utilities |
NurbsRegion |
Outer boundary plus optional holes |
NurbsRegion::outer_adaptive_sample |
Sample region boundaries for downstream use |
fit_nurbs_curve(...) |
Optional nalgebra-backed curve fitting utility (fitting) |
Optional features
| Feature | Description |
|---|---|
polynomial-highorder |
Enable nalgebra-backed high-order polynomial routines |
fitting |
Enables nalgebra-backed curve fitting utilities |
License
MIT