some improvements

This commit is contained in:
Simon Gardling
2022-03-23 12:24:57 -04:00
parent 6be78c763a
commit 5f2fdce026
2 changed files with 23 additions and 14 deletions

View File

@@ -234,6 +234,14 @@ pub fn resolution_helper(max_i: usize, min_x: f64, resolution: f64) -> Vec<f64>
.collect()
}
// Returns a vector of length `max_i` starting at value `min_x` with step of
// `step`
pub fn step_helper(max_i: usize, min_x: f64, step: f64) -> Vec<f64> {
(0..max_i)
.map(|x| (x as f64 * step as f64) + min_x)
.collect()
}
#[cfg(test)]
mod tests {
use super::*;