1
0
mirror of https://github.com/Pomax/BezierInfo-2.git synced 2025-08-27 10:15:05 +02:00

t-value control

This commit is contained in:
Pomax
2018-06-23 23:22:58 -07:00
parent 1da8c3966b
commit 3d334c2559
13 changed files with 4301 additions and 1907 deletions

View File

@@ -159,12 +159,20 @@ function computeBestFit(P, M, S, n) {
}
function fit(points, mode) {
// mode could be an int index to fit.modes, below,
// which are used to abstract time values, OR it
// could be a prespecified array of time values to
// be used in the final curve fitting step.
var TS;
if (mode instanceof Array) {
TS = mode;
mode = false;
}
mode = mode || 0;
console.log("mode: ", mode);
var n = points.length,
P = Array.from(points),
M = computeBasisMatrix(n),
S = computeTimeValues[fit.modes[mode]](P, n),
S = TS || computeTimeValues[fit.modes[mode]](P, n),
C = computeBestFit(P, M, S, n);
return { n, P, M, S, C };
}