reformat move.ts

This commit is contained in:
2026-08-06 14:07:33 +02:00
parent 0136981551
commit 6f43c64349
2 changed files with 50 additions and 63 deletions
+7
View File
@@ -25,6 +25,13 @@ export default class Vec2d implements Point {
return `[${this.x}, ${this.y}]`;
}
toPolar() {
return {
r: this.length(),
theta: Math.atan2(this.y, this.x),
};
}
normalize(): Vec2d {
const len = this.length();
return new Vec2d(this.x / len, this.y / len);