pub fn find_index(spline_map: &SplineMap, distance: f64) -> usize {
    let len = spline_map.steps.len();
    let mut size = len;
    let mut base: usize = 0;
    while size > 1 {
        let half = size / 2;
        let mid = base + half;
        let step = spline_map.steps[mid];
        if step.1 < distance {
            base = mid
        }
        size -= half;
    }
    base
}
// Find index for lookup in spline map with binary search.
// Returns last index with d < distance.
Find index for lookup in spline map with binary search.
Returns last index with d < distance.
Find index for lookup in spline map with binary search . Returns last index with d < distance .
pub fn find_index(spline_map: &SplineMap, distance: f64) -> usize {
    let len = spline_map.steps.len();
    let mut size = len;
    let mut base: usize = 0;
    while size > 1 {
        let half = size / 2;
        let mid = base + half;
        let step = spline_map.steps[mid];
        if step.1 < distance {
            base = mid
        }
        size -= half;
    }
    base
}
pub fn find_index ( spline_map : & SplineMap , distance : f64 ) -> usize { let len = spline_map . steps . len ( ) ; let mut size = len ; let mut base : usize = 0 ; while size > 1 { let half = size / 2 ; let mid = base + half ; let step = spline_map . steps [ mid ] ; if step . 1 < distance { base = mid } size -= half ; } base }
Find index for lookup in spline map with binary search.
Find index for lookup in spline map with binary search .
spline_map
&SplineMap
distance
f64
spline_map
&SplineMap
distance
f64