ColorScale.prototype.vectorLength = function (vector) { var result = 0; for (var i = 0; i < vector.length; i++) { result += vector[i] * vector[i]; } return Math.sqrt(result); };
info at phpclasses dot org