@vertexvis/geometry 1.1.1-testing.2 → 1.1.1-testing.4

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