pub fn interpolate_spectrum_samples(lambda: &[Float], vals: &[Float], n: i32, l: Float) -> Float {
    for i in 0..(n - 1) {
        assert!(lambda[(i + 1) as usize] > lambda[i as usize]);
    }
    if l <= lambda[0] {
        return vals[0];
    }
    if l >= lambda[(n - 1) as usize] {
        return vals[(n - 1) as usize];
    }
    let offset: usize = find_interval(n, |index| lambda[index as usize] <= l) as usize;
    assert!(l >= lambda[offset] && l <= lambda[offset + 1]);
    let t: Float = (l - lambda[offset]) / (lambda[offset + 1] - lambda[offset]);
    lerp(t, vals[offset], vals[offset + 1])
}
/// Find responsible interval and linearly interpolate between the two
/// sample values.
Find responsible interval and linearly interpolate between the two
sample values.
Find responsible interval and linearly interpolate between the two sample values .
pub fn interpolate_spectrum_samples(lambda: &[Float], vals: &[Float], n: i32, l: Float) -> Float {
    for i in 0..(n - 1) {
        assert!(lambda[(i + 1) as usize] > lambda[i as usize]);
    }
    if l <= lambda[0] {
        return vals[0];
    }
    if l >= lambda[(n - 1) as usize] {
        return vals[(n - 1) as usize];
    }
    let offset: usize = find_interval(n, |index| lambda[index as usize] <= l) as usize;
    assert!(l >= lambda[offset] && l <= lambda[offset + 1]);
    let t: Float = (l - lambda[offset]) / (lambda[offset + 1] - lambda[offset]);
    lerp(t, vals[offset], vals[offset + 1])
}
pub fn interpolate_spectrum_samples ( lambda : & [ Float ] , vals : & [ Float ] , n : i32 , l : Float ) -> Float { for i in 0 .. ( n - 1 ) { assert ! ( lambda [ ( i 1 ) as usize ] lambda [ i as usize ] ) ; } if l <= lambda [ 0 ] { return vals [ 0 ] ; } if l >= lambda [ ( n - 1 ) as usize ] { return vals [ ( n - 1 ) as usize ] ; } let offset : usize = find_interval ( n , | index | lambda [ index as usize ] <= l ) as usize ; assert ! ( l lambda [ offset ] l lambda [ offset 1 ] ) ; let t : Float = ( l - lambda [ offset ] ) / ( lambda [ offset + 1 ] - lambda [ offset ] ) ; lerp ( t , vals [ offset ] , vals [ offset + 1 ] ) }
Find responsible interval and linearly interpolate between the two
sample values.
Find responsible interval and linearly interpolate between the two sample values .
lambda
&[Float]
vals
&[Float]
n
i32
l
Float