Skip to content

Commit

Permalink
fix bug with the b-spline
Browse files Browse the repository at this point in the history
  • Loading branch information
cschen1205 committed May 30, 2017
1 parent 233d311 commit 3aa7f10
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion example.html
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
});
for(var i=0; i < 20; ++i){
var x = i * 50;
var y = Math.sin(x * Math.PI / 200) * 100;
var y = Math.sin(x * Math.PI / 200) * 100 + 140;
bspline.addWayPoint({x : x, y: y, z: 0});
}

Expand Down
2 changes: 1 addition & 1 deletion src/jsspline.js
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ var jsspline = jsspline || {};
var point = pt1.scale(-1).add(pt2.scale(3)).minus(pt3.scale(3)).add(pt4).scale(u*u*u / 6);
point = point.add(pt1.scale(3).minus(pt2.scale(6)).add(pt3.scale(3)).scale(u*u / 6));
point = point.add(pt1.scale(-3).add(pt2.scale(3)).scale(u / 6));
point = point.add(pt1.add(pt2.scale(4)).add(pt3)).scale(1.0 / 6);
point = point.add(pt1.add(pt2.scale(4)).add(pt3).scale(1.0 / 6));
return point;
};

Expand Down

0 comments on commit 3aa7f10

Please sign in to comment.