@kitware/vtk.js 29.0.0 → 29.1.1

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.
@@ -2245,4 +2245,4 @@ var vtkMath$1 = /*#__PURE__*/Object.freeze({
2245
2245
  'default': vtkMath
2246
2246
  });
2247
2247
 
2248
- export { ceilLog2 as $, degreesFromRadians as A, areEquals as B, clampValue as C, arrayRange as D, getMajorAxisIndex as E, createUninitializedBounds as F, floor as G, isInf as H, rgb2hsv as I, rgb2lab as J, lab2rgb as K, round as L, normalize2D as M, nearestPowerOfTwo as N, multiply3x3_vect3 as O, getSparseOrthogonalMatrix 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, float2CssRGBA 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, computeBoundsFromPoints as aN, clampAndNormalizeValue as aO, getScalarTypeFittingRange as aP, getAdjustedScalarRange as aQ, extentIsWithinOtherExtent as aR, boundsIsWithinOtherBounds as aS, pointIsWithinBounds as aT, solve3PointCircle as aU, inf as aV, negInf as aW, isFinite as aX, isNaN as aY, floatToHex2 as aZ, floatRGB2HexCode 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, clampVector as c, dot as d, distance2BetweenPoints as e, vtkMath 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, jacobi as t, uninitializeBounds as u, vtkMath$1 as v, multiplyScalar as w, random as x, determinant3x3 as y, rowsToMat3 as z };
2248
+ export { arrayMax as $, degreesFromRadians as A, areEquals as B, clampValue as C, arrayRange as D, getMajorAxisIndex as E, createUninitializedBounds as F, isIdentity3x3 as G, floor as H, isInf as I, rgb2hsv as J, rgb2lab as K, lab2rgb as L, round as M, normalize2D as N, nearestPowerOfTwo as O, multiply3x3_vect3 as P, getSparseOrthogonalMatrix as Q, areBoundsInitialized as R, isPowerOfTwo as S, angleBetweenVectors as T, signedAngleBetweenVectors as U, createArray as V, Pi as W, ceil as X, min as Y, max as Z, arrayMin as _, areMatricesEqual as a, float2CssRGBA as a$, ceilLog2 as a0, factorial as a1, binomial as a2, beginCombination as a3, nextCombination as a4, randomSeed as a5, getSeed as a6, gaussian as a7, multiplyScalar2D as a8, multiplyAccumulate2D 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, computeBoundsFromPoints as aN, clampAndNormalizeValue as aO, getScalarTypeFittingRange as aP, getAdjustedScalarRange as aQ, extentIsWithinOtherExtent as aR, boundsIsWithinOtherBounds as aS, pointIsWithinBounds as aT, solve3PointCircle as aU, inf as aV, negInf as aW, isFinite as aX, isNaN as aY, floatToHex2 as aZ, floatRGB2HexCode as a_, outer as aa, projectVector as ab, dot2D as ac, projectVector2D as ad, gaussianAmplitude as ae, gaussianWeight as af, outer2D as ag, norm2D as ah, rowsToMat4 as ai, columnsToMat4 as aj, columnsToMat3 as ak, LUFactor3x3 as al, LUSolve3x3 as am, linearSolve3x3 as an, multiply3x3_mat3 as ao, multiplyMatrix as ap, transpose3x3 as aq, invert3x3 as ar, identity3x3 as as, identity as at, isIdentity as au, quaternionToMatrix3x3 as av, roundNumber as aw, matrix3x3ToQuaternion as ax, multiplyQuaternion as ay, orthogonalize3x3 as az, roundVector as b, clampVector as c, dot as d, distance2BetweenPoints as e, vtkMath 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, jacobi as t, uninitializeBounds as u, vtkMath$1 as v, multiplyScalar as w, random as x, determinant3x3 as y, rowsToMat3 as z };
@@ -1,4 +1,4 @@
1
1
  import 'seedrandom';
2
2
  import '../../macros2.js';
3
3
  import './Math/Constants.js';
4
- export { ak as LUFactor3x3, al as LUSolve3x3, V as Pi, k as add, S as angleBetweenVectors, Q as areBoundsInitialized, B as areEquals, a as areMatricesEqual, _ as arrayMax, Z as arrayMin, D as arrayRange, a2 as beginCombination, a1 as binomial, aS as boundsIsWithinOtherBounds, W as ceil, $ as ceilLog2, aO as clampAndNormalizeValue, C as clampValue, c as clampVector, aj as columnsToMat3, ai as columnsToMat4, aN as computeBoundsFromPoints, U as createArray, F as createUninitializedBounds, j as cross, f as default, A as degreesFromRadians, o as determinant2x2, y as determinant3x3, aA as diagonalize3x3, e as distance2BetweenPoints, d as dot, ab as dot2D, aF as estimateMatrixCondition, aR as extentIsWithinOtherExtent, a0 as factorial, a$ as float2CssRGBA, a_ as floatRGB2HexCode, aZ as floatToHex2, G as floor, a6 as gaussian, ad as gaussianAmplitude, ae as gaussianWeight, aQ as getAdjustedScalarRange, E as getMajorAxisIndex, aP as getScalarTypeFittingRange, a5 as getSeed, P as getSparseOrthogonalMatrix, aI as hex2float, h as hsv2rgb, as as identity, ar as identity3x3, aV as inf, aq as invert3x3, aE as invertMatrix, aX as isFinite, at as isIdentity, au as isIdentity3x3, H as isInf, aY as isNaN, i as isNan, R as isPowerOfTwo, t as jacobi, p as jacobiN, K 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, O as multiply3x3_vect3, m as multiplyAccumulate, a8 as multiplyAccumulate2D, ao as multiplyMatrix, ay as multiplyQuaternion, w as multiplyScalar, a7 as multiplyScalar2D, N as nearestPowerOfTwo, aW as negInf, a3 as nextCombination, n as norm, ag as norm2D, l as normalize, M as normalize2D, az as orthogonalize3x3, a9 as outer, af as outer2D, q as perpendiculars, aT as pointIsWithinBounds, aa as projectVector, ac as projectVector2D, av as quaternionToMatrix3x3, r as radiansFromDegrees, x as random, a4 as randomSeed, I as rgb2hsv, J as rgb2lab, aM as rgb2xyz, L as round, aw as roundNumber, b as roundVector, z as rowsToMat3, ah as rowsToMat4, T as signedAngleBetweenVectors, aB as singularValueDecomposition3x3, aU as solve3PointCircle, aG as solveHomogeneousLeastSquares, aH as solveLeastSquares, g as solveLinearSystem, s as subtract, ap as transpose3x3, u as uninitializeBounds, aK as xyz2lab, aL as xyz2rgb } from './Math/index.js';
4
+ export { al as LUFactor3x3, am as LUSolve3x3, W as Pi, k as add, T as angleBetweenVectors, R as areBoundsInitialized, B as areEquals, a as areMatricesEqual, $ as arrayMax, _ as arrayMin, D as arrayRange, a3 as beginCombination, a2 as binomial, aS as boundsIsWithinOtherBounds, X as ceil, a0 as ceilLog2, aO as clampAndNormalizeValue, C as clampValue, c as clampVector, ak as columnsToMat3, aj as columnsToMat4, aN as computeBoundsFromPoints, V as createArray, F as createUninitializedBounds, j as cross, f as default, A as degreesFromRadians, o as determinant2x2, y as determinant3x3, aA as diagonalize3x3, e as distance2BetweenPoints, d as dot, ac as dot2D, aF as estimateMatrixCondition, aR as extentIsWithinOtherExtent, a1 as factorial, a$ as float2CssRGBA, a_ as floatRGB2HexCode, aZ as floatToHex2, H as floor, a7 as gaussian, ae as gaussianAmplitude, af as gaussianWeight, aQ as getAdjustedScalarRange, E as getMajorAxisIndex, aP as getScalarTypeFittingRange, a6 as getSeed, Q as getSparseOrthogonalMatrix, aI as hex2float, h as hsv2rgb, at as identity, as as identity3x3, aV as inf, ar as invert3x3, aE as invertMatrix, aX as isFinite, au as isIdentity, G as isIdentity3x3, I as isInf, aY as isNaN, i as isNan, S as isPowerOfTwo, t as jacobi, p as jacobiN, L as lab2rgb, aJ as lab2xyz, an as linearSolve3x3, aC as luFactorLinearSystem, aD as luSolveLinearSystem, ax as matrix3x3ToQuaternion, Z as max, Y as min, ao as multiply3x3_mat3, P as multiply3x3_vect3, m as multiplyAccumulate, a9 as multiplyAccumulate2D, ap as multiplyMatrix, ay as multiplyQuaternion, w as multiplyScalar, a8 as multiplyScalar2D, O as nearestPowerOfTwo, aW as negInf, a4 as nextCombination, n as norm, ah as norm2D, l as normalize, N as normalize2D, az as orthogonalize3x3, aa as outer, ag as outer2D, q as perpendiculars, aT as pointIsWithinBounds, ab as projectVector, ad as projectVector2D, av as quaternionToMatrix3x3, r as radiansFromDegrees, x as random, a5 as randomSeed, J as rgb2hsv, K as rgb2lab, aM as rgb2xyz, M as round, aw as roundNumber, b as roundVector, z as rowsToMat3, ai as rowsToMat4, U as signedAngleBetweenVectors, aB as singularValueDecomposition3x3, aU as solve3PointCircle, aG as solveHomogeneousLeastSquares, aH as solveLeastSquares, g as solveLinearSystem, s as subtract, aq as transpose3x3, u as uninitializeBounds, aK as xyz2lab, aL as xyz2rgb } from './Math/index.js';
@@ -13,6 +13,7 @@ export interface ICellPickerInitialValues extends IPickerInitialValues {
13
13
  cellIJK?: number[];
14
14
  pickNormal?: number[];
15
15
  mapperNormal?: number[];
16
+ opacityThreshold?:number;
16
17
  }
17
18
 
18
19
  export interface vtkCellPicker extends vtkPicker {
@@ -42,6 +43,16 @@ export interface vtkCellPicker extends vtkPicker {
42
43
  */
43
44
  getMapperNormalByReference(): number[];
44
45
 
46
+ /**
47
+ * Get the opacity threshold for volume picking
48
+ */
49
+ getOpacityThreshold(): number;
50
+
51
+ /**
52
+ * Get the opacity threshold for volume picking
53
+ */
54
+ setOpacityThreshold(value: number);
55
+
45
56
  /**
46
57
  * Get the parametric coordinates of the picked cell.
47
58
  */
@@ -5,9 +5,10 @@ import vtkPicker from './Picker.js';
5
5
  import vtkPolyLine from '../../Common/DataModel/PolyLine.js';
6
6
  import vtkTriangle from '../../Common/DataModel/Triangle.js';
7
7
  import vtkQuad from '../../Common/DataModel/Quad.js';
8
- import { l as normalize } from '../../Common/Core/Math/index.js';
8
+ import { l as normalize, G as isIdentity3x3 } from '../../Common/Core/Math/index.js';
9
9
  import { CellType } from '../../Common/DataModel/CellTypes/Constants.js';
10
- import { vec3 } from 'gl-matrix';
10
+ import { vec3, vec4 } from 'gl-matrix';
11
+ import vtkMatrixBuilder from '../../Common/Core/MatrixBuilder.js';
11
12
 
12
13
  // ----------------------------------------------------------------------------
13
14
  // Global methods
@@ -156,7 +157,7 @@ function vtkCellPicker(publicAPI, model) {
156
157
  }
157
158
  return pickResult;
158
159
  };
159
- publicAPI.intersectWithLine = (p1, p2, tol, mapper) => {
160
+ publicAPI.intersectWithLine = (p1, p2, tol, actor, mapper) => {
160
161
  let tMin = Number.MAX_VALUE;
161
162
  const t1 = 0.0;
162
163
  const t2 = 1.0;
@@ -172,6 +173,8 @@ function vtkCellPicker(publicAPI, model) {
172
173
  model.cellIJK = pickData.ijk;
173
174
  model.pCoords = pickData.pCoords;
174
175
  }
176
+ } else if (mapper.isA('vtkVolumeMapper')) {
177
+ tMin = publicAPI.intersectVolumeWithLine(p1, p2, clipLine.t1, clipLine.t2, tol, actor);
175
178
  } else if (mapper.isA('vtkMapper')) {
176
179
  tMin = publicAPI.intersectActorWithLine(p1, p2, t1, t2, tol, mapper);
177
180
  }
@@ -198,6 +201,109 @@ function vtkCellPicker(publicAPI, model) {
198
201
  }
199
202
  return tMin;
200
203
  };
204
+ publicAPI.intersectVolumeWithLine = (p1, p2, t1, t2, tol, volume) => {
205
+ let tMin = Number.MAX_VALUE;
206
+ const mapper = volume.getMapper();
207
+ const imageData = mapper.getInputData();
208
+ const origin = imageData.getOrigin();
209
+ const spacing = imageData.getSpacing();
210
+ const dims = imageData.getDimensions();
211
+ const scalars = imageData.getPointData().getScalars().getData();
212
+ const extent = imageData.getExtent();
213
+ const direction = imageData.getDirection();
214
+ let imageTransform;
215
+ if (!isIdentity3x3(direction)) {
216
+ imageTransform = vtkMatrixBuilder.buildFromRadian().translate(origin[0], origin[1], origin[2]).multiply3x3(direction).translate(-origin[0], -origin[1], -origin[2]).invert().getMatrix();
217
+ }
218
+
219
+ // calculate opacity table
220
+ const numIComps = 1;
221
+ const oWidth = 1024;
222
+ const tmpTable = new Float32Array(oWidth);
223
+ const opacityArray = new Float32Array(oWidth);
224
+ let ofun;
225
+ let oRange;
226
+ const sampleDist = volume.getMapper().getSampleDistance();
227
+ for (let c = 0; c < numIComps; ++c) {
228
+ ofun = volume.getProperty().getScalarOpacity(c);
229
+ oRange = ofun.getRange();
230
+ ofun.getTable(oRange[0], oRange[1], oWidth, tmpTable, 1);
231
+ const opacityFactor = sampleDist / volume.getProperty().getScalarOpacityUnitDistance(c);
232
+
233
+ // adjust for sample distance etc
234
+ for (let i = 0; i < oWidth; ++i) {
235
+ opacityArray[i] = 1.0 - (1.0 - tmpTable[i]) ** opacityFactor;
236
+ }
237
+ }
238
+ const scale = oWidth / (oRange[1] - oRange[0] + 1);
239
+
240
+ // Make a new p1 and p2 using the clipped t1 and t2
241
+ const q1 = [0, 0, 0];
242
+ const q2 = [0, 0, 0];
243
+ q1[0] = p1[0];
244
+ q1[1] = p1[1];
245
+ q1[2] = p1[2];
246
+ q2[0] = p2[0];
247
+ q2[1] = p2[1];
248
+ q2[2] = p2[2];
249
+ if (t1 !== 0.0 || t2 !== 1.0) {
250
+ for (let j = 0; j < 3; j++) {
251
+ q1[j] = p1[j] * (1.0 - t1) + p2[j] * t1;
252
+ q2[j] = p1[j] * (1.0 - t2) + p2[j] * t2;
253
+ }
254
+ }
255
+ const x1 = [0, 0, 0];
256
+ const x2 = [0, 0, 0];
257
+ for (let i = 0; i < 3; i++) {
258
+ x1[i] = (p1[i] - origin[i]) / spacing[i];
259
+ x2[i] = (p2[i] - origin[i]) / spacing[i];
260
+ }
261
+ const x = [0, 0, 0, 0];
262
+ const xi = [0, 0, 0];
263
+ const sliceSize = dims[1] * dims[0];
264
+ const rowSize = dims[0];
265
+ const nSteps = 100;
266
+ let insideVolume;
267
+ for (let t = t1; t < t2; t += 1 / nSteps) {
268
+ // calculate the location of the point
269
+ insideVolume = true;
270
+ for (let j = 0; j < 3; j++) {
271
+ // "t" is the fractional distance between endpoints x1 and x2
272
+ x[j] = x1[j] * (1.0 - t) + x2[j] * t;
273
+ }
274
+ x[3] = 1.0;
275
+ if (imageTransform) {
276
+ vec4.transformMat4(x, x, imageTransform);
277
+ }
278
+ for (let j = 0; j < 3; j++) {
279
+ // Bounds check
280
+ if (x[j] < extent[2 * j]) {
281
+ x[j] = extent[2 * j];
282
+ insideVolume = false;
283
+ } else if (x[j] > extent[2 * j + 1]) {
284
+ x[j] = extent[2 * j + 1];
285
+ insideVolume = false;
286
+ }
287
+ xi[j] = Math.round(x[j]);
288
+ }
289
+ if (insideVolume) {
290
+ const index = xi[2] * sliceSize + xi[1] * rowSize + xi[0];
291
+ let value = scalars[index];
292
+ if (value < oRange[0]) {
293
+ value = oRange[0];
294
+ } else if (value > oRange[1]) {
295
+ value = oRange[1];
296
+ }
297
+ value = Math.floor((value - oRange[0]) * scale);
298
+ const opacity = tmpTable[value];
299
+ if (opacity > model.opacityThreshold) {
300
+ tMin = t;
301
+ break;
302
+ }
303
+ }
304
+ }
305
+ return tMin;
306
+ };
201
307
  publicAPI.intersectActorWithLine = (p1, p2, t1, t2, tol, mapper) => {
202
308
  let tMin = Number.MAX_VALUE;
203
309
  const minXYZ = [0, 0, 0];
@@ -337,7 +443,8 @@ const DEFAULT_VALUES = {
337
443
  pCoords: [],
338
444
  cellIJK: [],
339
445
  pickNormal: [],
340
- mapperNormal: []
446
+ mapperNormal: [],
447
+ opacityThreshold: 0.2
341
448
  };
342
449
 
343
450
  // ----------------------------------------------------------------------------
@@ -349,6 +456,7 @@ function extend(publicAPI, model) {
349
456
  // Inheritance
350
457
  vtkPicker.extend(publicAPI, model, initialValues);
351
458
  macro.getArray(publicAPI, model, ['pickNormal', 'mapperNormal', 'pCoords', 'cellIJK']);
459
+ macro.setGet(publicAPI, model, ['opacityThreshold']);
352
460
  macro.get(publicAPI, model, ['cellId']);
353
461
 
354
462
  // Object methods
@@ -1,5 +1,5 @@
1
1
  import { m as macro } from '../../macros2.js';
2
- import { h as hsv2rgb, i as isNan, G as floor, H as isInf, I as rgb2hsv, J as rgb2lab, K as lab2rgb } from '../../Common/Core/Math/index.js';
2
+ import { h as hsv2rgb, i as isNan, H as floor, I as isInf, J as rgb2hsv, K as rgb2lab, L 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 { L as round, G as floor } from '../../Common/Core/Math/index.js';
3
+ import { M as round, H 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 { M as normalize2D, N as nearestPowerOfTwo } from '../../Common/Core/Math/index.js';
3
+ import { N as normalize2D, O 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 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 { C as clampValue, O as multiply3x3_vect3, F as createUninitializedBounds, P as getSparseOrthogonalMatrix } from '../../Common/Core/Math/index.js';
5
+ import { C as clampValue, P as multiply3x3_vect3, F as createUninitializedBounds, Q as getSparseOrthogonalMatrix } from '../../Common/Core/Math/index.js';
6
6
  import CoincidentTopologyHelper from './Mapper/CoincidentTopologyHelper.js';
7
7
 
8
8
  const {
@@ -180,7 +180,7 @@ function vtkPicker(publicAPI, model) {
180
180
  props.forEach(prop => {
181
181
  const mapper = prop.getMapper();
182
182
  pickable = prop.getNestedPickable() && prop.getNestedVisibility();
183
- if (prop.getProperty().getOpacity() <= 0.0) {
183
+ if (prop.getProperty().getOpacity?.() <= 0.0) {
184
184
  pickable = false;
185
185
  }
186
186
  if (pickable) {
@@ -214,7 +214,7 @@ function vtkPicker(publicAPI, model) {
214
214
  bbox.reset();
215
215
  }
216
216
  if (bbox.intersectBox(p1Mapper, ray, hitPosition, t)) {
217
- t[0] = publicAPI.intersectWithLine(p1Mapper, p2Mapper, tol * 0.333 * (scale[0] + scale[1] + scale[2]), mapper);
217
+ t[0] = publicAPI.intersectWithLine(p1Mapper, p2Mapper, tol * 0.333 * (scale[0] + scale[1] + scale[2]), prop, mapper);
218
218
  if (t[0] < Number.MAX_VALUE) {
219
219
  const p = [];
220
220
  p[0] = (1.0 - t[0]) * p1World[0] + t[0] * p2World[0];
@@ -246,6 +246,30 @@ function vtkPicker(publicAPI, model) {
246
246
  publicAPI.invokePickChange(model.pickedPositions);
247
247
  return 1;
248
248
  });
249
+ // sort array by distance
250
+ const tempArray = [];
251
+ for (let i = 0; i < model.pickedPositions.length; i++) {
252
+ tempArray.push({
253
+ actor: model.actors[i],
254
+ pickedPosition: model.pickedPositions[i],
255
+ distance2: distance2BetweenPoints(p1World, model.pickedPositions[i])
256
+ });
257
+ }
258
+ tempArray.sort((a, b) => {
259
+ const keyA = a.distance2;
260
+ const keyB = b.distance2;
261
+ // order the actors based on the distance2 attribute, so the near actors comes
262
+ // first in the list
263
+ if (keyA < keyB) return -1;
264
+ if (keyA > keyB) return 1;
265
+ return 0;
266
+ });
267
+ model.pickedPositions = [];
268
+ model.actors = [];
269
+ tempArray.forEach(obj => {
270
+ model.pickedPositions.push(obj.pickedPosition);
271
+ model.actors.push(obj.actor);
272
+ });
249
273
  };
250
274
  }
251
275
 
@@ -13,7 +13,7 @@ const {
13
13
  function vtkPointPicker(publicAPI, model) {
14
14
  // Set our className
15
15
  model.classHierarchy.push('vtkPointPicker');
16
- publicAPI.intersectWithLine = (p1, p2, tol, mapper) => {
16
+ publicAPI.intersectWithLine = (p1, p2, tol, actor, mapper) => {
17
17
  let tMin = Number.MAX_VALUE;
18
18
  if (mapper.isA('vtkImageMapper') || mapper.isA('vtkImageArrayMapper')) {
19
19
  const pickData = mapper.intersectWithLineForPointPicking(p1, p2);
@@ -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 { Q as areBoundsInitialized, u as uninitializeBounds, r as radiansFromDegrees, d as dot, F as createUninitializedBounds } from '../../Common/Core/Math/index.js';
5
+ import { R as areBoundsInitialized, u as uninitializeBounds, r as radiansFromDegrees, d as dot, F 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 { N as nearestPowerOfTwo } from '../../Common/Core/Math/index.js';
2
+ import { O 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';
@@ -1,5 +1,5 @@
1
1
  import { m as macro } from '../../macros2.js';
2
- import { F as createUninitializedBounds, C as clampValue, G as floor } from '../../Common/Core/Math/index.js';
2
+ import { F as createUninitializedBounds, C as clampValue, H as floor } from '../../Common/Core/Math/index.js';
3
3
  import Constants from './VolumeMapper/Constants.js';
4
4
  import vtkAbstractMapper from './AbstractMapper.js';
5
5
  import vtkPiecewiseFunction from '../../Common/DataModel/PiecewiseFunction.js';
@@ -9,6 +9,8 @@ import '../../Common/Core/DataArray.js';
9
9
  import '../../Common/DataModel/PolyData.js';
10
10
  import '../Core/Actor.js';
11
11
  import '../Core/Mapper.js';
12
+ import '../OpenGL/RenderWindow.js';
13
+ import '../WebGPU/RenderWindow.js';
12
14
 
13
15
  // Process arguments from URL
14
16
  const userParams = vtkURLExtract.extractURLParameters();
@@ -8,7 +8,7 @@ import { v as vtkPolyData2DVS } from './glsl/vtkPolyData2DVS.glsl.js';
8
8
  import vtkReplacementShaderMapper from './ReplacementShaderMapper.js';
9
9
  import vtkShaderProgram from './ShaderProgram.js';
10
10
  import vtkViewNode from '../SceneGraph/ViewNode.js';
11
- import { L as round } from '../../Common/Core/Math/index.js';
11
+ import { M 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
 
@@ -2,7 +2,7 @@ import Constants from './Texture/Constants.js';
2
2
  import HalfFloat from '../../Common/Core/HalfFloat.js';
3
3
  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';
4
4
  import vtkDataArray from '../../Common/Core/DataArray.js';
5
- import { R as isPowerOfTwo, N as nearestPowerOfTwo } from '../../Common/Core/Math/index.js';
5
+ import { S as isPowerOfTwo, O as nearestPowerOfTwo } from '../../Common/Core/Math/index.js';
6
6
  import vtkViewNode from '../SceneGraph/ViewNode.js';
7
7
  import { registerOverride } from './ViewNodeFactory.js';
8
8
 
@@ -60,6 +60,7 @@ function vtkOpenGLVolume(publicAPI, model) {
60
60
  } else {
61
61
  mat3.fromMat4(model.normalMatrix, model.MCWCMatrix);
62
62
  mat3.invert(model.normalMatrix, model.normalMatrix);
63
+ mat3.transpose(model.normalMatrix, model.normalMatrix);
63
64
  }
64
65
  model.keyMatrixTime.modified();
65
66
  }
@@ -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, S as angleBetweenVectors } from '../../Common/Core/Math/index.js';
6
+ import { s as subtract, T 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,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, T 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, w as multiplyScalar, U 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, T as signedAngleBetweenVectors } from '../../../Common/Core/Math/index.js';
5
+ import { s as subtract, l as normalize, j as cross, w as multiplyScalar, m as multiplyAccumulate, U 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
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@kitware/vtk.js",
3
- "version": "29.0.0",
3
+ "version": "29.1.1",
4
4
  "description": "Visualization Toolkit for the Web",
5
5
  "keywords": [
6
6
  "3d",