Readability improvements of globalscripts vector.js.
In compareLength, use Math.sign to replace a ternary + isNaN check.
In distanceToSquared, Use Math.pow(distance, 2) to avoid repetition of the distance, inline its value to remove the then unneeded variables.