1
0
mirror of https://github.com/Pomax/BezierInfo-2.git synced 2025-08-29 19:20:39 +02:00

curve from points

This commit is contained in:
Pomax
2020-08-31 23:18:43 -07:00
parent f52727160f
commit fbec463127
18 changed files with 483 additions and 194 deletions

View File

@@ -465,11 +465,18 @@ class GraphicsAPI extends BaseAPI {
}
/**
* Draw a circle around a Point
* Draw a circle
*/
circle(x, y, r) {
this.arc(x, y, r, 0, this.TAU);
}
/**
* Draw a circular arc
*/
arc(x, y, r, s, e) {
this.ctx.beginPath();
this.ctx.arc(x, y, r, 0, this.TAU);
this.ctx.arc(x, y, r, s, e);
this.ctx.fill();
this.ctx.stroke();
}

View File

@@ -238,15 +238,20 @@ class Bezier {
return utils.length(this.derivative.bind(this));
}
getABC(t, B) {
let S = this.points[0];
let E = this.points[this.order];
let ret = getABC(this.order, S, B || this.get(t), E, t);
static getABC(order = 2, S, B, E, t = 0.5) {
let ret = getABC(order, S, B, E, t);
ret.S = S;
ret.E = E;
return ret;
}
getABC(t, B) {
B = B || this.get(t);
let S = this.points[0];
let E = this.points[this.order];
return Bezier.getABC(this.order, S, B, E, t);
}
getLUT(steps) {
this.verify();
steps = steps || 100;