Struct LinearSpeed

Source
pub struct LinearSpeed<F: Float, P: CurvePoint<F> + Distance<F>, C: Curve<F, P>> { /* private fields */ }
Expand description

The same curve as a passed one, but with a linear dependency between the time and the distance.

Implementations§

Source§

impl<F: Float, P: CurvePoint<F> + Distance<F>, C: Curve<F, P>> LinearSpeed<F, P, C>

Source

pub fn new(curve: C, table_size: usize, steps_count: usize) -> Self

Trait Implementations§

Source§

impl<F: Float, P: CurvePoint<F> + Distance<F>, C: Curve<F, P>> Curve<F, P> for LinearSpeed<F, P, C>

Source§

fn value_at(&self, t: F) -> P

Get the point at a given value t in range from 0 to 1.
Source§

fn tangent_at(&self, t: F) -> P

Get the derivative at a given value t in range from 0 to 1.
Source§

fn start_point(&self) -> P

Source§

fn end_point(&self) -> P

Source§

fn estimate_length(&self, _precision: F) -> F

Estimate the length of the curve as an average between min and max estimation. The precision parameter is the maximum ration of min and max estimation. Read more
Source§

fn dot(p0: P) -> Bezier0<F, P>

Create a dot, at any t it will return the same value
Source§

fn line(p0: P, p1: P) -> Bezier1<F, P>

Create a line
Source§

fn quad_bezier(p0: P, p1: P, p2: P) -> Bezier2<F, P>

Create a quadratic bezier curve
Source§

fn cubic_bezier(p0: P, p1: P, p2: P, p3: P) -> Bezier3<F, P>

Create a cubic bezier curve
Source§

fn into_iter(self, steps_count: usize) -> CurveIterator<F, P, Self>
where Self: Sized,

Create an iterator that will generate points on the curve.
Source§

fn into_iter_inclusive(self, steps_count: usize) -> CurveIterator<F, P, Self>
where Self: Sized,

Create an iterator that will generate points on the curve, including the last point.
Source§

fn composed_curve(start_point: P) -> ComposedCurve<F, P>

Create a composed curve that will be a sequence of curves. Each segment of the curve will be represented by equal t range. For example, if you have 3 curves, they will take t ranges: 0 - 0.33, 0.33 - 0.66 and 0.66 - 1.0.
Source§

fn linear_speed( self, table_size: usize, steps_count: usize, ) -> LinearSpeed<F, P, Self>
where P: Distance<F>, Self: Sized,

Create a linear speed curve that will allow to move with a constant speed along the curve. It’s especially useful when you want to animate the movement along a composed curve. Read more

Auto Trait Implementations§

§

impl<F, P, C> Freeze for LinearSpeed<F, P, C>
where C: Freeze, F: Freeze,

§

impl<F, P, C> RefUnwindSafe for LinearSpeed<F, P, C>

§

impl<F, P, C> Send for LinearSpeed<F, P, C>
where C: Send, F: Send, P: Send,

§

impl<F, P, C> Sync for LinearSpeed<F, P, C>
where C: Sync, F: Sync, P: Sync,

§

impl<F, P, C> Unpin for LinearSpeed<F, P, C>
where C: Unpin, F: Unpin, P: Unpin,

§

impl<F, P, C> UnwindSafe for LinearSpeed<F, P, C>
where C: UnwindSafe, F: UnwindSafe, P: UnwindSafe,

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.