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: f64Implementations§
Source§impl Cam
impl Cam
Sourcepub fn from_segments(segments: &[Segment]) -> Result<Self, usize>
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).
Sourcepub fn from_table(rows: &[(f64, f64, Option<f64>)]) -> Result<Self, usize>
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.
Sourcepub fn from_config(cfg: &Config, prefix: &str) -> Result<Self, ConfigError>
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).