Struct rasterize::Quad[][src]

pub struct Quad(pub [Point; 3]);

Quadratic bezier curve

Polynimial form: (1 - t) ^ 2 * p0 + 2 * (1 - t) * t * p1 + t ^ 2 * p2 Matrix from:

            ┌          ┐ ┌    ┐
┌         ┐ │  1  0  0 │ │ p0 │
│ 1 t t^2 │ │ -2  2  0 │ │ p1 │
└         ┘ │  1 -2  1 │ │ p2 │
            └          ┘ └    ┘

Implementations

impl Quad[src]

pub fn new(
    p0: impl Into<Point>,
    p1: impl Into<Point>,
    p2: impl Into<Point>
) -> Self
[src]

Create new quadratic bezier curve

pub fn points(&self) -> [Point; 3][src]

Points defining quadratic bezier curve

pub fn ends(&self) -> (Line, Line)[src]

Tanget lines at the ends of the quadratic bezier curve

pub fn smooth(&self) -> Point[src]

Find smooth point used by SVG parser

Trait Implementations

impl Clone for Quad[src]

impl Copy for Quad[src]

impl Curve for Quad[src]

fn flatness(&self) -> Scalar[src]

Flattness criteria for the cubic curve

It is equal to f = max d(t) where d(t) = |q(t) - l(t)|, l(t) = (1 - t) * p0 + t * p2 for q(t) bezier2 curve with p{0..2} control points, in other words maximum distance from parametric line to bezier2 curve for the same parameter t.

Line can be represented as bezier2 curve, if p1 = (p0 + p2) / 2.0. Grouping polynomial coofficients:

    q(t) = t^2 p2 + 2 (1 - t) t p1 + (1 - t)^2 p0
    l(t) = t^2 p2 + (1 - t) t (p0 + p2) + (1 - t)^2 p0
    d(t) = |q(t) - l(t)| = (1 - t) t |2 * p1 - p0 - p2|
    f    = 1 / 4 * | 2 p1 - p0 - p2 |
    f^2  = 1/16 |2 * p1 - p0 - p2|^2

fn split(&self) -> (Self, Self)[src]

Optimized version of split_at(0.5)

impl Debug for Quad[src]

impl Display for Quad[src]

impl From<Quad> for Cubic[src]

impl From<Quad> for Segment[src]

impl FromStr for Quad[src]

type Err = SvgPathParserError

The associated error which can be returned from parsing.

impl PartialEq<Quad> for Quad[src]

impl StructuralPartialEq for Quad[src]

Auto Trait Implementations

impl RefUnwindSafe for Quad

impl Send for Quad

impl Sync for Quad

impl Unpin for Quad

impl UnwindSafe for Quad

Blanket Implementations

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

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

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

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

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

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

type Owned = T

The resulting type after obtaining ownership.

impl<T> ToString for T where
    T: Display + ?Sized
[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.