[][src]Trait lyon_geom::Segment

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

Common APIs to segment types.

Associated Types

type Scalar: Scalar

Loading content...

Required methods

fn from(&self) -> Point<Self::Scalar>

Start of the curve.

fn to(&self) -> Point<Self::Scalar>

End of the curve.

fn sample(&self, t: Self::Scalar) -> Point<Self::Scalar>

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

fn derivative(&self, t: Self::Scalar) -> Vector<Self::Scalar>

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

fn split(&self, t: Self::Scalar) -> (Self, Self)

Split this curve into two sub-curves.

fn before_split(&self, t: Self::Scalar) -> Self

Return the curve before the split point.

fn after_split(&self, t: Self::Scalar) -> Self

Return the curve after the split point.

fn split_range(&self, t_range: Range<Self::Scalar>) -> Self

Return the curve inside a given range of t.

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

fn flip(&self) -> Self

Swap the direction of the segment.

fn approximate_length(&self, tolerance: Self::Scalar) -> Self::Scalar

Compute the length of the segment using a flattened approximation.

Loading content...

Provided methods

fn x(&self, t: Self::Scalar) -> Self::Scalar

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

fn y(&self, t: Self::Scalar) -> Self::Scalar

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

fn dx(&self, t: Self::Scalar) -> Self::Scalar

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

fn dy(&self, t: Self::Scalar) -> Self::Scalar

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 QuadraticBezierSegment<S>[src]

type Scalar = S

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

type Scalar = S

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

type Scalar = T::Scalar

Loading content...