Skip to main content

subdivide

Function subdivide 

Source
pub fn subdivide(low: f64, high: f64, n: u32) -> Vec<f64>
Expand description

Subdivides an inclusive interval into n equally-spaced points.

§Arguments

  • low - Minimum value of the interval.
  • high - Maximum value of the interval.
  • n - Number of output points

§Examples

use cgrustplot::helper::math::subdivide;
let result = subdivide(0., 5., 6);
assert_eq!(result, vec![0., 1., 2., 3., 4., 5.]);

§Notes

Returns an empty vector if n is zero.

Returns a constant vector if low == high.