add some new math functions
This commit is contained in:
parent
5bab1f7a01
commit
b9b1ef1bc6
@ -212,6 +212,8 @@ function Library (ronin) {
|
|||||||
return Math.round(val / step) * step
|
return Math.round(val / step) * step
|
||||||
}
|
}
|
||||||
|
|
||||||
|
this.floor = Math.floor // round down to the nearest integer
|
||||||
|
|
||||||
this.min = Math.min
|
this.min = Math.min
|
||||||
|
|
||||||
this.max = Math.max
|
this.max = Math.max
|
||||||
@ -224,6 +226,18 @@ function Library (ronin) {
|
|||||||
|
|
||||||
this.cos = Math.cos
|
this.cos = Math.cos
|
||||||
|
|
||||||
|
this.ln = Math.log // caclulates on the base of e
|
||||||
|
|
||||||
|
this.pow = (a, b) => { // calculates a^b
|
||||||
|
return Math.pow(a, b)
|
||||||
|
}
|
||||||
|
|
||||||
|
this.sqrt = Math.sqrt // calculate the square root
|
||||||
|
|
||||||
|
this.sq = (a) => { // calculate the square
|
||||||
|
return a * a;
|
||||||
|
}
|
||||||
|
|
||||||
this.PI = Math.PI
|
this.PI = Math.PI
|
||||||
|
|
||||||
this.TWO_PI = Math.PI * 2
|
this.TWO_PI = Math.PI * 2
|
||||||
|
Loading…
x
Reference in New Issue
Block a user