@math.gl/core 3.5.6 → 3.6.0-alpha.2
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/dist/classes/base/math-array.d.ts +66 -0
- package/dist/classes/base/math-array.d.ts.map +1 -0
- package/dist/classes/base/math-array.js +216 -0
- package/dist/classes/base/matrix.d.ts +14 -0
- package/dist/classes/base/matrix.d.ts.map +1 -0
- package/dist/classes/base/matrix.js +61 -0
- package/dist/classes/base/vector.d.ts +44 -0
- package/dist/classes/base/vector.d.ts.map +1 -0
- package/dist/classes/base/vector.js +126 -0
- package/dist/classes/euler.d.ts +77 -0
- package/dist/classes/euler.d.ts.map +1 -0
- package/dist/classes/euler.js +485 -0
- package/dist/classes/matrix3.d.ts +60 -0
- package/dist/classes/matrix3.d.ts.map +1 -0
- package/dist/classes/matrix3.js +201 -0
- package/dist/classes/matrix4.d.ts +226 -0
- package/dist/classes/matrix4.d.ts.map +1 -0
- package/dist/classes/matrix4.js +538 -0
- package/dist/classes/pose.d.ts +40 -0
- package/dist/classes/pose.d.ts.map +1 -0
- package/dist/classes/pose.js +109 -0
- package/dist/classes/quaternion.d.ts +63 -0
- package/dist/classes/quaternion.d.ts.map +1 -0
- package/dist/classes/quaternion.js +262 -0
- package/dist/classes/spherical-coordinates.d.ts +60 -0
- package/dist/classes/spherical-coordinates.d.ts.map +1 -0
- package/dist/classes/spherical-coordinates.js +148 -0
- package/dist/classes/vector2.d.ts +55 -0
- package/dist/classes/vector2.d.ts.map +1 -0
- package/dist/classes/vector2.js +111 -0
- package/dist/classes/vector3.d.ts +56 -0
- package/dist/classes/vector3.d.ts.map +1 -0
- package/dist/classes/vector3.js +133 -0
- package/dist/classes/vector4.d.ts +41 -0
- package/dist/classes/vector4.d.ts.map +1 -0
- package/dist/classes/vector4.js +114 -0
- package/dist/es5/classes/base/math-array.js +57 -61
- package/dist/es5/classes/base/math-array.js.map +1 -1
- package/dist/es5/classes/base/matrix.js +0 -14
- package/dist/es5/classes/base/matrix.js.map +1 -1
- package/dist/es5/classes/base/vector.js +0 -12
- package/dist/es5/classes/base/vector.js.map +1 -1
- package/dist/es5/classes/euler.js +63 -49
- package/dist/es5/classes/euler.js.map +1 -1
- package/dist/es5/classes/matrix3.js +60 -33
- package/dist/es5/classes/matrix3.js.map +1 -1
- package/dist/es5/classes/matrix4.js +167 -164
- package/dist/es5/classes/matrix4.js.map +1 -1
- package/dist/es5/classes/pose.js +7 -6
- package/dist/es5/classes/pose.js.map +1 -1
- package/dist/es5/classes/quaternion.js +44 -36
- package/dist/es5/classes/quaternion.js.map +1 -1
- package/dist/es5/classes/spherical-coordinates.js +12 -8
- package/dist/es5/classes/spherical-coordinates.js.map +1 -1
- package/dist/es5/classes/vector2.js.map +1 -1
- package/dist/es5/classes/vector3.js +7 -2
- package/dist/es5/classes/vector3.js.map +1 -1
- package/dist/es5/classes/vector4.js +7 -2
- package/dist/es5/classes/vector4.js.map +1 -1
- package/dist/es5/docs/README.md +0 -0
- package/dist/es5/index.js +71 -89
- package/dist/es5/index.js.map +1 -1
- package/dist/es5/lib/assert.js.map +1 -1
- package/dist/es5/lib/common.js +40 -43
- package/dist/es5/lib/common.js.map +1 -1
- package/dist/es5/lib/gl-matrix-extras.js.map +1 -1
- package/dist/es5/lib/gl-matrix.d.js +2 -0
- package/dist/es5/lib/gl-matrix.d.js.map +1 -0
- package/dist/es5/lib/math-utils.js.map +1 -1
- package/dist/es5/lib/validators.js.map +1 -1
- package/dist/esm/classes/base/math-array.js +45 -47
- package/dist/esm/classes/base/math-array.js.map +1 -1
- package/dist/esm/classes/base/matrix.js +0 -11
- package/dist/esm/classes/base/matrix.js.map +1 -1
- package/dist/esm/classes/base/vector.js +0 -10
- package/dist/esm/classes/base/vector.js.map +1 -1
- package/dist/esm/classes/euler.js +61 -48
- package/dist/esm/classes/euler.js.map +1 -1
- package/dist/esm/classes/matrix3.js +55 -33
- package/dist/esm/classes/matrix3.js.map +1 -1
- package/dist/esm/classes/matrix4.js +156 -136
- package/dist/esm/classes/matrix4.js.map +1 -1
- package/dist/esm/classes/pose.js +8 -4
- package/dist/esm/classes/pose.js.map +1 -1
- package/dist/esm/classes/quaternion.js +37 -27
- package/dist/esm/classes/quaternion.js.map +1 -1
- package/dist/esm/classes/spherical-coordinates.js +15 -5
- package/dist/esm/classes/spherical-coordinates.js.map +1 -1
- package/dist/esm/classes/vector2.js.map +1 -1
- package/dist/esm/classes/vector3.js +7 -2
- package/dist/esm/classes/vector3.js.map +1 -1
- package/dist/esm/classes/vector4.js +7 -2
- package/dist/esm/classes/vector4.js.map +1 -1
- package/dist/esm/docs/README.md +0 -0
- package/dist/esm/index.js +2 -13
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/lib/assert.js.map +1 -1
- package/dist/esm/lib/common.js +41 -44
- package/dist/esm/lib/common.js.map +1 -1
- package/dist/esm/lib/gl-matrix-extras.js.map +1 -1
- package/dist/esm/lib/gl-matrix.d.js +2 -0
- package/dist/esm/lib/gl-matrix.d.js.map +1 -0
- package/dist/esm/lib/math-utils.js.map +1 -1
- package/dist/esm/lib/validators.js.map +1 -1
- package/dist/index.d.ts +17 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +24 -0
- package/dist/lib/assert.d.ts +2 -0
- package/dist/lib/assert.d.ts.map +1 -0
- package/dist/lib/assert.js +5 -0
- package/dist/lib/common.d.ts +93 -0
- package/dist/lib/common.d.ts.map +1 -0
- package/dist/lib/common.js +210 -0
- package/dist/lib/gl-matrix-extras.d.ts +7 -0
- package/dist/lib/gl-matrix-extras.d.ts.map +1 -0
- package/dist/lib/gl-matrix-extras.js +49 -0
- package/dist/lib/math-utils.d.ts +28 -0
- package/dist/lib/math-utils.d.ts.map +1 -0
- package/dist/lib/math-utils.js +28 -0
- package/dist/lib/validators.d.ts +6 -0
- package/dist/lib/validators.d.ts.map +1 -0
- package/dist/lib/validators.js +33 -0
- package/package.json +5 -4
- package/src/classes/base/math-array.ts +265 -0
- package/src/classes/base/{matrix.js → matrix.ts} +15 -19
- package/src/classes/base/{vector.js → vector.ts} +47 -54
- package/src/classes/{euler.js → euler.ts} +121 -221
- package/src/classes/matrix3.ts +253 -0
- package/src/classes/matrix4.ts +668 -0
- package/src/classes/{pose.js → pose.ts} +52 -49
- package/src/classes/{quaternion.js → quaternion.ts} +107 -95
- package/src/classes/{spherical-coordinates.js → spherical-coordinates.ts} +84 -54
- package/src/classes/vector2.ts +127 -0
- package/src/classes/{vector3.js → vector3.ts} +43 -55
- package/src/classes/{vector4.js → vector4.ts} +44 -48
- package/src/docs/README.md +0 -0
- package/{dist/esm/index.d.ts → src/index.ts} +32 -34
- package/src/lib/{assert.js → assert.ts} +1 -1
- package/src/lib/common.ts +304 -0
- package/src/lib/{gl-matrix-extras.js → gl-matrix-extras.ts} +26 -5
- package/src/lib/gl-matrix.d.ts +266 -0
- package/src/lib/{math-utils.js → math-utils.ts} +0 -0
- package/src/lib/{validators.js → validators.ts} +10 -6
- package/dist/es5/addons/polygon.d.ts +0 -17
- package/dist/es5/classes/base/math-array.d.ts +0 -56
- package/dist/es5/classes/base/matrix.d.ts +0 -15
- package/dist/es5/classes/base/vector.d.ts +0 -45
- package/dist/es5/classes/euler.d.ts +0 -92
- package/dist/es5/classes/matrix3.d.ts +0 -91
- package/dist/es5/classes/matrix4.d.ts +0 -161
- package/dist/es5/classes/pose.d.ts +0 -92
- package/dist/es5/classes/quaternion.d.ts +0 -107
- package/dist/es5/classes/spherical-coordinates.d.ts +0 -87
- package/dist/es5/classes/vector2.d.ts +0 -65
- package/dist/es5/classes/vector3.d.ts +0 -65
- package/dist/es5/classes/vector4.d.ts +0 -34
- package/dist/es5/index.d.ts +0 -54
- package/dist/es5/lib/common.d.ts +0 -80
- package/dist/esm/addons/polygon.d.ts +0 -17
- package/dist/esm/classes/base/math-array.d.ts +0 -56
- package/dist/esm/classes/base/matrix.d.ts +0 -15
- package/dist/esm/classes/base/vector.d.ts +0 -45
- package/dist/esm/classes/euler.d.ts +0 -92
- package/dist/esm/classes/matrix3.d.ts +0 -91
- package/dist/esm/classes/matrix4.d.ts +0 -161
- package/dist/esm/classes/pose.d.ts +0 -92
- package/dist/esm/classes/quaternion.d.ts +0 -107
- package/dist/esm/classes/spherical-coordinates.d.ts +0 -87
- package/dist/esm/classes/vector2.d.ts +0 -65
- package/dist/esm/classes/vector3.d.ts +0 -65
- package/dist/esm/classes/vector4.d.ts +0 -34
- package/dist/esm/lib/common.d.ts +0 -80
- package/src/addons/polygon.d.ts +0 -17
- package/src/classes/base/math-array.d.ts +0 -56
- package/src/classes/base/math-array.js +0 -250
- package/src/classes/base/matrix.d.ts +0 -15
- package/src/classes/base/vector.d.ts +0 -45
- package/src/classes/euler.d.ts +0 -92
- package/src/classes/matrix3.d.ts +0 -91
- package/src/classes/matrix3.js +0 -225
- package/src/classes/matrix4.d.ts +0 -161
- package/src/classes/matrix4.js +0 -530
- package/src/classes/pose.d.ts +0 -92
- package/src/classes/quaternion.d.ts +0 -107
- package/src/classes/spherical-coordinates.d.ts +0 -87
- package/src/classes/vector2.d.ts +0 -65
- package/src/classes/vector2.js +0 -122
- package/src/classes/vector3.d.ts +0 -65
- package/src/classes/vector4.d.ts +0 -34
- package/src/index.d.ts +0 -54
- package/src/index.js +0 -86
- package/src/lib/common.d.ts +0 -80
- package/src/lib/common.js +0 -222
|
@@ -1,44 +1,43 @@
|
|
|
1
|
-
import { checkVector, deprecated } from '../lib/validators';
|
|
2
1
|
import Matrix from './base/matrix';
|
|
2
|
+
import { checkVector } from '../lib/validators';
|
|
3
3
|
import { vec2_transformMat4AsVector, vec3_transformMat4AsVector } from '../lib/gl-matrix-extras';
|
|
4
4
|
import * as mat4 from 'gl-matrix/mat4';
|
|
5
5
|
import * as vec2 from 'gl-matrix/vec2';
|
|
6
6
|
import * as vec3 from 'gl-matrix/vec3';
|
|
7
7
|
import * as vec4 from 'gl-matrix/vec4';
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
COL0ROW0
|
|
12
|
-
COL0ROW1
|
|
13
|
-
COL0ROW2
|
|
14
|
-
COL0ROW3
|
|
15
|
-
COL1ROW0
|
|
16
|
-
COL1ROW1
|
|
17
|
-
COL1ROW2
|
|
18
|
-
COL1ROW3
|
|
19
|
-
COL2ROW0
|
|
20
|
-
COL2ROW1
|
|
21
|
-
COL2ROW2
|
|
22
|
-
COL2ROW3
|
|
23
|
-
COL3ROW0
|
|
24
|
-
COL3ROW1
|
|
25
|
-
COL3ROW2
|
|
26
|
-
COL3ROW3
|
|
27
|
-
});
|
|
28
|
-
|
|
8
|
+
var INDICES;
|
|
9
|
+
|
|
10
|
+
(function (INDICES) {
|
|
11
|
+
INDICES[INDICES["COL0ROW0"] = 0] = "COL0ROW0";
|
|
12
|
+
INDICES[INDICES["COL0ROW1"] = 1] = "COL0ROW1";
|
|
13
|
+
INDICES[INDICES["COL0ROW2"] = 2] = "COL0ROW2";
|
|
14
|
+
INDICES[INDICES["COL0ROW3"] = 3] = "COL0ROW3";
|
|
15
|
+
INDICES[INDICES["COL1ROW0"] = 4] = "COL1ROW0";
|
|
16
|
+
INDICES[INDICES["COL1ROW1"] = 5] = "COL1ROW1";
|
|
17
|
+
INDICES[INDICES["COL1ROW2"] = 6] = "COL1ROW2";
|
|
18
|
+
INDICES[INDICES["COL1ROW3"] = 7] = "COL1ROW3";
|
|
19
|
+
INDICES[INDICES["COL2ROW0"] = 8] = "COL2ROW0";
|
|
20
|
+
INDICES[INDICES["COL2ROW1"] = 9] = "COL2ROW1";
|
|
21
|
+
INDICES[INDICES["COL2ROW2"] = 10] = "COL2ROW2";
|
|
22
|
+
INDICES[INDICES["COL2ROW3"] = 11] = "COL2ROW3";
|
|
23
|
+
INDICES[INDICES["COL3ROW0"] = 12] = "COL3ROW0";
|
|
24
|
+
INDICES[INDICES["COL3ROW1"] = 13] = "COL3ROW1";
|
|
25
|
+
INDICES[INDICES["COL3ROW2"] = 14] = "COL3ROW2";
|
|
26
|
+
INDICES[INDICES["COL3ROW3"] = 15] = "COL3ROW3";
|
|
27
|
+
})(INDICES || (INDICES = {}));
|
|
28
|
+
|
|
29
|
+
const DEFAULT_FOVY = 45 * Math.PI / 180;
|
|
30
|
+
const DEFAULT_ASPECT = 1;
|
|
31
|
+
const DEFAULT_NEAR = 0.1;
|
|
32
|
+
const DEFAULT_FAR = 500;
|
|
33
|
+
const IDENTITY_MATRIX = Object.freeze([1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1]);
|
|
29
34
|
export default class Matrix4 extends Matrix {
|
|
30
35
|
static get IDENTITY() {
|
|
31
|
-
|
|
32
|
-
return constants.IDENTITY;
|
|
36
|
+
return getIdentityMatrix();
|
|
33
37
|
}
|
|
34
38
|
|
|
35
39
|
static get ZERO() {
|
|
36
|
-
|
|
37
|
-
return constants.ZERO;
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
get INDICES() {
|
|
41
|
-
return INDICES;
|
|
40
|
+
return getZeroMatrix();
|
|
42
41
|
}
|
|
43
42
|
|
|
44
43
|
get ELEMENTS() {
|
|
@@ -49,6 +48,10 @@ export default class Matrix4 extends Matrix {
|
|
|
49
48
|
return 4;
|
|
50
49
|
}
|
|
51
50
|
|
|
51
|
+
get INDICES() {
|
|
52
|
+
return INDICES;
|
|
53
|
+
}
|
|
54
|
+
|
|
52
55
|
constructor(array) {
|
|
53
56
|
super(-0, -0, -0, -0, -0, -0, -0, -0, -0, -0, -0, -0, -0, -0, -0, -0);
|
|
54
57
|
|
|
@@ -140,24 +143,30 @@ export default class Matrix4 extends Matrix {
|
|
|
140
143
|
}
|
|
141
144
|
|
|
142
145
|
identity() {
|
|
143
|
-
return this.copy(
|
|
146
|
+
return this.copy(IDENTITY_MATRIX);
|
|
144
147
|
}
|
|
145
148
|
|
|
146
|
-
|
|
147
|
-
mat4.fromQuat(this, q);
|
|
149
|
+
fromObject(object) {
|
|
148
150
|
return this.check();
|
|
149
151
|
}
|
|
150
152
|
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
153
|
+
fromQuaternion(quaternion) {
|
|
154
|
+
mat4.fromQuat(this, quaternion);
|
|
155
|
+
return this.check();
|
|
156
|
+
}
|
|
157
|
+
|
|
158
|
+
frustum(view) {
|
|
159
|
+
const {
|
|
160
|
+
left,
|
|
161
|
+
right,
|
|
162
|
+
bottom,
|
|
163
|
+
top,
|
|
164
|
+
near = DEFAULT_NEAR,
|
|
165
|
+
far = DEFAULT_FAR
|
|
166
|
+
} = view;
|
|
167
|
+
|
|
159
168
|
if (far === Infinity) {
|
|
160
|
-
|
|
169
|
+
computeInfinitePerspectiveOffCenter(this, left, right, bottom, top, near);
|
|
161
170
|
} else {
|
|
162
171
|
mat4.frustum(this, left, right, bottom, top, near, far);
|
|
163
172
|
}
|
|
@@ -165,75 +174,42 @@ export default class Matrix4 extends Matrix {
|
|
|
165
174
|
return this.check();
|
|
166
175
|
}
|
|
167
176
|
|
|
168
|
-
|
|
169
|
-
const
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
const column2Row3 = -1.0;
|
|
175
|
-
const column3Row2 = -2.0 * near;
|
|
176
|
-
result[0] = column0Row0;
|
|
177
|
-
result[1] = 0.0;
|
|
178
|
-
result[2] = 0.0;
|
|
179
|
-
result[3] = 0.0;
|
|
180
|
-
result[4] = 0.0;
|
|
181
|
-
result[5] = column1Row1;
|
|
182
|
-
result[6] = 0.0;
|
|
183
|
-
result[7] = 0.0;
|
|
184
|
-
result[8] = column2Row0;
|
|
185
|
-
result[9] = column2Row1;
|
|
186
|
-
result[10] = column2Row2;
|
|
187
|
-
result[11] = column2Row3;
|
|
188
|
-
result[12] = 0.0;
|
|
189
|
-
result[13] = 0.0;
|
|
190
|
-
result[14] = column3Row2;
|
|
191
|
-
result[15] = 0.0;
|
|
192
|
-
return result;
|
|
193
|
-
}
|
|
194
|
-
|
|
195
|
-
lookAt(eye, center, up) {
|
|
196
|
-
if (arguments.length === 1) {
|
|
197
|
-
({
|
|
198
|
-
eye,
|
|
199
|
-
center,
|
|
200
|
-
up
|
|
201
|
-
} = eye);
|
|
202
|
-
}
|
|
203
|
-
|
|
204
|
-
center = center || [0, 0, 0];
|
|
205
|
-
up = up || [0, 1, 0];
|
|
177
|
+
lookAt(view) {
|
|
178
|
+
const {
|
|
179
|
+
eye,
|
|
180
|
+
center = [0, 0, 0],
|
|
181
|
+
up = [0, 1, 0]
|
|
182
|
+
} = view;
|
|
206
183
|
mat4.lookAt(this, eye, center, up);
|
|
207
184
|
return this.check();
|
|
208
185
|
}
|
|
209
186
|
|
|
210
|
-
ortho({
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
187
|
+
ortho(view) {
|
|
188
|
+
const {
|
|
189
|
+
left,
|
|
190
|
+
right,
|
|
191
|
+
bottom,
|
|
192
|
+
top,
|
|
193
|
+
near = DEFAULT_NEAR,
|
|
194
|
+
far = DEFAULT_FAR
|
|
195
|
+
} = view;
|
|
218
196
|
mat4.ortho(this, left, right, bottom, top, near, far);
|
|
219
197
|
return this.check();
|
|
220
198
|
}
|
|
221
199
|
|
|
222
|
-
orthographic({
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
}
|
|
232
|
-
|
|
200
|
+
orthographic(view) {
|
|
201
|
+
const {
|
|
202
|
+
fovy = DEFAULT_FOVY,
|
|
203
|
+
aspect = DEFAULT_ASPECT,
|
|
204
|
+
focalDistance = 1,
|
|
205
|
+
near = DEFAULT_NEAR,
|
|
206
|
+
far = DEFAULT_FAR
|
|
207
|
+
} = view;
|
|
208
|
+
checkRadians(fovy);
|
|
233
209
|
const halfY = fovy / 2;
|
|
234
210
|
const top = focalDistance * Math.tan(halfY);
|
|
235
211
|
const right = top * aspect;
|
|
236
|
-
return
|
|
212
|
+
return this.ortho({
|
|
237
213
|
left: -right,
|
|
238
214
|
right,
|
|
239
215
|
bottom: -top,
|
|
@@ -243,19 +219,14 @@ export default class Matrix4 extends Matrix {
|
|
|
243
219
|
});
|
|
244
220
|
}
|
|
245
221
|
|
|
246
|
-
perspective({
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
fovy
|
|
254
|
-
|
|
255
|
-
if (fovy > Math.PI * 2) {
|
|
256
|
-
throw Error('radians');
|
|
257
|
-
}
|
|
258
|
-
|
|
222
|
+
perspective(view) {
|
|
223
|
+
const {
|
|
224
|
+
fovy = 45 * Math.PI / 180,
|
|
225
|
+
aspect = 1,
|
|
226
|
+
near = 0.1,
|
|
227
|
+
far = 500
|
|
228
|
+
} = view;
|
|
229
|
+
checkRadians(fovy);
|
|
259
230
|
mat4.perspective(this, fovy, aspect, near, far);
|
|
260
231
|
return this.check();
|
|
261
232
|
}
|
|
@@ -278,8 +249,10 @@ export default class Matrix4 extends Matrix {
|
|
|
278
249
|
return result;
|
|
279
250
|
}
|
|
280
251
|
|
|
281
|
-
getRotation(result
|
|
282
|
-
|
|
252
|
+
getRotation(result, scaleResult) {
|
|
253
|
+
result = result || [-0, -0, -0, -0, -0, -0, -0, -0, -0, -0, -0, -0, -0, -0, -0, -0];
|
|
254
|
+
scaleResult = scaleResult || [-0, -0, -0];
|
|
255
|
+
const scale = this.getScale(scaleResult);
|
|
283
256
|
const inverseScale0 = 1 / scale[0];
|
|
284
257
|
const inverseScale1 = 1 / scale[1];
|
|
285
258
|
const inverseScale2 = 1 / scale[2];
|
|
@@ -302,8 +275,10 @@ export default class Matrix4 extends Matrix {
|
|
|
302
275
|
return result;
|
|
303
276
|
}
|
|
304
277
|
|
|
305
|
-
getRotationMatrix3(result
|
|
306
|
-
|
|
278
|
+
getRotationMatrix3(result, scaleResult) {
|
|
279
|
+
result = result || [-0, -0, -0, -0, -0, -0, -0, -0, -0];
|
|
280
|
+
scaleResult = scaleResult || [-0, -0, -0];
|
|
281
|
+
const scale = this.getScale(scaleResult);
|
|
307
282
|
const inverseScale0 = 1 / scale[0];
|
|
308
283
|
const inverseScale1 = 1 / scale[1];
|
|
309
284
|
const inverseScale2 = 1 / scale[2];
|
|
@@ -354,8 +329,8 @@ export default class Matrix4 extends Matrix {
|
|
|
354
329
|
return this.check();
|
|
355
330
|
}
|
|
356
331
|
|
|
357
|
-
rotateXYZ(
|
|
358
|
-
return this.rotateX(
|
|
332
|
+
rotateXYZ(angleXYZ) {
|
|
333
|
+
return this.rotateX(angleXYZ[0]).rotateY(angleXYZ[1]).rotateZ(angleXYZ[2]);
|
|
359
334
|
}
|
|
360
335
|
|
|
361
336
|
rotateAxis(radians, axis) {
|
|
@@ -364,17 +339,12 @@ export default class Matrix4 extends Matrix {
|
|
|
364
339
|
}
|
|
365
340
|
|
|
366
341
|
scale(factor) {
|
|
367
|
-
|
|
368
|
-
mat4.scale(this, this, factor);
|
|
369
|
-
} else {
|
|
370
|
-
mat4.scale(this, this, [factor, factor, factor]);
|
|
371
|
-
}
|
|
372
|
-
|
|
342
|
+
mat4.scale(this, this, Array.isArray(factor) ? factor : [factor, factor, factor]);
|
|
373
343
|
return this.check();
|
|
374
344
|
}
|
|
375
345
|
|
|
376
|
-
translate(
|
|
377
|
-
mat4.translate(this, this,
|
|
346
|
+
translate(vector) {
|
|
347
|
+
mat4.translate(this, this, vector);
|
|
378
348
|
return this.check();
|
|
379
349
|
}
|
|
380
350
|
|
|
@@ -428,6 +398,18 @@ export default class Matrix4 extends Matrix {
|
|
|
428
398
|
return result;
|
|
429
399
|
}
|
|
430
400
|
|
|
401
|
+
transformPoint(vector, result) {
|
|
402
|
+
return this.transformAsPoint(vector, result);
|
|
403
|
+
}
|
|
404
|
+
|
|
405
|
+
transformVector(vector, result) {
|
|
406
|
+
return this.transformAsPoint(vector, result);
|
|
407
|
+
}
|
|
408
|
+
|
|
409
|
+
transformDirection(vector, result) {
|
|
410
|
+
return this.transformAsVector(vector, result);
|
|
411
|
+
}
|
|
412
|
+
|
|
431
413
|
makeRotationX(radians) {
|
|
432
414
|
return this.identity().rotateX(radians);
|
|
433
415
|
}
|
|
@@ -436,20 +418,58 @@ export default class Matrix4 extends Matrix {
|
|
|
436
418
|
return this.identity().translate([x, y, z]);
|
|
437
419
|
}
|
|
438
420
|
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
421
|
+
}
|
|
422
|
+
let ZERO;
|
|
423
|
+
let IDENTITY;
|
|
424
|
+
|
|
425
|
+
function getZeroMatrix() {
|
|
426
|
+
if (!ZERO) {
|
|
427
|
+
ZERO = new Matrix4([0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]);
|
|
428
|
+
Object.freeze(ZERO);
|
|
442
429
|
}
|
|
443
430
|
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
|
|
431
|
+
return ZERO;
|
|
432
|
+
}
|
|
433
|
+
|
|
434
|
+
function getIdentityMatrix() {
|
|
435
|
+
if (!IDENTITY) {
|
|
436
|
+
IDENTITY = new Matrix4();
|
|
437
|
+
Object.freeze(IDENTITY);
|
|
447
438
|
}
|
|
448
439
|
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
|
|
440
|
+
return IDENTITY;
|
|
441
|
+
}
|
|
442
|
+
|
|
443
|
+
function checkRadians(possiblyDegrees) {
|
|
444
|
+
if (possiblyDegrees > Math.PI * 2) {
|
|
445
|
+
throw Error('expected radians');
|
|
452
446
|
}
|
|
447
|
+
}
|
|
453
448
|
|
|
449
|
+
function computeInfinitePerspectiveOffCenter(result, left, right, bottom, top, near) {
|
|
450
|
+
const column0Row0 = 2 * near / (right - left);
|
|
451
|
+
const column1Row1 = 2 * near / (top - bottom);
|
|
452
|
+
const column2Row0 = (right + left) / (right - left);
|
|
453
|
+
const column2Row1 = (top + bottom) / (top - bottom);
|
|
454
|
+
const column2Row2 = -1;
|
|
455
|
+
const column2Row3 = -1;
|
|
456
|
+
const column3Row2 = -2 * near;
|
|
457
|
+
result[0] = column0Row0;
|
|
458
|
+
result[1] = 0;
|
|
459
|
+
result[2] = 0;
|
|
460
|
+
result[3] = 0;
|
|
461
|
+
result[4] = 0;
|
|
462
|
+
result[5] = column1Row1;
|
|
463
|
+
result[6] = 0;
|
|
464
|
+
result[7] = 0;
|
|
465
|
+
result[8] = column2Row0;
|
|
466
|
+
result[9] = column2Row1;
|
|
467
|
+
result[10] = column2Row2;
|
|
468
|
+
result[11] = column2Row3;
|
|
469
|
+
result[12] = 0;
|
|
470
|
+
result[13] = 0;
|
|
471
|
+
result[14] = column3Row2;
|
|
472
|
+
result[15] = 0;
|
|
473
|
+
return result;
|
|
454
474
|
}
|
|
455
475
|
//# sourceMappingURL=matrix4.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/classes/matrix4.js"],"names":["checkVector","deprecated","Matrix","vec2_transformMat4AsVector","vec3_transformMat4AsVector","mat4","vec2","vec3","vec4","IDENTITY","Object","freeze","ZERO","INDICES","COL0ROW0","COL0ROW1","COL0ROW2","COL0ROW3","COL1ROW0","COL1ROW1","COL1ROW2","COL1ROW3","COL2ROW0","COL2ROW1","COL2ROW2","COL2ROW3","COL3ROW0","COL3ROW1","COL3ROW2","COL3ROW3","constants","Matrix4","ELEMENTS","RANK","constructor","array","arguments","length","Array","isArray","copy","identity","check","set","m00","m10","m20","m30","m01","m11","m21","m31","m02","m12","m22","m32","m03","m13","m23","m33","setRowMajor","toRowMajor","result","fromQuaternion","q","fromQuat","frustum","left","right","bottom","top","near","far","Infinity","_computeInfinitePerspectiveOffCenter","column0Row0","column1Row1","column2Row0","column2Row1","column2Row2","column2Row3","column3Row2","lookAt","eye","center","up","ortho","orthographic","fovy","Math","PI","aspect","focalDistance","Error","halfY","tan","perspective","undefined","fov","determinant","getScale","sqrt","getTranslation","getRotation","scaleResult","scale","inverseScale0","inverseScale1","inverseScale2","getRotationMatrix3","transpose","invert","multiplyLeft","a","multiply","multiplyRight","rotateX","radians","rotateY","rotateZ","rotateXYZ","rx","ry","rz","rotateAxis","axis","rotate","factor","translate","vec","transform","vector","transformMat4","transformAsPoint","transformAsVector","makeRotationX","makeTranslation","x","y","z","transformPoint","transformVector","transformDirection"],"mappings":"AAoBA,SAAQA,WAAR,EAAqBC,UAArB,QAAsC,mBAAtC;AACA,OAAOC,MAAP,MAAmB,eAAnB;AAEA,SAAQC,0BAAR,EAAoCC,0BAApC,QAAqE,yBAArE;AAGA,OAAO,KAAKC,IAAZ,MAAsB,gBAAtB;AAEA,OAAO,KAAKC,IAAZ,MAAsB,gBAAtB;AAEA,OAAO,KAAKC,IAAZ,MAAsB,gBAAtB;AAEA,OAAO,KAAKC,IAAZ,MAAsB,gBAAtB;AAEA,MAAMC,QAAQ,GAAGC,MAAM,CAACC,MAAP,CAAc,CAAC,CAAD,EAAI,CAAJ,EAAO,CAAP,EAAU,CAAV,EAAa,CAAb,EAAgB,CAAhB,EAAmB,CAAnB,EAAsB,CAAtB,EAAyB,CAAzB,EAA4B,CAA5B,EAA+B,CAA/B,EAAkC,CAAlC,EAAqC,CAArC,EAAwC,CAAxC,EAA2C,CAA3C,EAA8C,CAA9C,CAAd,CAAjB;AACA,MAAMC,IAAI,GAAGF,MAAM,CAACC,MAAP,CAAc,CAAC,CAAD,EAAI,CAAJ,EAAO,CAAP,EAAU,CAAV,EAAa,CAAb,EAAgB,CAAhB,EAAmB,CAAnB,EAAsB,CAAtB,EAAyB,CAAzB,EAA4B,CAA5B,EAA+B,CAA/B,EAAkC,CAAlC,EAAqC,CAArC,EAAwC,CAAxC,EAA2C,CAA3C,EAA8C,CAA9C,CAAd,CAAb;AAEA,MAAME,OAAO,GAAGH,MAAM,CAACC,MAAP,CAAc;AAC5BG,EAAAA,QAAQ,EAAE,CADkB;AAE5BC,EAAAA,QAAQ,EAAE,CAFkB;AAG5BC,EAAAA,QAAQ,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B2E,OAAhB,CAAwBC,OAAxB,CAAP;AACD;;AAEDmB,EAAAA,eAAe,CAACC,CAAD,EAAIC,CAAJ,EAAOC,CAAP,EAAU;AACvB,WAAO,KAAKlG,QAAL,GAAgBuF,SAAhB,CAA0B,CAACS,CAAD,EAAIC,CAAJ,EAAOC,CAAP,CAA1B,CAAP;AACD;;AAIDC,EAAAA,cAAc,CAACT,MAAD,EAASrE,MAAT,EAAiB;AAC7B7D,IAAAA,UAAU,CAAC,wBAAD,EAA2B,KAA3B,CAAV;AACA,WAAO,KAAKoI,gBAAL,CAAsBF,MAAtB,EAA8BrE,MAA9B,CAAP;AACD;;AAED+E,EAAAA,eAAe,CAACV,MAAD,EAASrE,MAAT,EAAiB;AAC9B7D,IAAAA,UAAU,CAAC,yBAAD,EAA4B,KAA5B,CAAV;AACA,WAAO,KAAKoI,gBAAL,CAAsBF,MAAtB,EAA8BrE,MAA9B,CAAP;AACD;;AAEDgF,EAAAA,kBAAkB,CAACX,MAAD,EAASrE,MAAT,EAAiB;AACjC7D,IAAAA,UAAU,CAAC,4BAAD,EAA+B,KAA/B,CAAV;AACA,WAAO,KAAKqI,iBAAL,CAAuBH,MAAvB,EAA+BrE,MAA/B,CAAP;AACD;;AAtdyC","sourcesContent":["// Copyright (c) 2017 Uber Technologies, Inc.\n//\n// Permission is hereby granted, free of charge, to any person obtaining a copy\n// of this software and associated documentation files (the \"Software\"), to deal\n// in the Software without restriction, including without limitation the rights\n// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n// copies of the Software, and to permit persons to whom the Software is\n// furnished to do so, subject to the following conditions:\n//\n// The above copyright notice and this permission notice shall be included in\n// all copies or substantial portions of the Software.\n//\n// THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\n// THE SOFTWARE.\n\nimport {checkVector, deprecated} from '../lib/validators';\nimport Matrix from './base/matrix';\n// eslint-disable-next-line camelcase\nimport {vec2_transformMat4AsVector, vec3_transformMat4AsVector} from '../lib/gl-matrix-extras';\n\n// @ts-ignore: error TS2307: Cannot find module 'gl-matrix/...'.\nimport * as mat4 from 'gl-matrix/mat4';\n// @ts-ignore: error TS2307: Cannot find module 'gl-matrix/...'.\nimport * as vec2 from 'gl-matrix/vec2';\n// @ts-ignore: error TS2307: Cannot find module 'gl-matrix/...'.\nimport * as vec3 from 'gl-matrix/vec3';\n// @ts-ignore: error TS2307: Cannot find module 'gl-matrix/...'.\nimport * as vec4 from 'gl-matrix/vec4';\n\nconst IDENTITY = Object.freeze([1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1]);\nconst ZERO = Object.freeze([0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]);\n\nconst INDICES = Object.freeze({\n COL0ROW0: 0,\n COL0ROW1: 1,\n COL0ROW2: 2,\n COL0ROW3: 3,\n COL1ROW0: 4,\n COL1ROW1: 5,\n COL1ROW2: 6,\n COL1ROW3: 7,\n COL2ROW0: 8,\n COL2ROW1: 9,\n COL2ROW2: 10,\n COL2ROW3: 11,\n COL3ROW0: 12,\n COL3ROW1: 13,\n COL3ROW2: 14,\n COL3ROW3: 15\n});\n\nconst constants = {};\n\nexport default class Matrix4 extends Matrix {\n static get IDENTITY() {\n constants.IDENTITY = constants.IDENTITY || Object.freeze(new Matrix4(IDENTITY));\n return constants.IDENTITY;\n }\n\n static get ZERO() {\n constants.ZERO = constants.ZERO || Object.freeze(new Matrix4(ZERO));\n return constants.ZERO;\n }\n\n get INDICES() {\n return INDICES;\n }\n\n get ELEMENTS() {\n return 16;\n }\n\n get RANK() {\n return 4;\n }\n\n constructor(array) {\n // PERF NOTE: initialize elements as double precision numbers\n super(-0, -0, -0, -0, -0, -0, -0, -0, -0, -0, -0, -0, -0, -0, -0, -0);\n if (arguments.length === 1 && Array.isArray(array)) {\n this.copy(array);\n } else {\n this.identity();\n }\n }\n\n copy(array) {\n this[0] = array[0];\n this[1] = array[1];\n this[2] = array[2];\n this[3] = array[3];\n this[4] = array[4];\n this[5] = array[5];\n this[6] = array[6];\n this[7] = array[7];\n this[8] = array[8];\n this[9] = array[9];\n this[10] = array[10];\n this[11] = array[11];\n this[12] = array[12];\n this[13] = array[13];\n this[14] = array[14];\n this[15] = array[15];\n return this.check();\n }\n\n // eslint-disable-next-line max-params\n set(m00, m10, m20, m30, m01, m11, m21, m31, m02, m12, m22, m32, m03, m13, m23, m33) {\n this[0] = m00;\n this[1] = m10;\n this[2] = m20;\n this[3] = m30;\n this[4] = m01;\n this[5] = m11;\n this[6] = m21;\n this[7] = m31;\n this[8] = m02;\n this[9] = m12;\n this[10] = m22;\n this[11] = m32;\n this[12] = m03;\n this[13] = m13;\n this[14] = m23;\n this[15] = m33;\n return this.check();\n }\n\n // accepts row major order, stores as column major\n // eslint-disable-next-line max-params\n setRowMajor(m00, m01, m02, m03, m10, m11, m12, m13, m20, m21, m22, m23, m30, m31, m32, m33) {\n this[0] = m00;\n this[1] = m10;\n this[2] = m20;\n this[3] = m30;\n this[4] = m01;\n this[5] = m11;\n this[6] = m21;\n this[7] = m31;\n this[8] = m02;\n this[9] = m12;\n this[10] = m22;\n this[11] = m32;\n this[12] = m03;\n this[13] = m13;\n this[14] = m23;\n this[15] = m33;\n return this.check();\n }\n\n toRowMajor(result) {\n result[0] = this[0];\n result[1] = this[4];\n result[2] = this[8];\n result[3] = this[12];\n result[4] = this[1];\n result[5] = this[5];\n result[6] = this[9];\n result[7] = this[13];\n result[8] = this[2];\n result[9] = this[6];\n result[10] = this[10];\n result[11] = this[14];\n result[12] = this[3];\n result[13] = this[7];\n result[14] = this[11];\n result[15] = this[15];\n return result;\n }\n\n // Constructors\n\n identity() {\n return this.copy(IDENTITY);\n }\n\n // Calculates a 4x4 matrix from the given quaternion\n // q quat Quaternion to create matrix from\n fromQuaternion(q) {\n mat4.fromQuat(this, q);\n return this.check();\n }\n\n // Generates a frustum matrix with the given bounds\n // left Number Left bound of the frustum\n // right Number Right bound of the frustum\n // bottom Number Bottom bound of the frustum\n // top Number Top bound of the frustum\n // near Number Near bound of the frustum\n // far Number Far bound of the frustum\n frustum({left, right, bottom, top, near, far}) {\n if (far === Infinity) {\n Matrix4._computeInfinitePerspectiveOffCenter(this, left, right, bottom, top, near);\n } else {\n mat4.frustum(this, left, right, bottom, top, near, far);\n }\n return this.check();\n }\n\n // eslint-disable-next-line max-params\n static _computeInfinitePerspectiveOffCenter(result, left, right, bottom, top, near) {\n const column0Row0 = (2.0 * near) / (right - left);\n const column1Row1 = (2.0 * near) / (top - bottom);\n const column2Row0 = (right + left) / (right - left);\n const column2Row1 = (top + bottom) / (top - bottom);\n const column2Row2 = -1.0;\n const column2Row3 = -1.0;\n const column3Row2 = -2.0 * near;\n\n result[0] = column0Row0;\n result[1] = 0.0;\n result[2] = 0.0;\n result[3] = 0.0;\n result[4] = 0.0;\n result[5] = column1Row1;\n result[6] = 0.0;\n result[7] = 0.0;\n result[8] = column2Row0;\n result[9] = column2Row1;\n result[10] = column2Row2;\n result[11] = column2Row3;\n result[12] = 0.0;\n result[13] = 0.0;\n result[14] = column3Row2;\n result[15] = 0.0;\n return result;\n }\n\n // Generates a look-at matrix with the given eye position, focal point,\n // and up axis\n // eye vec3 Position of the viewer\n // center vec3 Point the viewer is looking at\n // up vec3 vec3 pointing up\n lookAt(eye, center, up) {\n // Signature: lookAt({eye, center = [0, 0, 0], up = [0, 1, 0]}))\n if (arguments.length === 1) {\n ({eye, center, up} = eye);\n }\n\n center = center || [0, 0, 0];\n up = up || [0, 1, 0];\n\n mat4.lookAt(this, eye, center, up);\n return this.check();\n }\n\n // Generates a orthogonal projection matrix with the given bounds\n // from \"traditional\" view space parameters\n // left number Left bound of the frustum\n // right number Right bound of the frustum\n // bottom number Bottom bound of the frustum\n // top number Top bound of the frustum\n // near number Near bound of the frustum\n // far number Far bound of the frustum\n ortho({left, right, bottom, top, near = 0.1, far = 500}) {\n mat4.ortho(this, left, right, bottom, top, near, far);\n return this.check();\n }\n\n // Generates an orthogonal projection matrix with the same parameters\n // as a perspective matrix (plus focalDistance)\n // fovy number Vertical field of view in radians\n // aspect number Aspect ratio. typically viewport width/height\n // focalDistance distance in the view frustum used for extent calculations\n // near number Near bound of the frustum\n // far number Far bound of the frustum\n orthographic({\n fovy = (45 * Math.PI) / 180,\n aspect = 1,\n focalDistance = 1,\n near = 0.1,\n far = 500\n }) {\n if (fovy > Math.PI * 2) {\n throw Error('radians');\n }\n const halfY = fovy / 2;\n const top = focalDistance * Math.tan(halfY); // focus_plane is the distance from the camera\n const right = top * aspect;\n\n return new Matrix4().ortho({\n left: -right,\n right,\n bottom: -top,\n top,\n near,\n far\n });\n }\n\n // Generates a perspective projection matrix with the given bounds\n // fovy number Vertical field of view in radians\n // aspect number Aspect ratio. typically viewport width/height\n // near number Near bound of the frustum\n // far number Far bound of the frustum\n perspective({\n fovy = undefined,\n fov = (45 * Math.PI) / 180, // DEPRECATED\n aspect = 1,\n near = 0.1,\n far = 500\n } = {}) {\n fovy = fovy || fov;\n if (fovy > Math.PI * 2) {\n throw Error('radians');\n }\n mat4.perspective(this, fovy, aspect, near, far);\n return this.check();\n }\n\n // Accessors\n\n determinant() {\n return mat4.determinant(this);\n }\n\n // Extracts the non-uniform scale assuming the matrix is an affine transformation.\n // The scales are the \"lengths\" of the column vectors in the upper-left 3x3 matrix.\n getScale(result = [-0, -0, -0]) {\n // explicit is faster than hypot...\n result[0] = Math.sqrt(this[0] * this[0] + this[1] * this[1] + this[2] * this[2]);\n result[1] = Math.sqrt(this[4] * this[4] + this[5] * this[5] + this[6] * this[6]);\n result[2] = Math.sqrt(this[8] * this[8] + this[9] * this[9] + this[10] * this[10]);\n // result[0] = Math.hypot(this[0], this[1], this[2]);\n // result[1] = Math.hypot(this[4], this[5], this[6]);\n // result[2] = Math.hypot(this[8], this[9], this[10]);\n return result;\n }\n\n // Gets the translation portion, assuming the matrix is a affine transformation matrix.\n getTranslation(result = [-0, -0, -0]) {\n result[0] = this[12];\n result[1] = this[13];\n result[2] = this[14];\n return result;\n }\n\n // Gets upper left 3x3 pure rotation matrix (non-scaling), assume affine transformation matrix\n getRotation(\n result = [-0, -0, -0, -0, -0, -0, -0, -0, -0, -0, -0, -0, -0, -0, -0, -0],\n scaleResult = null\n ) {\n const scale = this.getScale(scaleResult || [-0, -0, -0]);\n\n const inverseScale0 = 1 / scale[0];\n const inverseScale1 = 1 / scale[1];\n const inverseScale2 = 1 / scale[2];\n\n result[0] = this[0] * inverseScale0;\n result[1] = this[1] * inverseScale1;\n result[2] = this[2] * inverseScale2;\n result[3] = 0;\n result[4] = this[4] * inverseScale0;\n result[5] = this[5] * inverseScale1;\n result[6] = this[6] * inverseScale2;\n result[7] = 0;\n result[8] = this[8] * inverseScale0;\n result[9] = this[9] * inverseScale1;\n result[10] = this[10] * inverseScale2;\n result[11] = 0;\n result[12] = 0;\n result[13] = 0;\n result[14] = 0;\n result[15] = 1;\n return result;\n }\n\n getRotationMatrix3(result = [-0, -0, -0, -0, -0, -0, -0, -0, -0], scaleResult = null) {\n const scale = this.getScale(scaleResult || [-0, -0, -0]);\n\n const inverseScale0 = 1 / scale[0];\n const inverseScale1 = 1 / scale[1];\n const inverseScale2 = 1 / scale[2];\n\n result[0] = this[0] * inverseScale0;\n result[1] = this[1] * inverseScale1;\n result[2] = this[2] * inverseScale2;\n result[3] = this[4] * inverseScale0;\n result[4] = this[5] * inverseScale1;\n result[5] = this[6] * inverseScale2;\n result[6] = this[8] * inverseScale0;\n result[7] = this[9] * inverseScale1;\n result[8] = this[10] * inverseScale2;\n return result;\n }\n\n // Modifiers\n\n transpose() {\n mat4.transpose(this, this);\n return this.check();\n }\n\n invert() {\n mat4.invert(this, this);\n return this.check();\n }\n\n // Operations\n\n multiplyLeft(a) {\n mat4.multiply(this, a, this);\n return this.check();\n }\n\n multiplyRight(a) {\n mat4.multiply(this, this, a);\n return this.check();\n }\n\n // Rotates a matrix by the given angle around the X axis\n rotateX(radians) {\n mat4.rotateX(this, this, radians);\n // mat4.rotate(this, this, radians, [1, 0, 0]);\n return this.check();\n }\n\n // Rotates a matrix by the given angle around the Y axis.\n rotateY(radians) {\n mat4.rotateY(this, this, radians);\n // mat4.rotate(this, this, radians, [0, 1, 0]);\n return this.check();\n }\n\n // Rotates a matrix by the given angle around the Z axis.\n rotateZ(radians) {\n mat4.rotateZ(this, this, radians);\n // mat4.rotate(this, this, radians, [0, 0, 1]);\n return this.check();\n }\n\n rotateXYZ([rx, ry, rz]) {\n return this.rotateX(rx).rotateY(ry).rotateZ(rz);\n }\n\n rotateAxis(radians, axis) {\n mat4.rotate(this, this, radians, axis);\n return this.check();\n }\n\n scale(factor) {\n if (Array.isArray(factor)) {\n mat4.scale(this, this, factor);\n } else {\n mat4.scale(this, this, [factor, factor, factor]);\n }\n\n return this.check();\n }\n\n translate(vec) {\n mat4.translate(this, this, vec);\n return this.check();\n }\n\n // Transforms\n\n // Transforms any 2, 3 or 4 element vector. 2 and 3 elements are treated as points\n transform(vector, result) {\n if (vector.length === 4) {\n result = vec4.transformMat4(result || [-0, -0, -0, -0], vector, this);\n checkVector(result, 4);\n return result;\n }\n return this.transformAsPoint(vector, result);\n }\n\n // Transforms any 2 or 3 element array as point (w implicitly 1)\n transformAsPoint(vector, result) {\n const {length} = vector;\n switch (length) {\n case 2:\n result = vec2.transformMat4(result || [-0, -0], vector, this);\n break;\n case 3:\n result = vec3.transformMat4(result || [-0, -0, -0], vector, this);\n break;\n default:\n throw new Error('Illegal vector');\n }\n checkVector(result, vector.length);\n return result;\n }\n\n // Transforms any 2 or 3 element array as vector (w implicitly 0)\n transformAsVector(vector, result) {\n switch (vector.length) {\n case 2:\n result = vec2_transformMat4AsVector(result || [-0, -0], vector, this);\n break;\n case 3:\n result = vec3_transformMat4AsVector(result || [-0, -0, -0], vector, this);\n break;\n default:\n throw new Error('Illegal vector');\n }\n checkVector(result, vector.length);\n return result;\n }\n\n // three.js math API compatibility\n makeRotationX(radians) {\n return this.identity().rotateX(radians);\n }\n\n makeTranslation(x, y, z) {\n return this.identity().translate([x, y, z]);\n }\n\n // DEPRECATED in 3.0\n\n transformPoint(vector, result) {\n deprecated('Matrix4.transformPoint', '3.0');\n return this.transformAsPoint(vector, result);\n }\n\n transformVector(vector, result) {\n deprecated('Matrix4.transformVector', '3.0');\n return this.transformAsPoint(vector, result);\n }\n\n transformDirection(vector, result) {\n deprecated('Matrix4.transformDirection', '3.0');\n return this.transformAsVector(vector, result);\n }\n}\n"],"file":"matrix4.js"}
|
|
1
|
+
{"version":3,"sources":["../../../src/classes/matrix4.ts"],"names":["Matrix","checkVector","vec2_transformMat4AsVector","vec3_transformMat4AsVector","mat4","vec2","vec3","vec4","INDICES","DEFAULT_FOVY","Math","PI","DEFAULT_ASPECT","DEFAULT_NEAR","DEFAULT_FAR","IDENTITY_MATRIX","Object","freeze","Matrix4","IDENTITY","getIdentityMatrix","ZERO","getZeroMatrix","ELEMENTS","RANK","constructor","array","arguments","length","Array","isArray","copy","identity","check","set","m00","m10","m20","m30","m01","m11","m21","m31","m02","m12","m22","m32","m03","m13","m23","m33","setRowMajor","toRowMajor","result","fromObject","object","fromQuaternion","quaternion","fromQuat","frustum","view","left","right","bottom","top","near","far","Infinity","computeInfinitePerspectiveOffCenter","lookAt","eye","center","up","ortho","orthographic","fovy","aspect","focalDistance","checkRadians","halfY","tan","perspective","determinant","getScale","sqrt","getTranslation","getRotation","scaleResult","scale","inverseScale0","inverseScale1","inverseScale2","getRotationMatrix3","transpose","invert","multiplyLeft","a","multiply","multiplyRight","rotateX","radians","rotateY","rotateZ","rotateXYZ","angleXYZ","rotateAxis","axis","rotate","factor","translate","vector","transform","transformMat4","transformAsPoint","Error","transformAsVector","transformPoint","transformVector","transformDirection","makeRotationX","makeTranslation","x","y","z","possiblyDegrees","column0Row0","column1Row1","column2Row0","column2Row1","column2Row2","column2Row3","column3Row2"],"mappings":"AAEA,OAAOA,MAAP,MAAmB,eAAnB;AAEA,SAAQC,WAAR,QAA0B,mBAA1B;AAGA,SAAQC,0BAAR,EAAoCC,0BAApC,QAAqE,yBAArE;AACA,OAAO,KAAKC,IAAZ,MAAsB,gBAAtB;AACA,OAAO,KAAKC,IAAZ,MAAsB,gBAAtB;AACA,OAAO,KAAKC,IAAZ,MAAsB,gBAAtB;AACA,OAAO,KAAKC,IAAZ,MAAsB,gBAAtB;IAEKC,O;;WAAAA,O;AAAAA,EAAAA,O,CAAAA,O;AAAAA,EAAAA,O,CAAAA,O;AAAAA,EAAAA,O,CAAAA,O;AAAAA,EAAAA,O,CAAAA,O;AAAAA,EAAAA,O,CAAAA,O;AAAAA,EAAAA,O,CAAAA,O;AAAAA,EAAAA,O,CAAAA,O;AAAAA,EAAAA,O,CAAAA,O;AAAAA,EAAAA,O,CAAAA,O;AAAAA,EAAAA,O,CAAAA,O;AAAAA,EAAAA,O,CAAAA,O;AAAAA,EAAAA,O,CAAAA,O;AAAAA,EAAAA,O,CAAAA,O;AAAAA,EAAAA,O,CAAAA,O;AAAAA,EAAAA,O,CAAAA,O;AAAAA,EAAAA,O,CAAAA,O;GAAAA,O,KAAAA,O;;AAmBL,MAAMC,YAAY,GAAI,KAAKC,IAAI,CAACC,EAAX,GAAiB,GAAtC;AACA,MAAMC,cAAc,GAAG,CAAvB;AACA,MAAMC,YAAY,GAAG,GAArB;AACA,MAAMC,WAAW,GAAG,GAApB;AAEA,MAAMC,eAAe,GAAGC,MAAM,CAACC,MAAP,CAAc,CAAC,CAAD,EAAI,CAAJ,EAAO,CAAP,EAAU,CAA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,CAAN,GAAYyE,WAAZ;AACAzE,EAAAA,MAAM,CAAC,CAAD,CAAN,GAAY,CAAZ;AACAA,EAAAA,MAAM,CAAC,CAAD,CAAN,GAAY,CAAZ;AACAA,EAAAA,MAAM,CAAC,CAAD,CAAN,GAAY0E,WAAZ;AACA1E,EAAAA,MAAM,CAAC,CAAD,CAAN,GAAY2E,WAAZ;AACA3E,EAAAA,MAAM,CAAC,EAAD,CAAN,GAAa4E,WAAb;AACA5E,EAAAA,MAAM,CAAC,EAAD,CAAN,GAAa6E,WAAb;AACA7E,EAAAA,MAAM,CAAC,EAAD,CAAN,GAAa,CAAb;AACAA,EAAAA,MAAM,CAAC,EAAD,CAAN,GAAa,CAAb;AACAA,EAAAA,MAAM,CAAC,EAAD,CAAN,GAAa8E,WAAb;AACA9E,EAAAA,MAAM,CAAC,EAAD,CAAN,GAAa,CAAb;AACA,SAAOA,MAAP;AACD","sourcesContent":["// Copyright (c) 2017 Uber Technologies, Inc.\n// MIT License\nimport Matrix from './base/matrix';\nimport {NumericArray} from '@math.gl/types';\nimport {checkVector} from '../lib/validators';\n\n/* eslint-disable camelcase */\nimport {vec2_transformMat4AsVector, vec3_transformMat4AsVector} from '../lib/gl-matrix-extras';\nimport * as mat4 from 'gl-matrix/mat4';\nimport * as vec2 from 'gl-matrix/vec2';\nimport * as vec3 from 'gl-matrix/vec3';\nimport * as vec4 from 'gl-matrix/vec4';\n\nenum INDICES {\n COL0ROW0 = 0,\n COL0ROW1 = 1,\n COL0ROW2 = 2,\n COL0ROW3 = 3,\n COL1ROW0 = 4,\n COL1ROW1 = 5,\n COL1ROW2 = 6,\n COL1ROW3 = 7,\n COL2ROW0 = 8,\n COL2ROW1 = 9,\n COL2ROW2 = 10,\n COL2ROW3 = 11,\n COL3ROW0 = 12,\n COL3ROW1 = 13,\n COL3ROW2 = 14,\n COL3ROW3 = 15\n}\n\nconst DEFAULT_FOVY = (45 * Math.PI) / 180;\nconst DEFAULT_ASPECT = 1;\nconst DEFAULT_NEAR = 0.1;\nconst DEFAULT_FAR = 500;\n\nconst IDENTITY_MATRIX = Object.freeze([1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1]);\n\n/** 4x4 matrix */\nexport default class Matrix4 extends Matrix {\n static get IDENTITY(): Readonly<Matrix4> {\n return getIdentityMatrix();\n }\n\n static get ZERO(): Readonly<Matrix4> {\n return getZeroMatrix();\n }\n\n get ELEMENTS(): number {\n return 16;\n }\n\n get RANK(): number {\n return 4;\n }\n\n get INDICES(): typeof INDICES {\n return INDICES;\n }\n\n constructor(array?: Readonly<NumericArray>) {\n // PERF NOTE: initialize elements as double precision numbers\n super(-0, -0, -0, -0, -0, -0, -0, -0, -0, -0, -0, -0, -0, -0, -0, -0);\n if (arguments.length === 1 && Array.isArray(array)) {\n this.copy(array);\n } else {\n this.identity();\n }\n }\n\n copy(array: Readonly<NumericArray>): this {\n this[0] = array[0];\n this[1] = array[1];\n this[2] = array[2];\n this[3] = array[3];\n this[4] = array[4];\n this[5] = array[5];\n this[6] = array[6];\n this[7] = array[7];\n this[8] = array[8];\n this[9] = array[9];\n this[10] = array[10];\n this[11] = array[11];\n this[12] = array[12];\n this[13] = array[13];\n this[14] = array[14];\n this[15] = array[15];\n return this.check();\n }\n\n // eslint-disable-next-line max-params\n set(\n m00: number,\n m10: number,\n m20: number,\n m30: number,\n m01: number,\n m11: number,\n m21: number,\n m31: number,\n m02: number,\n m12: number,\n m22: number,\n m32: number,\n m03: number,\n m13: number,\n m23: number,\n m33: number\n ): this {\n this[0] = m00;\n this[1] = m10;\n this[2] = m20;\n this[3] = m30;\n this[4] = m01;\n this[5] = m11;\n this[6] = m21;\n this[7] = m31;\n this[8] = m02;\n this[9] = m12;\n this[10] = m22;\n this[11] = m32;\n this[12] = m03;\n this[13] = m13;\n this[14] = m23;\n this[15] = m33;\n return this.check();\n }\n\n // accepts row major order, stores as column major\n // eslint-disable-next-line max-params\n setRowMajor(\n m00: number,\n m01: number,\n m02: number,\n m03: number,\n m10: number,\n m11: number,\n m12: number,\n m13: number,\n m20: number,\n m21: number,\n m22: number,\n m23: number,\n m30: number,\n m31: number,\n m32: number,\n m33: number\n ): this {\n this[0] = m00;\n this[1] = m10;\n this[2] = m20;\n this[3] = m30;\n this[4] = m01;\n this[5] = m11;\n this[6] = m21;\n this[7] = m31;\n this[8] = m02;\n this[9] = m12;\n this[10] = m22;\n this[11] = m32;\n this[12] = m03;\n this[13] = m13;\n this[14] = m23;\n this[15] = m33;\n return this.check();\n }\n\n toRowMajor(result: NumericArray): NumericArray {\n result[0] = this[0];\n result[1] = this[4];\n result[2] = this[8];\n result[3] = this[12];\n result[4] = this[1];\n result[5] = this[5];\n result[6] = this[9];\n result[7] = this[13];\n result[8] = this[2];\n result[9] = this[6];\n result[10] = this[10];\n result[11] = this[14];\n result[12] = this[3];\n result[13] = this[7];\n result[14] = this[11];\n result[15] = this[15];\n return result;\n }\n\n // Constructors\n\n /** Set to identity matrix */\n identity(): this {\n return this.copy(IDENTITY_MATRIX);\n }\n\n /**\n *\n * @param object\n * @returns self\n */\n fromObject(object: {[key: string]: any}): this {\n return this.check();\n }\n\n /**\n * Calculates a 4x4 matrix from the given quaternion\n * @param quaternion Quaternion to create matrix from\n * @returns self\n */\n fromQuaternion(quaternion: Readonly<NumericArray>): this {\n mat4.fromQuat(this, quaternion);\n return this.check();\n }\n\n /**\n * Generates a frustum matrix with the given bounds\n * @param view.left - Left bound of the frustum\n * @param view.right - Right bound of the frustum\n * @param view.bottom - Bottom bound of the frustum\n * @param view.top - Top bound of the frustum\n * @param view.near - Near bound of the frustum\n * @param view.far - Far bound of the frustum. Can be set to Infinity.\n * @returns self\n */\n frustum(view: {\n left: number;\n right: number;\n bottom: number;\n top: number;\n near: number;\n far?: number;\n }): this {\n const {left, right, bottom, top, near = DEFAULT_NEAR, far = DEFAULT_FAR} = view;\n if (far === Infinity) {\n computeInfinitePerspectiveOffCenter(this, left, right, bottom, top, near);\n } else {\n mat4.frustum(this, left, right, bottom, top, near, far);\n }\n return this.check();\n }\n\n /**\n * Generates a look-at matrix with the given eye position, focal point,\n * and up axis\n * @param view.eye - (vector) Position of the viewer\n * @param view.center - (vector) Point the viewer is looking at\n * @param view.up - (vector) Up axis\n * @returns self\n */\n lookAt(view: {\n eye: Readonly<NumericArray>;\n center: Readonly<NumericArray>;\n up: Readonly<NumericArray>;\n }): this {\n const {eye, center = [0, 0, 0], up = [0, 1, 0]} = view;\n mat4.lookAt(this, eye, center, up);\n return this.check();\n }\n\n /**\n * Generates a orthogonal projection matrix with the given bounds\n * from \"traditional\" view space parameters\n * @param view.left - Left bound of the frustum\n * @param view.right number Right bound of the frustum\n * @param view.bottom - Bottom bound of the frustum\n * @param view.top number Top bound of the frustum\n * @param view.near - Near bound of the frustum\n * @param view.far number Far bound of the frustum\n * @returns self\n */\n ortho(view: {\n left: number;\n right: number;\n bottom: number;\n top: number;\n near?: number;\n far?: number;\n }): this {\n const {left, right, bottom, top, near = DEFAULT_NEAR, far = DEFAULT_FAR} = view;\n mat4.ortho(this, left, right, bottom, top, near, far);\n return this.check();\n }\n\n /**\n * Generates an orthogonal projection matrix with the same parameters\n * as a perspective matrix (plus focalDistance)\n * @param view.fovy Vertical field of view in radians\n * @param view.aspect Aspect ratio. Typically viewport width / viewport height\n * @param view.focalDistance Distance in the view frustum used for extent calculations\n * @param view.near Near bound of the frustum\n * @param view.far Far bound of the frustum\n * @returns self\n */\n orthographic(view: {\n fovy?: number;\n aspect?: number;\n focalDistance?: number;\n near?: number;\n far?: number;\n }): this {\n const {\n fovy = DEFAULT_FOVY,\n aspect = DEFAULT_ASPECT,\n focalDistance = 1,\n near = DEFAULT_NEAR,\n far = DEFAULT_FAR\n } = view;\n\n checkRadians(fovy);\n\n const halfY = fovy / 2;\n const top = focalDistance * Math.tan(halfY); // focus_plane is the distance from the camera\n const right = top * aspect;\n\n return this.ortho({\n left: -right,\n right,\n bottom: -top,\n top,\n near,\n far\n });\n }\n\n /**\n * Generates a perspective projection matrix with the given bounds\n * @param view.fovy Vertical field of view in radians\n * @param view.aspect Aspect ratio. typically viewport width/height\n * @param view.near Near bound of the frustum\n * @param view.far Far bound of the frustum\n * @returns self\n */\n perspective(view: {fovy: number; aspect?: number; near?: number; far?: number}): this {\n const {fovy = (45 * Math.PI) / 180, aspect = 1, near = 0.1, far = 500} = view;\n checkRadians(fovy);\n mat4.perspective(this, fovy, aspect, near, far);\n return this.check();\n }\n\n // Accessors\n\n determinant(): number {\n return mat4.determinant(this);\n }\n\n /**\n * Extracts the non-uniform scale assuming the matrix is an affine transformation.\n * The scales are the \"lengths\" of the column vectors in the upper-left 3x3 matrix.\n * @param result\n * @returns self\n */\n getScale(result: NumericArray = [-0, -0, -0]): NumericArray {\n // explicit is faster than hypot...\n result[0] = Math.sqrt(this[0] * this[0] + this[1] * this[1] + this[2] * this[2]);\n result[1] = Math.sqrt(this[4] * this[4] + this[5] * this[5] + this[6] * this[6]);\n result[2] = Math.sqrt(this[8] * this[8] + this[9] * this[9] + this[10] * this[10]);\n // result[0] = Math.hypot(this[0], this[1], this[2]);\n // result[1] = Math.hypot(this[4], this[5], this[6]);\n // result[2] = Math.hypot(this[8], this[9], this[10]);\n return result;\n }\n\n /**\n * Gets the translation portion, assuming the matrix is a affine transformation matrix.\n * @param result\n * @returns self\n */\n getTranslation(result: NumericArray = [-0, -0, -0]): NumericArray {\n result[0] = this[12];\n result[1] = this[13];\n result[2] = this[14];\n return result;\n }\n\n /**\n * Gets upper left 3x3 pure rotation matrix (non-scaling), assume affine transformation matrix\n * @param result\n * @param scaleResult\n * @returns self\n */\n getRotation(result?: NumericArray, scaleResult?: NumericArray): NumericArray {\n result = result || [-0, -0, -0, -0, -0, -0, -0, -0, -0, -0, -0, -0, -0, -0, -0, -0];\n scaleResult = scaleResult || [-0, -0, -0];\n const scale = this.getScale(scaleResult);\n const inverseScale0 = 1 / scale[0];\n const inverseScale1 = 1 / scale[1];\n const inverseScale2 = 1 / scale[2];\n result[0] = this[0] * inverseScale0;\n result[1] = this[1] * inverseScale1;\n result[2] = this[2] * inverseScale2;\n result[3] = 0;\n result[4] = this[4] * inverseScale0;\n result[5] = this[5] * inverseScale1;\n result[6] = this[6] * inverseScale2;\n result[7] = 0;\n result[8] = this[8] * inverseScale0;\n result[9] = this[9] * inverseScale1;\n result[10] = this[10] * inverseScale2;\n result[11] = 0;\n result[12] = 0;\n result[13] = 0;\n result[14] = 0;\n result[15] = 1;\n return result;\n }\n\n /**\n *\n * @param result\n * @param scaleResult\n * @returns self\n */\n getRotationMatrix3(result?: NumericArray, scaleResult?: NumericArray): NumericArray {\n result = result || [-0, -0, -0, -0, -0, -0, -0, -0, -0];\n scaleResult = scaleResult || [-0, -0, -0];\n const scale = this.getScale(scaleResult);\n const inverseScale0 = 1 / scale[0];\n const inverseScale1 = 1 / scale[1];\n const inverseScale2 = 1 / scale[2];\n result[0] = this[0] * inverseScale0;\n result[1] = this[1] * inverseScale1;\n result[2] = this[2] * inverseScale2;\n result[3] = this[4] * inverseScale0;\n result[4] = this[5] * inverseScale1;\n result[5] = this[6] * inverseScale2;\n result[6] = this[8] * inverseScale0;\n result[7] = this[9] * inverseScale1;\n result[8] = this[10] * inverseScale2;\n return result;\n }\n\n // Modifiers\n\n transpose(): this {\n mat4.transpose(this, this);\n return this.check();\n }\n\n invert(): this {\n mat4.invert(this, this);\n return this.check();\n }\n\n // Operations\n\n multiplyLeft(a: Readonly<NumericArray>): this {\n mat4.multiply(this, a, this);\n return this.check();\n }\n\n multiplyRight(a: Readonly<NumericArray>): this {\n mat4.multiply(this, this, a);\n return this.check();\n }\n\n // Rotates a matrix by the given angle around the X axis\n rotateX(radians: number): this {\n mat4.rotateX(this, this, radians);\n // mat4.rotate(this, this, radians, [1, 0, 0]);\n return this.check();\n }\n\n // Rotates a matrix by the given angle around the Y axis.\n rotateY(radians: number): this {\n mat4.rotateY(this, this, radians);\n // mat4.rotate(this, this, radians, [0, 1, 0]);\n return this.check();\n }\n\n /**\n * Rotates a matrix by the given angle around the Z axis.\n * @param radians\n * @returns self\n */\n rotateZ(radians: number): this {\n mat4.rotateZ(this, this, radians);\n // mat4.rotate(this, this, radians, [0, 0, 1]);\n return this.check();\n }\n\n /**\n *\n * @param param0\n * @returns self\n */\n rotateXYZ(angleXYZ: Readonly<NumericArray>): this {\n return this.rotateX(angleXYZ[0]).rotateY(angleXYZ[1]).rotateZ(angleXYZ[2]);\n }\n\n /**\n *\n * @param radians\n * @param axis\n * @returns self\n */\n rotateAxis(radians: number, axis: Readonly<NumericArray>): this {\n mat4.rotate(this, this, radians, axis);\n return this.check();\n }\n\n /**\n *\n * @param factor\n * @returns self\n */\n scale(factor: number | Readonly<NumericArray>): this {\n mat4.scale(this, this, Array.isArray(factor) ? factor : [factor, factor, factor]);\n return this.check();\n }\n\n /**\n *\n * @param vec\n * @returns self\n */\n translate(vector: Readonly<NumericArray>): this {\n mat4.translate(this, this, vector);\n return this.check();\n }\n\n // Transforms\n\n /**\n * Transforms any 2, 3 or 4 element vector. 2 and 3 elements are treated as points\n * @param vector\n * @param result\n * @returns self\n */\n transform(vector: Readonly<NumericArray>, result: NumericArray): NumericArray {\n if (vector.length === 4) {\n result = vec4.transformMat4(result || [-0, -0, -0, -0], vector, this);\n checkVector(result, 4);\n return result;\n }\n return this.transformAsPoint(vector, result);\n }\n\n /**\n * Transforms any 2 or 3 element array as point (w implicitly 1)\n * @param vector\n * @param result\n * @returns self\n */\n transformAsPoint(vector: Readonly<NumericArray>, result?: NumericArray) {\n const {length} = vector;\n switch (length) {\n case 2:\n result = vec2.transformMat4(result || [-0, -0], vector, this);\n break;\n case 3:\n result = vec3.transformMat4(result || [-0, -0, -0], vector, this);\n break;\n default:\n throw new Error('Illegal vector');\n }\n checkVector(result, vector.length);\n return result;\n }\n\n /**\n * Transforms any 2 or 3 element array as vector (w implicitly 0)\n * @param vector\n * @param result\n * @returns self\n */\n transformAsVector(vector: Readonly<NumericArray>, result?: NumericArray): NumericArray {\n switch (vector.length) {\n case 2:\n result = vec2_transformMat4AsVector(result || [-0, -0], vector, this);\n break;\n case 3:\n result = vec3_transformMat4AsVector(result || [-0, -0, -0], vector, this);\n break;\n default:\n throw new Error('Illegal vector');\n }\n checkVector(result, vector.length);\n return result;\n }\n\n /** @deprecated */\n transformPoint(vector: Readonly<NumericArray>, result?: NumericArray): NumericArray {\n return this.transformAsPoint(vector, result);\n }\n\n /** @deprecated */\n transformVector(vector: Readonly<NumericArray>, result?: NumericArray): NumericArray {\n return this.transformAsPoint(vector, result);\n }\n\n /** @deprecated */\n transformDirection(vector: Readonly<NumericArray>, result?: NumericArray): NumericArray {\n return this.transformAsVector(vector, result);\n }\n\n // three.js math API compatibility\n\n makeRotationX(radians: number): this {\n return this.identity().rotateX(radians);\n }\n\n makeTranslation(x: number, y: number, z: number): this {\n return this.identity().translate([x, y, z]);\n }\n}\n\n// TODO initializing static members directly is an option, but make sure no tree-shaking issues\nlet ZERO: Matrix4;\nlet IDENTITY: Matrix4;\n\nfunction getZeroMatrix(): Readonly<Matrix4> {\n if (!ZERO) {\n ZERO = new Matrix4([0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]);\n Object.freeze(ZERO);\n }\n return ZERO;\n}\n\nfunction getIdentityMatrix(): Matrix4 {\n if (!IDENTITY) {\n IDENTITY = new Matrix4();\n Object.freeze(IDENTITY);\n }\n return IDENTITY;\n}\n\n// HELPER FUNCTIONS\n\nfunction checkRadians(possiblyDegrees: number) {\n if (possiblyDegrees > Math.PI * 2) {\n throw Error('expected radians');\n }\n}\n\n// eslint-disable-next-line max-params\nfunction computeInfinitePerspectiveOffCenter(\n result: NumericArray,\n left: number,\n right: number,\n bottom: number,\n top: number,\n near: number\n): NumericArray {\n const column0Row0 = (2 * near) / (right - left);\n const column1Row1 = (2 * near) / (top - bottom);\n const column2Row0 = (right + left) / (right - left);\n const column2Row1 = (top + bottom) / (top - bottom);\n const column2Row2 = -1;\n const column2Row3 = -1;\n const column3Row2 = -2 * near;\n result[0] = column0Row0;\n result[1] = 0;\n result[2] = 0;\n result[3] = 0;\n result[4] = 0;\n result[5] = column1Row1;\n result[6] = 0;\n result[7] = 0;\n result[8] = column2Row0;\n result[9] = column2Row1;\n result[10] = column2Row2;\n result[11] = column2Row3;\n result[12] = 0;\n result[13] = 0;\n result[14] = column3Row2;\n result[15] = 0;\n return result;\n}\n"],"file":"matrix4.js"}
|
package/dist/esm/classes/pose.js
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
|
|
1
2
|
import Matrix4 from './matrix4';
|
|
2
3
|
import Vector3 from './vector3';
|
|
3
4
|
import Euler from './euler';
|
|
@@ -9,9 +10,13 @@ export default class Pose {
|
|
|
9
10
|
roll = 0,
|
|
10
11
|
pitch = 0,
|
|
11
12
|
yaw = 0,
|
|
12
|
-
position
|
|
13
|
-
orientation
|
|
13
|
+
position,
|
|
14
|
+
orientation
|
|
14
15
|
} = {}) {
|
|
16
|
+
_defineProperty(this, "position", void 0);
|
|
17
|
+
|
|
18
|
+
_defineProperty(this, "orientation", void 0);
|
|
19
|
+
|
|
15
20
|
if (Array.isArray(position) && position.length === 3) {
|
|
16
21
|
this.position = new Vector3(position);
|
|
17
22
|
} else {
|
|
@@ -104,8 +109,7 @@ export default class Pose {
|
|
|
104
109
|
const cr = Math.cos(this.roll);
|
|
105
110
|
const cp = Math.cos(this.pitch);
|
|
106
111
|
const cw = Math.cos(this.yaw);
|
|
107
|
-
|
|
108
|
-
return matrix;
|
|
112
|
+
return new Matrix4().setRowMajor(cw * cp, -sw * cr + cw * sp * sr, sw * sr + cw * sp * cr, this.x, sw * cp, cw * cr + sw * sp * sr, -cw * sr + sw * sp * cr, this.y, -sp, cp * sr, cp * cr, this.z, 0, 0, 0, 1);
|
|
109
113
|
}
|
|
110
114
|
|
|
111
115
|
getTransformationMatrixFromPose(pose) {
|