/// Calculates the total task distance (via haversine algorithm) from
/// the original `route` and the array of indices
///
Calculates the total task distance (via haversine algorithm) from
the original `route` and the array of indices
Calculates the total task distance ( via haversine algorithm ) from the original ` route ` and the array of indices
fn calculate_distance<T: Point>(points: &[T], path: &Path) -> f32 {
    path.iter().zip(path.iter().skip(1))
        .map(|(i1, i2)| (&points[*i1], &points[*i2]))
        .map(|(fix1, fix2)| haversine_distance(fix1, fix2))
        .sum()
}
fn calculate_distance < T : Point > ( points : & [ T ] , path : & Path ) -> f32 { path . iter ( ) . zip ( path . iter ( ) . skip ( 1 ) ) . map ( | ( i1 , i2 ) | ( & points [ * i1 ] , & points [ * i2 ] ) ) . map ( | ( fix1 , fix2 ) | haversine_distance ( fix1 , fix2 ) ) . sum ( ) }
Calculates the total task distance (via haversine algorithm) from
the original `route` and the array of indices
Calculates the total task distance ( via haversine algorithm ) from the original ` route ` and the array of indices
points
&[T]
path
&Path