@kitware/vtk.js 34.5.0 → 34.7.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 (70) hide show
  1. package/Common/Core/CellArray.d.ts +3 -0
  2. package/Common/Core/CellArray.js +12 -1
  3. package/Common/Core/DataArray.d.ts +15 -0
  4. package/Common/Core/DataArray.js +8 -4
  5. package/Common/Core/Math/index.js +12 -1
  6. package/Common/Core/Math.d.ts +24 -18
  7. package/Common/Core/Math.js +1 -1
  8. package/Common/DataModel/Triangle.d.ts +68 -19
  9. package/Common/DataModel/Triangle.js +136 -2
  10. package/Common/DataModel/TriangleStrip.d.ts +180 -0
  11. package/Common/DataModel/TriangleStrip.js +396 -0
  12. package/Common/DataModel.js +3 -1
  13. package/Common/Transform/LandmarkTransform.js +1 -1
  14. package/Common/Transform/Transform.d.ts +112 -1
  15. package/Common/Transform/Transform.js +301 -2
  16. package/Filters/Core/Cutter.js +42 -0
  17. package/Filters/General/OBBTree.js +1 -1
  18. package/Filters/General/TransformPolyDataFilter.d.ts +75 -0
  19. package/Filters/General/TransformPolyDataFilter.js +194 -0
  20. package/Filters/General.js +2 -0
  21. package/Filters/Sources/CircleSource.js +1 -1
  22. package/Filters/Sources/PointSource.js +1 -1
  23. package/Filters/Texture/TextureMapToPlane.js +1 -1
  24. package/IO/Geometry/DracoReader.js +1 -1
  25. package/IO/Geometry/GLTFImporter/Animations.js +1 -1
  26. package/IO/Geometry/GLTFImporter/Reader.js +2 -2
  27. package/IO/Image/HDRReader/Utils.js +1 -1
  28. package/IO/Image/HDRReader.js +1 -1
  29. package/IO/Misc/OBJWriter.d.ts +103 -0
  30. package/IO/Misc/OBJWriter.js +235 -0
  31. package/IO/Misc.js +2 -0
  32. package/Interaction/Manipulators/MouseCameraTrackballRollManipulator.js +1 -1
  33. package/Interaction/Manipulators/MouseCameraTrackballRotateManipulator.js +1 -1
  34. package/Interaction/Manipulators/MouseCameraUnicamManipulator.js +1 -1
  35. package/Interaction/Manipulators/MouseCameraUnicamRotateManipulator.js +1 -1
  36. package/Interaction/Style/InteractorStyleManipulator.js +75 -2
  37. package/Interaction/Style/InteractorStyleTrackballCamera.js +1 -1
  38. package/Interaction/Widgets/PiecewiseGaussianWidget.js +1 -1
  39. package/Proxy/Core/View2DProxy.js +1 -1
  40. package/Rendering/Core/AbstractImageMapper.js +1 -1
  41. package/Rendering/Core/AbstractMapper3D.js +1 -1
  42. package/Rendering/Core/Camera.d.ts +3 -3
  43. package/Rendering/Core/Camera.js +33 -3
  44. package/Rendering/Core/ColorTransferFunction/CssFilters.js +1 -1
  45. package/Rendering/Core/ColorTransferFunction.js +1 -1
  46. package/Rendering/Core/Coordinate.js +1 -1
  47. package/Rendering/Core/CubeAxesActor.js +1 -1
  48. package/Rendering/Core/Glyph3DMapper.js +1 -1
  49. package/Rendering/Core/ImageArrayMapper.js +1 -1
  50. package/Rendering/Core/ImageMapper.js +1 -1
  51. package/Rendering/Core/Mapper.js +1 -1
  52. package/Rendering/Core/Prop3D.js +1 -1
  53. package/Rendering/Core/RenderWindowInteractor.js +3 -3
  54. package/Rendering/Core/Renderer.js +1 -1
  55. package/Rendering/Core/ScalarBarActor.js +1 -1
  56. package/Rendering/Core/TextActor.js +1 -1
  57. package/Rendering/Core/VectorText/Utils.js +1 -1
  58. package/Rendering/Core/VolumeProperty.js +1 -1
  59. package/Rendering/OpenGL/PolyDataMapper2D.js +1 -1
  60. package/Rendering/OpenGL/Texture.js +1 -1
  61. package/Rendering/OpenGL/VolumeMapper.js +21 -19
  62. package/Widgets/Manipulators/LineManipulator.js +1 -1
  63. package/Widgets/Representations/PolyLineRepresentation.js +1 -1
  64. package/Widgets/Widgets3D/AngleWidget.js +1 -1
  65. package/Widgets/Widgets3D/LineWidget/helpers.js +1 -1
  66. package/Widgets/Widgets3D/ResliceCursorWidget/behavior.js +1 -1
  67. package/Widgets/Widgets3D/ResliceCursorWidget/helpers.js +1 -1
  68. package/Widgets/Widgets3D/ResliceCursorWidget.js +1 -1
  69. package/index.d.ts +3 -0
  70. package/package.json +1 -1
@@ -8,7 +8,7 @@ import vtkSphereSource from '../../Filters/Sources/SphereSource.js';
8
8
  import { FieldAssociations } from '../../Common/DataModel/DataSet/Constants.js';
9
9
  import { mat4, vec3 } from 'gl-matrix';
10
10
  import { m as macro } from '../../macros2.js';
11
- import { D as areEquals, l as normalize, d as dot, E as clampValue, s as subtract, j as cross, w as multiplyScalar, e as distance2BetweenPoints } from '../../Common/Core/Math/index.js';
11
+ import { E as areEquals, l as normalize, d as dot, F as clampValue, s as subtract, j as cross, x as multiplyScalar, e as distance2BetweenPoints } from '../../Common/Core/Math/index.js';
12
12
 
13
13
  const {
14
14
  States
@@ -1,6 +1,7 @@
1
1
  import { m as macro } from '../../macros2.js';
2
2
  import { MouseButton } from '../../Rendering/Core/RenderWindowInteractor/Constants.js';
3
3
  import vtkInteractorStyle from '../../Rendering/Core/InteractorStyle.js';
4
+ import { mat4, vec3 } from 'gl-matrix';
4
5
 
5
6
  const {
6
7
  vtkDebugMacro
@@ -101,6 +102,62 @@ function dollyByFactor(interactor, renderer, factor) {
101
102
  renderer.updateLightsGeometryToFollowCamera();
102
103
  }
103
104
  }
105
+ function getCameraMatrix(renderer, tempMatrix) {
106
+ const cam = renderer.getActiveCamera();
107
+ if (cam) {
108
+ mat4.copy(tempMatrix, cam.getViewMatrix());
109
+ return tempMatrix;
110
+ }
111
+ return null;
112
+ }
113
+
114
+ /**
115
+ * Transforms a vector by the transformation delta between two matrices.
116
+ *
117
+ * @param {Object} tempObjects - Temporary matrices/vectors for computation
118
+ * @param {mat4} beforeMatrix - Matrix before transformation
119
+ * @param {mat4} afterMatrix - Matrix after transformation
120
+ * @param {Array} vector - Vector to transform [x, y, z]
121
+ * @returns {Array} Transformed vector [x, y, z]
122
+ */
123
+ function transformVectorByTransformation(tempObjects, beforeMatrix, afterMatrix, vector) {
124
+ const {
125
+ matrixA,
126
+ matrixB,
127
+ newCenter
128
+ } = tempObjects;
129
+
130
+ // The view matrix from vtk.js is row-major, but gl-matrix expects column-major.
131
+ // We need to transpose them before use.
132
+ mat4.transpose(matrixA, beforeMatrix);
133
+ mat4.transpose(matrixB, afterMatrix);
134
+ mat4.invert(matrixB, matrixB);
135
+
136
+ // Compute delta transformation matrix
137
+ mat4.multiply(matrixA, matrixB, matrixA);
138
+ vec3.transformMat4(newCenter, vector, matrixA);
139
+ return newCenter;
140
+ }
141
+
142
+ /**
143
+ * Computes the new center of rotation based on camera movement.
144
+ * When the camera moves (pan), the center of rotation should move
145
+ * by the same transformation to maintain consistent rotation behavior.
146
+ *
147
+ * @param {Object} tempObjects - Temporary matrices/vectors for computation
148
+ * @param {Object} renderer - VTK renderer
149
+ * @param {mat4} beforeCameraMatrix - Camera view matrix before movement
150
+ * @param {Array} oldCenterOfRotation - Previous center of rotation [x, y, z]
151
+ * @returns {Array} New center of rotation [x, y, z]
152
+ */
153
+ function computeNewCenterOfRotation(tempObjects, renderer, beforeCameraMatrix, oldCenterOfRotation) {
154
+ const cam = renderer.getActiveCamera();
155
+ if (!cam || !beforeCameraMatrix) {
156
+ return oldCenterOfRotation;
157
+ }
158
+ const afterMatrixRowMajor = cam.getViewMatrix();
159
+ return transformVectorByTransformation(tempObjects, beforeCameraMatrix, afterMatrixRowMajor, oldCenterOfRotation);
160
+ }
104
161
 
105
162
  // ----------------------------------------------------------------------------
106
163
  // Static API
@@ -119,6 +176,14 @@ const STATIC = {
119
176
  function vtkInteractorStyleManipulator(publicAPI, model) {
120
177
  // Set our className
121
178
  model.classHierarchy.push('vtkInteractorStyleManipulator');
179
+
180
+ // Initialize temporary objects to reduce garbage collection
181
+ const tempCameraMatrix = mat4.create();
182
+ const tempComputeObjects = {
183
+ matrixA: mat4.create(),
184
+ matrixB: mat4.create(),
185
+ newCenter: vec3.create()
186
+ };
122
187
  model.currentVRManipulators = new Map();
123
188
  model.mouseManipulators = [];
124
189
  model.keyboardManipulators = [];
@@ -415,7 +480,11 @@ function vtkInteractorStyleManipulator(publicAPI, model) {
415
480
  publicAPI.handleMouseMove = callData => {
416
481
  model.cachedMousePosition = callData.position;
417
482
  if (model.currentManipulator && model.currentManipulator.onMouseMove) {
418
- model.currentManipulator.onMouseMove(model._interactor, model.getRenderer(callData), callData.position);
483
+ const renderer = model.getRenderer(callData);
484
+ const beforeCameraMatrix = getCameraMatrix(renderer, tempCameraMatrix);
485
+ model.currentManipulator.onMouseMove(model._interactor, renderer, callData.position);
486
+ const newCenter = computeNewCenterOfRotation(tempComputeObjects, renderer, beforeCameraMatrix, model.centerOfRotation);
487
+ publicAPI.setCenterOfRotation(newCenter);
419
488
  publicAPI.invokeInteractionEvent(INTERACTION_EVENT);
420
489
  }
421
490
  };
@@ -557,16 +626,20 @@ function vtkInteractorStyleManipulator(publicAPI, model) {
557
626
 
558
627
  //----------------------------------------------------------------------------
559
628
  publicAPI.handlePan = callData => {
629
+ const renderer = model.getRenderer(callData);
630
+ const beforeCameraMatrix = getCameraMatrix(renderer, tempCameraMatrix);
560
631
  let count = model.gestureManipulators.length;
561
632
  let actionCount = 0;
562
633
  while (count--) {
563
634
  const manipulator = model.gestureManipulators[count];
564
635
  if (manipulator && manipulator.isPanEnabled()) {
565
- manipulator.onPan(model._interactor, model.getRenderer(callData), callData.translation);
636
+ manipulator.onPan(model._interactor, renderer, callData.translation);
566
637
  actionCount++;
567
638
  }
568
639
  }
569
640
  if (actionCount) {
641
+ const newCenter = computeNewCenterOfRotation(tempComputeObjects, renderer, beforeCameraMatrix, model.centerOfRotation);
642
+ publicAPI.setCenterOfRotation(newCenter);
570
643
  publicAPI.invokeInteractionEvent(INTERACTION_EVENT);
571
644
  }
572
645
  };
@@ -1,7 +1,7 @@
1
1
  import { m as macro } from '../../macros2.js';
2
2
  import vtkInteractorStyle from '../../Rendering/Core/InteractorStyle.js';
3
3
  import vtkInteractorStyleConstants from '../../Rendering/Core/InteractorStyle/Constants.js';
4
- import { A as degreesFromRadians } from '../../Common/Core/Math/index.js';
4
+ import { B as degreesFromRadians } from '../../Common/Core/Math/index.js';
5
5
  import { Device, Input } from '../../Rendering/Core/RenderWindowInteractor/Constants.js';
6
6
 
7
7
  const {
@@ -1,5 +1,5 @@
1
1
  import { m as macro } from '../../macros2.js';
2
- import { F as arrayRange } from '../../Common/Core/Math/index.js';
2
+ import { G as arrayRange } from '../../Common/Core/Math/index.js';
3
3
  import WebworkerPromise from 'webworker-promise';
4
4
  import { W as WorkerFactory } from '../../_virtual/rollup-plugin-worker-loader__module_Sources/Interaction/Widgets/PiecewiseGaussianWidget/ComputeHistogram.worker.js';
5
5
 
@@ -1,7 +1,7 @@
1
1
  import { m as macro } from '../../macros2.js';
2
2
  import vtkMouseRangeManipulator from '../../Interaction/Manipulators/MouseRangeManipulator.js';
3
3
  import vtkViewProxy from './ViewProxy.js';
4
- import { j as cross, G as getMajorAxisIndex, r as radiansFromDegrees } from '../../Common/Core/Math/index.js';
4
+ import { j as cross, H as getMajorAxisIndex, r as radiansFromDegrees } from '../../Common/Core/Math/index.js';
5
5
  import { mat4, vec3 } from 'gl-matrix';
6
6
  import vtkBoundingBox from '../../Common/DataModel/BoundingBox.js';
7
7
 
@@ -1,6 +1,6 @@
1
1
  import { m as macro } from '../../macros2.js';
2
2
  import vtkAbstractMapper3D from './AbstractMapper3D.js';
3
- import { H as createUninitializedBounds } from '../../Common/Core/Math/index.js';
3
+ import { I as createUninitializedBounds } from '../../Common/Core/Math/index.js';
4
4
 
5
5
  // ----------------------------------------------------------------------------
6
6
  // vtkAbstractImageMapper methods
@@ -1,7 +1,7 @@
1
1
  import { m as macro } from '../../macros2.js';
2
2
  import vtkAbstractMapper from './AbstractMapper.js';
3
3
  import vtkBoundingBox from '../../Common/DataModel/BoundingBox.js';
4
- import { H as createUninitializedBounds } from '../../Common/Core/Math/index.js';
4
+ import { I as createUninitializedBounds } from '../../Common/Core/Math/index.js';
5
5
 
6
6
  // ----------------------------------------------------------------------------
7
7
  // vtkAbstractMapper methods
@@ -156,11 +156,11 @@ export interface vtkCamera extends vtkObject {
156
156
  getFreezeFocalPoint(): boolean;
157
157
 
158
158
  /**
159
- * Not implemented yet
160
159
  * Get the plane equations that bound the view frustum.
161
- * @param {Number} aspect Camera frustum aspect ratio.
160
+ * @param {Number} [aspect] Camera frustum aspect ratio (default: 1.0).
161
+ * @param {Float64Array} [planes] Optional array to fill with the plane equations.
162
162
  */
163
- getFrustumPlanes(aspect: number): void;
163
+ getFrustumPlanes(aspect?: number, planes?: Float64Array): Float64Array;
164
164
 
165
165
  /**
166
166
  * Not implemented yet
@@ -1,6 +1,6 @@
1
1
  import { mat4, vec4, vec3, quat } from 'gl-matrix';
2
2
  import { m as macro } from '../../macros2.js';
3
- import { r as radiansFromDegrees, k as add, j as cross } from '../../Common/Core/Math/index.js';
3
+ import { r as radiansFromDegrees, k as add, J as normalize4D, j as cross } from '../../Common/Core/Math/index.js';
4
4
 
5
5
  const {
6
6
  vtkDebugMacro
@@ -274,8 +274,38 @@ function vtkCamera(publicAPI, model) {
274
274
  publicAPI.setObliqueAngles = (alpha, beta) => {};
275
275
  publicAPI.getOrientation = () => {};
276
276
  publicAPI.getOrientationWXYZ = () => {};
277
- publicAPI.getFrustumPlanes = aspect => {
278
- // Return array of 24 params (4 params for each of 6 plane equations)
277
+ publicAPI.getFrustumPlanes = function () {
278
+ let aspect = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 1.0;
279
+ let planes = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : new Float64Array(24);
280
+ const normals = [
281
+ // Left
282
+ [1, 0, 0, 1],
283
+ // Right
284
+ [-1, 0, 0, 1],
285
+ // Bottom
286
+ [0, 1, 0, 1],
287
+ // Top
288
+ [0, -1, 0, 1],
289
+ // Near
290
+ [0, 0, 1, 1],
291
+ // Far
292
+ [0, 0, -1, 1]];
293
+
294
+ // Get the composite projection matrix
295
+ const matrix = publicAPI.getCompositeProjectionMatrix(aspect, -1, 1);
296
+
297
+ // Transform the normals to world coordinates
298
+ for (let i = 0; i < 6; i++) {
299
+ vec4.transformMat4(normals[i], normals[i], matrix);
300
+
301
+ // Normalize the plane normal
302
+ normalize4D(normals[i]);
303
+ planes[4 * i + 0] = normals[i][0];
304
+ planes[4 * i + 1] = normals[i][1];
305
+ planes[4 * i + 2] = normals[i][2];
306
+ planes[4 * i + 3] = normals[i][3];
307
+ }
308
+ return planes;
279
309
  };
280
310
  publicAPI.getCameraLightTransformMatrix = matrix => {
281
311
  mat4.copy(matrix, model.cameraLightTransform);
@@ -1,4 +1,4 @@
1
- import { I as identity, J as multiplyMatrix } from '../../../Common/Core/Math/index.js';
1
+ import { K as identity, L as multiplyMatrix } from '../../../Common/Core/Math/index.js';
2
2
 
3
3
  /**
4
4
  * A helper file to transform RGBA points using CSS filters equivalent
@@ -1,5 +1,5 @@
1
1
  import { m as macro } from '../../macros2.js';
2
- import { h as hsv2rgb, i as isNan, K as floor, L as isInf, M as rgb2hsv, N as rgb2lab, O as lab2rgb } from '../../Common/Core/Math/index.js';
2
+ import { h as hsv2rgb, i as isNan, M as floor, N as isInf, O as rgb2hsv, P as rgb2lab, Q as lab2rgb } from '../../Common/Core/Math/index.js';
3
3
  import vtkScalarsToColors from '../../Common/Core/ScalarsToColors.js';
4
4
  import Constants from './ColorTransferFunction/Constants.js';
5
5
 
@@ -1,6 +1,6 @@
1
1
  import { m as macro } from '../../macros2.js';
2
2
  import Constants from './Coordinate/Constants.js';
3
- import { P as round, K as floor } from '../../Common/Core/Math/index.js';
3
+ import { R as round, M as floor } from '../../Common/Core/Math/index.js';
4
4
 
5
5
  const {
6
6
  Coordinate
@@ -1,6 +1,6 @@
1
1
  import { vec3, mat4 } from 'gl-matrix';
2
2
  import * as d3 from 'd3-scale';
3
- import { Q as normalize2D, R as nearestPowerOfTwo } from '../../Common/Core/Math/index.js';
3
+ import { S as normalize2D, T as nearestPowerOfTwo } from '../../Common/Core/Math/index.js';
4
4
  import { m as macro } from '../../macros2.js';
5
5
  import vtkActor from './Actor.js';
6
6
  import vtkBoundingBox from '../../Common/DataModel/BoundingBox.js';
@@ -2,7 +2,7 @@ import { mat4, vec3, mat3 } from 'gl-matrix';
2
2
  import Constants from './Glyph3DMapper/Constants.js';
3
3
  import { m as macro } from '../../macros2.js';
4
4
  import vtkMapper from './Mapper.js';
5
- import { H as createUninitializedBounds, n as norm } from '../../Common/Core/Math/index.js';
5
+ import { I as createUninitializedBounds, n as norm } from '../../Common/Core/Math/index.js';
6
6
  import vtkBoundingBox from '../../Common/DataModel/BoundingBox.js';
7
7
 
8
8
  const {
@@ -1,7 +1,7 @@
1
1
  import { m as macro } from '../../macros2.js';
2
2
  import vtkAbstractImageMapper from './AbstractImageMapper.js';
3
3
  import vtkImageMapper from './ImageMapper.js';
4
- import { H as createUninitializedBounds } from '../../Common/Core/Math/index.js';
4
+ import { I as createUninitializedBounds } from '../../Common/Core/Math/index.js';
5
5
  import { intersectWithLineForPointPicking, intersectWithLineForCellPicking } from './AbstractImageMapper/helper.js';
6
6
  import CoincidentTopologyHelper from './Mapper/CoincidentTopologyHelper.js';
7
7
 
@@ -2,7 +2,7 @@ import Constants from './ImageMapper/Constants.js';
2
2
  import { m as macro } from '../../macros2.js';
3
3
  import vtkAbstractImageMapper from './AbstractImageMapper.js';
4
4
  import { intersectWithLineForPointPicking, intersectWithLineForCellPicking } from './AbstractImageMapper/helper.js';
5
- import { E as clampValue, S as multiply3x3_vect3, H as createUninitializedBounds, T as getSparseOrthogonalMatrix } from '../../Common/Core/Math/index.js';
5
+ import { F as clampValue, U as multiply3x3_vect3, I as createUninitializedBounds, V as getSparseOrthogonalMatrix } from '../../Common/Core/Math/index.js';
6
6
  import CoincidentTopologyHelper from './Mapper/CoincidentTopologyHelper.js';
7
7
 
8
8
  const {
@@ -3,7 +3,7 @@ import vtkAbstractMapper3D from './AbstractMapper3D.js';
3
3
  import vtkDataArray from '../../Common/Core/DataArray.js';
4
4
  import vtkImageData from '../../Common/DataModel/ImageData.js';
5
5
  import vtkLookupTable from '../../Common/Core/LookupTable.js';
6
- import { H as createUninitializedBounds, i as isNan } from '../../Common/Core/Math/index.js';
6
+ import { I as createUninitializedBounds, i as isNan } from '../../Common/Core/Math/index.js';
7
7
  import vtkScalarsToColors from '../../Common/Core/ScalarsToColors/Constants.js';
8
8
  import CoincidentTopologyHelper from './Mapper/CoincidentTopologyHelper.js';
9
9
  import Constants from './Mapper/Constants.js';
@@ -1,7 +1,7 @@
1
1
  import { mat4, quat } from 'gl-matrix';
2
2
  import { m as macro } from '../../macros2.js';
3
3
  import vtkBoundingBox from '../../Common/DataModel/BoundingBox.js';
4
- import { A as degreesFromRadians, r as radiansFromDegrees, a as areMatricesEqual } from '../../Common/Core/Math/index.js';
4
+ import { B as degreesFromRadians, r as radiansFromDegrees, a as areMatricesEqual } from '../../Common/Core/Math/index.js';
5
5
  import vtkProp from './Prop.js';
6
6
 
7
7
  const VTK_EPSILON = 1e-6;
@@ -1,5 +1,5 @@
1
1
  import { m as macro } from '../../macros2.js';
2
- import { A as degreesFromRadians } from '../../Common/Core/Math/index.js';
2
+ import { B as degreesFromRadians } from '../../Common/Core/Math/index.js';
3
3
  import Constants from './RenderWindowInteractor/Constants.js';
4
4
 
5
5
  const {
@@ -238,9 +238,9 @@ function vtkRenderWindowInteractor(publicAPI, model) {
238
238
  });
239
239
  container.removeEventListener('pointerup', publicAPI.handlePointerUp);
240
240
  container.removeEventListener('pointercancel', publicAPI.handlePointerCancel);
241
+ container.removeEventListener('keypress', publicAPI.handleKeyPress);
242
+ container.removeEventListener('keydown', publicAPI.handleKeyDown);
241
243
  }
242
- container.removeEventListener('keypress', publicAPI.handleKeyPress);
243
- container.removeEventListener('keydown', publicAPI.handleKeyDown);
244
244
  document.removeEventListener('keyup', publicAPI.handleKeyUp);
245
245
  document.removeEventListener('pointerlockchange', publicAPI.handlePointerLockChange);
246
246
  pointerCache.clear();
@@ -2,7 +2,7 @@ import { mat4, vec3 } from 'gl-matrix';
2
2
  import { n as newInstance$1, g as get, e as setGet, k as getArray, l as setGetArray, i as moveToProtected, c as macro } from '../../macros2.js';
3
3
  import vtkCamera from './Camera.js';
4
4
  import vtkLight from './Light.js';
5
- import { U as areBoundsInitialized, u as uninitializeBounds, r as radiansFromDegrees, d as dot, H as createUninitializedBounds } from '../../Common/Core/Math/index.js';
5
+ import { W as areBoundsInitialized, u as uninitializeBounds, r as radiansFromDegrees, d as dot, I as createUninitializedBounds } from '../../Common/Core/Math/index.js';
6
6
  import vtkViewport from './Viewport.js';
7
7
  import vtkBoundingBox from '../../Common/DataModel/BoundingBox.js';
8
8
 
@@ -1,5 +1,5 @@
1
1
  import * as d3 from 'd3-scale';
2
- import { R as nearestPowerOfTwo } from '../../Common/Core/Math/index.js';
2
+ import { T as nearestPowerOfTwo } from '../../Common/Core/Math/index.js';
3
3
  import { m as macro } from '../../macros2.js';
4
4
  import vtkActor from './Actor.js';
5
5
  import vtkDataArray from '../../Common/Core/DataArray.js';
@@ -5,7 +5,7 @@ import vtkActor2D from './Actor2D.js';
5
5
  import vtkMapper2D from './Mapper2D.js';
6
6
  import vtkTextProperty from './TextProperty.js';
7
7
  import ImageHelper from '../../Common/Core/ImageHelper.js';
8
- import { V as floatRGB2HexCode } from '../../Common/Core/Math/index.js';
8
+ import { X as floatRGB2HexCode } from '../../Common/Core/Math/index.js';
9
9
 
10
10
  // ----------------------------------------------------------------------------
11
11
  // vtkTextActor methods
@@ -1,4 +1,4 @@
1
- import { D as areEquals } from '../../../Common/Core/Math/index.js';
1
+ import { E as areEquals } from '../../../Common/Core/Math/index.js';
2
2
 
3
3
  /**
4
4
  * Computes UV coordinates for top/bottom faces
@@ -1,5 +1,5 @@
1
1
  import { m as macro } from '../../macros2.js';
2
- import { E as clampValue, K as floor } from '../../Common/Core/Math/index.js';
2
+ import { F as clampValue, M as floor } from '../../Common/Core/Math/index.js';
3
3
  import vtkColorTransferFunction from './ColorTransferFunction.js';
4
4
  import vtkPiecewiseFunction from '../../Common/DataModel/PiecewiseFunction.js';
5
5
  import Constants from './VolumeProperty/Constants.js';
@@ -8,7 +8,7 @@ import vtkReplacementShaderMapper from './ReplacementShaderMapper.js';
8
8
  import vtkShaderProgram from './ShaderProgram.js';
9
9
  import vtkViewNode from '../SceneGraph/ViewNode.js';
10
10
  import vtkOpenGLTexture from './Texture.js';
11
- import { P as round } from '../../Common/Core/Math/index.js';
11
+ import { R as round } from '../../Common/Core/Math/index.js';
12
12
  import { DisplayLocation } from '../Core/Property2D/Constants.js';
13
13
  import { registerOverride } from './ViewNodeFactory.js';
14
14
 
@@ -3,7 +3,7 @@ import Constants from './Texture/Constants.js';
3
3
  import HalfFloat from '../../Common/Core/HalfFloat.js';
4
4
  import { n as newInstance$1, o as obj, s as set, e as setGet, g as get, i as moveToProtected, a as newTypedArray, c as macro } from '../../macros2.js';
5
5
  import vtkDataArray from '../../Common/Core/DataArray.js';
6
- import { W as isPowerOfTwo, R as nearestPowerOfTwo } from '../../Common/Core/Math/index.js';
6
+ import { Y as isPowerOfTwo, T as nearestPowerOfTwo } from '../../Common/Core/Math/index.js';
7
7
  import vtkViewNode from '../SceneGraph/ViewNode.js';
8
8
  import { registerOverride } from './ViewNodeFactory.js';
9
9
  import supportsNorm16LinearCached from './Texture/supportsNorm16Linear.js';
@@ -958,20 +958,28 @@ function vtkOpenGLVolumeMapper(publicAPI, model) {
958
958
  });
959
959
  }
960
960
  }
961
- const volumeProperties = actor.getProperties();
962
- const firstValidInput = model.currentValidInputs[0];
963
- const firstImageData = firstValidInput.imageData;
964
- const firstScalars = firstImageData.getPointData().getScalars();
965
- const firstVolumeProperty = volumeProperties[firstValidInput.inputIndex];
966
-
967
- // Get the number of lights
968
961
  let newNumberOfLights = 0;
969
- if (firstVolumeProperty.getShade() && model.renderable.getBlendMode() === BlendMode.COMPOSITE_BLEND) {
970
- ren.getLights().forEach(light => {
971
- if (light.getSwitch() > 0) {
972
- newNumberOfLights++;
973
- }
974
- });
962
+ if (model.currentValidInputs.length > 0) {
963
+ const volumeProperties = actor.getProperties();
964
+ const firstValidInput = model.currentValidInputs[0];
965
+ const firstImageData = firstValidInput.imageData;
966
+ const firstScalars = firstImageData.getPointData().getScalars();
967
+ const firstVolumeProperty = volumeProperties[firstValidInput.inputIndex];
968
+
969
+ // Get the number of lights
970
+ if (firstVolumeProperty.getShade() && model.renderable.getBlendMode() === BlendMode.COMPOSITE_BLEND) {
971
+ ren.getLights().forEach(light => {
972
+ if (light.getSwitch() > 0) {
973
+ newNumberOfLights++;
974
+ }
975
+ });
976
+ }
977
+
978
+ // Number of components
979
+ const numberOfValidInputs = model.currentValidInputs.length;
980
+ const multiTexturePerVolumeEnabled = numberOfValidInputs > 1;
981
+ model.numberOfComponents = multiTexturePerVolumeEnabled ? numberOfValidInputs : firstScalars.getNumberOfComponents();
982
+ model.useIndependentComponents = getUseIndependentComponents(firstVolumeProperty, model.numberOfComponents);
975
983
  }
976
984
  if (newNumberOfLights !== model.numberOfLights) {
977
985
  model.numberOfLights = newNumberOfLights;
@@ -983,12 +991,6 @@ function vtkOpenGLVolumeMapper(publicAPI, model) {
983
991
  if (model.currentValidInputs.length === 0) {
984
992
  return;
985
993
  }
986
-
987
- // Number of components
988
- const numberOfValidInputs = model.currentValidInputs.length;
989
- const multiTexturePerVolumeEnabled = numberOfValidInputs > 1;
990
- model.numberOfComponents = multiTexturePerVolumeEnabled ? numberOfValidInputs : firstScalars.getNumberOfComponents();
991
- model.useIndependentComponents = getUseIndependentComponents(firstVolumeProperty, model.numberOfComponents);
992
994
  publicAPI.renderPieceStart(ren, actor);
993
995
  publicAPI.renderPieceDraw(ren, actor);
994
996
  publicAPI.renderPieceFinish(ren, actor);
@@ -1,5 +1,5 @@
1
1
  import { m as macro } from '../../macros2.js';
2
- import { d as dot, s as subtract, j as cross, w as multiplyScalar, k as add } from '../../Common/Core/Math/index.js';
2
+ import { d as dot, s as subtract, j as cross, x as multiplyScalar, k as add } from '../../Common/Core/Math/index.js';
3
3
  import vtkAbstractManipulator from './AbstractManipulator.js';
4
4
  import { EPSILON } from '../../Common/Core/Math/Constants.js';
5
5
 
@@ -1,7 +1,7 @@
1
1
  import { m as macro } from '../../macros2.js';
2
2
  import vtkActor from '../../Rendering/Core/Actor.js';
3
3
  import vtkMapper from '../../Rendering/Core/Mapper.js';
4
- import { D as areEquals } from '../../Common/Core/Math/index.js';
4
+ import { E as areEquals } from '../../Common/Core/Math/index.js';
5
5
  import vtkBoundingBox from '../../Common/DataModel/BoundingBox.js';
6
6
  import vtkTubeFilter from '../../Filters/General/TubeFilter.js';
7
7
  import { getPixelWorldHeightAtCoord } from '../Core/WidgetManager.js';
@@ -3,7 +3,7 @@ import vtkAbstractWidgetFactory from '../Core/AbstractWidgetFactory.js';
3
3
  import vtkPlanePointManipulator from '../Manipulators/PlaneManipulator.js';
4
4
  import vtkPolyLineRepresentation from '../Representations/PolyLineRepresentation.js';
5
5
  import vtkSphereHandleRepresentation from '../Representations/SphereHandleRepresentation.js';
6
- import { s as subtract, X as angleBetweenVectors } from '../../Common/Core/Math/index.js';
6
+ import { s as subtract, Z as angleBetweenVectors } from '../../Common/Core/Math/index.js';
7
7
  import widgetBehavior from './AngleWidget/behavior.js';
8
8
  import generateState from './AngleWidget/state.js';
9
9
  import { ViewTypes } from '../Core/WidgetManager/Constants.js';
@@ -1,4 +1,4 @@
1
- import { s as subtract, w as multiplyScalar, k as add, D as areEquals } from '../../../Common/Core/Math/index.js';
1
+ import { s as subtract, x as multiplyScalar, k as add, E as areEquals } from '../../../Common/Core/Math/index.js';
2
2
 
3
3
  function calculateTextPosition(model) {
4
4
  const vector = [0, 0, 0];
@@ -1,7 +1,7 @@
1
1
  import { m as macro } from '../../../macros2.js';
2
2
  import vtkBoundingBox from '../../../Common/DataModel/BoundingBox.js';
3
3
  import vtkLine from '../../../Common/DataModel/Line.js';
4
- import { k as add, l as normalize, s as subtract, d as dot, j as cross, m as multiplyAccumulate, w as multiplyScalar, Y as signedAngleBetweenVectors } from '../../../Common/Core/Math/index.js';
4
+ import { k as add, l as normalize, s as subtract, d as dot, j as cross, m as multiplyAccumulate, x as multiplyScalar, _ as signedAngleBetweenVectors } from '../../../Common/Core/Math/index.js';
5
5
  import { getLineNames, getOtherLineName, updateState, boundPointOnPlane, getLinePlaneName, getLineInPlaneName, rotateVector } from './helpers.js';
6
6
  import { InteractionMethodsName, ScrollingMethods, planeNameToViewType } from './Constants.js';
7
7
 
@@ -2,7 +2,7 @@ import vtkBoundingBox, { STATIC } from '../../../Common/DataModel/BoundingBox.js
2
2
  import vtkCubeSource from '../../../Filters/Sources/CubeSource.js';
3
3
  import vtkCutter from '../../../Filters/Core/Cutter.js';
4
4
  import vtkPlane from '../../../Common/DataModel/Plane.js';
5
- import { s as subtract, l as normalize, j as cross, w as multiplyScalar, m as multiplyAccumulate, Y as signedAngleBetweenVectors } from '../../../Common/Core/Math/index.js';
5
+ import { s as subtract, l as normalize, j as cross, x as multiplyScalar, m as multiplyAccumulate, _ as signedAngleBetweenVectors } from '../../../Common/Core/Math/index.js';
6
6
  import vtkMatrixBuilder from '../../../Common/Core/MatrixBuilder.js';
7
7
  import { viewTypeToPlaneName, planeNameToViewType, planeNames } from './Constants.js';
8
8
 
@@ -7,7 +7,7 @@ import vtkPlaneSource from '../../Filters/Sources/PlaneSource.js';
7
7
  import vtkPlanePointManipulator from '../Manipulators/PlaneManipulator.js';
8
8
  import vtkLineHandleRepresentation from '../Representations/LineHandleRepresentation.js';
9
9
  import vtkSphereHandleRepresentation from '../Representations/SphereHandleRepresentation.js';
10
- import { e as distance2BetweenPoints, m as multiplyAccumulate, s as subtract, l as normalize, w as multiplyScalar, k as add } from '../../Common/Core/Math/index.js';
10
+ import { e as distance2BetweenPoints, m as multiplyAccumulate, s as subtract, l as normalize, x as multiplyScalar, k as add } from '../../Common/Core/Math/index.js';
11
11
  import widgetBehavior from './ResliceCursorWidget/behavior.js';
12
12
  import generateState from './ResliceCursorWidget/state.js';
13
13
  import { updateState, transformPlane, boundPlane } from './ResliceCursorWidget/helpers.js';
package/index.d.ts CHANGED
@@ -52,6 +52,7 @@
52
52
  /// <reference path="./Common/DataModel/Spline3D/Constants.d.ts" />
53
53
  /// <reference path="./Common/DataModel/Spline3D.d.ts" />
54
54
  /// <reference path="./Common/DataModel/Triangle.d.ts" />
55
+ /// <reference path="./Common/DataModel/TriangleStrip.d.ts" />
55
56
  /// <reference path="./Common/Transform/LandmarkTransform.d.ts" />
56
57
  /// <reference path="./Common/Transform/Transform.d.ts" />
57
58
  /// <reference path="./Filters/Core/ThresholdPoints.d.ts" />
@@ -66,6 +67,7 @@
66
67
  /// <reference path="./Filters/General/ImageStreamline.d.ts" />
67
68
  /// <reference path="./Filters/General/LineFilter.d.ts" />
68
69
  /// <reference path="./Filters/General/OutlineFilter.d.ts" />
70
+ /// <reference path="./Filters/General/TransformPolyDataFilter.d.ts" />
69
71
  /// <reference path="./Filters/General/TriangleFilter.d.ts" />
70
72
  /// <reference path="./Filters/General/TubeFilter.d.ts" />
71
73
  /// <reference path="./Filters/Sources/Arrow2DSource.d.ts" />
@@ -111,6 +113,7 @@
111
113
  /// <reference path="./IO/Misc/JSONReader.d.ts" />
112
114
  /// <reference path="./IO/Misc/MTLReader.d.ts" />
113
115
  /// <reference path="./IO/Misc/OBJReader.d.ts" />
116
+ /// <reference path="./IO/Misc/OBJWriter.d.ts" />
114
117
  /// <reference path="./IO/Misc/PDBReader.d.ts" />
115
118
  /// <reference path="./IO/XML/XMLImageDataReader.d.ts" />
116
119
  /// <reference path="./IO/XML/XMLPolyDataReader.d.ts" />
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@kitware/vtk.js",
3
- "version": "34.5.0",
3
+ "version": "34.7.0",
4
4
  "description": "Visualization Toolkit for the Web",
5
5
  "keywords": [
6
6
  "3d",