/// Generates normals from a set of vertices by just projecting radially from
/// the origin.
Generates normals from a set of vertices by just projecting radially from
the origin.
Generates normals from a set of vertices by just projecting radially from the origin .
fn normals(vertices: &[[f32; 3]]) -> Vec<[f32; 3]> {
    vertices
        .iter()
        .map(|n| {
            let sq_norm = n[0] * n[0] + n[1] * n[1] + n[2] * n[2];
            if sq_norm < EPS {
                [0.0, 0.0, 0.0]
            } else {
                let norm = sq_norm.sqrt();
                n.map(|c| c / norm)
            }
        })
        .collect()
}
fn normals ( vertices : & [ [ f32 ; 3 ] ] ) -> Vec < [ f32 ; 3 ] > { vertices . iter ( ) . map ( | n | { let sq_norm = n [ 0 ] * n [ 0 ] + n [ 1 ] * n [ 1 ] + n [ 2 ] * n [ 2 ] ; if sq_norm < EPS { [ 0.0 , 0.0 , 0.0 ] } else { let norm = sq_norm . sqrt ( ) ; n . map ( | c | c / norm ) } } ) . collect ( ) }
Generates normals from a set of vertices by just projecting radially from
the origin.
Generates normals from a set of vertices by just projecting radially from the origin .
vertices
&[[f32; 3]]