ker/mod/webgl.math.js
function normalize(arr) {
    const n = copy(arr);
    let len = 0;
    for (const v of n) len += v * v;
    if (len > 0) {
        const coeff = 1 / Math.sqrt(len);
        for (let k = 0; k < n.length; k++) {
            n[k] *= coeff;
        }
    }
    return n;
}
function normalize(arr) {
    const n = copy(arr);
    let len = 0;
    for (const v of n) len += v * v;
    if (len > 0) {
        const coeff = 1 / Math.sqrt(len);
        for (let k = 0; k < n.length; k++) {
            n[k] *= coeff;
        }
    }
    return n;
}
function normalize ( arr ) { const n = copy ( arr ) ; let len = 0 ; for ( const v of n ) len += v * v ; if ( len > 0 ) { const coeff = 1 / Math . sqrt ( len ) ; for ( let k = 0 ; k < n . length ; k ++ ) { n [ k ] *= coeff ; } } return n ; }
Make a vector have a length of 1.

@param   {Float32Array} arr - Input vector.
@returns {Float32Array} A new vector.
Make a vector have a length of 1 .