deprived-main-website/src/routes/zhen/Utils/Vector2.ts
2025-04-06 00:17:55 +02:00

22 lines
422 B
TypeScript

export class Vector2 {
x: number;
y: number;
constructor(x: number, y: number) {
this.x = x;
this.y = y;
}
Add(vec2: Vector2) {
return new Vector2(this.x + vec2.x, this.y + vec2.y);
}
Sub(vec2: Vector2) {
return new Vector2(this.x - vec2.x, this.y - vec2.y);
}
Scale(mult: number) {
return new Vector2(this.x * mult, this.y * mult);;
}
}