CARS and also better node editing

This commit is contained in:
Emma
2023-02-13 16:38:58 -07:00
parent 657f228d47
commit 08d63395e3
13 changed files with 832 additions and 710 deletions

View File

@@ -184,13 +184,14 @@ export class PathSegment {
const current = stepSize * i;
points.push(this.getPointAtT(current))
}
return points.reduce((acc: { prev?: Vector, length: number }, cur) => {
this.length = points.reduce((acc: { prev?: Vector, length: number }, cur) => {
const prev = acc.prev;
acc.prev = cur;
if (!prev) return acc;
acc.length += cur.dist(prev);
return acc;
}, { prev: undefined, length: 0 }).length
return this.length;
}
calculateEvenlySpacedPoints(spacing: number, resolution = 1) {