From b9b1ef1bc6cf5ee62ecf8bf12c0877230778825d Mon Sep 17 00:00:00 2001 From: ngradwohl Date: Tue, 23 Jul 2019 07:42:20 +0200 Subject: [PATCH 1/2] add some new math functions --- desktop/sources/scripts/library.js | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/desktop/sources/scripts/library.js b/desktop/sources/scripts/library.js index 5fc3cad..2f03568 100644 --- a/desktop/sources/scripts/library.js +++ b/desktop/sources/scripts/library.js @@ -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 From 02971c65880d1e56f5d9ee6c2128665323f510fd Mon Sep 17 00:00:00 2001 From: ngradwohl Date: Tue, 23 Jul 2019 08:00:07 +0200 Subject: [PATCH 2/2] rename ln function to log --- desktop/sources/scripts/library.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/desktop/sources/scripts/library.js b/desktop/sources/scripts/library.js index 2f03568..bb1e396 100644 --- a/desktop/sources/scripts/library.js +++ b/desktop/sources/scripts/library.js @@ -226,7 +226,7 @@ function Library (ronin) { this.cos = Math.cos - this.ln = Math.log // caclulates on the base of e + this.log = Math.log // caclulates on the base of e this.pow = (a, b) => { // calculates a^b return Math.pow(a, b)