wgge 2.0.18 → 2.0.19
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/bin/login.cmd
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
npm login
|
|
@@ -2,11 +2,13 @@ import ObjectModel from "../ObjectModel";
|
|
|
2
2
|
import Rotation from "./Rotation";
|
|
3
3
|
import NumberHelper from "../../helper/NumberHelper";
|
|
4
4
|
|
|
5
|
+
export const ZERO_VECTOR2 = new Vector2(0, 0);
|
|
6
|
+
|
|
5
7
|
export default class Vector2 extends ObjectModel {
|
|
6
8
|
x;
|
|
7
9
|
y;
|
|
8
10
|
|
|
9
|
-
constructor(x, y, persistent) {
|
|
11
|
+
constructor(x = undefined, y = undefined, persistent = true) {
|
|
10
12
|
super(persistent);
|
|
11
13
|
|
|
12
14
|
this.x = 0;
|
|
@@ -200,6 +202,10 @@ export default class Vector2 extends ObjectModel {
|
|
|
200
202
|
this.removeEventListener('change', eventHandler);
|
|
201
203
|
}
|
|
202
204
|
|
|
205
|
+
static zero() {
|
|
206
|
+
return ZERO_VECTOR2;
|
|
207
|
+
}
|
|
208
|
+
|
|
203
209
|
toString(decimals = 2) {
|
|
204
210
|
return `[${NumberHelper.round(this.x, decimals)},${NumberHelper.round(this.y, decimals)}]`;
|
|
205
211
|
}
|
|
@@ -1,12 +1,14 @@
|
|
|
1
1
|
import ModelBase from "../ModelBase";
|
|
2
2
|
|
|
3
|
+
export const ZERO_VECTOR3 = new Vector3(0, 0, 0);
|
|
4
|
+
|
|
3
5
|
export default class Vector3 extends ModelBase {
|
|
4
6
|
x;
|
|
5
7
|
y;
|
|
6
8
|
z;
|
|
7
9
|
|
|
8
|
-
constructor(x, y, z) {
|
|
9
|
-
super();
|
|
10
|
+
constructor(x = undefined, y = undefined, z = undefined, persistent = true) {
|
|
11
|
+
super(persistent);
|
|
10
12
|
|
|
11
13
|
this.x = 0;
|
|
12
14
|
this.y = 0;
|
|
@@ -27,7 +29,7 @@ export default class Vector3 extends ModelBase {
|
|
|
27
29
|
return (v) ? this.x === v.x && this.y === v.y && this.z === v.z : false;
|
|
28
30
|
}
|
|
29
31
|
|
|
30
|
-
set(x, y, z) {
|
|
32
|
+
set(x, y = undefined, z = undefined) {
|
|
31
33
|
if (y === undefined && typeof x === 'object') {
|
|
32
34
|
this.set(x.x, x.y, x.z);
|
|
33
35
|
return;
|
|
@@ -110,4 +112,7 @@ export default class Vector3 extends ModelBase {
|
|
|
110
112
|
return this.subtract(v).size();
|
|
111
113
|
}
|
|
112
114
|
|
|
115
|
+
static zero() {
|
|
116
|
+
return ZERO_VECTOR3;
|
|
117
|
+
}
|
|
113
118
|
}
|