diff --git a/source/Ox/js/Math.js b/source/Ox/js/Math.js index 92544ad3..157606d1 100644 --- a/source/Ox/js/Math.js +++ b/source/Ox/js/Math.js @@ -69,6 +69,19 @@ Ox.divideInt = function(number, by) { }); }; +/*@ +Ox.hypot Returns the square root of the sum of the squares of its arguments + (x, y[, z]) -> Square root of the sum of the squares of its arguments + > Ox.hypot(3, 4) + 5 + > Ox.hypot(1, 1, 1) + Math.sqrt(3) +@*/ +Ox.hypot = function(x, y, z) { + z = z || 0; + return Math.sqrt(x * x + y * y + z * z) || 0; +}; + /*@ Ox.limit Limits a number by a given mininum and maximum `Ox.limit(num, min, max)` is a shorthand for `Math.min(Math.max(num, min),