Skip to main content

bracket

Function bracket 

Source
pub fn bracket(xs: &[f64], x: f64) -> (usize, f64)
Expand description

Bracket x in the sorted pillar grid xs: returns (idx, w) where xs[idx - 1] <= x <= xs[idx] and w is the weight of the upper pillar. x is clamped to the grid, so idx is always in [1, xs.len() - 1] and w in [0, 1].