was.js

Subversion Repositories:
Compare Path: Rev
With Path: Rev
?path1? @ 45  →  ?path2? @ 46
/tags/1.0.5/lib/mathematics/algebra.js
@@ -0,0 +1,17 @@
/*************************************************************************/
/* Copyright (C) 2015 Wizardry and Steamworks - License: GNU GPLv3 */
/*************************************************************************/
function wasMapValueToRange(value, xMin, xMax, yMin, yMax) {
return yMin + (
( yMax - yMin ) * ( value - xMin ) / ( xMax - xMin )
);
}
 
/*************************************************************************/
/* Node.JS package export. */
/*************************************************************************/
if(typeof module !== 'undefined' && typeof module.exports !== 'undefined') {
module.exports.mathematics = {
MapValueToRange: wasMapValueToRange
};
}