add Ox.hypot
This commit is contained in:
parent
d04c1d3059
commit
d8cd59e90f
1 changed files with 13 additions and 0 deletions
|
@ -69,6 +69,19 @@ Ox.divideInt = function(number, by) {
|
|||
});
|
||||
};
|
||||
|
||||
/*@
|
||||
Ox.hypot <f> Returns the square root of the sum of the squares of its arguments
|
||||
(x, y[, z]) -> <n> 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 <f> Limits a number by a given mininum and maximum
|
||||
`Ox.limit(num, min, max)` is a shorthand for `Math.min(Math.max(num, min),
|
||||
|
|
Loading…
Reference in a new issue