fn sort_valids(simplex_points: &mut [Point; 4], lambdas: &mut Vec4) {
    let mut valids = [true; 4];
    for i in 0..4 {
        if lambdas[i] == 0.0 {
            valids[i] = false;
        }
    }

    let mut valid_lambdas = Vec4::ZERO;
    let mut valid_count = 0;
    let mut valid_points = [Point::new(); 4];
    for i in 0..4 {
        if valids[i] {
            valid_points[valid_count] = simplex_points[i];
            valid_lambdas[valid_count] = lambdas[i];
            valid_count += 1;
        }
    }

    // Copy the valids back into simplex points
    for i in 0..4 {
        simplex_points[i] = valid_points[i];
        lambdas[i] = valid_lambdas[i];
    }
}
/// Sorts the valid support points to the beginning of the array
Sorts the valid support points to the beginning of the array
Sorts the valid support points to the beginning of the array
fn sort_valids(simplex_points: &mut [Point; 4], lambdas: &mut Vec4) {
    let mut valids = [true; 4];
    for i in 0..4 {
        if lambdas[i] == 0.0 {
            valids[i] = false;
        }
    }
    let mut valid_lambdas = Vec4::ZERO;
    let mut valid_count = 0;
    let mut valid_points = [Point::new(); 4];
    for i in 0..4 {
        if valids[i] {
            valid_points[valid_count] = simplex_points[i];
            valid_lambdas[valid_count] = lambdas[i];
            valid_count += 1;
        }
    }
    // Copy the valids back into simplex points
    for i in 0..4 {
        simplex_points[i] = valid_points[i];
        lambdas[i] = valid_lambdas[i];
    }
}
fn sort_valids ( simplex_points : & mut [ Point ; 4 ] , lambdas : & mut Vec4 ) { let mut valids = [ true ; 4 ] ; for i in 0 .. 4 { if lambdas [ i ] == 0.0 { valids [ i ] = false ; } } let mut valid_lambdas = Vec4 :: ZERO ; let mut valid_count = 0 ; let mut valid_points = [ Point :: new ( ) ; 4 ] ; for i in 0 .. 4 { if valids [ i ] { valid_points [ valid_count ] = simplex_points [ i ] ; valid_lambdas [ valid_count ] = lambdas [ i ] ; valid_count += 1 ; } } // Copy the valids back into simplex points for i in 0 .. 4 { simplex_points [ i ] = valid_points [ i ] ; lambdas [ i ] = valid_lambdas [ i ] ; } }
Sorts the valid support points to the beginning of the array
Sorts the valid support points to the beginning of the array
simplex_points
&mut [Point; 4]
lambdas
&mut Vec4
simplex_points
&mut [Point; 4]
lambdas
&mut Vec4