Skip to main content

Shape

Enum Shape 

Source
pub enum Shape {
    SCurve,
    SinSquared,
    Poly345,
    Poly4567,
}
Expand description

The shape of a move from rest to rest (profile.shape, or shape of a [[cycle.segment]]).

Variants§

§

SCurve

Seven segments: jerk up, constant acceleration, jerk down, cruise, and the same braking.

§

SinSquared

The speed rises as sin² of time over the ramp (Bestehorn): peak acceleration (pi/2) v / T_ramp, peak jerk (pi^2/2) v / T_ramp^2, at the ramp’s ends.

§

Poly345

s = 10 u^3 - 15 u^4 + 6 u^5 over the whole move (VDI 2143): speed and acceleration zero at both ends.

§

Poly4567

s = 35 u^4 - 84 u^5 + 70 u^6 - 20 u^7: jerk zero at both ends too.

Implementations§

Source§

impl Shape

Source

pub const NAMES: [&str; 4]

Source

pub fn from_name(name: &str) -> Option<Self>

Source

pub fn name(&self) -> &'static str

Source

pub fn peaks(&self) -> Option<[f64; 3]>

For a polynomial law: the peaks of speed, acceleration and jerk over a move of 1 in a time of 1 (multiply by h/T, h/T^2 and h/T^3). 3-4-5: s’ = 30 u^2 (1-u)^2, 1.875 at u = 1/2; s’’ = 60 u (1-u) (1-2u), 10/sqrt 3 at u = (1 - 1/sqrt 3)/2; s’‘’ 60 at the ends. 4-5-6-7: s’ = 140 u^3 (1-u)^3, 2.1875; s’’ = 420 u^2 (1-u)^2 (1-2u), with x = u - 1/2 largest at x^2 = 1/20: 420 * 2 / (25 sqrt 20) = 7.5132; s’‘’ = 840 u (1-u) (1 - 5u + 5u^2), 52.5 at u = 1/2. None for the shapes with a cruise.

Source

pub fn law(&self, u: f64) -> [f64; 4]

For a polynomial law: (s, s’, s’‘, s’‘’) at u in [0, 1] over a move of 1 in a time of 1.

Trait Implementations§

Source§

impl Clone for Shape

Source§

fn clone(&self) -> Shape

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Copy for Shape

Source§

impl Debug for Shape

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for Shape

Source§

fn default() -> Shape

Returns the “default value” for a type. Read more
Source§

impl<'de> Deserialize<'de> for Shape

Source§

fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>
where __D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
Source§

impl PartialEq for Shape

Source§

fn eq(&self, other: &Shape) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl Serialize for Shape

Source§

fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error>
where __S: Serializer,

Serialize this value into the given Serde serializer. Read more
Source§

impl StructuralPartialEq for Shape

Auto Trait Implementations§

§

impl Freeze for Shape

§

impl RefUnwindSafe for Shape

§

impl Send for Shape

§

impl Sync for Shape

§

impl Unpin for Shape

§

impl UnsafeUnpin for Shape

§

impl UnwindSafe for Shape

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> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,

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> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
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.