1
0
mirror of https://github.com/Pomax/BezierInfo-2.git synced 2025-08-31 12:01:54 +02:00

error-only for http-server, better parameter parsing for sketch markup

This commit is contained in:
Pomax
2020-08-27 11:36:17 -07:00
parent 46f94282e1
commit b2314a4f87
47 changed files with 130 additions and 293 deletions

View File

@@ -1,7 +1,7 @@
let curve;
setup() {
const type = this.type = getParameter(`type`, `quadratic`);
const type = this.parameters.type ?? `quadratic`;
curve = (type === `quadratic`) ? Bezier.defaultQuadratic(this) : Bezier.defaultCubic(this);
setMovable(curve.points);
}
@@ -62,7 +62,7 @@ translatePoints(points) {
rotatePoints(points) {
// rotate so that last point is (...,0)
let last = this.type === `quadratic` ? 2 : 3;
let last = points.length - 1;
let dx = points[last].x;
let dy = points[last].y;
let a = atan2(dy, dx);