From 81b5fb302d3bead4b516507bb2a701def0e14ed7 Mon Sep 17 00:00:00 2001 From: Holly Date: Sun, 5 Nov 2023 10:56:28 +0000 Subject: [PATCH] Add isZero getter to Vec2 and Vec3 --- server/Vec2.ts | 4 ++++ server/Vec3.ts | 4 ++++ 2 files changed, 8 insertions(+) diff --git a/server/Vec2.ts b/server/Vec2.ts index 98f2aac..812a60f 100644 --- a/server/Vec2.ts +++ b/server/Vec2.ts @@ -17,6 +17,10 @@ export class Vec2 { } } + public get isZero() { + return this.x === 0 && this.y === 0; + } + public set(x?:Vec2 | number, y?:number) { if (x instanceof Vec2) { this.x = x.x; diff --git a/server/Vec3.ts b/server/Vec3.ts index ff2604d..c71ed9b 100644 --- a/server/Vec3.ts +++ b/server/Vec3.ts @@ -21,6 +21,10 @@ export class Vec3 { } } + public get isZero() { + return this.x === 0 && this.y === 0 && this.z === 0; + } + public set(x?:Vec3 | number, y?:number, z?:number) { if (x instanceof Vec3) { this.x = x.x;