Module flo_curves::bezier
source · Expand description
Routines for describing, querying and manipulating Bezier curves
Bezier curves are described by types that implement the BezierCurve
trait, as a start point, an end point
and two control points. The Curve
type is provided as a base implementation but as with the other traits,
the primary trait can be implemented on any suitable data structure. BezierCurveFactory
is provided for
types that can create new instances of themselves.
Even for types that don’t support the factory method, the section()
method can be used to represent curve
subsections efficiently.
The fit_curve()
function provides a way to fit a series of Bezier curves to one or more points using a
least-mean-squared algorithm.
The various curve_intersects_X()
functions provide ways to determine where a curve meets another kind
of object.
Re-exports
pub use super::geo::*;
Modules
Manipulates multiple Bezier curves joined into a path
Structs
Represents a Bezier curve
Represents a subsection of a bezier curve
A structure that can be used to compute the tangent of a bezier curve
Traits
Trait implemented by things representing a cubic bezier curve
Trait implemented by bezier curves that can create new versions of themselves
Trait implemented by curves that can have sections taken from them
Trait implemented by bezier curves where we can compute the normal
Changes a point and its tangent into a normal
Functions
The cubic bezier weighted basis function
Computes the bezier coefficients (A, B, C, D) for a bezier curve
Finds the upper and lower points in a cubic curve’s bounding box
Determines the points at which two curves intersect using the Bezier clipping
algorihtm
Find the t values where a curve intersects a line
Find the t values where a curve intersects a ray
de Casteljau’s algorithm for lines
de Casteljau’s algorithm for quadratic bezier curves
de Casteljau’s algorithm for cubic bezier curves
Returns the 3rd derivative of a cubic bezier curve (2nd of a quadratic)
Returns the 1st derivative of a quadratic bezier curve (or the 2nd derivative of a cubic curve)
Returns the 1st derivative of a cubic bezier curve
Finds the t values of the extremities of a curve (these are the points at which
the x or y value is at a minimum or maximum)
Creates a bezier curve that fits a set of points with a particular error
Fits a bezier curve to a subset of points
Moves the point at ‘t’ on the curve by the offset vector
Computes a series of curves that approximate an offset curve from the specified origin curve.
If
curve2
overlaps curve1
, returns two sets of t
values (those for curve1
and those for curve2
)Performs a subdivision search on a curve for a point matching a function
Solves for t in a single dimension for a bezier curve (finds the point(s) where the basis
function evaluates to p)
Given a point that is close to or on the specified bezier curve, solves the ‘t’ value that can
be used to retrieve it
Subdivides a cubic bezier curve at a particular point, returning the weights of
the two component curves