15 releases (breaking)

0.11.0 Jan 19, 2025
0.9.2 Jan 8, 2025
0.6.1 Oct 28, 2016
0.6.0 Jul 22, 2016
0.2.0 Aug 30, 2015

#70 in Visualization

Download history 5/week @ 2024-11-04 7/week @ 2024-12-09 83/week @ 2024-12-30 799/week @ 2025-01-06 144/week @ 2025-01-13 50/week @ 2025-01-20 14/week @ 2025-01-27

1,090 downloads per month

Apache-2.0 OR MIT

24KB
607 lines

Curve Package Documentation Build

The package provides curves.

Examples

Trace a Bézier curve:

use curve::bezier::Linear;
use curve::Trace;

let curve = (Linear::new(1.0, 5.0), Linear::new(2.0, 3.0));
let points = Trace::new(curve, 3).collect::<Vec<_>>();
assert_eq!(points, vec![(1.0, 2.0), (3.0, 2.5), (5.0, 3.0)]);

Approximate a cubic Bézier curve with a sequence of quadratic:

use curve::bezier::goodness::CrudeIndependentAbsolute;
use curve::bezier::Cubic;
use curve::Approximation;

let goodness = CrudeIndependentAbsolute::new(1.0, f64::MAX, usize::MAX);
let cubic = (Cubic::new(0.0, 0.0, 90.0, 100.0), Cubic::new(0.0, 50.0, 0.0, 0.0));
let quadratics = Approximation::new(cubic, goodness).collect::<Vec<_>>();
assert_eq!(quadratics.len(), 4);

Contribution

Your contribution is highly appreciated. Do not hesitate to open an issue or a pull request. Note that any contribution submitted for inclusion in the project will be licensed according to the terms given in LICENSE.md.

Dependencies

~150KB