[][src]Trait lyon_geom::Segment

pub trait Segment: Copy + Sized {
    type Scalar: Scalar;
    pub fn from(&self) -> Point<Self::Scalar>;
pub fn to(&self) -> Point<Self::Scalar>;
pub fn sample(&self, t: Self::Scalar) -> Point<Self::Scalar>;
pub fn derivative(&self, t: Self::Scalar) -> Vector<Self::Scalar>;
pub fn split(&self, t: Self::Scalar) -> (Self, Self);
pub fn before_split(&self, t: Self::Scalar) -> Self;
pub fn after_split(&self, t: Self::Scalar) -> Self;
pub fn split_range(&self, t_range: Range<Self::Scalar>) -> Self;
pub fn flip(&self) -> Self;
pub fn approximate_length(&self, tolerance: Self::Scalar) -> Self::Scalar; pub fn x(&self, t: Self::Scalar) -> Self::Scalar { ... }
pub fn y(&self, t: Self::Scalar) -> Self::Scalar { ... }
pub fn dx(&self, t: Self::Scalar) -> Self::Scalar { ... }
pub fn dy(&self, t: Self::Scalar) -> Self::Scalar { ... } }

Common APIs to segment types.

Associated Types

Loading content...

Required methods

pub fn from(&self) -> Point<Self::Scalar>[src]

Start of the curve.

pub fn to(&self) -> Point<Self::Scalar>[src]

End of the curve.

pub fn sample(&self, t: Self::Scalar) -> Point<Self::Scalar>[src]

Sample the curve at t (expecting t between 0 and 1).

pub fn derivative(&self, t: Self::Scalar) -> Vector<Self::Scalar>[src]

Sample the derivative at t (expecting t between 0 and 1).

pub fn split(&self, t: Self::Scalar) -> (Self, Self)[src]

Split this curve into two sub-curves.

pub fn before_split(&self, t: Self::Scalar) -> Self[src]

Return the curve before the split point.

pub fn after_split(&self, t: Self::Scalar) -> Self[src]

Return the curve after the split point.

pub fn split_range(&self, t_range: Range<Self::Scalar>) -> Self[src]

Return the curve inside a given range of t.

This is equivalent splitting at the range's end points.

pub fn flip(&self) -> Self[src]

Swap the direction of the segment.

pub fn approximate_length(&self, tolerance: Self::Scalar) -> Self::Scalar[src]

Compute the length of the segment using a flattened approximation.

Loading content...

Provided methods

pub fn x(&self, t: Self::Scalar) -> Self::Scalar[src]

Sample x at t (expecting t between 0 and 1).

pub fn y(&self, t: Self::Scalar) -> Self::Scalar[src]

Sample y at t (expecting t between 0 and 1).

pub fn dx(&self, t: Self::Scalar) -> Self::Scalar[src]

Sample x derivative at t (expecting t between 0 and 1).

pub fn dy(&self, t: Self::Scalar) -> Self::Scalar[src]

Sample y derivative at t (expecting t between 0 and 1).

Loading content...

Implementors

impl<S: Scalar> Segment for Arc<S>[src]

type Scalar = S

impl<S: Scalar> Segment for CubicBezierSegment<S>[src]

type Scalar = S

impl<S: Scalar> Segment for LineSegment<S>[src]

type Scalar = S

impl<S: Scalar> Segment for QuadraticBezierSegment<S>[src]

type Scalar = S

impl<T: Segment> Segment for Monotonic<T>[src]

type Scalar = T::Scalar

Loading content...