Skip to content

Commit

Permalink
forgot to actually change one math function (addArrays) to work with …
Browse files Browse the repository at this point in the history
…vectors of any size too
  • Loading branch information
Tom Brewe committed Sep 10, 2018
1 parent 8ddef1d commit 1b64c66
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions src/fit-curve.js
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,10 @@ function fitCurve(points, maxError, progressCallback) {
});

// Remove duplicate points
points = points.filter((point, i) => i === 0 || !point.every((val, j) => val === points[i-1][j]));
points = points.filter((point, i) => {
return i === 0 || !point.every((val, j) => val === points[i-1][j])
});

if (points.length < 2) {
return [];
}
Expand Down Expand Up @@ -81,6 +84,7 @@ function fitCubic(points, leftTangent, rightTangent, error, progressCallback) {
return [bezCurve];
}


//Parameterize points, and attempt to fit curve
u = chordLengthParameterize(points);
[bezCurve, maxError, splitPoint] = generateAndReport(points, u, u, leftTangent, rightTangent, progressCallback)
Expand Down Expand Up @@ -484,8 +488,7 @@ class maths {

//add = logAndRun(math.add);
static addArrays(arr1, arr2) {
//return arr1.map((x1, i) => x1 + arr2[i]);
return [arr1[0]+arr2[0], arr1[1]+arr2[1]];
return arr1.map((x1, i) => x1 + arr2[i]);
}
static addItems(items, addition) {
return items.map(x => x+addition);
Expand Down

0 comments on commit 1b64c66

Please sign in to comment.