Skip to main content

Cam

Struct Cam 

Source
pub struct Cam {
    pub period: f64,
    pub advance: f64,
    /* private fields */
}
Expand description

A periodic cam: its pieces over one master period from 0, and what the slave rises by over the period.

Fields§

§period: f64§advance: f64

Implementations§

Source§

impl Cam

Source

pub fn from_segments(segments: &[Segment]) -> Result<Self, usize>

The cam of segments, the slave starting at 0. An error says which segment (from 0) is wrong: a span that is not positive, a dwell that rises, or two straight neighbours of different slopes (the slave’s speed would jump).

Source

pub fn from_table(rows: &[(f64, f64, Option<f64>)]) -> Result<Self, usize>

The cam through a table of points (master, slave, slope over the master where given), the master rising; the last point closes the period (the master’s span of the table is the period, the slave’s its advance). Where a row has no slope, the slopes are those of the periodic cubic spline through the points (the slave’s acceleration is then continuous), else a cubic runs between each two points with their slopes. An error names the row (from 0) that is wrong: fewer than three points, a master that does not rise, slopes on some rows only, or values so large or so close that the slopes overflow.

Source

pub fn from_config(cfg: &Config, prefix: &str) -> Result<Self, ConfigError>

The cam of <prefix>.table_file (a CSV file of master, slave and an optional slope, see parse_table) where that is not empty, else of the array [[<prefix>.segment]], each with master, slave (in the master’s and the slave’s units) and law (Law::from_name).

Source

pub fn at(&self, m: f64) -> [f64; 4]

[s, s’, s’‘, s’‘’] over the master at any master position: the period repeats, each time advance higher.

Source

pub fn peaks(&self, speed: f64) -> [f64; 3]

The highest slave speed, acceleration and jerk over a period at the steady master speed speed: max |s’| v, max |s’‘| v^2, max |s’‘’| v^3, sampled at 4000 points and at every piece’s ends.

Trait Implementations§

Source§

impl Clone for Cam

Source§

fn clone(&self) -> Cam

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 Debug for Cam

Source§

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

Formats the value using the given formatter. Read more

Auto Trait Implementations§

§

impl Freeze for Cam

§

impl RefUnwindSafe for Cam

§

impl Send for Cam

§

impl Sync for Cam

§

impl Unpin for Cam

§

impl UnsafeUnpin for Cam

§

impl UnwindSafe for Cam

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> 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.