1
0
mirror of https://github.com/Pomax/BezierInfo-2.git synced 2025-08-23 00:33:12 +02:00
This commit is contained in:
Pomax
2016-09-11 17:55:42 -07:00
parent 19bb1e1f2e
commit d7d1df1119
133 changed files with 1397 additions and 141 deletions

View File

@@ -0,0 +1,30 @@
module.exports = {
degree: 3,
activeDistance: 9,
setup() {
this.size(600, 300);
this.draw();
},
draw() {
this.clear();
this.grid(25);
var p = this.points[0];
this.points.forEach(n => {
this.stroke(200);
this.line(n.x, n.y, p.x, p.y);
p = n;
this.stroke(0);
this.ellipse(p.x, p.y, 4);
});
this.drawSplineData();
},
drawSplineData() {
if (this.points.length <= this.degree) return;
var mapped = this.points.map(p => [p.x, p.y]);
this.drawCurve(mapped);
this.drawKnots(mapped);
}
};