[]Struct piet_common::kurbo::QuadBez

pub struct QuadBez {
    pub p0: Point,
    pub p1: Point,
    pub p2: Point,
}

A single quadratic Bézier segment.

Fields

p0: Pointp1: Pointp2: Point

Methods

impl QuadBez

pub fn new<V>(p0: V, p1: V, p2: V) -> QuadBez where
    V: Into<Point>, 

Create a new quadratic Bézier segment.

pub fn raise(&self) -> CubicBez

Raise the order by 1.

Returns a cubic Bézier segment that exactly represents this quadratic.

Trait Implementations

impl ParamCurveArclen for QuadBez

fn arclen(&self, _accuracy: f64) -> f64

Arclength of a quadratic Bézier segment.

This computation is based on an analytical formula. Since that formula suffers from numerical instability when the curve is very close to a straight line, we detect that case and fall back to Legendre-Gauss quadrature.

Accuracy should be better than 1e-13 over the entire range.

Adapted from http://www.malczak.linuxpl.com/blog/quadratic-bezier-curve-length/ with permission.

fn inv_arclen(&self, arclen: f64, accuracy: f64) -> f64

Solve for the parameter that has the given arclength from the start. Read more

impl Copy for QuadBez

impl Mul<QuadBez> for Affine

type Output = QuadBez

The resulting type after applying the * operator.

impl ParamCurveNearest for QuadBez

fn nearest(&self, p: Point, _accuracy: f64) -> (f64, f64)

Find nearest point, using analytical algorithm based on cubic root finding.

impl Clone for QuadBez

fn clone_from(&mut self, source: &Self)1.0.0[src]

Performs copy-assignment from source. Read more

impl Debug for QuadBez

impl ParamCurveCurvature for QuadBez

fn curvature(&self, t: f64) -> f64

Compute the signed curvature at parameter t.

impl ParamCurveExtrema for QuadBez

fn extrema_ranges(&self) -> ArrayVec<[Range<f64>; 5]>

Return parameter ranges, each of which is monotonic within the range.

fn bounding_box(&self) -> Rect

The smallest rectangle that encloses the curve in the range (0..1).

impl ParamCurveDeriv for QuadBez

type DerivResult = Line

fn gauss_arclen(&self, coeffs: &[(f64, f64)]) -> f64

Estimate arclength using Gaussian quadrature. Read more

impl ParamCurve for QuadBez

fn subdivide(&self) -> (QuadBez, QuadBez)

Subdivide into halves, using de Casteljau.

impl ParamCurveArea for QuadBez

Auto Trait Implementations

impl Send for QuadBez

impl Unpin for QuadBez

impl Sync for QuadBez

impl UnwindSafe for QuadBez

impl RefUnwindSafe for QuadBez

Blanket Implementations

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> RoundFrom<T> for T[src]

impl<T, U> RoundInto<U> for T where
    U: RoundFrom<T>, 
[src]