toml
flo_curves = "0.2"
flo_curves
is a library providing routines for manipulating various types of curve, particularly Bezier curves. It provides
a grab-bag of algorithms, from the basis functions for generating points on a curve to collisions, fitting to points and even
path arithmetic. It is built around traits, which makes it easy to use the provided algorithms with any data structure, though
some defaults are provided.
flo_curves
is designed as a support library for flowbetween
, an animation tool I'm working on, but is also designed to work
stand-alone.
Creating a curve:
```Rust use flocurves::*; use flocurves::bezier;
let curve = bezier::Curve::from_points(Coord2(1.0, 2.0), (Coord2(2.0, 0.0), Coord2(3.0, 5.0)), Coord2(4.0, 2.0)); ```
Finding a point on a curve:
```Rust use flo_curves::bezier;
let pos = curve.pointatpos(0.5); ```
Intersections:
```Rust use flo_curves::bezier;
for (t1, t2) in bezier::curveintersectscurveclip(curve1, curve2) { let pos = curve1.pointat_pos(t1); println!("Intersection, curve1 t: {}, curve2 t: {}, position: {}, {}", t1, t2, pos.x(), pos.y()); } ```
Creating a path:
```Rust use flocurves::bezier; use flocurves::bezier::path::*;
let rectangle1 = BezierPathBuilder::
Path artihmetic:
```Rust use flo_curves::bezier::path::*;
let rectanglewithhole = path_sub::<_,_,_, SimpleBezierPath>(&vec![rectangle], &vec![circle]) ```