Trait rasterize::Curve [−][src]
pub trait Curve: Into<Segment> {
Show 17 methods
fn flatness(&self) -> Scalar;
fn transform(&self, tr: Transform) -> Self;
fn start(&self) -> Point;
fn end(&self) -> Point;
fn at(&self, t: Scalar) -> Point;
fn split_at(&self, t: Scalar) -> (Self, Self);
fn cut(&self, a: Scalar, b: Scalar) -> Self;
fn bbox(&self, init: Option<BBox>) -> BBox;
fn offset(&self, dist: Scalar, out: &mut impl Extend<Segment>);
fn deriv(&self) -> Segment;
fn reverse(&self) -> Self;
fn roots(&self) -> CurveRoots;
fn extremities(&self) -> CurveExtremities;
fn length(&self, t0: Scalar, t1: Scalar) -> Scalar;
fn flatten(&self, tr: Transform, flatness: Scalar) -> CurveFlattenIterⓘNotable traits for CurveFlattenIterimpl Iterator for CurveFlattenIter type Item = Line; { ... }
fn split(&self) -> (Self, Self) { ... }
fn from_length(&self, l: Scalar, error: Option<Scalar>) -> Scalar { ... }
}Expand description
Set of operations common to all bezier curves.
Required methods
Correspond to maximum diviation of the curve from the straight line
f = max |curve(t) - line(curve_start, curve_end)(t)|. This function
actually returns 16.0 * f^2 to avoid unneeded division and square root.
Create subcurve specified starting at parameter value a and ending at value b
Extend provided init bounding box with the bounding box of the curve
Offset the curve by distance dist, result is inserted into out container
Identical curve but directed from end to start, instead of start to end.
fn roots(&self) -> CurveRoots
fn roots(&self) -> CurveRoots
Find roots of the equation curve(t)_y = 0. Values of the parameter at which curve
crosses y axis.
fn extremities(&self) -> CurveExtremities
fn extremities(&self) -> CurveExtremities
Find all extermities of the curve curve'(t)_x = 0 || curve'(t)_y = 0
Provided methods
fn flatten(&self, tr: Transform, flatness: Scalar) -> CurveFlattenIterⓘNotable traits for CurveFlattenIterimpl Iterator for CurveFlattenIter type Item = Line;
fn flatten(&self, tr: Transform, flatness: Scalar) -> CurveFlattenIterⓘNotable traits for CurveFlattenIterimpl Iterator for CurveFlattenIter type Item = Line;
impl Iterator for CurveFlattenIter type Item = Line;Convert curve to an iterator over line segments with desired flatness
Find value of parameter t given desired l length of the segment
This method is not particulary fast, parmeter value is found by solving
f(t) = self.length(0.0, t) - l == 0 using Newton’s method with fallback
to bisection if next iteration will produce out of bound value.
Reference: https://www.geometrictools.com/Documentation/MovingAlongCurveSpecifiedSpeed.pdf