@kitware/vtk.js 26.0.0-beta.2 → 26.0.0-beta.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.
Files changed (46) hide show
  1. package/BREAKING_CHANGES.md +7 -0
  2. package/Common/Core/ClassHierarchy.js +6 -11
  3. package/Common/Core/Math/Constants.js +12 -0
  4. package/Common/Core/Math/index.js +48 -29
  5. package/Common/Core/Math.d.ts +34 -4
  6. package/Common/Core/Math.js +2 -1
  7. package/Common/Core/MatrixBuilder.d.ts +13 -2
  8. package/Common/Core/MatrixBuilder.js +14 -2
  9. package/Common/Core/ScalarsToColors.d.ts +1 -3
  10. package/Common/Core/ScalarsToColors.js +1 -1
  11. package/Common/DataModel/BoundingBox.js +7 -7
  12. package/Common/DataModel/EdgeLocator.d.ts +79 -0
  13. package/Common/DataModel/EdgeLocator.js +85 -0
  14. package/Common/DataModel/ImageData.js +2 -50
  15. package/Common/DataModel/IncrementalOctreeNode.d.ts +15 -0
  16. package/Common/DataModel/IncrementalOctreeNode.js +27 -8
  17. package/Common/DataModel/IncrementalOctreePointLocator.js +61 -5
  18. package/Common/DataModel/Polygon.js +2 -2
  19. package/Common/Transform/Transform.js +51 -0
  20. package/Common/Transform.js +3 -1
  21. package/Filters/General/ClipClosedSurface.js +21 -18
  22. package/Filters/General/ContourTriangulator/helper.js +1 -1
  23. package/Filters/General/ImageMarchingCubes.js +5 -22
  24. package/Filters/General/ImageMarchingSquares.js +6 -23
  25. package/Filters/General.js +6 -0
  26. package/Imaging/Core/ImageReslice.js +84 -36
  27. package/Rendering/Core/ColorTransferFunction.d.ts +20 -0
  28. package/Rendering/Core/ColorTransferFunction.js +76 -7
  29. package/Rendering/Core/Prop3D.js +6 -1
  30. package/Rendering/Core/VolumeProperty.js +3 -2
  31. package/Rendering/OpenGL/PolyDataMapper.js +7 -5
  32. package/Rendering/OpenGL/RenderWindow.d.ts +25 -1
  33. package/Rendering/OpenGL/Texture.js +22 -6
  34. package/Rendering/OpenGL/VolumeMapper.js +3 -1
  35. package/Rendering/OpenGL/glsl/vtkVolumeFS.glsl.js +1 -1
  36. package/Rendering/SceneGraph/RenderWindowViewNode.js +8 -2
  37. package/Rendering/SceneGraph/ViewNode.js +11 -0
  38. package/Widgets/Core/AbstractWidget.js +1 -1
  39. package/Widgets/Core/WidgetManager.js +25 -19
  40. package/Widgets/Representations/WidgetRepresentation.js +19 -7
  41. package/Widgets/Widgets3D/ResliceCursorWidget/behavior.js +13 -7
  42. package/index.d.ts +1 -0
  43. package/macros.d.ts +5 -3
  44. package/macros.js +41 -8
  45. package/package.json +3 -1
  46. package/Filters/General/ClipClosedSurface/ccsEdgeLocator.js +0 -40
@@ -1,3 +1,10 @@
1
+ ## From 25.x to 26
2
+
3
+ - **ResliceCursorWidget**: vtkResliceCursorContextRepresentation is deprecated and removed.
4
+ Instead, a `vtkSphereHandleRepresentation` is used for `rotation` and `center` handles,
5
+ and a `vtkLineHandleRepresenttion` is used for the axes. `rotateLineInView()` now
6
+ takes an axis name (string, e.g. 'XinY') instead of a substate.
7
+
1
8
  ## From 24.x to 25
2
9
 
3
10
  - **math**: For functions calling math functions for computations with matrices, the format must now be number[] or Matrix as defined in the typescript definitions.
@@ -1,4 +1,3 @@
1
- import _toConsumableArray from '@babel/runtime/helpers/toConsumableArray';
2
1
  import _classCallCheck from '@babel/runtime/helpers/classCallCheck';
3
2
  import _createClass from '@babel/runtime/helpers/createClass';
4
3
  import _get from '@babel/runtime/helpers/get';
@@ -11,6 +10,7 @@ function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflec
11
10
 
12
11
  function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
13
12
 
13
+ /* eslint-disable prefer-rest-params */
14
14
  var ClassHierarchy = /*#__PURE__*/function (_Array) {
15
15
  _inherits(ClassHierarchy, _Array);
16
16
 
@@ -25,18 +25,13 @@ var ClassHierarchy = /*#__PURE__*/function (_Array) {
25
25
  _createClass(ClassHierarchy, [{
26
26
  key: "push",
27
27
  value: function push() {
28
- var _this = this,
29
- _get2;
30
-
31
- for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
32
- args[_key] = arguments[_key];
28
+ for (var i = 0; i < arguments.length; i++) {
29
+ if (!this.includes(arguments[i])) {
30
+ _get(_getPrototypeOf(ClassHierarchy.prototype), "push", this).call(this, arguments[i]);
31
+ }
33
32
  }
34
33
 
35
- // no perf issue since args.length should be small
36
- var newArgs = args.filter(function (arg) {
37
- return !_this.includes(arg);
38
- });
39
- return (_get2 = _get(_getPrototypeOf(ClassHierarchy.prototype), "push", this)).call.apply(_get2, [this].concat(_toConsumableArray(newArgs)));
34
+ return this.length;
40
35
  }
41
36
  }]);
42
37
 
@@ -0,0 +1,12 @@
1
+ var IDENTITY = [1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1];
2
+ var IDENTITY_3X3 = [1, 0, 0, 0, 1, 0, 0, 0, 1];
3
+ var EPSILON = 1e-6;
4
+ var VTK_SMALL_NUMBER = 1.0e-12;
5
+ var Constants = {
6
+ IDENTITY: IDENTITY,
7
+ IDENTITY_3X3: IDENTITY_3X3,
8
+ EPSILON: EPSILON,
9
+ VTK_SMALL_NUMBER: VTK_SMALL_NUMBER
10
+ };
11
+
12
+ export { EPSILON, IDENTITY, IDENTITY_3X3, VTK_SMALL_NUMBER, Constants as default };
@@ -2,6 +2,7 @@ import _slicedToArray from '@babel/runtime/helpers/slicedToArray';
2
2
  import _toConsumableArray from '@babel/runtime/helpers/toConsumableArray';
3
3
  import seedrandom from 'seedrandom';
4
4
  import macro from '../../../macros.js';
5
+ import { IDENTITY, IDENTITY_3X3, VTK_SMALL_NUMBER, EPSILON } from './Constants.js';
5
6
 
6
7
  var vtkErrorMacro = macro.vtkErrorMacro,
7
8
  vtkWarningMacro = macro.vtkWarningMacro; // ----------------------------------------------------------------------------
@@ -17,7 +18,6 @@ var vtkErrorMacro = macro.vtkErrorMacro,
17
18
 
18
19
  var randomSeedValue = 0;
19
20
  var VTK_MAX_ROTATIONS = 20;
20
- var VTK_SMALL_NUMBER = 1.0e-12;
21
21
 
22
22
  function notImplemented(method) {
23
23
  return function () {
@@ -53,7 +53,13 @@ function swapColumnsMatrix_nxn(matrix, n, column1, column2) {
53
53
  function createArray() {
54
54
  var size = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 3;
55
55
  // faster than Array.from and/or while loop
56
- return Array(size).fill(0);
56
+ var res = Array(size);
57
+
58
+ for (var i = 0; i < size; ++i) {
59
+ res[i] = 0;
60
+ }
61
+
62
+ return res;
57
63
  }
58
64
  var Pi = function Pi() {
59
65
  return Math.PI;
@@ -676,6 +682,27 @@ function invert3x3(in_3x3, outI_3x3) {
676
682
  function determinant3x3(mat_3x3) {
677
683
  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];
678
684
  }
685
+ /**
686
+ * Returns true if elements of both arrays are equals.
687
+ * @param {Array} a an array of numbers (vector, point, matrix...)
688
+ * @param {Array} b an array of numbers (vector, point, matrix...)
689
+ * @param {Number} eps tolerance
690
+ */
691
+
692
+ function areEquals(a, b) {
693
+ var eps = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : EPSILON;
694
+
695
+ if (a.length !== b.length) {
696
+ return false;
697
+ }
698
+
699
+ function isEqual(element, index) {
700
+ return Math.abs(element - b[index]) <= eps;
701
+ }
702
+
703
+ return a.every(isEqual);
704
+ }
705
+ var areMatricesEqual = areEquals;
679
706
  function identity3x3(mat_3x3) {
680
707
  for (var i = 0; i < 3; i++) {
681
708
  /* eslint-disable-next-line no-multi-assign */
@@ -694,6 +721,14 @@ function identity(n, mat) {
694
721
 
695
722
  return mat;
696
723
  }
724
+ function isIdentity(mat) {
725
+ var eps = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : EPSILON;
726
+ return areMatricesEqual(mat, IDENTITY, eps);
727
+ }
728
+ function isIdentity3x3(mat) {
729
+ var eps = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : EPSILON;
730
+ return areMatricesEqual(mat, IDENTITY_3X3, eps);
731
+ }
697
732
  function quaternionToMatrix3x3(quat_4, mat_3x3) {
698
733
  var ww = quat_4[0] * quat_4[0];
699
734
  var wx = quat_4[0] * quat_4[1];
@@ -720,27 +755,6 @@ function quaternionToMatrix3x3(quat_4, mat_3x3) {
720
755
  mat_3x3[5] = (yz - wx) * f;
721
756
  mat_3x3[8] = zz * f + s;
722
757
  }
723
- /**
724
- * Returns true if elements of both arrays are equals.
725
- * @param {Array} a an array of numbers (vector, point, matrix...)
726
- * @param {Array} b an array of numbers (vector, point, matrix...)
727
- * @param {Number} eps tolerance
728
- */
729
-
730
- function areEquals(a, b) {
731
- var eps = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 1e-6;
732
-
733
- if (a.length !== b.length) {
734
- return false;
735
- }
736
-
737
- function isEqual(element, index) {
738
- return Math.abs(element - b[index]) <= eps;
739
- }
740
-
741
- return a.every(isEqual);
742
- }
743
- var areMatricesEqual = areEquals;
744
758
  function roundNumber(num) {
745
759
  var digits = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0;
746
760
 
@@ -1406,7 +1420,8 @@ function solveLinearSystem(A, x, size) {
1406
1420
 
1407
1421
  luSolveLinearSystem(A, index, x, size);
1408
1422
  return 1;
1409
- }
1423
+ } // Note that A is modified during the inversion !
1424
+
1410
1425
  function invertMatrix(A, AI, size) {
1411
1426
  var index = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : null;
1412
1427
  var column = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : null;
@@ -1416,7 +1431,7 @@ function invertMatrix(A, AI, size) {
1416
1431
  // memory whose values are not used in LUSolveLinearSystem
1417
1432
 
1418
1433
  if (luFactorLinearSystem(A, tmp1Size, size) === 0) {
1419
- return 0;
1434
+ return null;
1420
1435
  }
1421
1436
 
1422
1437
  for (var j = 0; j < size; j++) {
@@ -1432,7 +1447,7 @@ function invertMatrix(A, AI, size) {
1432
1447
  }
1433
1448
  }
1434
1449
 
1435
- return 1;
1450
+ return AI;
1436
1451
  }
1437
1452
  function estimateMatrixCondition(A, size) {
1438
1453
  var minValue = +Number.MAX_VALUE;
@@ -2174,6 +2189,8 @@ var vtkMath = {
2174
2189
  invert3x3: invert3x3,
2175
2190
  identity3x3: identity3x3,
2176
2191
  identity: identity,
2192
+ isIdentity: isIdentity,
2193
+ isIdentity3x3: isIdentity3x3,
2177
2194
  determinant3x3: determinant3x3,
2178
2195
  quaternionToMatrix3x3: quaternionToMatrix3x3,
2179
2196
  areEquals: areEquals,
@@ -2291,11 +2308,13 @@ var vtkMath$1 = /*#__PURE__*/Object.freeze({
2291
2308
  transpose3x3: transpose3x3,
2292
2309
  invert3x3: invert3x3,
2293
2310
  determinant3x3: determinant3x3,
2311
+ areEquals: areEquals,
2312
+ areMatricesEqual: areMatricesEqual,
2294
2313
  identity3x3: identity3x3,
2295
2314
  identity: identity,
2315
+ isIdentity: isIdentity,
2316
+ isIdentity3x3: isIdentity3x3,
2296
2317
  quaternionToMatrix3x3: quaternionToMatrix3x3,
2297
- areEquals: areEquals,
2298
- areMatricesEqual: areMatricesEqual,
2299
2318
  roundNumber: roundNumber,
2300
2319
  roundVector: roundVector,
2301
2320
  jacobiN: jacobiN,
@@ -2347,4 +2366,4 @@ var vtkMath$1 = /*#__PURE__*/Object.freeze({
2347
2366
  'default': vtkMath
2348
2367
  });
2349
2368
 
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, vtkMath as g, hsv2rgb as h, isNan as i, solveLinearSystem as j, cross as k, add as l, normalize as m, norm as n, multiplyAccumulate as o, determinant2x2 as p, jacobiN as q, radiansFromDegrees as r, subtract as s, perpendiculars as t, uninitializeBounds as u, vtkMath$1 as v, jacobi as w, multiplyScalar as x, random as y, determinant3x3 as z };
2369
+ 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, diagonalize3x3 as aA, singularValueDecomposition3x3 as aB, luFactorLinearSystem as aC, luSolveLinearSystem as aD, invertMatrix as aE, estimateMatrixCondition as aF, solveHomogeneousLeastSquares as aG, solveLeastSquares as aH, hex2float as aI, lab2xyz as aJ, xyz2lab as aK, xyz2rgb as aL, rgb2xyz as aM, clampAndNormalizeValue as aN, getScalarTypeFittingRange as aO, getAdjustedScalarRange as aP, extentIsWithinOtherExtent as aQ, boundsIsWithinOtherBounds as aR, pointIsWithinBounds as aS, solve3PointCircle as aT, inf as aU, negInf as aV, isFinite as aW, isNaN as aX, floatToHex2 as aY, floatRGB2HexCode as aZ, float2CssRGBA as a_, 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, isIdentity as at, isIdentity3x3 as au, quaternionToMatrix3x3 as av, roundNumber as aw, matrix3x3ToQuaternion as ax, multiplyQuaternion as ay, orthogonalize3x3 as az, roundVector as b, computeBoundsFromPoints as c, dot as d, clampVector as e, distance2BetweenPoints as f, vtkMath as g, hsv2rgb as h, isNan as i, solveLinearSystem as j, cross as k, add as l, normalize as m, norm as n, multiplyAccumulate as o, determinant2x2 as p, jacobiN as q, radiansFromDegrees as r, subtract as s, perpendiculars as t, uninitializeBounds as u, vtkMath$1 as v, jacobi as w, multiplyScalar as x, random as y, determinant3x3 as z };
@@ -489,12 +489,41 @@ export function transpose3x3(in_3x3: Matrix3x3, outT_3x3: Matrix3x3): void;
489
489
  */
490
490
  export function invert3x3(in_3x3: Matrix3x3, outI_3x3: Matrix3x3): void;
491
491
 
492
+ /**
493
+ * Set mat to the identity matrix.
494
+ * @param {Number} n The size of the matrix.
495
+ * @param {Number[]} mat The output matrix.
496
+ * @see isIdentity()
497
+ * @see identity3x3()
498
+ */
499
+ export function identity(n: number, mat: number[]): void;
500
+
492
501
  /**
493
502
  * Set mat_3x3 to the identity matrix.
494
503
  * @param {Matrix3x3} mat_3x3 The input 3x3 matrix.
504
+ * @see isIdentity3x3()
505
+ * @see identity()
495
506
  */
496
507
  export function identity3x3(mat_3x3: Matrix3x3): void;
497
508
 
509
+ /**
510
+ * Returns true if provided matrix is the identity matrix.
511
+ * @param {Number[]} mat The 3x3 matrix to check
512
+ * @param {Number} [eps] The tolerance value.
513
+ * @see isIdentity()
514
+ * @see identity()
515
+ */
516
+ export function isIdentity(mat: Matrix3x3, eps?: number): boolean;
517
+
518
+ /**
519
+ * Returns true if provided 3x3 matrix is the identity matrix.
520
+ * @param {Matrix3x3} mat The 3x3 matrix to check
521
+ * @param {Number} [eps] The tolerance value.
522
+ * @see isIdentity()
523
+ * @see identity3x3()
524
+ */
525
+ export function isIdentity3x3(mat: Matrix3x3, eps?: number): boolean;
526
+
498
527
  /**
499
528
  * Calculate the determinant of a 3x3 matrix.
500
529
  * @param {Matrix3x3} mat_3x3 The input 3x3 matrix.
@@ -606,13 +635,14 @@ export function solveLinearSystem(A: Matrix, x: number[], size: number): number;
606
635
 
607
636
  /**
608
637
  *
609
- * @param {Matrix} A
610
- * @param {Matrix} AI
611
- * @param {Number} [size]
638
+ * @param {Matrix} A The input matrix. It is modified during the inversion.
639
+ * @param {Matrix} AI The output inverse matrix. Can be the same as input matrix.
640
+ * @param {Number} [size] The square size of the matrix to invert : 4 for a 4x4
612
641
  * @param {Number[]} [index]
613
642
  * @param {Number[]} [column]
643
+ * @return AI on success, null otherwise
614
644
  */
615
- export function invertMatrix(A: Matrix, AI: Matrix, size?: number, index?: number[], column?: number[]): number;
645
+ export function invertMatrix(A: Matrix, AI: Matrix, size?: number, index?: number[], column?: number[]): Matrix|null;
616
646
 
617
647
  /**
618
648
  *
@@ -2,4 +2,5 @@ import '@babel/runtime/helpers/slicedToArray';
2
2
  import '@babel/runtime/helpers/toConsumableArray';
3
3
  import 'seedrandom';
4
4
  import '../../macros.js';
5
- export { ak as LUFactor3x3, al as LUSolve3x3, V as Pi, l as add, S as angleBetweenVectors, Q as areBoundsInitialized, C as areEquals, a as areMatricesEqual, _ as arrayMax, Z as arrayMin, E as arrayRange, a2 as beginCombination, a1 as binomial, aP as boundsIsWithinOtherBounds, W as ceil, $ as ceilLog2, aL as clampAndNormalizeValue, D as clampValue, e as clampVector, aj as columnsToMat3, ai as columnsToMat4, c as computeBoundsFromPoints, U as createArray, O as createUninitializedBounds, k as cross, g as default, B as degreesFromRadians, p as determinant2x2, z as determinant3x3, ay as diagonalize3x3, f as distance2BetweenPoints, d as dot, ab as dot2D, aD as estimateMatrixCondition, aO as extentIsWithinOtherExtent, a0 as factorial, aY as float2CssRGBA, aX as floatRGB2HexCode, aW as floatToHex2, K as floor, a6 as gaussian, ad as gaussianAmplitude, ae as gaussianWeight, aN as getAdjustedScalarRange, F as getMajorAxisIndex, aM as getScalarTypeFittingRange, a5 as getSeed, aG as hex2float, h as hsv2rgb, as as identity, ar as identity3x3, aS as inf, aq as invert3x3, aC as invertMatrix, aU as isFinite, G as isInf, aV as isNaN, i as isNan, R as isPowerOfTwo, w as jacobi, q as jacobiN, J as lab2rgb, aH as lab2xyz, am as linearSolve3x3, aA as luFactorLinearSystem, aB as luSolveLinearSystem, av as matrix3x3ToQuaternion, Y as max, X as min, an as multiply3x3_mat3, P as multiply3x3_vect3, o as multiplyAccumulate, a8 as multiplyAccumulate2D, ao as multiplyMatrix, aw as multiplyQuaternion, x as multiplyScalar, a7 as multiplyScalar2D, N as nearestPowerOfTwo, aT as negInf, a3 as nextCombination, n as norm, ag as norm2D, m as normalize, M as normalize2D, ax as orthogonalize3x3, a9 as outer, af as outer2D, t as perpendiculars, aQ as pointIsWithinBounds, aa as projectVector, ac as projectVector2D, at as quaternionToMatrix3x3, r as radiansFromDegrees, y as random, a4 as randomSeed, H as rgb2hsv, I as rgb2lab, aK as rgb2xyz, L as round, au as roundNumber, b as roundVector, A as rowsToMat3, ah as rowsToMat4, T as signedAngleBetweenVectors, az as singularValueDecomposition3x3, aR as solve3PointCircle, aE as solveHomogeneousLeastSquares, aF as solveLeastSquares, j as solveLinearSystem, s as subtract, ap as transpose3x3, u as uninitializeBounds, aI as xyz2lab, aJ as xyz2rgb } from './Math/index.js';
5
+ import './Math/Constants.js';
6
+ export { ak as LUFactor3x3, al as LUSolve3x3, V as Pi, l as add, S as angleBetweenVectors, Q as areBoundsInitialized, C as areEquals, a as areMatricesEqual, _ as arrayMax, Z as arrayMin, E as arrayRange, a2 as beginCombination, a1 as binomial, aR as boundsIsWithinOtherBounds, W as ceil, $ as ceilLog2, aN as clampAndNormalizeValue, D as clampValue, e as clampVector, aj as columnsToMat3, ai as columnsToMat4, c as computeBoundsFromPoints, U as createArray, O as createUninitializedBounds, k as cross, g as default, B as degreesFromRadians, p as determinant2x2, z as determinant3x3, aA as diagonalize3x3, f as distance2BetweenPoints, d as dot, ab as dot2D, aF as estimateMatrixCondition, aQ as extentIsWithinOtherExtent, a0 as factorial, a_ as float2CssRGBA, aZ as floatRGB2HexCode, aY as floatToHex2, K as floor, a6 as gaussian, ad as gaussianAmplitude, ae as gaussianWeight, aP as getAdjustedScalarRange, F as getMajorAxisIndex, aO as getScalarTypeFittingRange, a5 as getSeed, aI as hex2float, h as hsv2rgb, as as identity, ar as identity3x3, aU as inf, aq as invert3x3, aE as invertMatrix, aW as isFinite, at as isIdentity, au as isIdentity3x3, G as isInf, aX as isNaN, i as isNan, R as isPowerOfTwo, w as jacobi, q as jacobiN, J as lab2rgb, aJ as lab2xyz, am as linearSolve3x3, aC as luFactorLinearSystem, aD as luSolveLinearSystem, ax as matrix3x3ToQuaternion, Y as max, X as min, an as multiply3x3_mat3, P as multiply3x3_vect3, o as multiplyAccumulate, a8 as multiplyAccumulate2D, ao as multiplyMatrix, ay as multiplyQuaternion, x as multiplyScalar, a7 as multiplyScalar2D, N as nearestPowerOfTwo, aV as negInf, a3 as nextCombination, n as norm, ag as norm2D, m as normalize, M as normalize2D, az as orthogonalize3x3, a9 as outer, af as outer2D, t as perpendiculars, aS as pointIsWithinBounds, aa as projectVector, ac as projectVector2D, av as quaternionToMatrix3x3, r as radiansFromDegrees, y as random, a4 as randomSeed, H as rgb2hsv, I as rgb2lab, aM as rgb2xyz, L as round, aw as roundNumber, b as roundVector, A as rowsToMat3, ah as rowsToMat4, T as signedAngleBetweenVectors, aB as singularValueDecomposition3x3, aT as solve3PointCircle, aG as solveHomogeneousLeastSquares, aH as solveLeastSquares, j as solveLinearSystem, s as subtract, ap as transpose3x3, u as uninitializeBounds, aK as xyz2lab, aL as xyz2rgb } from './Math/index.js';
@@ -1,4 +1,4 @@
1
- import { mat4 } from 'gl-matrix';
1
+ import { mat3, mat4 } from 'gl-matrix';
2
2
  import { TypedArray, Vector3 } from './../../types';
3
3
 
4
4
  declare interface Transform {
@@ -66,11 +66,22 @@ declare interface Transform {
66
66
  */
67
67
  multiply(mat4x4: mat4): Transform
68
68
 
69
+ /**
70
+ * Multiply the current matrix with the provided 3x3 matrix.
71
+ * @param {mat3} mat3x3 column-first matrix
72
+ */
73
+ multiply3x3(mat3x3: mat3): Transform
74
+
69
75
  /**
70
76
  * Resets the MatrixBuilder to the Identity matrix.
71
- */
77
+ */
72
78
  identity(): Transform
73
79
 
80
+ /**
81
+ * Inverts the MatrixBuilder matrix.
82
+ */
83
+ invert(): Transform
84
+
74
85
  /**
75
86
  * Multiplies the array by the MatrixBuilder's internal matrix, in sets of
76
87
  * 3. Updates the array in place. If specified, `offset` starts at a given
@@ -1,14 +1,14 @@
1
1
  import _toConsumableArray from '@babel/runtime/helpers/toConsumableArray';
2
2
  import _classCallCheck from '@babel/runtime/helpers/classCallCheck';
3
3
  import _createClass from '@babel/runtime/helpers/createClass';
4
- import { mat4, vec3, glMatrix } from 'gl-matrix';
4
+ import { vec3, mat4, glMatrix } from 'gl-matrix';
5
5
  import { a as areMatricesEqual } from './Math/index.js';
6
+ import { IDENTITY } from './Math/Constants.js';
6
7
 
7
8
  var NoOp = function NoOp(v) {
8
9
  return v;
9
10
  };
10
11
 
11
- var IDENTITY = mat4.identity(new Float64Array(16));
12
12
  var EPSILON = 1e-6;
13
13
 
14
14
  var Transform = /*#__PURE__*/function () {
@@ -100,6 +100,18 @@ var Transform = /*#__PURE__*/function () {
100
100
  mat4.multiply(this.matrix, this.matrix, mat4x4);
101
101
  return this;
102
102
  }
103
+ }, {
104
+ key: "multiply3x3",
105
+ value: function multiply3x3(mat3x3) {
106
+ mat4.multiply(this.matrix, this.matrix, [mat3x3[0], mat3x3[1], mat3x3[2], 0, mat3x3[3], mat3x3[4], mat3x3[5], 0, mat3x3[6], mat3x3[7], mat3x3[8], 0, 0, 0, 0, 1]);
107
+ return this;
108
+ }
109
+ }, {
110
+ key: "invert",
111
+ value: function invert() {
112
+ mat4.invert(this.matrix, this.matrix);
113
+ return this;
114
+ }
103
115
  }, {
104
116
  key: "identity",
105
117
  value: function identity() {
@@ -105,10 +105,8 @@ export interface vtkScalarsToColors extends vtkObject {
105
105
 
106
106
  /**
107
107
  *
108
- * @param {Number} min
109
- * @param {Number} max
110
108
  */
111
- getRange(min: number, max: number): Range;
109
+ getRange(): Range;
112
110
 
113
111
  /**
114
112
  * Get which component of a vector to map to colors.
@@ -501,7 +501,7 @@ function vtkScalarsToColors(publicAPI, model) {
501
501
  return publicAPI.setMappingRange(min, max);
502
502
  };
503
503
 
504
- publicAPI.getRange = function (min, max) {
504
+ publicAPI.getRange = function () {
505
505
  return publicAPI.getMappingRange();
506
506
  };
507
507
  } // ----------------------------------------------------------------------------
@@ -38,7 +38,7 @@ function _reset(bounds) {
38
38
  return _setBounds(bounds, INIT_BOUNDS);
39
39
  }
40
40
 
41
- function _addPoint(bounds) {
41
+ function _addPoint(bounds, x, y, z) {
42
42
  var _bounds = _slicedToArray(bounds, 6),
43
43
  xMin = _bounds[0],
44
44
  xMax = _bounds[1],
@@ -47,12 +47,12 @@ function _addPoint(bounds) {
47
47
  zMin = _bounds[4],
48
48
  zMax = _bounds[5];
49
49
 
50
- bounds[0] = xMin < (arguments.length <= 1 ? undefined : arguments[1]) ? xMin : arguments.length <= 1 ? undefined : arguments[1];
51
- bounds[1] = xMax > (arguments.length <= 1 ? undefined : arguments[1]) ? xMax : arguments.length <= 1 ? undefined : arguments[1];
52
- bounds[2] = yMin < (arguments.length <= 2 ? undefined : arguments[2]) ? yMin : arguments.length <= 2 ? undefined : arguments[2];
53
- bounds[3] = yMax > (arguments.length <= 2 ? undefined : arguments[2]) ? yMax : arguments.length <= 2 ? undefined : arguments[2];
54
- bounds[4] = zMin < (arguments.length <= 3 ? undefined : arguments[3]) ? zMin : arguments.length <= 3 ? undefined : arguments[3];
55
- bounds[5] = zMax > (arguments.length <= 3 ? undefined : arguments[3]) ? zMax : arguments.length <= 3 ? undefined : arguments[3];
50
+ bounds[0] = xMin < x ? xMin : x;
51
+ bounds[1] = xMax > x ? xMax : x;
52
+ bounds[2] = yMin < y ? yMin : y;
53
+ bounds[3] = yMax > y ? yMax : y;
54
+ bounds[4] = zMin < z ? zMin : z;
55
+ bounds[5] = zMax > z ? zMax : z;
56
56
  return bounds;
57
57
  }
58
58
 
@@ -0,0 +1,79 @@
1
+ import { Nullable } from './../../types';
2
+
3
+ /**
4
+ *
5
+ */
6
+ export interface IEdgeLocatorInitialValues {
7
+ oriented?: boolean;
8
+ }
9
+
10
+ export interface IEdge<T = unknown> {
11
+ key: number;
12
+ edgeId: number;
13
+ value?: T;
14
+ }
15
+
16
+ export interface vtkEdgeLocator {
17
+ /**
18
+ * Remove all the edges previously added.
19
+ */
20
+ initialize(): void;
21
+
22
+ /**
23
+ * Returns the inserted edge or null if no edge was inserted.
24
+ * @param {Number} pointId0 Edge first point id
25
+ * @param {Number} pointId1 Edge last point id
26
+ * @return {IEdge|null} an edge object ({ key, edgeId, value }) or null
27
+ */
28
+ isInsertedEdge<T = unknown>(pointId0: number, pointId1: number): Nullable<IEdge<T>>;
29
+
30
+ /**
31
+ * Insert edge if it does not already exist.
32
+ * Returns the existing or newly inserted edge.
33
+ *
34
+ * @param {Number} pointId0 Edge first point id
35
+ * @param {Number} pointId1 Edge last point id
36
+ * @param {unknown} value Optional value option
37
+ * @return {IEdge|null} an edge object ({ key, edgeId, value }) or null
38
+ * @see insertEdge()
39
+ * @see isInsertedEdge()
40
+ */
41
+ insertUniqueEdge<T>(pointId0: number, pointId1: number, value?: T): IEdge<T>;
42
+
43
+ /**
44
+ * Insert edge. If the edge already exists, it is overwritten by this
45
+ * new edge. You may verify that the edge did not previously exist with
46
+ * `isInsertedEdge()`.
47
+ * Returns the newly inserted edge.
48
+ * @param {Number} pointId0 Edge first point id
49
+ * @param {Number} pointId1 Edge last point id
50
+ * @param {unknown} value Optional value option
51
+ * @return {Edge|null} an edge object ({ key, edgeId, value }) or null
52
+ * @see isInsertedEdge
53
+ * @see insertUniqueEdge
54
+ */
55
+ insertEdge<T>(pointId0: number, pointId1: number, value?: T): IEdge<T>;
56
+ }
57
+
58
+ // ----------------------------------------------------------------------------
59
+ // Static API
60
+ // ----------------------------------------------------------------------------
61
+
62
+ // ----------------------------------------------------------------------------
63
+
64
+ /**
65
+ * Method use to create a new instance of vtkEdgeLocator
66
+ * @param {IEdgeLocatorInitialValues} [initialValues] for pre-setting some of its content
67
+ */
68
+ export function newInstance(
69
+ initialValues?: IEdgeLocatorInitialValues
70
+ ): vtkEdgeLocator;
71
+
72
+ /**
73
+ * vtkEdgeLocator
74
+ */
75
+ export declare const vtkEdgeLocator: {
76
+ newInstance: typeof newInstance;
77
+ };
78
+
79
+ export default vtkEdgeLocator;
@@ -0,0 +1,85 @@
1
+ import _classCallCheck from '@babel/runtime/helpers/classCallCheck';
2
+ import _createClass from '@babel/runtime/helpers/createClass';
3
+
4
+ var EdgeLocator = /*#__PURE__*/function () {
5
+ function EdgeLocator() {
6
+ var oriented = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;
7
+
8
+ _classCallCheck(this, EdgeLocator);
9
+
10
+ this.oriented = oriented;
11
+ this.edgeMap = new Map();
12
+ }
13
+
14
+ _createClass(EdgeLocator, [{
15
+ key: "initialize",
16
+ value: function initialize() {
17
+ this.edgeMap.clear();
18
+ }
19
+ }, {
20
+ key: "computeEdgeKey",
21
+ value: function computeEdgeKey(pointId0, pointId1) {
22
+ return this.oriented || pointId0 < pointId1 ? // Cantor pairing function:
23
+ 0.5 * (pointId0 * pointId1) * (pointId0 * pointId1 + 1) + pointId1 : 0.5 * (pointId1 * pointId0) * (pointId1 * pointId0 + 1) + pointId0;
24
+ }
25
+ }, {
26
+ key: "insertUniqueEdge",
27
+ value: function insertUniqueEdge(pointId0, pointId1, newEdgeValue) {
28
+ // Generate a unique key
29
+ var key = this.computeEdgeKey(pointId0, pointId1);
30
+ var node = this.edgeMap.get(key);
31
+
32
+ if (!node) {
33
+ // Didn't find key, so add a new edge entry
34
+ node = {
35
+ key: key,
36
+ edgeId: this.edgeMap.size,
37
+ value: newEdgeValue
38
+ };
39
+ this.edgeMap.set(key, node);
40
+ }
41
+
42
+ return node;
43
+ }
44
+ }, {
45
+ key: "insertEdge",
46
+ value: function insertEdge(pointId0, pointId1, newEdgeValue) {
47
+ // Generate a unique key
48
+ var key = this.computeEdgeKey(pointId0, pointId1);
49
+ var node = {
50
+ key: key,
51
+ edgeId: this.edgeMap.size,
52
+ value: newEdgeValue
53
+ };
54
+ this.edgeMap.set(key, node);
55
+ return node;
56
+ }
57
+ }, {
58
+ key: "isInsertedEdge",
59
+ value: function isInsertedEdge(pointId0, pointId1) {
60
+ var key = this.computeEdgeKey(pointId0, pointId1);
61
+ return this.edgeMap.get(key);
62
+ }
63
+ }], [{
64
+ key: "getEdgePointIds",
65
+ value: function getEdgePointIds(node) {
66
+ var n = 0.5 * (-1 + Math.sqrt(8 * node.key + 1));
67
+ var pointId0 = node.key - 0.5 * (n + 1) * n;
68
+ var pointId1 = n - pointId0;
69
+ return [pointId0, pointId1];
70
+ }
71
+ }]);
72
+
73
+ return EdgeLocator;
74
+ }();
75
+
76
+ function newInstance() {
77
+ var initialValues = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
78
+ return new EdgeLocator(initialValues.oriented);
79
+ }
80
+
81
+ var vtkEdgeLocator = {
82
+ newInstance: newInstance
83
+ };
84
+
85
+ export { vtkEdgeLocator as default };
@@ -222,55 +222,6 @@ function vtkImageData(publicAPI, model) {
222
222
  model.indexToWorld[10] = model.direction[8];
223
223
  mat4.scale(model.indexToWorld, model.indexToWorld, model.spacing);
224
224
  mat4.invert(model.worldToIndex, model.indexToWorld);
225
- }; //
226
- // The direction matrix is a 3x3 basis for the I, J, K axes
227
- // of the image. The rows of the matrix correspond to the
228
- // axes directions in world coordinates. Direction must
229
- // form an orthonormal basis, results are undefined if
230
- // it is not.
231
- //
232
-
233
-
234
- publicAPI.setDirection = function () {
235
- if (model.deleted) {
236
- vtkErrorMacro('instance deleted - cannot call any method');
237
- return false;
238
- }
239
-
240
- for (var _len2 = arguments.length, args = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++) {
241
- args[_key2] = arguments[_key2];
242
- }
243
-
244
- var array = args; // allow an array passed as a single arg.
245
-
246
- if (array.length === 1 && (Array.isArray(array[0]) || array[0].constructor === Float32Array || array[0].constructor === Float64Array)) {
247
- array = array[0];
248
- }
249
-
250
- if (array.length !== 9) {
251
- throw new RangeError('Invalid number of values for array setter');
252
- }
253
-
254
- var changeDetected = false;
255
- model.direction.forEach(function (item, index) {
256
- if (item !== array[index]) {
257
- if (changeDetected) {
258
- return;
259
- }
260
-
261
- changeDetected = true;
262
- }
263
- });
264
-
265
- if (changeDetected) {
266
- for (var i = 0; i < 9; ++i) {
267
- model.direction[i] = array[i];
268
- }
269
-
270
- publicAPI.modified();
271
- }
272
-
273
- return true;
274
225
  };
275
226
 
276
227
  publicAPI.indexToWorld = function (ain) {
@@ -487,8 +438,9 @@ function extend(publicAPI, model) {
487
438
  model.indexToWorld = new Float64Array(16);
488
439
  model.worldToIndex = new Float64Array(16); // Set/Get methods
489
440
 
490
- macro.get(publicAPI, model, ['direction', 'indexToWorld', 'worldToIndex']);
441
+ macro.get(publicAPI, model, ['indexToWorld', 'worldToIndex']);
491
442
  macro.setGetArray(publicAPI, model, ['origin', 'spacing'], 3);
443
+ macro.setGetArray(publicAPI, model, ['direction'], 9);
492
444
  macro.getArray(publicAPI, model, ['extent'], 6); // Object specific methods
493
445
 
494
446
  vtkImageData(publicAPI, model);
@@ -48,6 +48,21 @@ export interface vtkIncrementalOctreeNode extends vtkObject {
48
48
  */
49
49
  getBounds(bounds: Bounds): void;
50
50
 
51
+ /**
52
+ * @param {Vector3} point
53
+ */
54
+ getChildIndex(point: Vector3): number;
55
+
56
+ /**
57
+ * @param {Vector3} point
58
+ */
59
+ containsPoint(point: Vector3): boolean;
60
+
61
+ /**
62
+ * @param {Vector3} point
63
+ */
64
+ containsPointByData(point: Vector3): boolean;
65
+
51
66
  /**
52
67
  * Given a point inserted to either this node (a leaf node) or a descendant
53
68
  * leaf (of this node --- when this node is a non-leaf node), update the