move: implement follow the leader algorithm

This commit is contained in:
2026-08-05 19:40:07 +02:00
parent 4ad9e76c9e
commit 63d5236924
4 changed files with 63 additions and 37 deletions
+5
View File
@@ -21,6 +21,11 @@ export default class Vec2d implements Point {
return `[${this.x}, ${this.y}]`;
}
normalize(): Vec2d {
const len = this.length();
return new Vec2d(this.x / len, this.y / len);
}
scale(scalar: number): Vec2d {
return new Vec2d(this.x * scalar, this.y * scalar);
}