[][src]Struct lyon_geom::cubic_bezier::CubicBezierSegment

pub struct CubicBezierSegment<S> {
    pub from: Point<S>,
    pub ctrl1: Point<S>,
    pub ctrl2: Point<S>,
    pub to: Point<S>,
}

A 2d curve segment defined by four points: the beginning of the segment, two control points and the end of the segment.

The curve is defined by equation:² ∀ t ∈ [0..1], P(t) = (1 - t)³ * from + 3 * (1 - t)² * t * ctrl1 + 3 * t² * (1 - t) * ctrl2 + t³ * to

Fields

from: Point<S>ctrl1: Point<S>ctrl2: Point<S>to: Point<S>

Methods

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

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

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

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

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

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

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

pub fn solve_t_for_x(&self, x: S) -> ArrayVec<[S; 3]>[src]

Return the parameter values corresponding to a given x coordinate. See also solve_t_for_x for monotonic curves.

pub fn solve_t_for_y(&self, y: S) -> ArrayVec<[S; 3]>[src]

Return the parameter values corresponding to a given y coordinate. See also solve_t_for_y for monotonic curves.

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

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

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

Sample the x coordinate of the curve's derivative at t (expecting t between 0 and 1).

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

Sample the y coordinate of the curve's derivative at t (expecting t between 0 and 1).

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

Return the sub-curve inside a given range of t.

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

pub fn split(&self, t: S) -> (CubicBezierSegment<S>, CubicBezierSegment<S>)[src]

Split this curve into two sub-curves.

pub fn before_split(&self, t: S) -> CubicBezierSegment<S>[src]

Return the curve before the split point.

pub fn after_split(&self, t: S) -> CubicBezierSegment<S>[src]

Return the curve after the split point.

pub fn baseline(&self) -> LineSegment<S>[src]

pub fn is_linear(&self, tolerance: S) -> bool[src]

pub fn fat_line(&self) -> (LineEquation<S>, LineEquation<S>)[src]

Computes a "fat line" of this segment.

A fat line is two conservative lines between which the segment is fully contained.

pub fn transform(&self, transform: &Transform2D<S>) -> Self[src]

Applies the transform to this curve and returns the results.

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

Swap the beginning and the end of the segment.

Important traits for Flattened<S>
pub fn flattened(&self, tolerance: S) -> Flattened<S>[src]

Returns the flattened representation of the curve as an iterator, starting after the current point.

pub fn for_each_monotonic_t<F>(&self, cb: F) where
    F: FnMut(S), 
[src]

Invokes a callback between each monotonic part of the segment.

pub fn for_each_monotonic_range<F>(&self, cb: F) where
    F: FnMut(Range<S>), 
[src]

Invokes a callback for each monotonic part of the segment..

pub fn for_each_quadratic_bezier<F>(&self, tolerance: S, cb: &mut F) where
    F: FnMut(&QuadraticBezierSegment<S>), 
[src]

Approximates the cubic bézier curve with sequence of quadratic ones, invoking a callback at each step.

pub fn for_each_monotonic_quadratic<F>(&self, tolerance: S, cb: &mut F) where
    F: FnMut(&Monotonic<QuadraticBezierSegment<S>>), 
[src]

Approximates the cubic bézier curve with sequence of monotonic quadratic ones, invoking a callback at each step.

pub fn for_each_flattened<F: FnMut(Point<S>)>(
    &self,
    tolerance: S,
    call_back: &mut F
)
[src]

Iterates through the curve invoking a callback at each point.

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

Compute the length of the segment using a flattened approximation.

pub fn for_each_inflection_t<F>(&self, cb: &mut F) where
    F: FnMut(S), 
[src]

pub fn for_each_local_x_extremum_t<F>(&self, cb: &mut F) where
    F: FnMut(S), 
[src]

Return local x extrema or None if this curve is monotonic.

This returns the advancements along the curve, not the actual x position.

pub fn for_each_local_y_extremum_t<F>(&self, cb: &mut F) where
    F: FnMut(S), 
[src]

Return local y extrema or None if this curve is monotonic.

This returns the advancements along the curve, not the actual y position.

pub fn y_maximum_t(&self) -> S[src]

Find the advancement of the y-most position in the curve.

This returns the advancement along the curve, not the actual y position.

pub fn y_minimum_t(&self) -> S[src]

Find the advancement of the y-least position in the curve.

This returns the advancement along the curve, not the actual y position.

pub fn x_maximum_t(&self) -> S[src]

Find the advancement of the x-most position in the curve.

This returns the advancement along the curve, not the actual x position.

pub fn x_minimum_t(&self) -> S[src]

Find the x-least position in the curve.

pub fn fast_bounding_rect(&self) -> Rect<S>[src]

Returns a conservative rectangle the curve is contained in.

This method is faster than bounding_rect but more conservative.

pub fn fast_bounding_range_x(&self) -> (S, S)[src]

Returns a conservative range of x this curve is contained in.

pub fn fast_bounding_range_y(&self) -> (S, S)[src]

Returns a conservative range of y this curve is contained in.

pub fn bounding_rect(&self) -> Rect<S>[src]

Returns the smallest rectangle the curve is contained in

pub fn bounding_range_x(&self) -> (S, S)[src]

Returns the smallest range of x this curve is contained in.

pub fn bounding_range_y(&self) -> (S, S)[src]

Returns the smallest range of y this curve is contained in.

pub fn assume_monotonic(&self) -> MonotonicCubicBezierSegment<S>[src]

Cast this curve into a monotonic curve without checking that the monotonicity assumption is correct.

pub fn is_x_monotonic(&self) -> bool[src]

Returns whether this segment is monotonic on the x axis.

pub fn is_y_monotonic(&self) -> bool[src]

Returns whether this segment is monotonic on the y axis.

pub fn is_monotonic(&self) -> bool[src]

Returns whether this segment is fully monotonic.

pub fn cubic_intersections_t(
    &self,
    curve: &CubicBezierSegment<S>
) -> ArrayVec<[(S, S); 9]>
[src]

Computes the intersections (if any) between this segment and another one.

The result is provided in the form of the t parameters of each point along the curves. To get the intersection points, sample the curves at the corresponding values.

Returns endpoint intersections where an endpoint intersects the interior of the other curve, but not endpoint/endpoint intersections.

Returns no intersections if either curve is a point.

pub fn cubic_intersections(
    &self,
    curve: &CubicBezierSegment<S>
) -> ArrayVec<[Point<S>; 9]>
[src]

Computes the intersection points (if any) between this segment and another one.

pub fn quadratic_intersections_t(
    &self,
    curve: &QuadraticBezierSegment<S>
) -> ArrayVec<[(S, S); 9]>
[src]

Computes the intersections (if any) between this segment a quadratic bézier segment.

The result is provided in the form of the t parameters of each point along the curves. To get the intersection points, sample the curves at the corresponding values.

Returns endpoint intersections where an endpoint intersects the interior of the other curve, but not endpoint/endpoint intersections.

Returns no intersections if either curve is a point.

pub fn quadratic_intersections(
    &self,
    curve: &QuadraticBezierSegment<S>
) -> ArrayVec<[Point<S>; 9]>
[src]

Computes the intersection points (if any) between this segment and a quadratic bézier segment.

pub fn line_intersections_t(&self, line: &Line<S>) -> ArrayVec<[S; 3]>[src]

Computes the intersections (if any) between this segment and a line.

The result is provided in the form of the t parameters of each point along curve. To get the intersection points, sample the curve at the corresponding values.

pub fn line_intersections(&self, line: &Line<S>) -> ArrayVec<[Point<S>; 3]>[src]

Computes the intersection points (if any) between this segment and a line.

pub fn line_segment_intersections_t(
    &self,
    segment: &LineSegment<S>
) -> ArrayVec<[(S, S); 3]>
[src]

Computes the intersections (if any) between this segment and a line segment.

The result is provided in the form of the t parameters of each point along curve and segment. To get the intersection points, sample the segments at the corresponding values.

pub fn from(&self) -> Point<S>[src]

pub fn to(&self) -> Point<S>[src]

pub fn line_segment_intersections(
    &self,
    segment: &LineSegment<S>
) -> ArrayVec<[Point<S>; 3]>
[src]

Trait Implementations

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

type Scalar = S

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

impl<S: Copy> Copy for CubicBezierSegment<S>[src]

impl<S: Clone> Clone for CubicBezierSegment<S>[src]

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

Performs copy-assignment from source. Read more

impl<S: PartialEq> PartialEq<CubicBezierSegment<S>> for CubicBezierSegment<S>[src]

impl<S> From<CubicBezierSegment<S>> for BezierSegment<S>[src]

impl<S: Debug> Debug for CubicBezierSegment<S>[src]

Auto Trait Implementations

impl<S> Unpin for CubicBezierSegment<S> where
    S: Unpin

impl<S> Sync for CubicBezierSegment<S> where
    S: Sync

impl<S> Send for CubicBezierSegment<S> where
    S: Send

impl<S> UnwindSafe for CubicBezierSegment<S> where
    S: UnwindSafe

impl<S> RefUnwindSafe for CubicBezierSegment<S> where
    S: RefUnwindSafe

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> Borrow<T> for T where
    T: ?Sized
[src]

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

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