1
0
mirror of https://github.com/Pomax/BezierInfo-2.git synced 2025-09-02 12:54:23 +02:00
This commit is contained in:
Pomax
2020-09-05 22:50:12 -07:00
parent bec07e3297
commit 9434a71d34
46 changed files with 1795 additions and 1623 deletions

View File

@@ -0,0 +1,30 @@
// setup={this.setupCubic} draw={this.drawSingleArc} onKeyDown={this.props.onKeyDown}
let curve, utils = Bezier.getUtils();
setup() {
curve = Bezier.defaultCubic(this);
setMovable(curve.points);
setSlider(`.slide-control`, `error`, 0.5);
}
draw() {
clear();
curve.drawSkeleton();
curve.drawCurve();
// See "arc.js" for the code required to find arcs on the curve.
let arcs = curve.arcs(this.error);
arcs.forEach(a => {
setColor( randomColor(0.3) );
arc(
a.x, a.y, a.r, a.s, a.e,
a.x, a.y
);
});
setColor("black");
text(`Arc approximation with total error ${this.error}`, this.width/2, 15, CENTER);
curve.drawPoints();
}