prime-splines 1.1.1

Spline math — Bezier, Catmull-Rom, B-spline, slerp
Documentation
  • Coverage
  • 100%
    16 out of 16 items documented15 out of 15 items with examples
  • Size
  • Source code size: 34.95 kB This is the summed size of all the files inside the crates.io package for this release.
  • Documentation size: 2.07 MB This is the summed size of all files generated by rustdoc for all configured targets
  • Ø build duration
  • this release: 35s Average build duration of successful builds.
  • all releases: 45s Average build duration of successful builds in releases after 2024-10-23.
  • Links
  • bwyard/prime
    1 0 3
  • crates.io
  • Dependencies
  • Versions
  • Owners
  • bwyard

prime-splines

Spline math — Bezier (quadratic, cubic), Hermite, Catmull-Rom, B-spline, slerp, arc length, and uniform-speed parameterization. Scalar and 3D variants.

Part of the prime math ecosystem.

What's inside

  • bezier_quadratic / bezier_cubic — Bezier curves (scalar + 3D)
  • hermite / hermite_3d — Hermite interpolation with tangents
  • catmull_rom / catmull_rom_3d — smooth pass-through splines
  • b_spline_cubic / b_spline_cubic_3d — B-spline curves
  • slerp — spherical linear interpolation for rotations
  • bezier_cubic_arc_length — arc length approximation
  • bezier_cubic_t_at_length — uniform-speed parameterization

Usage

use prime_splines::{catmull_rom_3d, slerp, bezier_cubic_t_at_length_3d};
use glam::Vec3;

// Smooth path through control points
let pos = catmull_rom_3d(t, p0, p1, p2, p3);

// Spherical interpolation between directions
let dir = slerp(from, to, t);

// Move at constant speed along a bezier
let uniform_t = bezier_cubic_t_at_length_3d(p0, p1, p2, p3, target_length, 64);

License

MIT