vectorLength = function( vec ) {
            return Math.sqrt( vec.x * vec.x + vec.y * vec.y + vec.z * vec.z );
        }
Get the length/norm of a vector.

https://en.wikipedia.org/wiki/Norm_(mathematics)