Skip to main content

peak_keeping

Function peak_keeping 

Source
pub fn peak_keeping(
    n: usize,
    point: impl Fn(usize) -> [f64; 2],
    buckets: usize,
) -> Vec<[f64; 2]>
Expand description

At most 2 buckets of the n points point(0) .. point(n - 1), in their order, for drawing a long line: the points cut into buckets stretches of about equal count, and of each the lowest and the highest point (one, where they are the same). A stride would step over a peak one sample wide; this keeps every stretch’s extremes, so the drawn line reaches every peak there is. Fewer points than 2 buckets are given as they are.