pub struct CubicBezier<T>(pub [T; 4]);Expand description
A cubic Bézier curve, defined by four control points.
TODO More info about Béziers
p1
\ ____
\ _-´ `--_ p3
\ / `-_ \
\ | `-_ |\
\| `-__ / \
\ `---_____--´ \
p0 \
p2Tuple Fields§
§0: [T; 4]Implementations§
Source§impl<T> CubicBezier<T>
impl<T> CubicBezier<T>
Sourcepub fn eval(&self, t: f32) -> T
pub fn eval(&self, t: f32) -> T
Evaluates the value of self at t.
For t < 0, returns the first control point. For t > 1, returns the last control point. Uses De Casteljau’s algorithm.
Sourcepub fn fast_eval(&self, t: f32) -> T
pub fn fast_eval(&self, t: f32) -> T
Evaluates the value of self at t.
For t < 0, returns the first control point. For t > 1, returns the last control point.
Directly evaluates the cubic. Faster but possibly less numerically
stable than Self::eval.
Trait Implementations§
Source§impl<T: Clone> Clone for CubicBezier<T>
impl<T: Clone> Clone for CubicBezier<T>
Source§fn clone(&self) -> CubicBezier<T>
fn clone(&self) -> CubicBezier<T>
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl<T: Debug> Debug for CubicBezier<T>
impl<T: Debug> Debug for CubicBezier<T>
Source§impl<T> Parametric<T> for CubicBezier<T>
impl<T> Parametric<T> for CubicBezier<T>
Source§impl<T: PartialEq> PartialEq for CubicBezier<T>
impl<T: PartialEq> PartialEq for CubicBezier<T>
impl<T: Eq> Eq for CubicBezier<T>
impl<T> StructuralPartialEq for CubicBezier<T>
Auto Trait Implementations§
impl<T> Freeze for CubicBezier<T>where
T: Freeze,
impl<T> RefUnwindSafe for CubicBezier<T>where
T: RefUnwindSafe,
impl<T> Send for CubicBezier<T>where
T: Send,
impl<T> Sync for CubicBezier<T>where
T: Sync,
impl<T> Unpin for CubicBezier<T>where
T: Unpin,
impl<T> UnwindSafe for CubicBezier<T>where
T: UnwindSafe,
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more