Last active
June 23, 2020 16:17
-
-
Save Aleksey-Danchin/d064f00515a1a9bdec63 to your computer and use it in GitHub Desktop.
Fabric function of the others quadratic functions.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function GetQuadraticFunction (a, b, c, d) { | |
return (function (a, b, c, d) { | |
function init (value, defaultValue) { | |
value = parseFloat(value); | |
if (Number.isNaN(value) || !Number.isFinite(value)) { | |
value = defaultValue; | |
} | |
return value; | |
} | |
a = init(a, 1); b = init(b, 0); c = init(c, 0); d = init(d, 0); | |
return function (x) { | |
return a * Math.pow(x - d, 2) + b * (x - d) + c; | |
} | |
})(a, b, c, d); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Для чего же сделаны тут коментарии, как не для спора, в котором рождается мигрень)