@vertexvis/geometry 1.1.1-testing.2 → 1.1.1-testing.3
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/bundle.cjs +30 -35
- package/dist/bundle.cjs.map +1 -1
- package/dist/bundle.js +30 -35
- package/dist/bundle.js.map +1 -1
- package/dist/cdn/bundle.js +30 -35
- package/dist/cdn/bundle.js.map +1 -1
- package/dist/cdn/bundle.min.js.map +1 -1
- package/package.json +4 -4
package/dist/cdn/bundle.js
CHANGED
|
@@ -249,36 +249,46 @@ var angle = /*#__PURE__*/Object.freeze({
|
|
|
249
249
|
* Creates a 4x4 matrix from a set of row-major components.
|
|
250
250
|
*/
|
|
251
251
|
function fromValues(
|
|
252
|
-
|
|
252
|
+
// prettier-ignore
|
|
253
253
|
m11, m12, m13, m14, m21, m22, m23, m24, m31, m32, m33, m34, m41, m42, m43, m44) {
|
|
254
|
-
|
|
254
|
+
// prettier-ignore
|
|
255
255
|
return [
|
|
256
256
|
m11, m12, m13, m14,
|
|
257
257
|
m21, m22, m23, m24,
|
|
258
258
|
m31, m32, m33, m34,
|
|
259
259
|
m41, m42, m43, m44,
|
|
260
260
|
];
|
|
261
|
-
/* eslint-enable prettier/prettier */
|
|
262
261
|
}
|
|
263
262
|
/**
|
|
264
263
|
* Creates a `Matrix4` from an object representation.
|
|
265
264
|
*/
|
|
266
265
|
function fromObject(obj) {
|
|
267
|
-
|
|
266
|
+
// prettier-ignore
|
|
268
267
|
return fromValues(obj.m11, obj.m12, obj.m13, obj.m14, obj.m21, obj.m22, obj.m23, obj.m24, obj.m31, obj.m32, obj.m33, obj.m34, obj.m41, obj.m42, obj.m43, obj.m44);
|
|
269
|
-
/* eslint-enable prettier/prettier */
|
|
270
268
|
}
|
|
271
269
|
/**
|
|
272
270
|
* Returns a new [identity matrix](https://en.wikipedia.org/wiki/Identity_matrix).
|
|
273
271
|
*/
|
|
274
272
|
function makeIdentity() {
|
|
275
|
-
|
|
273
|
+
// prettier-ignore
|
|
274
|
+
return [
|
|
275
|
+
1, 0, 0, 0,
|
|
276
|
+
0, 1, 0, 0,
|
|
277
|
+
0, 0, 1, 0,
|
|
278
|
+
0, 0, 0, 1,
|
|
279
|
+
];
|
|
276
280
|
}
|
|
277
281
|
/**
|
|
278
282
|
* Returns a matrix with all values as 0.
|
|
279
283
|
*/
|
|
280
284
|
function makeZero() {
|
|
281
|
-
|
|
285
|
+
// prettier-ignore
|
|
286
|
+
return [
|
|
287
|
+
0, 0, 0, 0,
|
|
288
|
+
0, 0, 0, 0,
|
|
289
|
+
0, 0, 0, 0,
|
|
290
|
+
0, 0, 0, 0,
|
|
291
|
+
];
|
|
282
292
|
}
|
|
283
293
|
/**
|
|
284
294
|
* Creates a translation matrix.
|
|
@@ -295,14 +305,13 @@ function makeZero() {
|
|
|
295
305
|
*/
|
|
296
306
|
function makeTranslation(translation) {
|
|
297
307
|
const { x, y, z } = translation;
|
|
298
|
-
|
|
308
|
+
// prettier-ignore
|
|
299
309
|
return [
|
|
300
310
|
1, 0, 0, 0,
|
|
301
311
|
0, 1, 0, 0,
|
|
302
312
|
0, 0, 1, 0,
|
|
303
313
|
x, y, z, 1,
|
|
304
314
|
];
|
|
305
|
-
/* eslint-enable prettier/prettier */
|
|
306
315
|
}
|
|
307
316
|
/**
|
|
308
317
|
* Creates a rotation matrix.
|
|
@@ -324,14 +333,13 @@ function makeRotation(rotation) {
|
|
|
324
333
|
const xx = x * x2, xy = x * y2, xz = x * z2;
|
|
325
334
|
const yy = y * y2, yz = y * z2, zz = z * z2;
|
|
326
335
|
const wx = w * x2, wy = w * y2, wz = w * z2;
|
|
327
|
-
|
|
336
|
+
// prettier-ignore
|
|
328
337
|
return [
|
|
329
338
|
1 - (yy + zz), xy - wz, xz + wy, 0,
|
|
330
339
|
xy + wz, 1 - (xx + zz), yz - wx, 0,
|
|
331
340
|
xz - wy, yz + wx, 1 - (xx + yy), 0,
|
|
332
341
|
0, 0, 0, 1
|
|
333
342
|
];
|
|
334
|
-
/* eslint-enable prettier/prettier */
|
|
335
343
|
}
|
|
336
344
|
/**
|
|
337
345
|
* Creates a scale matrix.
|
|
@@ -348,14 +356,13 @@ function makeRotation(rotation) {
|
|
|
348
356
|
*/
|
|
349
357
|
function makeScale(scale) {
|
|
350
358
|
const { x, y, z } = scale;
|
|
351
|
-
|
|
359
|
+
// prettier-ignore
|
|
352
360
|
return [
|
|
353
361
|
x, 0, 0, 0,
|
|
354
362
|
0, y, 0, 0,
|
|
355
363
|
0, 0, z, 0,
|
|
356
364
|
0, 0, 0, 1,
|
|
357
365
|
];
|
|
358
|
-
/* eslint-enable prettier/prettier */
|
|
359
366
|
}
|
|
360
367
|
/**
|
|
361
368
|
* Creates a matrix that has translation, rotation, and scale applied to it.
|
|
@@ -388,14 +395,13 @@ function makeTRS(translation, rotation, scale) {
|
|
|
388
395
|
* @returns A matrix with its basis components populated.
|
|
389
396
|
*/
|
|
390
397
|
function makeBasis(x, y, z) {
|
|
391
|
-
|
|
398
|
+
// prettier-ignore
|
|
392
399
|
return [
|
|
393
400
|
x.x, x.y, x.z, 0,
|
|
394
401
|
y.x, y.y, y.z, 0,
|
|
395
402
|
z.x, z.y, z.z, 0,
|
|
396
403
|
0, 0, 0, 1
|
|
397
404
|
];
|
|
398
|
-
/* eslint-enable prettier/prettier */
|
|
399
405
|
}
|
|
400
406
|
/**
|
|
401
407
|
* Creates a matrix used for [perspective
|
|
@@ -422,14 +428,13 @@ function makeFrustum(left, right, top, bottom, near, far) {
|
|
|
422
428
|
const b = (top + bottom) / (top - bottom);
|
|
423
429
|
const c = -(far + near) / (far - near);
|
|
424
430
|
const d = (-2 * far * near) / (far - near);
|
|
425
|
-
|
|
431
|
+
// prettier-ignore
|
|
426
432
|
return [
|
|
427
433
|
x, 0, 0, 0,
|
|
428
434
|
0, y, 0, 0,
|
|
429
435
|
a, b, c, -1,
|
|
430
436
|
0, 0, d, 0
|
|
431
437
|
];
|
|
432
|
-
/* eslint-enable prettier/prettier */
|
|
433
438
|
}
|
|
434
439
|
/**
|
|
435
440
|
* Creates a perspective projection matrix.
|
|
@@ -482,14 +487,13 @@ function makeOrthographic(left, right, bottom, top, near, far) {
|
|
|
482
487
|
const x = (right + left) * w;
|
|
483
488
|
const y = (top + bottom) * h;
|
|
484
489
|
const z = (far + near) * d;
|
|
485
|
-
|
|
490
|
+
// prettier-ignore
|
|
486
491
|
return [
|
|
487
492
|
2 * w, 0, 0, -x,
|
|
488
493
|
0, 2 * h, 0, -y,
|
|
489
494
|
0, 0, -2 * d, -z,
|
|
490
495
|
0, 0, 0, 1
|
|
491
496
|
];
|
|
492
|
-
/* eslint-enable prettier/prettier */
|
|
493
497
|
}
|
|
494
498
|
/**
|
|
495
499
|
* Matrix becomes a combination of an inverse translation and rotation.
|
|
@@ -517,14 +521,13 @@ function makeLookAtView(position, lookAt, up) {
|
|
|
517
521
|
const dotX = -dot$1(x, position);
|
|
518
522
|
const dotY = -dot$1(y, position);
|
|
519
523
|
const dotZ = -dot$1(z, position);
|
|
520
|
-
|
|
524
|
+
// prettier-ignore
|
|
521
525
|
return [
|
|
522
526
|
x.x, y.x, z.x, 0,
|
|
523
527
|
x.y, y.y, z.y, 0,
|
|
524
528
|
x.z, y.z, z.z, 0,
|
|
525
529
|
dotX, dotY, dotZ, 1,
|
|
526
530
|
];
|
|
527
|
-
/* eslint-enable prettier/prettier */
|
|
528
531
|
}
|
|
529
532
|
/**
|
|
530
533
|
* Matrix becomes a combination of translation and rotation.
|
|
@@ -543,14 +546,13 @@ function makeLookAt(position, lookAt, up) {
|
|
|
543
546
|
const z = normalize(subtract(position, lookAt));
|
|
544
547
|
const x = normalize(cross(up, z));
|
|
545
548
|
const y = cross(z, x);
|
|
546
|
-
|
|
549
|
+
// prettier-ignore
|
|
547
550
|
return [
|
|
548
551
|
x.x, x.y, x.z, 0,
|
|
549
552
|
y.x, y.y, y.z, 0,
|
|
550
553
|
z.x, z.y, z.z, 0,
|
|
551
554
|
position.x, position.y, position.z, 1
|
|
552
555
|
];
|
|
553
|
-
/* eslint-enable prettier/prettier */
|
|
554
556
|
}
|
|
555
557
|
/**
|
|
556
558
|
* Returns the inverse of the given matrix. If the determinate of the matrix is
|
|
@@ -628,7 +630,7 @@ function lookAt(m, position, target, up) {
|
|
|
628
630
|
x = normalize(x);
|
|
629
631
|
const y = cross(z, x);
|
|
630
632
|
const res = [...m];
|
|
631
|
-
|
|
633
|
+
// prettier-ignore
|
|
632
634
|
res[0] = x.x;
|
|
633
635
|
res[1] = x.y;
|
|
634
636
|
res[2] = x.z;
|
|
@@ -638,7 +640,6 @@ function lookAt(m, position, target, up) {
|
|
|
638
640
|
res[8] = z.x;
|
|
639
641
|
res[9] = z.y;
|
|
640
642
|
res[10] = z.z;
|
|
641
|
-
/* eslint-enable prettier/prettier */
|
|
642
643
|
return res;
|
|
643
644
|
}
|
|
644
645
|
/**
|
|
@@ -667,14 +668,13 @@ function multiply$2(a, b) {
|
|
|
667
668
|
* matrix.
|
|
668
669
|
*/
|
|
669
670
|
function transpose(matrix) {
|
|
670
|
-
|
|
671
|
+
// prettier-ignore
|
|
671
672
|
return [
|
|
672
673
|
matrix[0], matrix[4], matrix[8], matrix[12],
|
|
673
674
|
matrix[1], matrix[5], matrix[9], matrix[13],
|
|
674
675
|
matrix[2], matrix[6], matrix[10], matrix[14],
|
|
675
676
|
matrix[3], matrix[7], matrix[11], matrix[15],
|
|
676
677
|
];
|
|
677
|
-
/* eslint-enable prettier/prettier */
|
|
678
678
|
}
|
|
679
679
|
/**
|
|
680
680
|
* Multiplies the columns of a row-major matrix by the given vector.
|
|
@@ -682,7 +682,7 @@ function transpose(matrix) {
|
|
|
682
682
|
function scale$4(matrix, scale) {
|
|
683
683
|
const { x, y, z } = scale;
|
|
684
684
|
const m = [...matrix];
|
|
685
|
-
|
|
685
|
+
// prettier-ignore
|
|
686
686
|
m[0] *= x;
|
|
687
687
|
m[1] *= x;
|
|
688
688
|
m[2] *= x;
|
|
@@ -695,7 +695,6 @@ function scale$4(matrix, scale) {
|
|
|
695
695
|
m[9] *= z;
|
|
696
696
|
m[10] *= z;
|
|
697
697
|
m[11] *= z;
|
|
698
|
-
/* eslint-enable prettier/prettier */
|
|
699
698
|
return m;
|
|
700
699
|
}
|
|
701
700
|
/**
|
|
@@ -731,28 +730,26 @@ function toObject(m) {
|
|
|
731
730
|
* @param m A Matrix4 item written in column-major form.
|
|
732
731
|
*/
|
|
733
732
|
function toObjectColumnMajor(m) {
|
|
734
|
-
|
|
733
|
+
// prettier-ignore
|
|
735
734
|
return {
|
|
736
735
|
m11: m[0], m12: m[4], m13: m[8], m14: m[12],
|
|
737
736
|
m21: m[1], m22: m[5], m23: m[9], m24: m[13],
|
|
738
737
|
m31: m[2], m32: m[6], m33: m[10], m34: m[14],
|
|
739
738
|
m41: m[3], m42: m[7], m43: m[11], m44: m[15],
|
|
740
739
|
};
|
|
741
|
-
/* eslint-enable prettier/prettier */
|
|
742
740
|
}
|
|
743
741
|
/**
|
|
744
742
|
* Returns an object representation of a `Matrix4`.
|
|
745
743
|
* @param m A Matrix4 item written in row-major form.
|
|
746
744
|
*/
|
|
747
745
|
function toObjectRowMajor(m) {
|
|
748
|
-
|
|
746
|
+
// prettier-ignore
|
|
749
747
|
return {
|
|
750
748
|
m11: m[0], m12: m[1], m13: m[2], m14: m[3],
|
|
751
749
|
m21: m[4], m22: m[5], m23: m[6], m24: m[7],
|
|
752
750
|
m31: m[8], m32: m[9], m33: m[10], m34: m[11],
|
|
753
751
|
m41: m[12], m42: m[13], m43: m[14], m44: m[15],
|
|
754
752
|
};
|
|
755
|
-
/* eslint-enable prettier/prettier */
|
|
756
753
|
}
|
|
757
754
|
/**
|
|
758
755
|
* A type guard to check if `obj` is of type `Matrix4`.
|
|
@@ -1171,7 +1168,6 @@ function create$a(...args) {
|
|
|
1171
1168
|
};
|
|
1172
1169
|
}
|
|
1173
1170
|
/* eslint-enable @typescript-eslint/no-explicit-any */
|
|
1174
|
-
/* eslint-enable padding-line-between-statements */
|
|
1175
1171
|
/**
|
|
1176
1172
|
* Checks if each component of the given vector is populated with a numeric
|
|
1177
1173
|
* component. A component is invalid if it contains a non-finite or NaN value.
|
|
@@ -1628,7 +1624,6 @@ function union(box, ...rest) {
|
|
|
1628
1624
|
return create$9(min(a.min, b.min), max(a.max, b.max));
|
|
1629
1625
|
}, box);
|
|
1630
1626
|
}
|
|
1631
|
-
/* eslint-enable padding-line-between-statements */
|
|
1632
1627
|
/**
|
|
1633
1628
|
* Returns the distance between the min and max for the provided
|
|
1634
1629
|
* bounding box for each axis.
|