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

code comments

This commit is contained in:
Pomax
2020-09-19 22:51:19 -07:00
parent 4c0e71cd4a
commit d77d3649b6
27 changed files with 97 additions and 61 deletions

View File

@@ -17,16 +17,19 @@ draw() {
curve.drawSkeleton();
// First, reduce our curves into a set of simple sections
var reduced = this.reduce(curve);
reduced.forEach(c => {
setStroke(randomColor() );
this.drawCurve(c);
circle(c.points[0].x, c.points[0].y, 2);
});
var last = reduced.slice(-1)[0];
let p = last.points[3] ?? last.points[2];
circle(p.x, p.y, 3);
// then, we can offset each simple curve by projective scaling
setStroke(`#FF000050`);
var offset = curve.offset(this.distance);
offset.forEach(c => {
@@ -38,6 +41,7 @@ draw() {
p = last.points[3] ?? last.points[2];
circle(p.x, p.y, 3);
// on both sides, so we need to offset by -distance, too.
setStroke(`#0000FF50`);
var offset = curve.offset(-this.distance);
offset.forEach(c => {
@@ -116,3 +120,5 @@ reduce(curve) {
return pass2;
}
// TODO: duplicate the offset code from utils.js? It's *a lot* of code, though...