[][src]Enum beziercurve_wkt::BezierCurveItem

pub enum BezierCurveItem {
    Line(Line),
    QuadraticCurve(QuadraticCurve),
    CubicCurve(CubicCurve),
}

Variants

Line(Line)
QuadraticCurve(QuadraticCurve)
CubicCurve(CubicCurve)

Methods

impl BezierCurveItem[src]

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

Returns the start point of the curve

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

Returns the end point of the curve

pub fn from_str(s: &str) -> Result<Self, ParseError>[src]

Parses the BezierCurveItem from a string

let parsed1 = BezierCurveItem::from_str("(0.0 1.0, 2.0 1.0)").unwrap();
assert_eq!(parsed1, Line((Point { x: 0.0, y: 1.0 }, Point { x: 2.0, y: 1.0 })));

let parsed2 = BezierCurveItem::from_str("(0.0 1.0, 2.0 1.0, 3.0 4.0)").unwrap();
assert_eq!(parsed2, QuadraticCurve((Point { x: 0.0, y: 1.0 }, Point { x: 2.0, y: 1.0 }, Point { x: 3.0, y: 4.0 })));

pub fn get_max_x(&self) -> f64[src]

Returns the x

max value of the BezierCurveItem - useful for calculating bounding boxes

pub fn get_min_x(&self) -> f64[src]

Returns the x

min value of the BezierCurveItem - useful for calculating bounding boxes

pub fn get_max_y(&self) -> f64[src]

Returns the y

max value of the BezierCurveItem - useful for calculating bounding boxes

pub fn get_min_y(&self) -> f64[src]

Returns the y

min value of the BezierCurveItem - useful for calculating bounding boxes

pub fn get_bbox(&self) -> Bbox[src]

Returns the bounding box of this item

pub fn intersect(&self, curve: &Self) -> IntersectionResult[src]

Returns the intersection of two items (line-curve, curve-curve or line-line intersection).

Warning: calling this function is expensive, it's recommended to cull items that don't intersect first by intersecting their bounding boxes.

pub fn normal(&self, t: f64) -> BezierNormalVector[src]

Returns the normal of the curve / line at t

pub fn split_at(&self, t: f64) -> (Self, Self)[src]

Splits the curve / line into two curves / lines

Trait Implementations

impl Clone for BezierCurveItem[src]

impl Copy for BezierCurveItem[src]

impl Debug for BezierCurveItem[src]

impl Display for BezierCurveItem[src]

impl PartialEq<BezierCurveItem> for BezierCurveItem[src]

impl PartialOrd<BezierCurveItem> for BezierCurveItem[src]

impl StructuralPartialEq for BezierCurveItem[src]

Auto Trait Implementations

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.