@kitware/vtk.js 24.19.1 → 25.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (65) hide show
  1. package/BREAKING_CHANGES.md +5 -0
  2. package/Common/Core/DataArray.d.ts +1 -1
  3. package/Common/Core/Math/index.js +360 -337
  4. package/Common/Core/Math.d.ts +70 -8
  5. package/Common/Core/Math.js +2 -1
  6. package/Common/DataModel/DataSetAttributes/FieldData.d.ts +1 -1
  7. package/Common/DataModel/Line.js +1 -3
  8. package/Common/Transform/LandmarkTransform.js +11 -24
  9. package/Filters/General/OBBTree.js +21 -23
  10. package/Filters/Texture/TextureMapToPlane.js +6 -15
  11. package/IO/Core/HttpSceneLoader.d.ts +11 -2
  12. package/Interaction/Manipulators/MouseCameraTrackballRollManipulator.js +1 -1
  13. package/Interaction/Manipulators/MouseCameraUnicamRotateManipulator.js +1 -1
  14. package/Interaction/Style/InteractorStyleTrackballCamera.js +1 -1
  15. package/Interaction/Widgets/PiecewiseGaussianWidget.js +1 -1
  16. package/Proxy/Core/View2DProxy.js +1 -1
  17. package/Rendering/Core/Camera.d.ts +12 -1
  18. package/Rendering/Core/CellPicker.d.ts +3 -3
  19. package/Rendering/Core/ColorTransferFunction.js +1 -1
  20. package/Rendering/Core/Coordinate.d.ts +7 -7
  21. package/Rendering/Core/Coordinate.js +1 -1
  22. package/Rendering/Core/CubeAxesActor.js +1 -1
  23. package/Rendering/Core/Glyph3DMapper.js +1 -1
  24. package/Rendering/Core/ImageMapper.d.ts +1 -1
  25. package/Rendering/Core/ImageMapper.js +2 -3
  26. package/Rendering/Core/ImageSlice.d.ts +4 -4
  27. package/Rendering/Core/InteractorObserver.d.ts +2 -2
  28. package/Rendering/Core/Mapper.js +1 -1
  29. package/Rendering/Core/Picker.d.ts +1 -1
  30. package/Rendering/Core/Prop3D.js +1 -1
  31. package/Rendering/Core/RenderWindow.d.ts +6 -6
  32. package/Rendering/Core/RenderWindowInteractor.js +1 -1
  33. package/Rendering/Core/Renderer.d.ts +8 -9
  34. package/Rendering/Core/Renderer.js +1 -1
  35. package/Rendering/Core/ScalarBarActor.js +1 -1
  36. package/Rendering/Core/VolumeMapper.js +1 -1
  37. package/Rendering/Core/VolumeProperty.d.ts +2 -2
  38. package/Rendering/Misc/SynchronizableRenderWindow.d.ts +1 -1
  39. package/Rendering/OpenGL/PolyDataMapper2D.js +1 -1
  40. package/Rendering/OpenGL/RenderWindow.d.ts +7 -7
  41. package/Rendering/OpenGL/Texture.js +1 -1
  42. package/Widgets/Core/WidgetManager.d.ts +1 -1
  43. package/Widgets/Representations/HandleRepresentation.js +2 -1
  44. package/Widgets/Representations/PolyLineRepresentation.js +1 -1
  45. package/Widgets/Widgets3D/AngleWidget/state.js +2 -2
  46. package/Widgets/Widgets3D/AngleWidget.js +2 -2
  47. package/Widgets/Widgets3D/DistanceWidget/state.js +2 -2
  48. package/Widgets/Widgets3D/DistanceWidget.js +1 -1
  49. package/Widgets/Widgets3D/EllipseWidget.js +1 -4
  50. package/Widgets/Widgets3D/ImageCroppingWidget/state.js +1 -1
  51. package/Widgets/Widgets3D/ImageCroppingWidget.js +2 -1
  52. package/Widgets/Widgets3D/LabelWidget/state.js +1 -1
  53. package/Widgets/Widgets3D/LabelWidget.js +1 -1
  54. package/Widgets/Widgets3D/LineWidget/helpers.js +1 -1
  55. package/Widgets/Widgets3D/LineWidget/state.js +3 -3
  56. package/Widgets/Widgets3D/LineWidget.js +1 -8
  57. package/Widgets/Widgets3D/PolyLineWidget.js +2 -8
  58. package/Widgets/Widgets3D/RectangleWidget.js +1 -4
  59. package/Widgets/Widgets3D/ResliceCursorWidget/behavior.js +1 -1
  60. package/Widgets/Widgets3D/ResliceCursorWidget/helpers.js +1 -1
  61. package/Widgets/Widgets3D/SphereWidget.js +4 -12
  62. package/Widgets/Widgets3D/SplineWidget/state.js +2 -2
  63. package/Widgets/Widgets3D/SplineWidget.js +2 -5
  64. package/package.json +1 -1
  65. package/types.d.ts +23 -13
@@ -1,4 +1,5 @@
1
1
  import _slicedToArray from '@babel/runtime/helpers/slicedToArray';
2
+ import _toConsumableArray from '@babel/runtime/helpers/toConsumableArray';
2
3
  import seedrandom from 'seedrandom';
3
4
  import macro from '../../../macros.js';
4
5
 
@@ -22,25 +23,38 @@ function notImplemented(method) {
22
23
  return function () {
23
24
  return vtkErrorMacro("vtkMath::".concat(method, " - NOT IMPLEMENTED"));
24
25
  };
25
- }
26
+ } // Swap rows for n by n matrix
26
27
 
27
- function vtkSwapVectors3(v1, v2) {
28
- for (var i = 0; i < 3; i++) {
29
- var tmp = v1[i];
30
- v1[i] = v2[i];
31
- v2[i] = tmp;
28
+
29
+ function swapRowsMatrix_nxn(matrix, n, row1, row2) {
30
+ var tmp;
31
+
32
+ for (var i = 0; i < n; i++) {
33
+ tmp = matrix[row1 * n + i];
34
+ matrix[row1 * n + i] = matrix[row2 * n + i];
35
+ matrix[row2 * n + i] = tmp;
32
36
  }
33
- }
37
+ } // Swap columns for n by n matrix
34
38
 
35
- function createArray() {
36
- var size = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 3;
37
- // faster than Array.from and/or while loop
38
- return Array(size).fill(0);
39
+
40
+ function swapColumnsMatrix_nxn(matrix, n, column1, column2) {
41
+ var tmp;
42
+
43
+ for (var i = 0; i < n; i++) {
44
+ tmp = matrix[i * n + column1];
45
+ matrix[i * n + column1] = matrix[i * n + column2];
46
+ matrix[i * n + column2] = tmp;
47
+ }
39
48
  } // ----------------------------------------------------------------------------
40
49
  // Global methods
41
50
  // ----------------------------------------------------------------------------
42
51
 
43
52
 
53
+ function createArray() {
54
+ var size = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 3;
55
+ // faster than Array.from and/or while loop
56
+ return Array(size).fill(0);
57
+ }
44
58
  var Pi = function Pi() {
45
59
  return Math.PI;
46
60
  };
@@ -208,11 +222,15 @@ function dot(x, y) {
208
222
  return x[0] * y[0] + x[1] * y[1] + x[2] * y[2];
209
223
  }
210
224
  function outer(x, y, out_3x3) {
211
- for (var i = 0; i < 3; i++) {
212
- for (var j = 0; j < 3; j++) {
213
- out_3x3[i][j] = x[i] * y[j];
214
- }
215
- }
225
+ out_3x3[0] = x[0] * y[0];
226
+ out_3x3[1] = x[0] * y[1];
227
+ out_3x3[2] = x[0] * y[2];
228
+ out_3x3[3] = x[1] * y[0];
229
+ out_3x3[4] = x[1] * y[1];
230
+ out_3x3[5] = x[1] * y[2];
231
+ out_3x3[6] = x[2] * y[0];
232
+ out_3x3[7] = x[2] * y[1];
233
+ out_3x3[8] = x[2] * y[2];
216
234
  }
217
235
  function cross(x, y, out) {
218
236
  var Zx = x[1] * y[2] - x[2] * y[1];
@@ -379,11 +397,10 @@ function gaussianWeight(mean, variance, position) {
379
397
  return Math.exp(-Math.pow(distanceFromMean, 2) / (2 * variance));
380
398
  }
381
399
  function outer2D(x, y, out_2x2) {
382
- for (var i = 0; i < 2; i++) {
383
- for (var j = 0; j < 2; j++) {
384
- out_2x2[i][j] = x[i] * y[j];
385
- }
386
- }
400
+ out_2x2[0] = x[0] * y[0];
401
+ out_2x2[1] = x[0] * y[1];
402
+ out_2x2[2] = x[1] * y[0];
403
+ out_2x2[3] = x[1] * y[1];
387
404
  }
388
405
  function norm2D(x2D) {
389
406
  return Math.sqrt(x2D[0] * x2D[0] + x2D[1] * x2D[1]);
@@ -398,6 +415,44 @@ function normalize2D(x) {
398
415
 
399
416
  return den;
400
417
  }
418
+ function rowsToMat4(row0, row1, row2, row3, mat) {
419
+ for (var i = 0; i < 4; i++) {
420
+ mat[i] = row0[i];
421
+ mat[4 + i] = row1[i];
422
+ mat[8 + i] = row2[i];
423
+ mat[12 + i] = row3[i];
424
+ }
425
+
426
+ return mat;
427
+ }
428
+ function columnsToMat4(column0, column1, column2, column3, mat) {
429
+ for (var i = 0; i < 4; i++) {
430
+ mat[4 * i] = column0[i];
431
+ mat[4 * i + 1] = column1[i];
432
+ mat[4 * i + 2] = column2[i];
433
+ mat[4 * i + 3] = column3[i];
434
+ }
435
+
436
+ return mat;
437
+ }
438
+ function rowsToMat3(row0, row1, row2, mat) {
439
+ for (var i = 0; i < 3; i++) {
440
+ mat[i] = row0[i];
441
+ mat[3 + i] = row1[i];
442
+ mat[6 + i] = row2[i];
443
+ }
444
+
445
+ return mat;
446
+ }
447
+ function columnsToMat3(column0, column1, column2, mat) {
448
+ for (var i = 0; i < 3; i++) {
449
+ mat[3 * i] = column0[i];
450
+ mat[3 * i + 1] = column1[i];
451
+ mat[3 * i + 2] = column2[i];
452
+ }
453
+
454
+ return mat;
455
+ }
401
456
  function determinant2x2() {
402
457
  for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
403
458
  args[_key] = arguments[_key];
@@ -420,13 +475,13 @@ function LUFactor3x3(mat_3x3, index_3) {
420
475
  var scale = [0, 0, 0]; // Loop over rows to get implicit scaling information
421
476
 
422
477
  for (var i = 0; i < 3; i++) {
423
- largest = Math.abs(mat_3x3[i][0]);
478
+ largest = Math.abs(mat_3x3[i * 3]);
424
479
 
425
- if ((tmp = Math.abs(mat_3x3[i][1])) > largest) {
480
+ if ((tmp = Math.abs(mat_3x3[i * 3 + 1])) > largest) {
426
481
  largest = tmp;
427
482
  }
428
483
 
429
- if ((tmp = Math.abs(mat_3x3[i][2])) > largest) {
484
+ if ((tmp = Math.abs(mat_3x3[i * 3 + 2])) > largest) {
430
485
  largest = tmp;
431
486
  }
432
487
 
@@ -435,43 +490,43 @@ function LUFactor3x3(mat_3x3, index_3) {
435
490
  // first column
436
491
 
437
492
 
438
- largest = scale[0] * Math.abs(mat_3x3[0][0]);
493
+ largest = scale[0] * Math.abs(mat_3x3[0]);
439
494
  maxI = 0;
440
495
 
441
- if ((tmp = scale[1] * Math.abs(mat_3x3[1][0])) >= largest) {
496
+ if ((tmp = scale[1] * Math.abs(mat_3x3[3])) >= largest) {
442
497
  largest = tmp;
443
498
  maxI = 1;
444
499
  }
445
500
 
446
- if ((tmp = scale[2] * Math.abs(mat_3x3[2][0])) >= largest) {
501
+ if ((tmp = scale[2] * Math.abs(mat_3x3[6])) >= largest) {
447
502
  maxI = 2;
448
503
  }
449
504
 
450
505
  if (maxI !== 0) {
451
- vtkSwapVectors3(mat_3x3[maxI], mat_3x3[0]);
506
+ swapRowsMatrix_nxn(mat_3x3, 3, maxI, 0);
452
507
  scale[maxI] = scale[0];
453
508
  }
454
509
 
455
510
  index_3[0] = maxI;
456
- mat_3x3[1][0] /= mat_3x3[0][0];
457
- mat_3x3[2][0] /= mat_3x3[0][0]; // second column
511
+ mat_3x3[3] /= mat_3x3[0];
512
+ mat_3x3[6] /= mat_3x3[0]; // second column
458
513
 
459
- mat_3x3[1][1] -= mat_3x3[1][0] * mat_3x3[0][1];
460
- mat_3x3[2][1] -= mat_3x3[2][0] * mat_3x3[0][1];
461
- largest = scale[1] * Math.abs(mat_3x3[1][1]);
514
+ mat_3x3[4] -= mat_3x3[3] * mat_3x3[1];
515
+ mat_3x3[7] -= mat_3x3[6] * mat_3x3[1];
516
+ largest = scale[1] * Math.abs(mat_3x3[4]);
462
517
  maxI = 1;
463
518
 
464
- if ((tmp = scale[2] * Math.abs(mat_3x3[2][1])) >= largest) {
519
+ if ((tmp = scale[2] * Math.abs(mat_3x3[7])) >= largest) {
465
520
  maxI = 2;
466
- vtkSwapVectors3(mat_3x3[2], mat_3x3[1]);
521
+ swapRowsMatrix_nxn(mat_3x3, 3, 1, 2);
467
522
  scale[2] = scale[1];
468
523
  }
469
524
 
470
525
  index_3[1] = maxI;
471
- mat_3x3[2][1] /= mat_3x3[1][1]; // third column
526
+ mat_3x3[7] /= mat_3x3[4]; // third column
472
527
 
473
- mat_3x3[1][2] -= mat_3x3[1][0] * mat_3x3[0][2];
474
- mat_3x3[2][2] -= mat_3x3[2][0] * mat_3x3[0][2] + mat_3x3[2][1] * mat_3x3[1][2];
528
+ mat_3x3[5] -= mat_3x3[3] * mat_3x3[2];
529
+ mat_3x3[8] -= mat_3x3[6] * mat_3x3[2] + mat_3x3[7] * mat_3x3[5];
475
530
  index_3[2] = 2;
476
531
  }
477
532
  function LUSolve3x3(mat_3x3, index_3, x_3) {
@@ -481,25 +536,25 @@ function LUSolve3x3(mat_3x3, index_3, x_3) {
481
536
  x_3[0] = sum;
482
537
  sum = x_3[index_3[1]];
483
538
  x_3[index_3[1]] = x_3[1];
484
- x_3[1] = sum - mat_3x3[1][0] * x_3[0];
539
+ x_3[1] = sum - mat_3x3[3] * x_3[0];
485
540
  sum = x_3[index_3[2]];
486
541
  x_3[index_3[2]] = x_3[2];
487
- x_3[2] = sum - mat_3x3[2][0] * x_3[0] - mat_3x3[2][1] * x_3[1]; // back substitution
542
+ x_3[2] = sum - mat_3x3[6] * x_3[0] - mat_3x3[7] * x_3[1]; // back substitution
488
543
 
489
- x_3[2] /= mat_3x3[2][2];
490
- x_3[1] = (x_3[1] - mat_3x3[1][2] * x_3[2]) / mat_3x3[1][1];
491
- x_3[0] = (x_3[0] - mat_3x3[0][1] * x_3[1] - mat_3x3[0][2] * x_3[2]) / mat_3x3[0][0];
544
+ x_3[2] /= mat_3x3[8];
545
+ x_3[1] = (x_3[1] - mat_3x3[5] * x_3[2]) / mat_3x3[4];
546
+ x_3[0] = (x_3[0] - mat_3x3[1] * x_3[1] - mat_3x3[2] * x_3[2]) / mat_3x3[0];
492
547
  }
493
548
  function linearSolve3x3(mat_3x3, x_3, y_3) {
494
- var a1 = mat_3x3[0][0];
495
- var b1 = mat_3x3[0][1];
496
- var c1 = mat_3x3[0][2];
497
- var a2 = mat_3x3[1][0];
498
- var b2 = mat_3x3[1][1];
499
- var c2 = mat_3x3[1][2];
500
- var a3 = mat_3x3[2][0];
501
- var b3 = mat_3x3[2][1];
502
- var c3 = mat_3x3[2][2]; // Compute the adjoint
549
+ var a1 = mat_3x3[0];
550
+ var b1 = mat_3x3[1];
551
+ var c1 = mat_3x3[2];
552
+ var a2 = mat_3x3[3];
553
+ var b2 = mat_3x3[4];
554
+ var c2 = mat_3x3[5];
555
+ var a3 = mat_3x3[6];
556
+ var b3 = mat_3x3[7];
557
+ var c3 = mat_3x3[8]; // Compute the adjoint
503
558
 
504
559
  var d1 = +determinant2x2(b2, b3, c2, c3);
505
560
  var d2 = -determinant2x2(a2, a3, c2, c3);
@@ -522,72 +577,75 @@ function linearSolve3x3(mat_3x3, x_3, y_3) {
522
577
  y_3[2] = v3 / det;
523
578
  }
524
579
  function multiply3x3_vect3(mat_3x3, in_3, out_3) {
525
- var x = mat_3x3[0][0] * in_3[0] + mat_3x3[0][1] * in_3[1] + mat_3x3[0][2] * in_3[2];
526
- var y = mat_3x3[1][0] * in_3[0] + mat_3x3[1][1] * in_3[1] + mat_3x3[1][2] * in_3[2];
527
- var z = mat_3x3[2][0] * in_3[0] + mat_3x3[2][1] * in_3[1] + mat_3x3[2][2] * in_3[2];
580
+ var x = mat_3x3[0] * in_3[0] + mat_3x3[1] * in_3[1] + mat_3x3[2] * in_3[2];
581
+ var y = mat_3x3[3] * in_3[0] + mat_3x3[4] * in_3[1] + mat_3x3[5] * in_3[2];
582
+ var z = mat_3x3[6] * in_3[0] + mat_3x3[7] * in_3[1] + mat_3x3[8] * in_3[2];
528
583
  out_3[0] = x;
529
584
  out_3[1] = y;
530
585
  out_3[2] = z;
531
586
  }
532
587
  function multiply3x3_mat3(a_3x3, b_3x3, out_3x3) {
533
- var tmp = [[0, 0, 0], [0, 0, 0], [0, 0, 0]];
588
+ var copyA = _toConsumableArray(a_3x3);
534
589
 
535
- for (var i = 0; i < 3; i++) {
536
- tmp[0][i] = a_3x3[0][0] * b_3x3[0][i] + a_3x3[0][1] * b_3x3[1][i] + a_3x3[0][2] * b_3x3[2][i];
537
- tmp[1][i] = a_3x3[1][0] * b_3x3[0][i] + a_3x3[1][1] * b_3x3[1][i] + a_3x3[1][2] * b_3x3[2][i];
538
- tmp[2][i] = a_3x3[2][0] * b_3x3[0][i] + a_3x3[2][1] * b_3x3[1][i] + a_3x3[2][2] * b_3x3[2][i];
539
- }
590
+ var copyB = _toConsumableArray(b_3x3);
540
591
 
541
- for (var j = 0; j < 3; j++) {
542
- out_3x3[j][0] = tmp[j][0];
543
- out_3x3[j][1] = tmp[j][1];
544
- out_3x3[j][2] = tmp[j][2];
592
+ for (var i = 0; i < 3; i++) {
593
+ out_3x3[i] = copyA[0] * copyB[i] + copyA[1] * copyB[i + 3] + copyA[2] * copyB[i + 6];
594
+ out_3x3[i + 3] = copyA[3] * copyB[i] + copyA[4] * copyB[i + 3] + copyA[5] * copyB[i + 6];
595
+ out_3x3[i + 6] = copyA[6] * copyB[i] + copyA[7] * copyB[i + 3] + copyA[8] * copyB[i + 6];
545
596
  }
546
597
  }
547
598
  function multiplyMatrix(a, b, rowA, colA, rowB, colB, out_rowXcol) {
548
599
  // we need colA == rowB
549
600
  if (colA !== rowB) {
550
601
  vtkErrorMacro('Number of columns of A must match number of rows of B.');
551
- } // output matrix is rowA*colB
602
+ } // If a or b is used to store the result, copying them is required
603
+
604
+
605
+ var copyA = _toConsumableArray(a);
606
+
607
+ var copyB = _toConsumableArray(b); // output matrix is rowA*colB
552
608
  // output row
553
609
 
554
610
 
555
611
  for (var i = 0; i < rowA; i++) {
556
612
  // output col
557
613
  for (var j = 0; j < colB; j++) {
558
- out_rowXcol[i][j] = 0; // sum for this point
614
+ out_rowXcol[i * colB + j] = 0; // sum for this point
559
615
 
560
616
  for (var k = 0; k < colA; k++) {
561
- out_rowXcol[i][j] += a[i][k] * b[k][j];
617
+ out_rowXcol[i * colB + j] += copyA[i * colA + k] * copyB[j + colB * k];
562
618
  }
563
619
  }
564
620
  }
565
621
  }
566
622
  function transpose3x3(in_3x3, outT_3x3) {
567
- var tmp;
568
- tmp = in_3x3[1][0];
569
- outT_3x3[1][0] = in_3x3[0][1];
570
- outT_3x3[0][1] = tmp;
571
- tmp = in_3x3[2][0];
572
- outT_3x3[2][0] = in_3x3[0][2];
573
- outT_3x3[0][2] = tmp;
574
- tmp = in_3x3[2][1];
575
- outT_3x3[2][1] = in_3x3[1][2];
576
- outT_3x3[1][2] = tmp;
577
- outT_3x3[0][0] = in_3x3[0][0];
578
- outT_3x3[1][1] = in_3x3[1][1];
579
- outT_3x3[2][2] = in_3x3[2][2];
623
+ var tmp; // off-diagonal elements
624
+
625
+ tmp = in_3x3[3];
626
+ outT_3x3[3] = in_3x3[1];
627
+ outT_3x3[1] = tmp;
628
+ tmp = in_3x3[6];
629
+ outT_3x3[6] = in_3x3[2];
630
+ outT_3x3[2] = tmp;
631
+ tmp = in_3x3[7];
632
+ outT_3x3[7] = in_3x3[5];
633
+ outT_3x3[5] = tmp; // on-diagonal elements
634
+
635
+ outT_3x3[0] = in_3x3[0];
636
+ outT_3x3[4] = in_3x3[4];
637
+ outT_3x3[8] = in_3x3[8];
580
638
  }
581
639
  function invert3x3(in_3x3, outI_3x3) {
582
- var a1 = in_3x3[0][0];
583
- var b1 = in_3x3[0][1];
584
- var c1 = in_3x3[0][2];
585
- var a2 = in_3x3[1][0];
586
- var b2 = in_3x3[1][1];
587
- var c2 = in_3x3[1][2];
588
- var a3 = in_3x3[2][0];
589
- var b3 = in_3x3[2][1];
590
- var c3 = in_3x3[2][2]; // Compute the adjoint
640
+ var a1 = in_3x3[0];
641
+ var b1 = in_3x3[1];
642
+ var c1 = in_3x3[2];
643
+ var a2 = in_3x3[3];
644
+ var b2 = in_3x3[4];
645
+ var c2 = in_3x3[5];
646
+ var a3 = in_3x3[6];
647
+ var b3 = in_3x3[7];
648
+ var c3 = in_3x3[8]; // Compute the adjoint
591
649
 
592
650
  var d1 = +determinant2x2(b2, b3, c2, c3);
593
651
  var d2 = -determinant2x2(a2, a3, c2, c3);
@@ -600,24 +658,41 @@ function invert3x3(in_3x3, outI_3x3) {
600
658
  var f3 = +determinant2x2(a1, a2, b1, b2); // Divide by the determinant
601
659
 
602
660
  var det = a1 * d1 + b1 * d2 + c1 * d3;
603
- outI_3x3[0][0] = d1 / det;
604
- outI_3x3[1][0] = d2 / det;
605
- outI_3x3[2][0] = d3 / det;
606
- outI_3x3[0][1] = e1 / det;
607
- outI_3x3[1][1] = e2 / det;
608
- outI_3x3[2][1] = e3 / det;
609
- outI_3x3[0][2] = f1 / det;
610
- outI_3x3[1][2] = f2 / det;
611
- outI_3x3[2][2] = f3 / det;
661
+
662
+ if (det === 0) {
663
+ vtkWarningMacro('Matrix has 0 determinant');
664
+ }
665
+
666
+ outI_3x3[0] = d1 / det;
667
+ outI_3x3[3] = d2 / det;
668
+ outI_3x3[6] = d3 / det;
669
+ outI_3x3[1] = e1 / det;
670
+ outI_3x3[4] = e2 / det;
671
+ outI_3x3[7] = e3 / det;
672
+ outI_3x3[2] = f1 / det;
673
+ outI_3x3[5] = f2 / det;
674
+ outI_3x3[8] = f3 / det;
675
+ }
676
+ function determinant3x3(mat_3x3) {
677
+ return mat_3x3[0] * mat_3x3[4] * mat_3x3[8] + mat_3x3[3] * mat_3x3[7] * mat_3x3[2] + mat_3x3[6] * mat_3x3[1] * mat_3x3[5] - mat_3x3[0] * mat_3x3[7] * mat_3x3[5] - mat_3x3[3] * mat_3x3[1] * mat_3x3[8] - mat_3x3[6] * mat_3x3[4] * mat_3x3[2];
612
678
  }
613
679
  function identity3x3(mat_3x3) {
614
680
  for (var i = 0; i < 3; i++) {
615
- mat_3x3[i][0] = mat_3x3[i][1] = mat_3x3[i][2] = 0;
616
- mat_3x3[i][i] = 1;
681
+ /* eslint-disable-next-line no-multi-assign */
682
+ mat_3x3[i * 3] = mat_3x3[i * 3 + 1] = mat_3x3[i * 3 + 2] = 0;
683
+ mat_3x3[i * 3 + i] = 1;
617
684
  }
618
685
  }
619
- function determinant3x3(mat_3x3) {
620
- return mat_3x3[0][0] * mat_3x3[1][1] * mat_3x3[2][2] + mat_3x3[1][0] * mat_3x3[2][1] * mat_3x3[0][2] + mat_3x3[2][0] * mat_3x3[0][1] * mat_3x3[1][2] - mat_3x3[0][0] * mat_3x3[2][1] * mat_3x3[1][2] - mat_3x3[1][0] * mat_3x3[0][1] * mat_3x3[2][2] - mat_3x3[2][0] * mat_3x3[1][1] * mat_3x3[0][2];
686
+ function identity(n, mat) {
687
+ for (var i = 0; i < n; i++) {
688
+ for (var j = 0; j < n; j++) {
689
+ mat[i * n + j] = 0;
690
+ }
691
+
692
+ mat[i * n + i] = 1;
693
+ }
694
+
695
+ return mat;
621
696
  }
622
697
  function quaternionToMatrix3x3(quat_4, mat_3x3) {
623
698
  var ww = quat_4[0] * quat_4[0];
@@ -635,15 +710,15 @@ function quaternionToMatrix3x3(quat_4, mat_3x3) {
635
710
  var f = 1 / (ww + rr);
636
711
  var s = (ww - rr) * f;
637
712
  f *= 2;
638
- mat_3x3[0][0] = xx * f + s;
639
- mat_3x3[1][0] = (xy + wz) * f;
640
- mat_3x3[2][0] = (xz - wy) * f;
641
- mat_3x3[0][1] = (xy - wz) * f;
642
- mat_3x3[1][1] = yy * f + s;
643
- mat_3x3[2][1] = (yz + wx) * f;
644
- mat_3x3[0][2] = (xz + wy) * f;
645
- mat_3x3[1][2] = (yz - wx) * f;
646
- mat_3x3[2][2] = zz * f + s;
713
+ mat_3x3[0] = xx * f + s;
714
+ mat_3x3[3] = (xy + wz) * f;
715
+ mat_3x3[6] = (xz - wy) * f;
716
+ mat_3x3[1] = (xy - wz) * f;
717
+ mat_3x3[4] = yy * f + s;
718
+ mat_3x3[7] = (yz + wx) * f;
719
+ mat_3x3[2] = (xz + wy) * f;
720
+ mat_3x3[5] = (yz - wx) * f;
721
+ mat_3x3[8] = zz * f + s;
647
722
  }
648
723
  /**
649
724
  * Returns true if elements of both arrays are equals.
@@ -710,24 +785,18 @@ function jacobiN(a, n, w, v) {
710
785
  var b = createArray(n);
711
786
  var z = createArray(n);
712
787
 
713
- var vtkROTATE = function vtkROTATE(aa, ii, jj, kk, ll) {
714
- g = aa[ii][jj];
715
- h = aa[kk][ll];
716
- aa[ii][jj] = g - s * (h + g * tau);
717
- aa[kk][ll] = h + s * (g - h * tau);
788
+ var vtkROTATE = function vtkROTATE(aa, ii, jj) {
789
+ g = aa[ii];
790
+ h = aa[jj];
791
+ aa[ii] = g - s * (h + g * tau);
792
+ aa[jj] = h + s * (g - h * tau);
718
793
  }; // initialize
719
794
 
720
795
 
721
- for (ip = 0; ip < n; ip++) {
722
- for (iq = 0; iq < n; iq++) {
723
- v[ip][iq] = 0.0;
724
- }
725
-
726
- v[ip][ip] = 1.0;
727
- }
796
+ identity(n, v);
728
797
 
729
798
  for (ip = 0; ip < n; ip++) {
730
- b[ip] = w[ip] = a[ip][ip];
799
+ b[ip] = w[ip] = a[ip + ip * n];
731
800
  z[ip] = 0.0;
732
801
  } // begin rotation sequence
733
802
 
@@ -737,7 +806,7 @@ function jacobiN(a, n, w, v) {
737
806
 
738
807
  for (ip = 0; ip < n - 1; ip++) {
739
808
  for (iq = ip + 1; iq < n; iq++) {
740
- sm += Math.abs(a[ip][iq]);
809
+ sm += Math.abs(a[ip * n + iq]);
741
810
  }
742
811
  }
743
812
 
@@ -754,17 +823,17 @@ function jacobiN(a, n, w, v) {
754
823
 
755
824
  for (ip = 0; ip < n - 1; ip++) {
756
825
  for (iq = ip + 1; iq < n; iq++) {
757
- g = 100.0 * Math.abs(a[ip][iq]); // after 4 sweeps
826
+ g = 100.0 * Math.abs(a[ip * n + iq]); // after 4 sweeps
758
827
 
759
828
  if (i > 3 && Math.abs(w[ip]) + g === Math.abs(w[ip]) && Math.abs(w[iq]) + g === Math.abs(w[iq])) {
760
- a[ip][iq] = 0.0;
761
- } else if (Math.abs(a[ip][iq]) > tresh) {
829
+ a[ip * n + iq] = 0.0;
830
+ } else if (Math.abs(a[ip * n + iq]) > tresh) {
762
831
  h = w[iq] - w[ip];
763
832
 
764
833
  if (Math.abs(h) + g === Math.abs(h)) {
765
- t = a[ip][iq] / h;
834
+ t = a[ip * n + iq] / h;
766
835
  } else {
767
- theta = 0.5 * h / a[ip][iq];
836
+ theta = 0.5 * h / a[ip * n + iq];
768
837
  t = 1.0 / (Math.abs(theta) + Math.sqrt(1.0 + theta * theta));
769
838
 
770
839
  if (theta < 0.0) {
@@ -775,29 +844,29 @@ function jacobiN(a, n, w, v) {
775
844
  c = 1.0 / Math.sqrt(1 + t * t);
776
845
  s = t * c;
777
846
  tau = s / (1.0 + c);
778
- h = t * a[ip][iq];
847
+ h = t * a[ip * n + iq];
779
848
  z[ip] -= h;
780
849
  z[iq] += h;
781
850
  w[ip] -= h;
782
851
  w[iq] += h;
783
- a[ip][iq] = 0.0; // ip already shifted left by 1 unit
852
+ a[ip * n + iq] = 0.0; // ip already shifted left by 1 unit
784
853
 
785
854
  for (j = 0; j <= ip - 1; j++) {
786
- vtkROTATE(a, j, ip, j, iq);
855
+ vtkROTATE(a, j * n + ip, j * n + iq);
787
856
  } // ip and iq already shifted left by 1 unit
788
857
 
789
858
 
790
859
  for (j = ip + 1; j <= iq - 1; j++) {
791
- vtkROTATE(a, ip, j, j, iq);
860
+ vtkROTATE(a, ip * n + j, j * n + iq);
792
861
  } // iq already shifted left by 1 unit
793
862
 
794
863
 
795
864
  for (j = iq + 1; j < n; j++) {
796
- vtkROTATE(a, ip, j, iq, j);
865
+ vtkROTATE(a, ip * n + j, iq * n + j);
797
866
  }
798
867
 
799
868
  for (j = 0; j < n; j++) {
800
- vtkROTATE(v, j, ip, j, iq);
869
+ vtkROTATE(v, j * n + ip, j * n + iq);
801
870
  }
802
871
  }
803
872
  }
@@ -834,12 +903,7 @@ function jacobiN(a, n, w, v) {
834
903
  if (k !== j) {
835
904
  w[k] = w[j];
836
905
  w[j] = tmp;
837
-
838
- for (i = 0; i < n; i++) {
839
- tmp = v[i][j];
840
- v[i][j] = v[i][k];
841
- v[i][k] = tmp;
842
- }
906
+ swapColumnsMatrix_nxn(v, n, j, k);
843
907
  }
844
908
  } // ensure eigenvector consistency (i.e., Jacobi can compute vectors that
845
909
  // are negative of one another (.707,.707,0) and (-.707,-.707,0). This can
@@ -849,55 +913,47 @@ function jacobiN(a, n, w, v) {
849
913
 
850
914
  var ceil_half_n = (n >> 1) + (n & 1);
851
915
 
852
- for (j = 0; j < n; j++) {
853
- for (numPos = 0, i = 0; i < n; i++) {
854
- if (v[i][j] >= 0.0) {
855
- numPos++;
856
- }
857
- } // if ( numPos < ceil(double(n)/double(2.0)) )
916
+ for (numPos = 0, i = 0; i < n * n; i++) {
917
+ if (v[i] >= 0.0) {
918
+ numPos++;
919
+ }
920
+ } // if ( numPos < ceil(double(n)/double(2.0)) )
858
921
 
859
922
 
860
- if (numPos < ceil_half_n) {
861
- for (i = 0; i < n; i++) {
862
- v[i][j] *= -1.0;
863
- }
923
+ if (numPos < ceil_half_n) {
924
+ for (i = 0; i < n; i++) {
925
+ v[i * n + j] *= -1.0;
864
926
  }
865
927
  }
866
928
 
867
929
  return 1;
868
930
  }
869
931
  function matrix3x3ToQuaternion(mat_3x3, quat_4) {
870
- var tmp = [[0, 0, 0, 0], [0, 0, 0, 0], [0, 0, 0, 0], [0, 0, 0, 0]]; // on-diagonal elements
871
-
872
- tmp[0][0] = mat_3x3[0][0] + mat_3x3[1][1] + mat_3x3[2][2];
873
- tmp[1][1] = mat_3x3[0][0] - mat_3x3[1][1] - mat_3x3[2][2];
874
- tmp[2][2] = -mat_3x3[0][0] + mat_3x3[1][1] - mat_3x3[2][2];
875
- tmp[3][3] = -mat_3x3[0][0] - mat_3x3[1][1] + mat_3x3[2][2]; // off-diagonal elements
876
-
877
- tmp[0][1] = tmp[1][0] = mat_3x3[2][1] - mat_3x3[1][2];
878
- tmp[0][2] = tmp[2][0] = mat_3x3[0][2] - mat_3x3[2][0];
879
- tmp[0][3] = tmp[3][0] = mat_3x3[1][0] - mat_3x3[0][1];
880
- tmp[1][2] = tmp[2][1] = mat_3x3[1][0] + mat_3x3[0][1];
881
- tmp[1][3] = tmp[3][1] = mat_3x3[0][2] + mat_3x3[2][0];
882
- tmp[2][3] = tmp[3][2] = mat_3x3[2][1] + mat_3x3[1][2];
883
- var eigenvectors = [[0, 0, 0, 0], [0, 0, 0, 0], [0, 0, 0, 0], [0, 0, 0, 0]];
932
+ var tmp = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]; // on-diagonal elements
933
+
934
+ tmp[0] = mat_3x3[0] + mat_3x3[4] + mat_3x3[8];
935
+ tmp[5] = mat_3x3[0] - mat_3x3[4] - mat_3x3[8];
936
+ tmp[10] = -mat_3x3[0] + mat_3x3[4] - mat_3x3[8];
937
+ tmp[15] = -mat_3x3[0] - mat_3x3[4] + mat_3x3[8]; // off-diagonal elements
938
+
939
+ tmp[1] = tmp[4] = mat_3x3[7] - mat_3x3[5];
940
+ tmp[2] = tmp[8] = mat_3x3[2] - mat_3x3[6];
941
+ tmp[3] = tmp[12] = mat_3x3[3] - mat_3x3[1];
942
+ tmp[6] = tmp[9] = mat_3x3[3] + mat_3x3[1];
943
+ tmp[7] = tmp[13] = mat_3x3[2] + mat_3x3[6];
944
+ tmp[11] = tmp[14] = mat_3x3[7] + mat_3x3[5];
945
+ var eigenvectors = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0];
884
946
  var eigenvalues = [0, 0, 0, 0]; // convert into format that JacobiN can use,
885
947
  // then use Jacobi to find eigenvalues and eigenvectors
948
+ // tmp is copied because jacobiN may modify it
886
949
 
887
- var NTemp = [0, 0, 0, 0];
888
- var eigenvectorsTemp = [0, 0, 0, 0];
889
-
890
- for (var i = 0; i < 4; i++) {
891
- NTemp[i] = tmp[i];
892
- eigenvectorsTemp[i] = eigenvectors[i];
893
- }
894
-
895
- jacobiN(NTemp, 4, eigenvalues, eigenvectorsTemp); // the first eigenvector is the one we want
950
+ var NTemp = [].concat(tmp);
951
+ jacobiN(NTemp, 4, eigenvalues, eigenvectors); // the first eigenvector is the one we want
896
952
 
897
- quat_4[0] = eigenvectors[0][0];
898
- quat_4[1] = eigenvectors[1][0];
899
- quat_4[2] = eigenvectors[2][0];
900
- quat_4[3] = eigenvectors[3][0];
953
+ quat_4[0] = eigenvectors[0];
954
+ quat_4[1] = eigenvectors[4];
955
+ quat_4[2] = eigenvectors[8];
956
+ quat_4[3] = eigenvectors[12];
901
957
  }
902
958
  function multiplyQuaternion(quat_1, quat_2, quat_out) {
903
959
  var ww = quat_1[0] * quat_2[0];
@@ -923,10 +979,8 @@ function multiplyQuaternion(quat_1, quat_2, quat_out) {
923
979
  }
924
980
  function orthogonalize3x3(a_3x3, out_3x3) {
925
981
  // copy the matrix
926
- for (var i = 0; i < 3; i++) {
927
- out_3x3[0][i] = a_3x3[0][i];
928
- out_3x3[1][i] = a_3x3[1][i];
929
- out_3x3[2][i] = a_3x3[2][i];
982
+ for (var i = 0; i < 9; i++) {
983
+ out_3x3[i] = a_3x3[i];
930
984
  } // Pivot the matrix to improve accuracy
931
985
 
932
986
 
@@ -935,11 +989,11 @@ function orthogonalize3x3(a_3x3, out_3x3) {
935
989
  var largest; // Loop over rows to get implicit scaling information
936
990
 
937
991
  for (var _i = 0; _i < 3; _i++) {
938
- var _x = Math.abs(out_3x3[_i][0]);
992
+ var _x = Math.abs(out_3x3[_i * 3]);
939
993
 
940
- var _x2 = Math.abs(out_3x3[_i][1]);
994
+ var _x2 = Math.abs(out_3x3[_i * 3 + 1]);
941
995
 
942
- var _x3 = Math.abs(out_3x3[_i][2]);
996
+ var _x3 = Math.abs(out_3x3[_i * 3 + 2]);
943
997
 
944
998
  largest = _x2 > _x ? _x2 : _x;
945
999
  largest = _x3 > largest ? _x3 : largest;
@@ -951,9 +1005,9 @@ function orthogonalize3x3(a_3x3, out_3x3) {
951
1005
  } // first column
952
1006
 
953
1007
 
954
- var x1 = Math.abs(out_3x3[0][0]) * scale[0];
955
- var x2 = Math.abs(out_3x3[1][0]) * scale[1];
956
- var x3 = Math.abs(out_3x3[2][0]) * scale[2];
1008
+ var x1 = Math.abs(out_3x3[0]) * scale[0];
1009
+ var x2 = Math.abs(out_3x3[3]) * scale[1];
1010
+ var x3 = Math.abs(out_3x3[6]) * scale[2];
957
1011
  index[0] = 0;
958
1012
  largest = x1;
959
1013
 
@@ -967,19 +1021,21 @@ function orthogonalize3x3(a_3x3, out_3x3) {
967
1021
  }
968
1022
 
969
1023
  if (index[0] !== 0) {
970
- vtkSwapVectors3(out_3x3[index[0]], out_3x3[0]);
1024
+ // swap vectors
1025
+ swapColumnsMatrix_nxn(out_3x3, 3, index[0], 0);
971
1026
  scale[index[0]] = scale[0];
972
1027
  } // second column
973
1028
 
974
1029
 
975
- var y2 = Math.abs(out_3x3[1][1]) * scale[1];
976
- var y3 = Math.abs(out_3x3[2][1]) * scale[2];
1030
+ var y2 = Math.abs(out_3x3[4]) * scale[1];
1031
+ var y3 = Math.abs(out_3x3[7]) * scale[2];
977
1032
  index[1] = 1;
978
1033
  largest = y2;
979
1034
 
980
1035
  if (y3 >= largest) {
981
- index[1] = 2;
982
- vtkSwapVectors3(out_3x3[2], out_3x3[1]);
1036
+ index[1] = 2; // swap vectors
1037
+
1038
+ swapColumnsMatrix_nxn(out_3x3, 3, 1, 2);
983
1039
  } // third column
984
1040
 
985
1041
 
@@ -992,10 +1048,8 @@ function orthogonalize3x3(a_3x3, out_3x3) {
992
1048
  if (determinant3x3(out_3x3) < 0) {
993
1049
  flip = 1;
994
1050
 
995
- for (var _i2 = 0; _i2 < 3; _i2++) {
996
- out_3x3[0][_i2] = -out_3x3[0][_i2];
997
- out_3x3[1][_i2] = -out_3x3[1][_i2];
998
- out_3x3[2][_i2] = -out_3x3[2][_i2];
1051
+ for (var _i2 = 0; _i2 < 9; _i2++) {
1052
+ out_3x3[_i2] = -out_3x3[_i2];
999
1053
  }
1000
1054
  } // Do orthogonalization using a quaternion intermediate
1001
1055
  // (this, essentially, does the orthogonalization via
@@ -1008,20 +1062,18 @@ function orthogonalize3x3(a_3x3, out_3x3) {
1008
1062
  quaternionToMatrix3x3(quat, out_3x3); // Put the flip back into the orthogonalized matrix.
1009
1063
 
1010
1064
  if (flip) {
1011
- for (var _i3 = 0; _i3 < 3; _i3++) {
1012
- out_3x3[0][_i3] = -out_3x3[0][_i3];
1013
- out_3x3[1][_i3] = -out_3x3[1][_i3];
1014
- out_3x3[2][_i3] = -out_3x3[2][_i3];
1065
+ for (var _i3 = 0; _i3 < 9; _i3++) {
1066
+ out_3x3[_i3] = -out_3x3[_i3];
1015
1067
  }
1016
1068
  } // Undo the pivoting
1017
1069
 
1018
1070
 
1019
1071
  if (index[1] !== 1) {
1020
- vtkSwapVectors3(out_3x3[index[1]], out_3x3[1]);
1072
+ swapColumnsMatrix_nxn(out_3x3, 3, index[1], 1);
1021
1073
  }
1022
1074
 
1023
1075
  if (index[0] !== 0) {
1024
- vtkSwapVectors3(out_3x3[index[0]], out_3x3[0]);
1076
+ swapColumnsMatrix_nxn(out_3x3, 3, index[0], 0);
1025
1077
  }
1026
1078
  }
1027
1079
  function diagonalize3x3(a_3x3, w_3, v_3x3) {
@@ -1030,22 +1082,12 @@ function diagonalize3x3(a_3x3, w_3, v_3x3) {
1030
1082
  var k;
1031
1083
  var maxI;
1032
1084
  var tmp;
1033
- var maxVal; // do the matrix[3][3] to **matrix conversion for Jacobi
1034
-
1035
- var C = [createArray(3), createArray(3), createArray(3)];
1036
- var ATemp = createArray(3);
1037
- var VTemp = createArray(3);
1085
+ var maxVal; // a is copied because jacobiN may modify it
1038
1086
 
1039
- for (i = 0; i < 3; i++) {
1040
- C[i][0] = a_3x3[i][0];
1041
- C[i][1] = a_3x3[i][1];
1042
- C[i][2] = a_3x3[i][2];
1043
- ATemp[i] = C[i];
1044
- VTemp[i] = v_3x3[i];
1045
- } // diagonalize using Jacobi
1087
+ var copyA = _toConsumableArray(a_3x3); // diagonalize using Jacobi
1046
1088
 
1047
1089
 
1048
- jacobiN(ATemp, 3, w_3, VTemp); // if all the eigenvalues are the same, return identity matrix
1090
+ jacobiN(copyA, 3, w_3, v_3x3); // if all the eigenvalues are the same, return identity matrix
1049
1091
 
1050
1092
  if (w_3[0] === w_3[1] && w_3[0] === w_3[2]) {
1051
1093
  identity3x3(v_3x3);
@@ -1060,11 +1102,11 @@ function diagonalize3x3(a_3x3, w_3, v_3x3) {
1060
1102
  // two eigenvalues are the same
1061
1103
  if (w_3[(i + 1) % 3] === w_3[(i + 2) % 3]) {
1062
1104
  // find maximum element of the independent eigenvector
1063
- maxVal = Math.abs(v_3x3[i][0]);
1105
+ maxVal = Math.abs(v_3x3[i * 3]);
1064
1106
  maxI = 0;
1065
1107
 
1066
1108
  for (j = 1; j < 3; j++) {
1067
- if (maxVal < (tmp = Math.abs(v_3x3[i][j]))) {
1109
+ if (maxVal < (tmp = Math.abs(v_3x3[i * 3 + j]))) {
1068
1110
  maxVal = tmp;
1069
1111
  maxI = j;
1070
1112
  }
@@ -1075,26 +1117,32 @@ function diagonalize3x3(a_3x3, w_3, v_3x3) {
1075
1117
  tmp = w_3[maxI];
1076
1118
  w_3[maxI] = w_3[i];
1077
1119
  w_3[i] = tmp;
1078
- vtkSwapVectors3(v_3x3[i], v_3x3[maxI]);
1120
+ swapRowsMatrix_nxn(v_3x3, 3, i, maxI);
1079
1121
  } // maximum element of eigenvector should be positive
1080
1122
 
1081
1123
 
1082
- if (v_3x3[maxI][maxI] < 0) {
1083
- v_3x3[maxI][0] = -v_3x3[maxI][0];
1084
- v_3x3[maxI][1] = -v_3x3[maxI][1];
1085
- v_3x3[maxI][2] = -v_3x3[maxI][2];
1124
+ if (v_3x3[maxI * 3 + maxI] < 0) {
1125
+ v_3x3[maxI * 3] = -v_3x3[maxI * 3];
1126
+ v_3x3[maxI * 3 + 1] = -v_3x3[maxI * 3 + 1];
1127
+ v_3x3[maxI * 3 + 2] = -v_3x3[maxI * 3 + 2];
1086
1128
  } // re-orthogonalize the other two eigenvectors
1087
1129
 
1088
1130
 
1089
1131
  j = (maxI + 1) % 3;
1090
1132
  k = (maxI + 2) % 3;
1091
- v_3x3[j][0] = 0.0;
1092
- v_3x3[j][1] = 0.0;
1093
- v_3x3[j][2] = 0.0;
1094
- v_3x3[j][j] = 1.0;
1095
- cross(v_3x3[maxI], v_3x3[j], v_3x3[k]);
1096
- normalize(v_3x3[k]);
1097
- cross(v_3x3[k], v_3x3[maxI], v_3x3[j]); // transpose vectors back to columns
1133
+ v_3x3[j * 3] = 0.0;
1134
+ v_3x3[j * 3 + 1] = 0.0;
1135
+ v_3x3[j * 3 + 2] = 0.0;
1136
+ v_3x3[j * 3 + j] = 1.0;
1137
+ var vectTmp1 = cross([v_3x3[maxI * 3], v_3x3[maxI * 3 + 1], v_3x3[maxI * 3 + 2]], [v_3x3[j * 3], v_3x3[j * 3 + 1], v_3x3[j * 3 + 2]], []);
1138
+ normalize(vectTmp1);
1139
+ var vectTmp2 = cross(vectTmp1, [v_3x3[maxI * 3], v_3x3[maxI * 3 + 1], v_3x3[maxI * 3 + 2]], []);
1140
+
1141
+ for (var t = 0; t < 3; t++) {
1142
+ v_3x3[k * 3 + t] = vectTmp1[t];
1143
+ v_3x3[j * 3 + t] = vectTmp2[t];
1144
+ } // transpose vectors back to columns
1145
+
1098
1146
 
1099
1147
  transpose3x3(v_3x3, v_3x3);
1100
1148
  return;
@@ -1105,11 +1153,11 @@ function diagonalize3x3(a_3x3, w_3, v_3x3) {
1105
1153
  // the first vector
1106
1154
 
1107
1155
 
1108
- maxVal = Math.abs(v_3x3[0][0]);
1156
+ maxVal = Math.abs(v_3x3[0]);
1109
1157
  maxI = 0;
1110
1158
 
1111
1159
  for (i = 1; i < 3; i++) {
1112
- if (maxVal < (tmp = Math.abs(v_3x3[i][0]))) {
1160
+ if (maxVal < (tmp = Math.abs(v_3x3[i * 3]))) {
1113
1161
  maxVal = tmp;
1114
1162
  maxI = i;
1115
1163
  }
@@ -1117,57 +1165,50 @@ function diagonalize3x3(a_3x3, w_3, v_3x3) {
1117
1165
 
1118
1166
 
1119
1167
  if (maxI !== 0) {
1120
- tmp = w_3[maxI];
1168
+ var eigenValTmp = w_3[maxI];
1121
1169
  w_3[maxI] = w_3[0];
1122
- w_3[0] = tmp;
1123
- vtkSwapVectors3(v_3x3[maxI], v_3x3[0]);
1170
+ w_3[0] = eigenValTmp;
1171
+ swapRowsMatrix_nxn(v_3x3, 3, maxI, 0);
1124
1172
  } // do the same for the y element
1125
1173
 
1126
1174
 
1127
- if (Math.abs(v_3x3[1][1]) < Math.abs(v_3x3[2][1])) {
1128
- tmp = w_3[2];
1175
+ if (Math.abs(v_3x3[4]) < Math.abs(v_3x3[7])) {
1176
+ var _eigenValTmp = w_3[2];
1129
1177
  w_3[2] = w_3[1];
1130
- w_3[1] = tmp;
1131
- vtkSwapVectors3(v_3x3[2], v_3x3[1]);
1178
+ w_3[1] = _eigenValTmp;
1179
+ swapRowsMatrix_nxn(v_3x3, 3, 1, 2);
1132
1180
  } // ensure that the sign of the eigenvectors is correct
1133
1181
 
1134
1182
 
1135
1183
  for (i = 0; i < 2; i++) {
1136
- if (v_3x3[i][i] < 0) {
1137
- v_3x3[i][0] = -v_3x3[i][0];
1138
- v_3x3[i][1] = -v_3x3[i][1];
1139
- v_3x3[i][2] = -v_3x3[i][2];
1184
+ if (v_3x3[i * 3 + i] < 0) {
1185
+ v_3x3[i * 3] = -v_3x3[i * 3];
1186
+ v_3x3[i * 3 + 1] = -v_3x3[i * 3 + 1];
1187
+ v_3x3[i * 3 + 2] = -v_3x3[i * 3 + 2];
1140
1188
  }
1141
1189
  } // set sign of final eigenvector to ensure that determinant is positive
1142
1190
 
1143
1191
 
1144
1192
  if (determinant3x3(v_3x3) < 0) {
1145
- v_3x3[2][0] = -v_3x3[2][0];
1146
- v_3x3[2][1] = -v_3x3[2][1];
1147
- v_3x3[2][2] = -v_3x3[2][2];
1193
+ v_3x3[6] = -v_3x3[6];
1194
+ v_3x3[7] = -v_3x3[7];
1195
+ v_3x3[8] = -v_3x3[8];
1148
1196
  } // transpose the eigenvectors back again
1149
1197
 
1150
1198
 
1151
1199
  transpose3x3(v_3x3, v_3x3);
1152
1200
  }
1153
1201
  function singularValueDecomposition3x3(a_3x3, u_3x3, w_3, vT_3x3) {
1154
- var i;
1155
- var B = [createArray(3), createArray(3), createArray(3)]; // copy so that A can be used for U or VT without risk
1202
+ var i; // copy so that A can be used for U or VT without risk
1156
1203
 
1157
- for (i = 0; i < 3; i++) {
1158
- B[0][i] = a_3x3[0][i];
1159
- B[1][i] = a_3x3[1][i];
1160
- B[2][i] = a_3x3[2][i];
1161
- } // temporarily flip if determinant is negative
1204
+ var B = _toConsumableArray(a_3x3); // temporarily flip if determinant is negative
1162
1205
 
1163
1206
 
1164
1207
  var d = determinant3x3(B);
1165
1208
 
1166
1209
  if (d < 0) {
1167
- for (i = 0; i < 3; i++) {
1168
- B[0][i] = -B[0][i];
1169
- B[1][i] = -B[1][i];
1170
- B[2][i] = -B[2][i];
1210
+ for (i = 0; i < 9; i++) {
1211
+ B[i] = -B[i];
1171
1212
  }
1172
1213
  } // orthogonalize, diagonalize, etc.
1173
1214
 
@@ -1185,6 +1226,13 @@ function singularValueDecomposition3x3(a_3x3, u_3x3, w_3, vT_3x3) {
1185
1226
  w_3[2] = -w_3[2];
1186
1227
  }
1187
1228
  }
1229
+ /**
1230
+ * Factor linear equations Ax = b using LU decomposition A = LU. Output factorization LU is in matrix A.
1231
+ * @param {Matrix} A square matrix
1232
+ * @param {Number} index integer array of pivot indices index[0->n-1]
1233
+ * @param {Number} size matrix size
1234
+ */
1235
+
1188
1236
  function luFactorLinearSystem(A, index, size) {
1189
1237
  var i;
1190
1238
  var j;
@@ -1200,7 +1248,7 @@ function luFactorLinearSystem(A, index, size) {
1200
1248
 
1201
1249
  for (i = 0; i < size; i++) {
1202
1250
  for (largest = 0.0, j = 0; j < size; j++) {
1203
- if ((temp2 = Math.abs(A[i][j])) > largest) {
1251
+ if ((temp2 = Math.abs(A[i * size + j])) > largest) {
1204
1252
  largest = temp2;
1205
1253
  }
1206
1254
  }
@@ -1218,26 +1266,26 @@ function luFactorLinearSystem(A, index, size) {
1218
1266
 
1219
1267
  for (j = 0; j < size; j++) {
1220
1268
  for (i = 0; i < j; i++) {
1221
- sum = A[i][j];
1269
+ sum = A[i * size + j];
1222
1270
 
1223
1271
  for (k = 0; k < i; k++) {
1224
- sum -= A[i][k] * A[k][j];
1272
+ sum -= A[i * size + k] * A[k * size + j];
1225
1273
  }
1226
1274
 
1227
- A[i][j] = sum;
1275
+ A[i * size + j] = sum;
1228
1276
  } //
1229
1277
  // Begin search for largest pivot element
1230
1278
  //
1231
1279
 
1232
1280
 
1233
1281
  for (largest = 0.0, i = j; i < size; i++) {
1234
- sum = A[i][j];
1282
+ sum = A[i * size + j];
1235
1283
 
1236
1284
  for (k = 0; k < j; k++) {
1237
- sum -= A[i][k] * A[k][j];
1285
+ sum -= A[i * size + k] * A[k * size + j];
1238
1286
  }
1239
1287
 
1240
- A[i][j] = sum;
1288
+ A[i * size + j] = sum;
1241
1289
 
1242
1290
  if ((temp1 = scale[i] * Math.abs(sum)) >= largest) {
1243
1291
  largest = temp1;
@@ -1250,9 +1298,9 @@ function luFactorLinearSystem(A, index, size) {
1250
1298
 
1251
1299
  if (j !== maxI) {
1252
1300
  for (k = 0; k < size; k++) {
1253
- temp1 = A[maxI][k];
1254
- A[maxI][k] = A[j][k];
1255
- A[j][k] = temp1;
1301
+ temp1 = A[maxI * size + k];
1302
+ A[maxI * size + k] = A[j * size + k];
1303
+ A[j * size + k] = temp1;
1256
1304
  }
1257
1305
 
1258
1306
  scale[maxI] = scale[j];
@@ -1263,16 +1311,16 @@ function luFactorLinearSystem(A, index, size) {
1263
1311
 
1264
1312
  index[j] = maxI;
1265
1313
 
1266
- if (Math.abs(A[j][j]) <= VTK_SMALL_NUMBER) {
1314
+ if (Math.abs(A[j * size + j]) <= VTK_SMALL_NUMBER) {
1267
1315
  vtkWarningMacro('Unable to factor linear system');
1268
1316
  return 0;
1269
1317
  }
1270
1318
 
1271
1319
  if (j !== size - 1) {
1272
- temp1 = 1.0 / A[j][j];
1320
+ temp1 = 1.0 / A[j * size + j];
1273
1321
 
1274
1322
  for (i = j + 1; i < size; i++) {
1275
- A[i][j] *= temp1;
1323
+ A[i * size + j] *= temp1;
1276
1324
  }
1277
1325
  }
1278
1326
  }
@@ -1296,7 +1344,7 @@ function luSolveLinearSystem(A, index, x, size) {
1296
1344
 
1297
1345
  if (ii >= 0) {
1298
1346
  for (j = ii; j <= i - 1; j++) {
1299
- sum -= A[i][j] * x[j];
1347
+ sum -= A[i * size + j] * x[j];
1300
1348
  }
1301
1349
  } else if (sum !== 0.0) {
1302
1350
  ii = i;
@@ -1312,37 +1360,37 @@ function luSolveLinearSystem(A, index, x, size) {
1312
1360
  sum = x[i];
1313
1361
 
1314
1362
  for (j = i + 1; j < size; j++) {
1315
- sum -= A[i][j] * x[j];
1363
+ sum -= A[i * size + j] * x[j];
1316
1364
  }
1317
1365
 
1318
- x[i] = sum / A[i][i];
1366
+ x[i] = sum / A[i * size + i];
1319
1367
  }
1320
1368
  }
1321
1369
  function solveLinearSystem(A, x, size) {
1322
1370
  // if we solving something simple, just solve it
1323
1371
  if (size === 2) {
1324
1372
  var y = createArray(2);
1325
- var det = determinant2x2(A[0][0], A[0][1], A[1][0], A[1][1]);
1373
+ var det = determinant2x2(A[0], A[1], A[2], A[3]);
1326
1374
 
1327
1375
  if (det === 0.0) {
1328
1376
  // Unable to solve linear system
1329
1377
  return 0;
1330
1378
  }
1331
1379
 
1332
- y[0] = (A[1][1] * x[0] - A[0][1] * x[1]) / det;
1333
- y[1] = (-(A[1][0] * x[0]) + A[0][0] * x[1]) / det;
1380
+ y[0] = (A[3] * x[0] - A[1] * x[1]) / det;
1381
+ y[1] = (-(A[2] * x[0]) + A[0] * x[1]) / det;
1334
1382
  x[0] = y[0];
1335
1383
  x[1] = y[1];
1336
1384
  return 1;
1337
1385
  }
1338
1386
 
1339
1387
  if (size === 1) {
1340
- if (A[0][0] === 0.0) {
1388
+ if (A[0] === 0.0) {
1341
1389
  // Unable to solve linear system
1342
1390
  return 0;
1343
1391
  }
1344
1392
 
1345
- x[0] /= A[0][0];
1393
+ x[0] /= A[0];
1346
1394
  return 1;
1347
1395
  } //
1348
1396
  // System of equations is not trivial, use Crout's method
@@ -1380,7 +1428,7 @@ function invertMatrix(A, AI, size) {
1380
1428
  luSolveLinearSystem(A, tmp1Size, tmp2Size, size);
1381
1429
 
1382
1430
  for (var _i4 = 0; _i4 < size; _i4++) {
1383
- AI[_i4][j] = tmp2Size[_i4];
1431
+ AI[_i4 * size + j] = tmp2Size[_i4];
1384
1432
  }
1385
1433
  }
1386
1434
 
@@ -1392,16 +1440,16 @@ function estimateMatrixCondition(A, size) {
1392
1440
 
1393
1441
  for (var i = 0; i < size; i++) {
1394
1442
  for (var j = i; j < size; j++) {
1395
- if (Math.abs(A[i][j]) > max) {
1396
- maxValue = Math.abs(A[i][j]);
1443
+ if (Math.abs(A[i * size + j]) > maxValue) {
1444
+ maxValue = Math.abs(A[i * size + j]);
1397
1445
  }
1398
1446
  }
1399
1447
  } // find the minimum diagonal value
1400
1448
 
1401
1449
 
1402
1450
  for (var _i5 = 0; _i5 < size; _i5++) {
1403
- if (Math.abs(A[_i5][_i5]) < min) {
1404
- minValue = Math.abs(A[_i5][_i5]);
1451
+ if (Math.abs(A[_i5 * size + _i5]) < minValue) {
1452
+ minValue = Math.abs(A[_i5 * size + _i5]);
1405
1453
  }
1406
1454
  }
1407
1455
 
@@ -1426,26 +1474,16 @@ function solveHomogeneousLeastSquares(numberOfSamples, xt, xOrder, mt) {
1426
1474
  var k; // set up intermediate variables
1427
1475
  // Allocate matrix to hold X times transpose of X
1428
1476
 
1429
- var XXt = createArray(xOrder); // size x by x
1477
+ var XXt = createArray(xOrder * xOrder); // size x by x
1430
1478
  // Allocate the array of eigenvalues and eigenvectors
1431
1479
 
1432
1480
  var eigenvals = createArray(xOrder);
1433
- var eigenvecs = createArray(xOrder); // Clear the upper triangular region (and btw, allocate the eigenvecs as well)
1434
-
1435
- for (i = 0; i < xOrder; i++) {
1436
- eigenvecs[i] = createArray(xOrder);
1437
- XXt[i] = createArray(xOrder);
1438
-
1439
- for (j = 0; j < xOrder; j++) {
1440
- XXt[i][j] = 0.0;
1441
- }
1442
- } // Calculate XXt upper half only, due to symmetry
1443
-
1481
+ var eigenvecs = createArray(xOrder * xOrder); // Calculate XXt upper half only, due to symmetry
1444
1482
 
1445
1483
  for (k = 0; k < numberOfSamples; k++) {
1446
1484
  for (i = 0; i < xOrder; i++) {
1447
1485
  for (j = i; j < xOrder; j++) {
1448
- XXt[i][j] += xt[k][i] * xt[k][j];
1486
+ XXt[i * xOrder + j] += xt[k * xOrder + i] * xt[k * xOrder + j];
1449
1487
  }
1450
1488
  }
1451
1489
  } // now fill in the lower half of the XXt matrix
@@ -1453,7 +1491,7 @@ function solveHomogeneousLeastSquares(numberOfSamples, xt, xOrder, mt) {
1453
1491
 
1454
1492
  for (i = 0; i < xOrder; i++) {
1455
1493
  for (j = 0; j < i; j++) {
1456
- XXt[i][j] = XXt[j][i];
1494
+ XXt[i * xOrder + j] = XXt[j * xOrder + i];
1457
1495
  }
1458
1496
  } // Compute the eigenvectors and eigenvalues
1459
1497
 
@@ -1462,7 +1500,7 @@ function solveHomogeneousLeastSquares(numberOfSamples, xt, xOrder, mt) {
1462
1500
  // corresponding eigenvec.
1463
1501
 
1464
1502
  for (i = 0; i < xOrder; i++) {
1465
- mt[i][0] = eigenvecs[i][xOrder - 1];
1503
+ mt[i] = eigenvecs[i * xOrder + xOrder - 1];
1466
1504
  }
1467
1505
 
1468
1506
  return 1;
@@ -1499,7 +1537,7 @@ function solveLeastSquares(numberOfSamples, xt, xOrder, yt, yOrder, mt) {
1499
1537
 
1500
1538
  for (i = 0; i < numberOfSamples; i++) {
1501
1539
  for (j = 0; j < yOrder; j++) {
1502
- if (Math.abs(yt[i][j]) > VTK_SMALL_NUMBER) {
1540
+ if (Math.abs(yt[i * yOrder + j]) > VTK_SMALL_NUMBER) {
1503
1541
  allHomogeneous = 0;
1504
1542
  homogenFlags[j] = 0;
1505
1543
  }
@@ -1529,52 +1567,30 @@ function solveLeastSquares(numberOfSamples, xt, xOrder, yt, yOrder, mt) {
1529
1567
 
1530
1568
  if (someHomogeneous) {
1531
1569
  // hmt is the homogeneous equation version of mt, the general solution.
1532
- hmt = createArray(xOrder);
1533
-
1534
- for (j = 0; j < xOrder; j++) {
1535
- // Only allocate 1 here, not yOrder, because here we're going to solve
1536
- // just the one homogeneous equation subset of the entire problem
1537
- hmt[j] = [0];
1538
- } // Ok, solve the homogeneous problem
1539
-
1570
+ // hmt should be xOrder x yOrder, but since we are solving only the homogeneous part, here it is xOrder x 1
1571
+ hmt = createArray(xOrder); // Ok, solve the homogeneous problem
1540
1572
 
1541
1573
  homogRC = solveHomogeneousLeastSquares(numberOfSamples, xt, xOrder, hmt);
1542
1574
  } // set up intermediate variables
1543
1575
 
1544
1576
 
1545
- var XXt = createArray(xOrder); // size x by x
1546
-
1547
- var XXtI = createArray(xOrder); // size x by x
1548
-
1549
- var XYt = createArray(xOrder); // size x by y
1550
-
1551
- for (i = 0; i < xOrder; i++) {
1552
- XXt[i] = createArray(xOrder);
1553
- XXtI[i] = createArray(xOrder);
1554
-
1555
- for (j = 0; j < xOrder; j++) {
1556
- XXt[i][j] = 0.0;
1557
- XXtI[i][j] = 0.0;
1558
- }
1559
-
1560
- XYt[i] = createArray(yOrder);
1577
+ var XXt = createArray(xOrder * xOrder); // size x by x
1561
1578
 
1562
- for (j = 0; j < yOrder; j++) {
1563
- XYt[i][j] = 0.0;
1564
- }
1565
- } // first find the pseudoinverse matrix
1579
+ var XXtI = createArray(xOrder * xOrder); // size x by x
1566
1580
 
1581
+ var XYt = createArray(xOrder * yOrder); // size x by y
1582
+ // first find the pseudoinverse matrix
1567
1583
 
1568
1584
  for (k = 0; k < numberOfSamples; k++) {
1569
1585
  for (i = 0; i < xOrder; i++) {
1570
1586
  // first calculate the XXt matrix, only do the upper half (symmetrical)
1571
1587
  for (j = i; j < xOrder; j++) {
1572
- XXt[i][j] += xt[k][i] * xt[k][j];
1588
+ XXt[i * xOrder + j] += xt[k * xOrder + i] * xt[k * xOrder + j];
1573
1589
  } // now calculate the XYt matrix
1574
1590
 
1575
1591
 
1576
1592
  for (j = 0; j < yOrder; j++) {
1577
- XYt[i][j] += xt[k][i] * yt[k][j];
1593
+ XYt[i * yOrder + j] += xt[k * xOrder + i] * yt[k * yOrder + j];
1578
1594
  }
1579
1595
  }
1580
1596
  } // now fill in the lower half of the XXt matrix
@@ -1582,7 +1598,7 @@ function solveLeastSquares(numberOfSamples, xt, xOrder, yt, yOrder, mt) {
1582
1598
 
1583
1599
  for (i = 0; i < xOrder; i++) {
1584
1600
  for (j = 0; j < i; j++) {
1585
- XXt[i][j] = XXt[j][i];
1601
+ XXt[i * xOrder + j] = XXt[j * xOrder + i];
1586
1602
  }
1587
1603
  }
1588
1604
 
@@ -1591,10 +1607,10 @@ function solveLeastSquares(numberOfSamples, xt, xOrder, yt, yOrder, mt) {
1591
1607
  if (successFlag) {
1592
1608
  for (i = 0; i < xOrder; i++) {
1593
1609
  for (j = 0; j < yOrder; j++) {
1594
- mt[i][j] = 0.0;
1610
+ mt[i * yOrder + j] = 0.0;
1595
1611
 
1596
1612
  for (k = 0; k < xOrder; k++) {
1597
- mt[i][j] += XXtI[i][k] * XYt[k][j];
1613
+ mt[i * yOrder + j] += XXtI[i * xOrder + k] * XYt[k * yOrder + j];
1598
1614
  }
1599
1615
  }
1600
1616
  }
@@ -1607,7 +1623,7 @@ function solveLeastSquares(numberOfSamples, xt, xOrder, yt, yOrder, mt) {
1607
1623
  if (homogenFlags[j]) {
1608
1624
  // Fix this one
1609
1625
  for (i = 0; i < xOrder; i++) {
1610
- mt[i][j] = hmt[i][0];
1626
+ mt[i * yOrder + j] = hmt[i * yOrder];
1611
1627
  }
1612
1628
  }
1613
1629
  }
@@ -2157,6 +2173,7 @@ var vtkMath = {
2157
2173
  transpose3x3: transpose3x3,
2158
2174
  invert3x3: invert3x3,
2159
2175
  identity3x3: identity3x3,
2176
+ identity: identity,
2160
2177
  determinant3x3: determinant3x3,
2161
2178
  quaternionToMatrix3x3: quaternionToMatrix3x3,
2162
2179
  areEquals: areEquals,
@@ -2214,6 +2231,7 @@ var vtkMath = {
2214
2231
 
2215
2232
  var vtkMath$1 = /*#__PURE__*/Object.freeze({
2216
2233
  __proto__: null,
2234
+ createArray: createArray,
2217
2235
  Pi: Pi,
2218
2236
  radiansFromDegrees: radiansFromDegrees,
2219
2237
  degreesFromRadians: degreesFromRadians,
@@ -2259,6 +2277,10 @@ var vtkMath$1 = /*#__PURE__*/Object.freeze({
2259
2277
  outer2D: outer2D,
2260
2278
  norm2D: norm2D,
2261
2279
  normalize2D: normalize2D,
2280
+ rowsToMat4: rowsToMat4,
2281
+ columnsToMat4: columnsToMat4,
2282
+ rowsToMat3: rowsToMat3,
2283
+ columnsToMat3: columnsToMat3,
2262
2284
  determinant2x2: determinant2x2,
2263
2285
  LUFactor3x3: LUFactor3x3,
2264
2286
  LUSolve3x3: LUSolve3x3,
@@ -2268,8 +2290,9 @@ var vtkMath$1 = /*#__PURE__*/Object.freeze({
2268
2290
  multiplyMatrix: multiplyMatrix,
2269
2291
  transpose3x3: transpose3x3,
2270
2292
  invert3x3: invert3x3,
2271
- identity3x3: identity3x3,
2272
2293
  determinant3x3: determinant3x3,
2294
+ identity3x3: identity3x3,
2295
+ identity: identity,
2273
2296
  quaternionToMatrix3x3: quaternionToMatrix3x3,
2274
2297
  areEquals: areEquals,
2275
2298
  areMatricesEqual: areMatricesEqual,
@@ -2324,4 +2347,4 @@ var vtkMath$1 = /*#__PURE__*/Object.freeze({
2324
2347
  'default': vtkMath
2325
2348
  });
2326
2349
 
2327
- export { binomial as $, degreesFromRadians as A, areEquals as B, clampValue as C, arrayRange as D, getMajorAxisIndex as E, isInf as F, rgb2hsv as G, rgb2lab as H, lab2rgb as I, floor as J, round as K, normalize2D as L, nearestPowerOfTwo as M, createUninitializedBounds as N, multiply3x3_vect3 as O, areBoundsInitialized as P, isPowerOfTwo as Q, angleBetweenVectors as R, signedAngleBetweenVectors as S, Pi as T, ceil as U, min as V, max as W, arrayMin as X, arrayMax as Y, ceilLog2 as Z, factorial as _, areMatricesEqual as a, beginCombination as a0, nextCombination as a1, randomSeed as a2, getSeed as a3, gaussian as a4, multiplyScalar2D as a5, multiplyAccumulate2D as a6, outer as a7, projectVector as a8, dot2D as a9, hex2float as aA, lab2xyz as aB, xyz2lab as aC, xyz2rgb as aD, rgb2xyz as aE, clampAndNormalizeValue as aF, getScalarTypeFittingRange as aG, getAdjustedScalarRange as aH, extentIsWithinOtherExtent as aI, boundsIsWithinOtherBounds as aJ, pointIsWithinBounds as aK, solve3PointCircle as aL, inf as aM, negInf as aN, isFinite as aO, isNaN as aP, floatToHex2 as aQ, floatRGB2HexCode as aR, float2CssRGBA as aS, projectVector2D as aa, gaussianAmplitude as ab, gaussianWeight as ac, outer2D as ad, norm2D as ae, LUFactor3x3 as af, LUSolve3x3 as ag, linearSolve3x3 as ah, multiply3x3_mat3 as ai, multiplyMatrix as aj, transpose3x3 as ak, invert3x3 as al, identity3x3 as am, quaternionToMatrix3x3 as an, roundNumber as ao, matrix3x3ToQuaternion as ap, multiplyQuaternion as aq, orthogonalize3x3 as ar, diagonalize3x3 as as, singularValueDecomposition3x3 as at, luFactorLinearSystem as au, luSolveLinearSystem as av, invertMatrix as aw, estimateMatrixCondition as ax, solveHomogeneousLeastSquares as ay, solveLeastSquares as az, roundVector as b, computeBoundsFromPoints as c, dot as d, clampVector as e, distance2BetweenPoints as f, solveLinearSystem as g, hsv2rgb as h, isNan as i, cross as j, add as k, normalize as l, multiplyAccumulate as m, norm as n, determinant2x2 as o, jacobiN as p, perpendiculars as q, radiansFromDegrees as r, subtract as s, vtkMath as t, uninitializeBounds as u, vtkMath$1 as v, jacobi as w, multiplyScalar as x, random as y, determinant3x3 as z };
2350
+ export { ceilLog2 as $, rowsToMat3 as A, degreesFromRadians as B, areEquals as C, clampValue as D, arrayRange as E, getMajorAxisIndex as F, isInf as G, rgb2hsv as H, rgb2lab as I, lab2rgb as J, floor as K, round as L, normalize2D as M, nearestPowerOfTwo as N, createUninitializedBounds as O, multiply3x3_vect3 as P, areBoundsInitialized as Q, isPowerOfTwo as R, angleBetweenVectors as S, signedAngleBetweenVectors as T, createArray as U, Pi as V, ceil as W, min as X, max as Y, arrayMin as Z, arrayMax as _, areMatricesEqual as a, factorial as a0, binomial as a1, beginCombination as a2, nextCombination as a3, randomSeed as a4, getSeed as a5, gaussian as a6, multiplyScalar2D as a7, multiplyAccumulate2D as a8, outer as a9, luFactorLinearSystem as aA, luSolveLinearSystem as aB, invertMatrix as aC, estimateMatrixCondition as aD, solveHomogeneousLeastSquares as aE, solveLeastSquares as aF, hex2float as aG, lab2xyz as aH, xyz2lab as aI, xyz2rgb as aJ, rgb2xyz as aK, clampAndNormalizeValue as aL, getScalarTypeFittingRange as aM, getAdjustedScalarRange as aN, extentIsWithinOtherExtent as aO, boundsIsWithinOtherBounds as aP, pointIsWithinBounds as aQ, solve3PointCircle as aR, inf as aS, negInf as aT, isFinite as aU, isNaN as aV, floatToHex2 as aW, floatRGB2HexCode as aX, float2CssRGBA as aY, projectVector as aa, dot2D as ab, projectVector2D as ac, gaussianAmplitude as ad, gaussianWeight as ae, outer2D as af, norm2D as ag, rowsToMat4 as ah, columnsToMat4 as ai, columnsToMat3 as aj, LUFactor3x3 as ak, LUSolve3x3 as al, linearSolve3x3 as am, multiply3x3_mat3 as an, multiplyMatrix as ao, transpose3x3 as ap, invert3x3 as aq, identity3x3 as ar, identity as as, quaternionToMatrix3x3 as at, roundNumber as au, matrix3x3ToQuaternion as av, multiplyQuaternion as aw, orthogonalize3x3 as ax, diagonalize3x3 as ay, singularValueDecomposition3x3 as az, roundVector as b, computeBoundsFromPoints as c, dot as d, clampVector as e, distance2BetweenPoints as f, solveLinearSystem as g, hsv2rgb as h, isNan as i, cross as j, add as k, normalize as l, multiplyAccumulate as m, norm as n, determinant2x2 as o, jacobiN as p, perpendiculars as q, radiansFromDegrees as r, subtract as s, vtkMath as t, uninitializeBounds as u, vtkMath$1 as v, jacobi as w, multiplyScalar as x, random as y, determinant3x3 as z };