Skip to content
Projects

mattatz/curvo has 219 GitHub stars and 14 forks. GitHot measured 0 stars in 24 hours. Last checked 2026-11-15 23:59 UTC. Last push 2026-10-19.

How these counts are measured

Measured star growth

in 24h
0
in 7 days
Collecting history
in 15 days
Collecting history
in 1 month
Collecting history

Net star changes over overlapping periods, not daily totals. Missing measurements are left blank. Stars measure attention, not software quality.

About

NURBS curve / surface modeling library for Rust.

Creative & Media

README.md

Original

Curvo

License Crates.io Docs Test

Curvo is a NURBS curve / surface modeling library for Rust.

Visualization on bevy Visualization on Bevy

This library enables not only the creation of NURBS curves from control points, knot vectors, and weights associated with each control point, but also supports generating curves that precisely pass through the given control points and creating periodic curves. Additionally, it allows for the construction of NURBS surfaces through operations such as extruding and lofting based on NURBS curves as inputs.

The modeling operations for NURBS surfaces supported by this library currently include the following:

  • Extrude
  • Loft
  • Sweep
  • Revolve
Sweep the profile curve along the rail curve to create a surfaceRevolve the profile curve around an z-axis by PI radians to create a NURBS surface

The supported features also include finding the closest point on NURBS curves, finding intersections between two NURBS curves, and dividing based on arc length.

Find closest point on the NURBS curveDivide the NURBS curve based on arc lengthFind intersection points between two NURBS curves

Additional features

Boolean operations between NURBS curvesSmooth periodic points interpolation with knot stylesCurvature of a NURBS curveDiscontinuity of a NURBS curveEllipse arc generationIso-curves on a surfaceClosest point on a surfaceSplit a surfaceCurve plane intersectionSurface & curve intersectionsTrimmed surfaceOffset curveFillet curve

Usage

use curvo::prelude::*;
use nalgebra::{Point3, Rotation3, Translation3, Vector3};
use std::f64::consts::FRAC_PI_2;

fn main() {
  // Create a set of points to interpolate
  let points = vec![
      Point3::new(-1.0, -1.0, 0.),
      Point3::new(1.0, -1.0, 0.),
      Point3::new(1.0, 1.0, 0.),
      Point3::new(-1.0, 1.0, 0.),
      Point3::new(-1.0, 2.0, 0.),
      Point3::new(1.0, 2.5, 0.),
  ];

  // Create a NURBS curve that interpolates the given points with degree 3
  // You can also specify the precision of the curve by generic type (f32 or f64)
  let interpolated = NurbsCurve3D::<f64>::interpolate(&points, 3).unwrap();

  // NURBS curve & surface can be transformed by nalgebra's matrix
  let rotation = Rotation3::from_axis_angle(&Vector3::z_axis(), FRAC_PI_2);
  let translation = Translation3::new(0., 0., 3.);
  let transform_matrix = translation * rotation; // nalgebra::Isometry3

  // Transform the curve by the given matrix (nalgebra::Isometry3 into nalgebra::Matrix4)
  let offsetted = interpolated.transformed(&transform_matrix.into());

  // Create a NURBS surface by lofting two NURBS curves
  let lofted = NurbsSurface::try_loft(
    &[interpolated, offsetted],
    Some(3), // degree of v direction
  ).unwrap();

  // Tessellate the surface in adaptive manner about curvature for efficient rendering
  let option = AdaptiveTessellationOptions::default().with_norm_tolerance(1e-4);
  let tessellation = lofted.tessellate(Some(option));
}

Dependencies

  • nalgebra: this library heavily relies on nalgebra, a linear algebra library, to perform its computations.

References

Feature development sponsored by VUILD Inc.

The NURBS boolean operations feature in this project was developed at the request of VUILD.
They supported the development as a sponsor by funding the feature's implementation.