diff --git a/src/js/strength.js b/src/js/strength.js index 7f6aa15cd24e..b8a2d277e557 100644 --- a/src/js/strength.js +++ b/src/js/strength.js @@ -5,13 +5,33 @@ motionsplan.Strength = function(weight, body_weight) { body_weight = body_weight; function getIndex100() { - let Loeft = weight; - let Vaegt = body_weight; - return Math.round(Loeft * 986.63 / (1270.4 - 172970 * ((Math.pow(Vaegt, -1.3925)))) * Math.pow(10, 0)) / Math.pow(10, 0) + let Loeft = weight; + let Vaegt = body_weight; + return Loeft * 986.63 / (1270.4 - 172970 * ((Math.pow(Vaegt, -1.3925)))); + } + + function getAllometricScaling() { + let S = weight; + let M = body_weight; + return S * Math.pow(M, -2/3); + } + + function getBodyweightPercent() { + return weight / body_weight; + } + + function getNuckolsIndex() { + let a, b; + let w = weight; + let bw = body_weight; + + return 100*w/(a*Math.pow(bw, 2)+b*bw); } let publicAPI = { - getIndex100: getIndex100 + getIndex100 : getIndex100, + getAllometricScaling : getAllometricScaling, + getBodyweightPercent : getBodyweightPercent }; return publicAPI; diff --git a/src/test/strength.js b/src/test/strength.js index 25185aff6d7d..b7846f23ca76 100644 --- a/src/test/strength.js +++ b/src/test/strength.js @@ -6,7 +6,31 @@ describe('Strength', function() { it('should return the correct number', function() { // weigt, reps let rm = motionsplan.Strength(80, 80); - assert.equal(rm.getIndex100(), 89); + assert.equal(rm.getIndex100(), 89.36709244049503); + }); + }); + describe('getAllometricScaling', function() { + it('should return the correct number', function() { + // weigt, reps + let rm = motionsplan.Strength(405, 220); + assert.equal(rm.getAllometricScaling(), 11.11321976546847); + }); + }); + describe('getAllometricScalingSecondTry', function() { + it('should return the correct number', function() { + let rm = motionsplan.Strength(300, 150); + assert.equal(rm.getAllometricScaling(), 10.626585691826113); + }); + }); + describe('getBodyweightPercent', function() { + it('should return the correct number', function() { + // weigt, reps + let rm = motionsplan.Strength(405, 220); + assert.equal(rm.getBodyweightPercent(), 1.8409090909090908); + }); + it('should return the correct number', function() { + let rm = motionsplan.Strength(300, 150); + assert.equal(rm.getBodyweightPercent(), 2); }); }); });