@math.gl/core 4.0.0 → 4.1.0-alpha.1

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.
Files changed (147) hide show
  1. package/dist/classes/base/math-array.d.ts +1 -2
  2. package/dist/classes/base/math-array.js +223 -266
  3. package/dist/classes/base/matrix.d.ts +1 -2
  4. package/dist/classes/base/matrix.js +56 -53
  5. package/dist/classes/base/vector.d.ts +1 -2
  6. package/dist/classes/base/vector.js +125 -135
  7. package/dist/classes/euler.d.ts +2 -3
  8. package/dist/classes/euler.js +464 -533
  9. package/dist/classes/matrix3.d.ts +9 -4
  10. package/dist/classes/matrix3.js +191 -190
  11. package/dist/classes/matrix4.d.ts +8 -4
  12. package/dist/classes/matrix4.js +521 -452
  13. package/dist/classes/pose.d.ts +4 -5
  14. package/dist/classes/pose.js +106 -119
  15. package/dist/classes/quaternion.d.ts +1 -2
  16. package/dist/classes/quaternion.js +261 -233
  17. package/dist/classes/spherical-coordinates.d.ts +3 -4
  18. package/dist/classes/spherical-coordinates.js +142 -147
  19. package/dist/classes/vector2.d.ts +6 -5
  20. package/dist/classes/vector2.js +103 -85
  21. package/dist/classes/vector3.d.ts +6 -5
  22. package/dist/classes/vector3.js +129 -136
  23. package/dist/classes/vector4.d.ts +7 -6
  24. package/dist/classes/vector4.js +108 -114
  25. package/dist/gl-matrix/common.d.ts +0 -1
  26. package/dist/gl-matrix/common.js +38 -6
  27. package/dist/gl-matrix/mat3.d.ts +0 -1
  28. package/dist/gl-matrix/mat3.js +699 -425
  29. package/dist/gl-matrix/mat4.d.ts +0 -1
  30. package/dist/gl-matrix/mat4.js +1879 -1339
  31. package/dist/gl-matrix/quat.d.ts +0 -1
  32. package/dist/gl-matrix/quat.js +655 -257
  33. package/dist/gl-matrix/vec2.d.ts +0 -1
  34. package/dist/gl-matrix/vec2.js +529 -212
  35. package/dist/gl-matrix/vec3.d.ts +0 -1
  36. package/dist/gl-matrix/vec3.js +703 -335
  37. package/dist/gl-matrix/vec4.d.ts +0 -1
  38. package/dist/gl-matrix/vec4.js +579 -293
  39. package/dist/gl-matrix/wip/index.d.ts +3 -4
  40. package/dist/gl-matrix/wip/index.js +5 -1
  41. package/dist/gl-matrix/wip/mat2.d.ts +1 -2
  42. package/dist/gl-matrix/wip/mat2.js +336 -157
  43. package/dist/gl-matrix/wip/mat2d.d.ts +0 -1
  44. package/dist/gl-matrix/wip/mat2d.js +380 -202
  45. package/dist/gl-matrix/wip/quat2.d.ts +0 -1
  46. package/dist/gl-matrix/wip/quat2.js +650 -409
  47. package/dist/index.cjs +60 -100
  48. package/dist/index.cjs.map +7 -0
  49. package/dist/index.d.ts +27 -23
  50. package/dist/index.js +25 -16
  51. package/dist/lib/assert.d.ts +0 -1
  52. package/dist/lib/assert.js +6 -4
  53. package/dist/lib/common.d.ts +2 -3
  54. package/dist/lib/common.js +165 -134
  55. package/dist/lib/gl-matrix-extras.d.ts +0 -1
  56. package/dist/lib/gl-matrix-extras.js +42 -36
  57. package/dist/lib/math-utils.d.ts +0 -1
  58. package/dist/lib/math-utils.js +5 -1
  59. package/dist/lib/validators.d.ts +0 -1
  60. package/dist/lib/validators.js +25 -25
  61. package/package.json +5 -6
  62. package/src/classes/base/math-array.ts +4 -1
  63. package/src/classes/base/matrix.ts +4 -1
  64. package/src/classes/base/vector.ts +4 -1
  65. package/src/classes/euler.ts +4 -1
  66. package/src/classes/matrix3.ts +12 -3
  67. package/src/classes/matrix4.ts +11 -3
  68. package/src/classes/pose.ts +4 -1
  69. package/src/classes/quaternion.ts +4 -1
  70. package/src/classes/spherical-coordinates.ts +4 -1
  71. package/src/classes/vector2.ts +11 -4
  72. package/src/classes/vector3.ts +10 -4
  73. package/src/classes/vector4.ts +9 -4
  74. package/src/gl-matrix/wip/index.js +4 -0
  75. package/src/gl-matrix/wip/mat2.js +4 -0
  76. package/src/gl-matrix/wip/mat2d.js +4 -0
  77. package/src/gl-matrix/wip/quat2.ts +4 -0
  78. package/src/index.ts +10 -2
  79. package/src/lib/assert.ts +4 -0
  80. package/src/lib/common.ts +3 -1
  81. package/src/lib/gl-matrix-extras.ts +4 -0
  82. package/src/lib/gl-matrix.d.ts +4 -0
  83. package/src/lib/math-utils.ts +4 -0
  84. package/src/lib/validators.ts +4 -19
  85. package/dist/classes/base/math-array.d.ts.map +0 -1
  86. package/dist/classes/base/math-array.js.map +0 -1
  87. package/dist/classes/base/matrix.d.ts.map +0 -1
  88. package/dist/classes/base/matrix.js.map +0 -1
  89. package/dist/classes/base/vector.d.ts.map +0 -1
  90. package/dist/classes/base/vector.js.map +0 -1
  91. package/dist/classes/euler.d.ts.map +0 -1
  92. package/dist/classes/euler.js.map +0 -1
  93. package/dist/classes/matrix3.d.ts.map +0 -1
  94. package/dist/classes/matrix3.js.map +0 -1
  95. package/dist/classes/matrix4.d.ts.map +0 -1
  96. package/dist/classes/matrix4.js.map +0 -1
  97. package/dist/classes/pose.d.ts.map +0 -1
  98. package/dist/classes/pose.js.map +0 -1
  99. package/dist/classes/quaternion.d.ts.map +0 -1
  100. package/dist/classes/quaternion.js.map +0 -1
  101. package/dist/classes/spherical-coordinates.d.ts.map +0 -1
  102. package/dist/classes/spherical-coordinates.js.map +0 -1
  103. package/dist/classes/vector2.d.ts.map +0 -1
  104. package/dist/classes/vector2.js.map +0 -1
  105. package/dist/classes/vector3.d.ts.map +0 -1
  106. package/dist/classes/vector3.js.map +0 -1
  107. package/dist/classes/vector4.d.ts.map +0 -1
  108. package/dist/classes/vector4.js.map +0 -1
  109. package/dist/gl-matrix/common.d.ts.map +0 -1
  110. package/dist/gl-matrix/common.js.map +0 -1
  111. package/dist/gl-matrix/mat3.d.ts.map +0 -1
  112. package/dist/gl-matrix/mat3.js.map +0 -1
  113. package/dist/gl-matrix/mat4.d.ts.map +0 -1
  114. package/dist/gl-matrix/mat4.js.map +0 -1
  115. package/dist/gl-matrix/quat.d.ts.map +0 -1
  116. package/dist/gl-matrix/quat.js.map +0 -1
  117. package/dist/gl-matrix/vec2.d.ts.map +0 -1
  118. package/dist/gl-matrix/vec2.js.map +0 -1
  119. package/dist/gl-matrix/vec3.d.ts.map +0 -1
  120. package/dist/gl-matrix/vec3.js.map +0 -1
  121. package/dist/gl-matrix/vec4.d.ts.map +0 -1
  122. package/dist/gl-matrix/vec4.js.map +0 -1
  123. package/dist/gl-matrix/wip/index.d.ts.map +0 -1
  124. package/dist/gl-matrix/wip/index.js.map +0 -1
  125. package/dist/gl-matrix/wip/mat2.d.ts.map +0 -1
  126. package/dist/gl-matrix/wip/mat2.js.map +0 -1
  127. package/dist/gl-matrix/wip/mat2d.d.ts.map +0 -1
  128. package/dist/gl-matrix/wip/mat2d.js.map +0 -1
  129. package/dist/gl-matrix/wip/quat2.d.ts.map +0 -1
  130. package/dist/gl-matrix/wip/quat2.js.map +0 -1
  131. package/dist/gl-matrix/wip/types.d.js +0 -2
  132. package/dist/gl-matrix/wip/types.d.js.map +0 -1
  133. package/dist/index.d.ts.map +0 -1
  134. package/dist/index.js.map +0 -1
  135. package/dist/lib/assert.d.ts.map +0 -1
  136. package/dist/lib/assert.js.map +0 -1
  137. package/dist/lib/common.d.ts.map +0 -1
  138. package/dist/lib/common.js.map +0 -1
  139. package/dist/lib/gl-matrix-extras.d.ts.map +0 -1
  140. package/dist/lib/gl-matrix-extras.js.map +0 -1
  141. package/dist/lib/gl-matrix.d.js +0 -2
  142. package/dist/lib/gl-matrix.d.js.map +0 -1
  143. package/dist/lib/math-utils.d.ts.map +0 -1
  144. package/dist/lib/math-utils.js.map +0 -1
  145. package/dist/lib/validators.d.ts.map +0 -1
  146. package/dist/lib/validators.js.map +0 -1
  147. package/src/gl-matrix/wip/types.d.ts +0 -93
@@ -1,145 +1,138 @@
1
+ // math.gl
2
+ // SPDX-License-Identifier: MIT
3
+ // Copyright (c) vis.gl contributors
4
+ // Copyright (c) 2017 Uber Technologies, Inc.
1
5
  import { Vector } from "./base/vector.js";
2
6
  import { config, isArray } from "../lib/common.js";
3
7
  import { checkNumber } from "../lib/validators.js";
8
+ // @ts-ignore gl-matrix types
4
9
  import { angle as vec3_angle, cross as vec3_cross, rotateX as vec3_rotateX, rotateY as vec3_rotateY, rotateZ as vec3_rotateZ, transformMat4 as vec3_transformMat4, transformMat3 as vec3_transformMat3, transformQuat as vec3_transformQuat } from "../gl-matrix/vec3.js";
10
+ /* eslint-disable camelcase */
5
11
  import { vec3_transformMat2, vec3_transformMat4AsVector } from "../lib/gl-matrix-extras.js";
6
12
  const ORIGIN = [0, 0, 0];
7
13
  let ZERO;
14
+ /**
15
+ * Three-element vector class with common linear algebra operations.
16
+ * Subclass of Array<number> meaning that it is highly compatible with other libraries
17
+ */
8
18
  export class Vector3 extends Vector {
9
- static get ZERO() {
10
- if (!ZERO) {
11
- ZERO = new Vector3(0, 0, 0);
12
- Object.freeze(ZERO);
13
- }
14
-
15
- return ZERO;
16
- }
17
-
18
- constructor(x = 0, y = 0, z = 0) {
19
- super(-0, -0, -0);
20
-
21
- if (arguments.length === 1 && isArray(x)) {
22
- this.copy(x);
23
- } else {
24
- if (config.debug) {
25
- checkNumber(x);
26
- checkNumber(y);
27
- checkNumber(z);
28
- }
29
-
30
- this[0] = x;
31
- this[1] = y;
32
- this[2] = z;
33
- }
34
- }
35
-
36
- set(x, y, z) {
37
- this[0] = x;
38
- this[1] = y;
39
- this[2] = z;
40
- return this.check();
41
- }
42
-
43
- copy(array) {
44
- this[0] = array[0];
45
- this[1] = array[1];
46
- this[2] = array[2];
47
- return this.check();
48
- }
49
-
50
- fromObject(object) {
51
- if (config.debug) {
52
- checkNumber(object.x);
53
- checkNumber(object.y);
54
- checkNumber(object.z);
55
- }
56
-
57
- this[0] = object.x;
58
- this[1] = object.y;
59
- this[2] = object.z;
60
- return this.check();
61
- }
62
-
63
- toObject(object) {
64
- object.x = this[0];
65
- object.y = this[1];
66
- object.z = this[2];
67
- return object;
68
- }
69
-
70
- get ELEMENTS() {
71
- return 3;
72
- }
73
-
74
- get z() {
75
- return this[2];
76
- }
77
-
78
- set z(value) {
79
- this[2] = checkNumber(value);
80
- }
81
-
82
- angle(vector) {
83
- return vec3_angle(this, vector);
84
- }
85
-
86
- cross(vector) {
87
- vec3_cross(this, this, vector);
88
- return this.check();
89
- }
90
-
91
- rotateX({
92
- radians,
93
- origin = ORIGIN
94
- }) {
95
- vec3_rotateX(this, this, origin, radians);
96
- return this.check();
97
- }
98
-
99
- rotateY({
100
- radians,
101
- origin = ORIGIN
102
- }) {
103
- vec3_rotateY(this, this, origin, radians);
104
- return this.check();
105
- }
106
-
107
- rotateZ({
108
- radians,
109
- origin = ORIGIN
110
- }) {
111
- vec3_rotateZ(this, this, origin, radians);
112
- return this.check();
113
- }
114
-
115
- transform(matrix4) {
116
- return this.transformAsPoint(matrix4);
117
- }
118
-
119
- transformAsPoint(matrix4) {
120
- vec3_transformMat4(this, this, matrix4);
121
- return this.check();
122
- }
123
-
124
- transformAsVector(matrix4) {
125
- vec3_transformMat4AsVector(this, this, matrix4);
126
- return this.check();
127
- }
128
-
129
- transformByMatrix3(matrix3) {
130
- vec3_transformMat3(this, this, matrix3);
131
- return this.check();
132
- }
133
-
134
- transformByMatrix2(matrix2) {
135
- vec3_transformMat2(this, this, matrix2);
136
- return this.check();
137
- }
138
-
139
- transformByQuaternion(quaternion) {
140
- vec3_transformQuat(this, this, quaternion);
141
- return this.check();
142
- }
143
-
19
+ static get ZERO() {
20
+ if (!ZERO) {
21
+ ZERO = new Vector3(0, 0, 0);
22
+ Object.freeze(ZERO);
23
+ }
24
+ return ZERO;
25
+ }
26
+ /**
27
+ * @class
28
+ * @param x
29
+ * @param y
30
+ * @param z
31
+ */
32
+ constructor(x = 0, y = 0, z = 0) {
33
+ // PERF NOTE: initialize elements as double precision numbers
34
+ super(-0, -0, -0);
35
+ if (arguments.length === 1 && isArray(x)) {
36
+ this.copy(x);
37
+ }
38
+ else {
39
+ // this.set(x, y, z);
40
+ if (config.debug) {
41
+ checkNumber(x);
42
+ checkNumber(y);
43
+ checkNumber(z);
44
+ }
45
+ // @ts-expect-error TS2412: Property '0' of type 'number | [number, number, number]' is not assignable to numeric index type 'number'
46
+ this[0] = x;
47
+ this[1] = y;
48
+ this[2] = z;
49
+ }
50
+ }
51
+ set(x, y, z) {
52
+ this[0] = x;
53
+ this[1] = y;
54
+ this[2] = z;
55
+ return this.check();
56
+ }
57
+ copy(array) {
58
+ this[0] = array[0];
59
+ this[1] = array[1];
60
+ this[2] = array[2];
61
+ return this.check();
62
+ }
63
+ fromObject(object) {
64
+ if (config.debug) {
65
+ checkNumber(object.x);
66
+ checkNumber(object.y);
67
+ checkNumber(object.z);
68
+ }
69
+ this[0] = object.x;
70
+ this[1] = object.y;
71
+ this[2] = object.z;
72
+ return this.check();
73
+ }
74
+ toObject(object) {
75
+ object.x = this[0];
76
+ object.y = this[1];
77
+ object.z = this[2];
78
+ return object;
79
+ }
80
+ // Getters/setters
81
+ get ELEMENTS() {
82
+ return 3;
83
+ }
84
+ get z() {
85
+ return this[2];
86
+ }
87
+ set z(value) {
88
+ this[2] = checkNumber(value);
89
+ }
90
+ // ACCESSORS
91
+ angle(vector) {
92
+ return vec3_angle(this, vector);
93
+ }
94
+ // MODIFIERS
95
+ cross(vector) {
96
+ vec3_cross(this, this, vector);
97
+ return this.check();
98
+ }
99
+ rotateX({ radians, origin = ORIGIN }) {
100
+ vec3_rotateX(this, this, origin, radians);
101
+ return this.check();
102
+ }
103
+ rotateY({ radians, origin = ORIGIN }) {
104
+ vec3_rotateY(this, this, origin, radians);
105
+ return this.check();
106
+ }
107
+ rotateZ({ radians, origin = ORIGIN }) {
108
+ vec3_rotateZ(this, this, origin, radians);
109
+ return this.check();
110
+ }
111
+ // Transforms
112
+ // transforms as point (4th component is implicitly 1)
113
+ transform(matrix4) {
114
+ return this.transformAsPoint(matrix4);
115
+ }
116
+ // transforms as point (4th component is implicitly 1)
117
+ transformAsPoint(matrix4) {
118
+ vec3_transformMat4(this, this, matrix4);
119
+ return this.check();
120
+ }
121
+ // transforms as vector (4th component is implicitly 0, ignores translation. slightly faster)
122
+ transformAsVector(matrix4) {
123
+ vec3_transformMat4AsVector(this, this, matrix4);
124
+ return this.check();
125
+ }
126
+ transformByMatrix3(matrix3) {
127
+ vec3_transformMat3(this, this, matrix3);
128
+ return this.check();
129
+ }
130
+ transformByMatrix2(matrix2) {
131
+ vec3_transformMat2(this, this, matrix2);
132
+ return this.check();
133
+ }
134
+ transformByQuaternion(quaternion) {
135
+ vec3_transformQuat(this, this, quaternion);
136
+ return this.check();
137
+ }
144
138
  }
145
- //# sourceMappingURL=vector3.js.map
@@ -1,9 +1,11 @@
1
- import { NumericArray } from '@math.gl/types';
2
- import { Vector } from './base/vector';
3
- import type { Matrix4 } from './matrix4';
1
+ import { NumericArray, NumberArray4 } from '@math.gl/types';
2
+ import { Vector } from "./base/vector.js";
3
+ import type { Matrix4 } from "./matrix4.js";
4
+ /** Helper type that captures array length for a 4 element vector */
5
+ export type Vector4Like = Vector4 | NumberArray4;
4
6
  /**
5
- * Four-element vector class.
6
- * Subclass of Array<number>
7
+ * Four-element vector class with common linear algebra operations.
8
+ * Subclass of Array<number> meaning that it is highly compatible with other libraries
7
9
  */
8
10
  export declare class Vector4 extends Vector {
9
11
  static get ZERO(): Vector4;
@@ -38,4 +40,3 @@ export declare class Vector4 extends Vector {
38
40
  transformByQuaternion(quaternion: Readonly<NumericArray>): this;
39
41
  applyMatrix4(m: Matrix4): this;
40
42
  }
41
- //# sourceMappingURL=vector4.d.ts.map
@@ -1,122 +1,116 @@
1
+ // math.gl
2
+ // SPDX-License-Identifier: MIT
3
+ // Copyright (c) vis.gl contributors
4
+ // Copyright (c) 2017 Uber Technologies, Inc.
5
+ /* eslint-disable camelcase */
1
6
  import { transformMat4 as vec4_transformMat4, transformQuat as vec4_transformQuat } from "../gl-matrix/vec3.js";
2
7
  import { vec4_transformMat2, vec4_transformMat3 } from "../lib/gl-matrix-extras.js";
3
8
  import { Vector } from "./base/vector.js";
4
9
  import { config, isArray } from "../lib/common.js";
5
10
  import { checkNumber } from "../lib/validators.js";
6
11
  let ZERO;
12
+ /**
13
+ * Four-element vector class with common linear algebra operations.
14
+ * Subclass of Array<number> meaning that it is highly compatible with other libraries
15
+ */
7
16
  export class Vector4 extends Vector {
8
- static get ZERO() {
9
- if (!ZERO) {
10
- ZERO = new Vector4(0, 0, 0, 0);
11
- Object.freeze(ZERO);
12
- }
13
-
14
- return ZERO;
15
- }
16
-
17
- constructor(x = 0, y = 0, z = 0, w = 0) {
18
- super(-0, -0, -0, -0);
19
-
20
- if (isArray(x) && arguments.length === 1) {
21
- this.copy(x);
22
- } else {
23
- if (config.debug) {
24
- checkNumber(x);
25
- checkNumber(y);
26
- checkNumber(z);
27
- checkNumber(w);
28
- }
29
-
30
- this[0] = x;
31
- this[1] = y;
32
- this[2] = z;
33
- this[3] = w;
34
- }
35
- }
36
-
37
- set(x, y, z, w) {
38
- this[0] = x;
39
- this[1] = y;
40
- this[2] = z;
41
- this[3] = w;
42
- return this.check();
43
- }
44
-
45
- copy(array) {
46
- this[0] = array[0];
47
- this[1] = array[1];
48
- this[2] = array[2];
49
- this[3] = array[3];
50
- return this.check();
51
- }
52
-
53
- fromObject(object) {
54
- if (config.debug) {
55
- checkNumber(object.x);
56
- checkNumber(object.y);
57
- checkNumber(object.z);
58
- checkNumber(object.w);
59
- }
60
-
61
- this[0] = object.x;
62
- this[1] = object.y;
63
- this[2] = object.z;
64
- this[3] = object.w;
65
- return this;
66
- }
67
-
68
- toObject(object) {
69
- object.x = this[0];
70
- object.y = this[1];
71
- object.z = this[2];
72
- object.w = this[3];
73
- return object;
74
- }
75
-
76
- get ELEMENTS() {
77
- return 4;
78
- }
79
-
80
- get z() {
81
- return this[2];
82
- }
83
-
84
- set z(value) {
85
- this[2] = checkNumber(value);
86
- }
87
-
88
- get w() {
89
- return this[3];
90
- }
91
-
92
- set w(value) {
93
- this[3] = checkNumber(value);
94
- }
95
-
96
- transform(matrix4) {
97
- vec4_transformMat4(this, this, matrix4);
98
- return this.check();
99
- }
100
-
101
- transformByMatrix3(matrix3) {
102
- vec4_transformMat3(this, this, matrix3);
103
- return this.check();
104
- }
105
-
106
- transformByMatrix2(matrix2) {
107
- vec4_transformMat2(this, this, matrix2);
108
- return this.check();
109
- }
110
-
111
- transformByQuaternion(quaternion) {
112
- vec4_transformQuat(this, this, quaternion);
113
- return this.check();
114
- }
115
-
116
- applyMatrix4(m) {
117
- m.transform(this, this);
118
- return this;
119
- }
120
-
17
+ static get ZERO() {
18
+ if (!ZERO) {
19
+ ZERO = new Vector4(0, 0, 0, 0);
20
+ Object.freeze(ZERO);
21
+ }
22
+ return ZERO;
23
+ }
24
+ constructor(x = 0, y = 0, z = 0, w = 0) {
25
+ // PERF NOTE: initialize elements as double precision numbers
26
+ super(-0, -0, -0, -0);
27
+ if (isArray(x) && arguments.length === 1) {
28
+ this.copy(x);
29
+ }
30
+ else {
31
+ // this.set(x, y, z, w);
32
+ if (config.debug) {
33
+ checkNumber(x);
34
+ checkNumber(y);
35
+ checkNumber(z);
36
+ checkNumber(w);
37
+ }
38
+ this[0] = x;
39
+ this[1] = y;
40
+ this[2] = z;
41
+ this[3] = w;
42
+ }
43
+ }
44
+ set(x, y, z, w) {
45
+ this[0] = x;
46
+ this[1] = y;
47
+ this[2] = z;
48
+ this[3] = w;
49
+ return this.check();
50
+ }
51
+ copy(array) {
52
+ this[0] = array[0];
53
+ this[1] = array[1];
54
+ this[2] = array[2];
55
+ this[3] = array[3];
56
+ return this.check();
57
+ }
58
+ fromObject(object) {
59
+ if (config.debug) {
60
+ checkNumber(object.x);
61
+ checkNumber(object.y);
62
+ checkNumber(object.z);
63
+ checkNumber(object.w);
64
+ }
65
+ this[0] = object.x;
66
+ this[1] = object.y;
67
+ this[2] = object.z;
68
+ this[3] = object.w;
69
+ return this;
70
+ }
71
+ toObject(object) {
72
+ object.x = this[0];
73
+ object.y = this[1];
74
+ object.z = this[2];
75
+ object.w = this[3];
76
+ return object;
77
+ }
78
+ // Getters/setters
79
+ /* eslint-disable no-multi-spaces, brace-style, no-return-assign */
80
+ get ELEMENTS() {
81
+ return 4;
82
+ }
83
+ get z() {
84
+ return this[2];
85
+ }
86
+ set z(value) {
87
+ this[2] = checkNumber(value);
88
+ }
89
+ get w() {
90
+ return this[3];
91
+ }
92
+ set w(value) {
93
+ this[3] = checkNumber(value);
94
+ }
95
+ transform(matrix4) {
96
+ vec4_transformMat4(this, this, matrix4);
97
+ return this.check();
98
+ }
99
+ transformByMatrix3(matrix3) {
100
+ vec4_transformMat3(this, this, matrix3);
101
+ return this.check();
102
+ }
103
+ transformByMatrix2(matrix2) {
104
+ vec4_transformMat2(this, this, matrix2);
105
+ return this.check();
106
+ }
107
+ transformByQuaternion(quaternion) {
108
+ vec4_transformQuat(this, this, quaternion);
109
+ return this.check();
110
+ }
111
+ // three.js compatibility
112
+ applyMatrix4(m) {
113
+ m.transform(this, this);
114
+ return this;
115
+ }
121
116
  }
122
- //# sourceMappingURL=vector4.js.map
@@ -35,4 +35,3 @@ export const EPSILON: 0.000001;
35
35
  export let ARRAY_TYPE: ArrayConstructor | Float32ArrayConstructor;
36
36
  export const RANDOM: () => number;
37
37
  export const ANGLE_ORDER: "zyx";
38
- //# sourceMappingURL=common.d.ts.map
@@ -1,19 +1,51 @@
1
+ // @eslint-disable
2
+ // @ts-nocheck
3
+ /**
4
+ * Common utilities
5
+ * @module glMatrix
6
+ */
7
+ // Configuration Constants
1
8
  export const EPSILON = 0.000001;
2
9
  export let ARRAY_TYPE = typeof Float32Array !== 'undefined' ? Float32Array : Array;
3
10
  export const RANDOM = Math.random;
4
11
  export const ANGLE_ORDER = 'zyx';
12
+ /**
13
+ * Symmetric round
14
+ * see https://www.npmjs.com/package/round-half-up-symmetric#user-content-detailed-background
15
+ *
16
+ * @param {Number} a value to round
17
+ */
5
18
  export function round(a) {
6
- if (a >= 0) return Math.round(a);
7
- return a % 0.5 === 0 ? Math.floor(a) : Math.round(a);
19
+ if (a >= 0)
20
+ return Math.round(a);
21
+ return a % 0.5 === 0 ? Math.floor(a) : Math.round(a);
8
22
  }
23
+ /**
24
+ * Sets the type of array used when creating new vectors and matrices
25
+ *
26
+ * @param {Float32ArrayConstructor | ArrayConstructor} type Array type, such as Float32Array or Array
27
+ */
9
28
  export function setMatrixArrayType(type) {
10
- ARRAY_TYPE = type;
29
+ ARRAY_TYPE = type;
11
30
  }
12
31
  const degree = Math.PI / 180;
32
+ /**
33
+ * Convert Degree To Radian
34
+ *
35
+ * @param {Number} a Angle in Degrees
36
+ */
13
37
  export function toRadian(a) {
14
- return a * degree;
38
+ return a * degree;
15
39
  }
40
+ /**
41
+ * Tests whether or not the arguments have approximately the same value, within an absolute
42
+ * or relative tolerance of glMatrix.EPSILON (an absolute tolerance is used for values less
43
+ * than or equal to 1.0, and a relative tolerance is used for larger values)
44
+ *
45
+ * @param {Number} a The first number to test.
46
+ * @param {Number} b The second number to test.
47
+ * @returns {Boolean} True if the numbers are approximately equal, false otherwise.
48
+ */
16
49
  export function equals(a, b) {
17
- return Math.abs(a - b) <= EPSILON * Math.max(1.0, Math.abs(a), Math.abs(b));
50
+ return Math.abs(a - b) <= EPSILON * Math.max(1.0, Math.abs(a), Math.abs(b));
18
51
  }
19
- //# sourceMappingURL=common.js.map
@@ -284,4 +284,3 @@ export declare const mul: typeof multiply;
284
284
  * @function
285
285
  */
286
286
  export declare const sub: typeof subtract;
287
- //# sourceMappingURL=mat3.d.ts.map