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