pub enum Profile {
SCurve(SCurve),
Ramps {
dist: f64,
speed: f64,
up: Ramp,
cruise: f64,
down: Ramp,
},
Law {
dist: f64,
shape: Shape,
time: f64,
},
}Expand description
A move from rest to rest over dist in one of the shapes.
Variants§
SCurve(SCurve)
The S-curve with the same acceleration and braking, in closed form.
Ramps
Speeding up to speed, cruising for cruise seconds, braking: the S-curve with braking of its own, and sin².
Law
A polynomial law over the whole move, time long.
Implementations§
Source§impl Profile
impl Profile
Sourcepub fn new(dist: f64, shape: Shape, limits: Limits) -> Self
pub fn new(dist: f64, shape: Shape, limits: Limits) -> Self
The shortest move over dist in shape within limits. A polynomial law, which has no separate braking, keeps
the lower of the acceleration and the deceleration.
Sourcepub fn stretched(dist: f64, shape: Shape, limits: Limits, duration: f64) -> Self
pub fn stretched(dist: f64, shape: Shape, limits: Limits, duration: f64) -> Self
Time scaling: the move over dist in shape stretched to duration (no shorter than the shortest within
limits), with the limits scaled by 1/k, 1/k^2 and 1/k^3 for k = duration / shortest: the same shape, slower.
pub fn dist(&self) -> f64
pub fn duration(&self) -> f64
Trait Implementations§
Source§impl<'de> Deserialize<'de> for Profile
impl<'de> Deserialize<'de> for Profile
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Auto Trait Implementations§
impl Freeze for Profile
impl RefUnwindSafe for Profile
impl Send for Profile
impl Sync for Profile
impl Unpin for Profile
impl UnsafeUnpin for Profile
impl UnwindSafe for Profile
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