Add isZero getter to Vec2 and Vec3
This commit is contained in:
parent
8fc6836b29
commit
81b5fb302d
2 changed files with 8 additions and 0 deletions
|
@ -17,6 +17,10 @@ export class Vec2 {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public get isZero() {
|
||||||
|
return this.x === 0 && this.y === 0;
|
||||||
|
}
|
||||||
|
|
||||||
public set(x?:Vec2 | number, y?:number) {
|
public set(x?:Vec2 | number, y?:number) {
|
||||||
if (x instanceof Vec2) {
|
if (x instanceof Vec2) {
|
||||||
this.x = x.x;
|
this.x = x.x;
|
||||||
|
|
|
@ -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) {
|
public set(x?:Vec3 | number, y?:number, z?:number) {
|
||||||
if (x instanceof Vec3) {
|
if (x instanceof Vec3) {
|
||||||
this.x = x.x;
|
this.x = x.x;
|
||||||
|
|
Loading…
Reference in a new issue