Math describes the namespace that holds math functions and
constants. Optimizations or browser specific functions for math
sshould be implemented in this namespace.
- Source:
Members
-
<static> cos
-
- Source:
- See:
-
- Math.cos
-
<static> max
-
- Source:
- See:
-
- Math.max
-
<static> min
-
- Source:
- See:
-
- Math.min
-
<static, constant> PI :number
-
PI value, with a 15 decimal aproximation
Type:
- number
- Source:
-
<static, constant> PId2 :number
-
PI/2 value, with a 15 decimal aproximation
Type:
- number
- Source:
-
<static, constant> PId4 :number
-
PI/4 value, with a 15 decimal aproximation
Type:
- number
- Source:
-
<static, constant> PId6 :number
-
PI/6 value, with a 15 decimal aproximation
Type:
- number
- Source:
-
<static, constant> PId8 :number
-
PI/8 value, with a 15 decimal aproximation
Type:
- number
- Source:
-
<static, constant> PIx2 :number
-
Two PI value, with a 15 decimal aproximation
Type:
- number
- Source:
-
<static> pow
-
- Source:
- See:
-
- Math.pow
-
<static> sin
-
- Source:
- See:
-
- Math.sin
-
<static> sqrt
-
- Source:
- See:
-
- Math.sqrt
-
<static> tan
-
- Source:
- See:
-
- Math.tan
Methods
-
<static> abs(number) → {number}
-
Returns the absolute value of a number
Parameters:
Name Type Description number
number - Source:
Returns:
returns the absolute number- Type
- number
-
<static> ceil(n) → {number}
-
Returns the ceil of a number
Parameters:
Name Type Description n
number the number - Source:
Returns:
the ceiled number- Type
- number
-
<static> clamp(x, min, max) → {number}
-
Clamps a number.
Parameters:
Name Type Description x
number The number to clamp. min
number Lower limmit. max
number Upper limit. - Source:
Returns:
A number between min and max.- Type
- number
-
<static> floor(n) → {number}
-
Returns the floor of a number
Parameters:
Name Type Description n
number the number - Source:
Returns:
the floored number- Type
- number
-
<static> overlaps(a, b) → {number}
-
Checks if two bounderies are overlaping
Parameters:
Name Type Description a
Object an object with min and max properties b
Object an object with min and max properties - Source:
Returns:
A positive number if they're overlaping. Zero if they're just in touch, negative number if they're not overlaping.- Type
- number
-
<static> randFloat(min, max) → {number}
-
Get a random float
Parameters:
Name Type Argument Description min
number the min possible value between min and max, if max is defined. If not than it's the max value, between 0 and min. max
number <nullable>
optional, the max possible value, between min and max. - Source:
Returns:
a random float number.- Type
- number
-
<static> randInt(min, max) → {number}
-
Get a random float
Parameters:
Name Type Argument Description min
number the min possible value between min and max, if max is defined. If not than it's the max value, between 0 and min. max
number <nullable>
optional, the max possible value, between min and max. - Source:
Returns:
a random integer number- Type
- number
-
<static> round(n) → {number}
-
Rounds a number to the unit.
Parameters:
Name Type Description n
number Number to round. - Source:
Returns:
Rounded number.- Type
- number
-
<static> roundFour(n) → {number}
-
Rounds a number to fourth decimal.
Parameters:
Name Type Description n
number Number to round. - Source:
Returns:
Rounded number.- Type
- number
-
<static> roundN(number, n) → {number}
-
Rounds a number to nth decimal.
Parameters:
Name Type Description number
number Number to round. n
number Decimals to round. - Source:
Returns:
Rounded number.- Type
- number
-
<static> roundOne(n) → {number}
-
Rounds a number to first decimal.
Parameters:
Name Type Description n
number Number to round. - Source:
Returns:
Rounded number.- Type
- number
-
<static> roundThree(n) → {number}
-
Rounds a number to third decimal.
Parameters:
Name Type Description n
number Number to round. - Source:
Returns:
Rounded number.- Type
- number
-
<static> roundTwo(n) → {number}
-
Rounds a number to second decimal.
Parameters:
Name Type Description n
number Number to round. - Source:
Returns:
Rounded number.- Type
- number
-
<static> sq(n) → {number}
-
Squares a number.
Parameters:
Name Type Description n
number Number to square - Source:
Returns:
NUmber squared- Type
- number