add some new math functions

This commit is contained in:
ngradwohl 2019-07-23 07:42:20 +02:00
parent 5bab1f7a01
commit b9b1ef1bc6

View File

@ -212,6 +212,8 @@ function Library (ronin) {
return Math.round(val / step) * step
}
this.floor = Math.floor // round down to the nearest integer
this.min = Math.min
this.max = Math.max
@ -224,6 +226,18 @@ function Library (ronin) {
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.TWO_PI = Math.PI * 2