Skip to main content

edges

Function edges 

Source
pub fn edges(x: &[f64], y: &[f64], low: f64, high: f64) -> Vec<Edge>
Expand description

Every edge a waveform makes through a two-level trigger.

low and high are fractions of the waveform’s own range, so 0.1 and 0.9 are the usual ten-to-ninety-percent thresholds whatever the signal’s amplitude turns out to be. Two levels rather than one is the whole point: a waveform that rings around a single threshold would trigger on every wobble, and one that has to cross the other level before it can trigger again cannot.

Each edge’s coordinate is interpolated between the samples that straddle the threshold. A waveform with no range at all — a constant — has no edges.