[][src]Module flo_curves::bezier

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

path

Manipulates multiple Bezier curves joined into a path

Structs

Curve

Represents a Bezier curve

CurveSection

Represents a subsection of a bezier curve

Tangent

A structure that can be used to compute the tangent of a bezier curve

Enums

CurveCategory

Possible types of a two-dimensional cubic bezier curve

CurveFeatures

Describes the features of a two-dimensional cubic bezier curve

Traits

BezierCurve

Trait implemented by things representing a cubic bezier curve

BezierCurve2D

Functions supported on 2D bezier curves

BezierCurveFactory

Trait implemented by bezier curves that can create new versions of themselves

NormalCurve

Trait implemented by bezier curves where we can compute the normal

Normalize

Changes a point and its tangent into a normal

Functions

basis

The cubic bezier weighted basis function

bezier_coefficients

Computes the bezier coefficients (A, B, C, D) for a bezier curve

bounding_box4

Finds the upper and lower points in a cubic curve's bounding box

characterize_cubic_bezier

Determines the characteristics of a particular bezier curve: whether or not it is an arch, or changes directions (has inflection points), or self-intersects (has a loop)

characterize_curve

Discovers the 'character' of a particular bezier curve, returning a value indicating what kinds of features it has (for example, whether it has a loop or a cusp)

curve_intersects_curve_clip

Determines the points at which two curves intersect using the Bezier clipping algorihtm

curve_intersects_line

Find the t values where a curve intersects a line

curve_intersects_ray

Find the t values where a curve intersects a ray

de_casteljau2

de Casteljau's algorithm for lines

de_casteljau3

de Casteljau's algorithm for quadratic bezier curves

de_casteljau4

de Casteljau's algorithm for cubic bezier curves

derivative2

Returns the 3rd derivative of a cubic bezier curve (2nd of a quadratic)

derivative3

Returns the 1st derivative of a quadratic bezier curve (or the 2nd derivative of a cubic curve)

derivative4

Returns the 1st derivative of a cubic bezier curve

features_for_cubic_bezier

Determines the characteristics of a paritcular bezier curve: whether or not it is an arch, or changes directions (has inflection points), or self-intersects (has a loop)

features_for_curve

Discovers what kind of features a curve has and where they are located

find_extremities

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)

find_self_intersection_point

If a cubic curve contains a loop, finds the t values where the curve self-intersects

fit_curve

Creates a bezier curve that fits a set of points with a particular error

fit_curve_cubic

Fits a bezier curve to a subset of points

move_point

Moves the point at 't' on the curve by the offset vector

offset

Computes a series of curves that approximate an offset curve from the specified origin curve.

overlapping_region

If curve2 overlaps curve1, returns two sets of t values (those for curve1 and those for curve2)

search_bounds4

Performs a subdivision search on a curve for a point matching a function

solve_basis_for_t

Solves for t in a single dimension for a bezier curve (finds the point(s) where the basis function evaluates to p)

solve_curve_for_t

Given a point that is close to or on the specified bezier curve, solves the 't' value that can be used to retrieve it

subdivide4

Subdivides a cubic bezier curve at a particular point, returning the weights of the two component curves