@kitware/vtk.js 25.7.3 → 25.7.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/Common/Core/CellArray.d.ts +2 -2
- package/Common/Core/DataArray.d.ts +18 -15
- package/Common/Core/DataArray.js +9 -15
- package/Common/Core/MatrixBuilder.d.ts +2 -2
- package/Common/Core/Points.d.ts +4 -4
- package/Common/Core/StringArray.js +1 -2
- package/Common/Core/VariantArray.js +1 -2
- package/Common/DataModel/BoundingBox.js +37 -13
- package/Common/DataModel/ImageData.js +12 -52
- package/Filters/General/ClipClosedSurface.js +2 -4
- package/Filters/General/ImageStreamline.js +5 -2
- package/Filters/General/PaintFilter.js +2 -1
- package/Filters/General/TubeFilter.js +3 -8
- package/Filters/General/WindowedSincPolyDataFilter.js +7 -9
- package/Rendering/OpenGL/PolyDataMapper2D.js +3 -1
- package/package.json +1 -1
- package/types.d.ts +0 -1
|
@@ -25,9 +25,9 @@ export interface vtkCellArray extends vtkDataArray {
|
|
|
25
25
|
|
|
26
26
|
/**
|
|
27
27
|
* Set the data of this array.
|
|
28
|
-
* @param {TypedArray} typedArray The Array value.
|
|
28
|
+
* @param {Number[]|TypedArray} typedArray The Array value.
|
|
29
29
|
*/
|
|
30
|
-
setData(typedArray: TypedArray): void;
|
|
30
|
+
setData(typedArray: number[]|TypedArray): void;
|
|
31
31
|
|
|
32
32
|
/**
|
|
33
33
|
* Returns the point indices at the given location as a subarray.
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { vtkObject, vtkRange } from './../../interfaces';
|
|
2
|
-
import { float, int, Nullable, TypedArray } from './../../types';
|
|
2
|
+
import { float, int, Nullable, Range, TypedArray } from './../../types';
|
|
3
3
|
|
|
4
4
|
|
|
5
5
|
/**
|
|
@@ -30,7 +30,7 @@ export interface IDataArrayInitialValues {
|
|
|
30
30
|
empty?: boolean;
|
|
31
31
|
name?: string;
|
|
32
32
|
numberOfComponents?: number;
|
|
33
|
-
rangeTuple?:
|
|
33
|
+
rangeTuple?: Range;
|
|
34
34
|
size?: number;
|
|
35
35
|
values?: Array<number>|TypedArray;
|
|
36
36
|
}
|
|
@@ -60,21 +60,21 @@ export interface vtkDataArray extends vtkObject {
|
|
|
60
60
|
/**
|
|
61
61
|
*
|
|
62
62
|
*/
|
|
63
|
-
getData(): TypedArray;
|
|
63
|
+
getData(): number[]|TypedArray;
|
|
64
64
|
|
|
65
65
|
/**
|
|
66
66
|
* Get the range of the given component.
|
|
67
67
|
*
|
|
68
68
|
* @param {Number} componentIndex (default: -1)
|
|
69
69
|
*/
|
|
70
|
-
getRange(componentIndex?: number):
|
|
70
|
+
getRange(componentIndex?: number): Range;
|
|
71
71
|
|
|
72
72
|
/**
|
|
73
73
|
*
|
|
74
74
|
* @param {vtkRange} rangeValue
|
|
75
75
|
* @param {Number} componentIndex
|
|
76
76
|
*/
|
|
77
|
-
setRange(rangeValue: vtkRange, componentIndex: number):
|
|
77
|
+
setRange(rangeValue: vtkRange, componentIndex: number): Range;
|
|
78
78
|
|
|
79
79
|
/**
|
|
80
80
|
* Set the given tuple at the given index.
|
|
@@ -93,17 +93,20 @@ export interface vtkDataArray extends vtkObject {
|
|
|
93
93
|
/**
|
|
94
94
|
* Get the tuple at the given index.
|
|
95
95
|
*
|
|
96
|
-
*
|
|
96
|
+
* For performance reasons, it is advised to pass a 'tupleToFill':
|
|
97
97
|
* `const x = [];`
|
|
98
|
-
* `
|
|
98
|
+
* `for (int i = 0; i < N; ++i) {
|
|
99
|
+
* ` dataArray.getTuple(idx, x);`
|
|
100
|
+
* ` ...`
|
|
99
101
|
* instead of:
|
|
100
|
-
* `
|
|
101
|
-
*
|
|
102
|
+
* `for (int i = 0; i < N; ++i) {
|
|
103
|
+
* ` const x = dataArray.getTuple(idx);`
|
|
104
|
+
* `...`
|
|
102
105
|
* @param {Number} idx
|
|
103
|
-
* @param {
|
|
104
|
-
* @returns {
|
|
106
|
+
* @param {Number[]|TypedArray} [tupleToFill] (default [])
|
|
107
|
+
* @returns {Number[]|TypedArray}
|
|
105
108
|
*/
|
|
106
|
-
getTuple(idx: number, tupleToFill?:
|
|
109
|
+
getTuple(idx: number, tupleToFill?: number[]|TypedArray): number[]|TypedArray;
|
|
107
110
|
|
|
108
111
|
/**
|
|
109
112
|
* Get the tuples between fromId (inclusive) and toId (exclusive).
|
|
@@ -223,10 +226,10 @@ export interface vtkDataArray extends vtkObject {
|
|
|
223
226
|
* If this dataArray's numberOfComponents doesn't divide the given array's
|
|
224
227
|
* length, this dataArray's numberOfComponents is set to 1.
|
|
225
228
|
*
|
|
226
|
-
* @param {TypedArray} typedArray
|
|
227
|
-
* @param {Number} [numberOfComponents]
|
|
229
|
+
* @param {Number[]|TypedArray} typedArray The Array value.
|
|
230
|
+
* @param {Number} [numberOfComponents]
|
|
228
231
|
*/
|
|
229
|
-
setData(typedArray: TypedArray, numberOfComponents?: number): void;
|
|
232
|
+
setData(typedArray: number[]|TypedArray, numberOfComponents?: number): void;
|
|
230
233
|
|
|
231
234
|
/**
|
|
232
235
|
* Get the state of this array.
|
package/Common/Core/DataArray.js
CHANGED
|
@@ -7,8 +7,7 @@ function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (O
|
|
|
7
7
|
|
|
8
8
|
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
9
9
|
var vtkErrorMacro = vtkErrorMacro$1;
|
|
10
|
-
var DefaultDataType = Constants.DefaultDataType;
|
|
11
|
-
var TUPLE_HOLDER = []; // ----------------------------------------------------------------------------
|
|
10
|
+
var DefaultDataType = Constants.DefaultDataType; // ----------------------------------------------------------------------------
|
|
12
11
|
// Global methods
|
|
13
12
|
// ----------------------------------------------------------------------------
|
|
14
13
|
// Original source from https://www.npmjs.com/package/compute-range
|
|
@@ -132,9 +131,11 @@ function getDataType(typedArray) {
|
|
|
132
131
|
function getMaxNorm(normArray) {
|
|
133
132
|
var numComps = normArray.getNumberOfComponents();
|
|
134
133
|
var maxNorm = 0.0;
|
|
134
|
+
var tuple = new Array(numComps);
|
|
135
135
|
|
|
136
136
|
for (var i = 0; i < normArray.getNumberOfTuples(); ++i) {
|
|
137
|
-
|
|
137
|
+
normArray.getTuple(i, tuple);
|
|
138
|
+
var norm$1 = norm(tuple, numComps);
|
|
138
139
|
|
|
139
140
|
if (norm$1 > maxNorm) {
|
|
140
141
|
maxNorm = norm$1;
|
|
@@ -335,13 +336,8 @@ function vtkDataArray(publicAPI, model) {
|
|
|
335
336
|
};
|
|
336
337
|
|
|
337
338
|
publicAPI.getTuple = function (idx) {
|
|
338
|
-
var tupleToFill = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] :
|
|
339
|
+
var tupleToFill = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : [];
|
|
339
340
|
var numberOfComponents = model.numberOfComponents || 1;
|
|
340
|
-
|
|
341
|
-
if (tupleToFill.length !== numberOfComponents) {
|
|
342
|
-
tupleToFill.length = numberOfComponents;
|
|
343
|
-
}
|
|
344
|
-
|
|
345
341
|
var offset = idx * numberOfComponents; // Check most common component sizes first
|
|
346
342
|
// to avoid doing a for loop if possible
|
|
347
343
|
|
|
@@ -363,7 +359,7 @@ function vtkDataArray(publicAPI, model) {
|
|
|
363
359
|
break;
|
|
364
360
|
|
|
365
361
|
default:
|
|
366
|
-
for (var i =
|
|
362
|
+
for (var i = numberOfComponents - 1; i >= 0; --i) {
|
|
367
363
|
tupleToFill[i] = model.values[offset + i];
|
|
368
364
|
}
|
|
369
365
|
|
|
@@ -482,12 +478,10 @@ function vtkDataArray(publicAPI, model) {
|
|
|
482
478
|
vtkErrorMacro('numberOfComponents must match');
|
|
483
479
|
}
|
|
484
480
|
|
|
485
|
-
var tuple1 =
|
|
486
|
-
var tuple2 =
|
|
481
|
+
var tuple1 = source1.getTuple(source1Idx);
|
|
482
|
+
var tuple2 = source2.getTuple(source2Idx);
|
|
487
483
|
var out = [];
|
|
488
|
-
out.length = numberOfComponents;
|
|
489
|
-
source1.getTuple(source1Idx, tuple1);
|
|
490
|
-
source2.getTuple(source2Idx, tuple2); // Check most common component sizes first
|
|
484
|
+
out.length = numberOfComponents; // Check most common component sizes first
|
|
491
485
|
// to avoid doing a for loop if possible
|
|
492
486
|
|
|
493
487
|
switch (numberOfComponents) {
|
|
@@ -78,11 +78,11 @@ declare interface Transform {
|
|
|
78
78
|
* iterations (sets of 3) to loop through. Assumes the `typedArray` is an
|
|
79
79
|
* array of multiples of 3, unless specifically handling with offset and
|
|
80
80
|
* iterations. Returns the instance for chaining.
|
|
81
|
-
* @param {TypedArray} typedArray
|
|
81
|
+
* @param {Number[]|TypedArray} typedArray The Array value.
|
|
82
82
|
* @param {Number} [offset]
|
|
83
83
|
* @param {Number} [nbIterations]
|
|
84
84
|
*/
|
|
85
|
-
apply(typedArray: TypedArray, offset?: number, nbIterations?: number): Transform
|
|
85
|
+
apply(typedArray: number[]|TypedArray, offset?: number, nbIterations?: number): Transform
|
|
86
86
|
|
|
87
87
|
/**
|
|
88
88
|
* Returns the internal `mat4` matrix.
|
package/Common/Core/Points.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import vtkDataArray from './DataArray';
|
|
2
|
-
import { Bounds } from './../../types';
|
|
2
|
+
import { Bounds, TypedArray } from './../../types';
|
|
3
3
|
|
|
4
4
|
/**
|
|
5
5
|
*
|
|
@@ -26,10 +26,10 @@ export interface vtkPoints extends vtkDataArray {
|
|
|
26
26
|
/**
|
|
27
27
|
* Get the coordinate of a point.
|
|
28
28
|
* @param {Number} idx The index of point.
|
|
29
|
-
* @param {Number[]} [tupleToFill]
|
|
30
|
-
* @
|
|
29
|
+
* @param {Number[]|TypedArray} [tupleToFill] (default [])
|
|
30
|
+
* @returns {Number[]|TypedArray}
|
|
31
31
|
*/
|
|
32
|
-
getPoint(idx: number, tupleToFill?: number[]): number[];
|
|
32
|
+
getPoint(idx: number, tupleToFill?: number[]|TypedArray): number[]|TypedArray;
|
|
33
33
|
|
|
34
34
|
/**
|
|
35
35
|
* Get the number of points for this object can hold.
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import _toConsumableArray from '@babel/runtime/helpers/toConsumableArray';
|
|
2
2
|
import macro from '../../macros.js';
|
|
3
3
|
|
|
4
|
-
var TUPLE_HOLDER = []; // ----------------------------------------------------------------------------
|
|
5
4
|
// vtkStringArray methods
|
|
6
5
|
// ----------------------------------------------------------------------------
|
|
7
6
|
|
|
@@ -34,7 +33,7 @@ function vtkStringArray(publicAPI, model) {
|
|
|
34
33
|
};
|
|
35
34
|
|
|
36
35
|
publicAPI.getTuple = function (idx) {
|
|
37
|
-
var tupleToFill = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] :
|
|
36
|
+
var tupleToFill = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : [];
|
|
38
37
|
var numberOfComponents = model.numberOfComponents || 1;
|
|
39
38
|
|
|
40
39
|
if (tupleToFill.length) {
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import _toConsumableArray from '@babel/runtime/helpers/toConsumableArray';
|
|
2
2
|
import macro from '../../macros.js';
|
|
3
3
|
|
|
4
|
-
var TUPLE_HOLDER = []; // ----------------------------------------------------------------------------
|
|
5
4
|
// vtkVariantArray methods
|
|
6
5
|
// ----------------------------------------------------------------------------
|
|
7
6
|
|
|
@@ -34,7 +33,7 @@ function vtkVariantArray(publicAPI, model) {
|
|
|
34
33
|
};
|
|
35
34
|
|
|
36
35
|
publicAPI.getTuple = function (idx) {
|
|
37
|
-
var tupleToFill = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] :
|
|
36
|
+
var tupleToFill = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : [];
|
|
38
37
|
var numberOfComponents = model.numberOfComponents || 1;
|
|
39
38
|
|
|
40
39
|
if (tupleToFill.length) {
|
|
@@ -56,6 +56,24 @@ function _addPoint(bounds) {
|
|
|
56
56
|
return bounds;
|
|
57
57
|
}
|
|
58
58
|
|
|
59
|
+
function _addPoints(bounds, points) {
|
|
60
|
+
if (points.length === 0) {
|
|
61
|
+
return bounds;
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
if (Array.isArray(points[0])) {
|
|
65
|
+
for (var i = 0; i < points.length; ++i) {
|
|
66
|
+
_addPoint(bounds, points[i]);
|
|
67
|
+
}
|
|
68
|
+
} else {
|
|
69
|
+
for (var _i = 0; _i < points.length; _i += 3) {
|
|
70
|
+
_addPoint(bounds, points.slice(_i, _i + 3));
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
return bounds;
|
|
75
|
+
}
|
|
76
|
+
|
|
59
77
|
function _addBounds(bounds, xMin, xMax, yMin, yMax, zMin, zMax) {
|
|
60
78
|
var _bounds2 = _slicedToArray(bounds, 6),
|
|
61
79
|
_xMin = _bounds2[0],
|
|
@@ -337,18 +355,18 @@ function _intersectBox(bounds, origin, dir, coord, tolerance) {
|
|
|
337
355
|
} // Calculate parametric distance to plane
|
|
338
356
|
|
|
339
357
|
|
|
340
|
-
for (var
|
|
341
|
-
if (quadrant[
|
|
342
|
-
maxT[
|
|
358
|
+
for (var _i2 = 0; _i2 < 3; _i2++) {
|
|
359
|
+
if (quadrant[_i2] !== MIDDLE && dir[_i2] !== 0.0) {
|
|
360
|
+
maxT[_i2] = (candidatePlane[_i2] - origin[_i2]) / dir[_i2];
|
|
343
361
|
} else {
|
|
344
|
-
maxT[
|
|
362
|
+
maxT[_i2] = -1.0;
|
|
345
363
|
}
|
|
346
364
|
} // Find the largest parametric value of intersection
|
|
347
365
|
|
|
348
366
|
|
|
349
|
-
for (var
|
|
350
|
-
if (maxT[whichPlane] < maxT[
|
|
351
|
-
whichPlane =
|
|
367
|
+
for (var _i3 = 0; _i3 < 3; _i3++) {
|
|
368
|
+
if (maxT[whichPlane] < maxT[_i3]) {
|
|
369
|
+
whichPlane = _i3;
|
|
352
370
|
}
|
|
353
371
|
} // Check for valie intersection along line
|
|
354
372
|
|
|
@@ -359,15 +377,15 @@ function _intersectBox(bounds, origin, dir, coord, tolerance) {
|
|
|
359
377
|
|
|
360
378
|
tolerance[0] = maxT[whichPlane]; // Intersection point along line is okay. Check bbox.
|
|
361
379
|
|
|
362
|
-
for (var
|
|
363
|
-
if (whichPlane !==
|
|
364
|
-
coord[
|
|
380
|
+
for (var _i4 = 0; _i4 < 3; _i4++) {
|
|
381
|
+
if (whichPlane !== _i4) {
|
|
382
|
+
coord[_i4] = origin[_i4] + maxT[whichPlane] * dir[_i4];
|
|
365
383
|
|
|
366
|
-
if (coord[
|
|
384
|
+
if (coord[_i4] < bounds[2 * _i4] || coord[_i4] > bounds[2 * _i4 + 1]) {
|
|
367
385
|
return 0;
|
|
368
386
|
}
|
|
369
387
|
} else {
|
|
370
|
-
coord[
|
|
388
|
+
coord[_i4] = candidatePlane[_i4];
|
|
371
389
|
}
|
|
372
390
|
}
|
|
373
391
|
|
|
@@ -623,6 +641,11 @@ var BoundingBox = /*#__PURE__*/function () {
|
|
|
623
641
|
|
|
624
642
|
return _addPoint(this.bounds, xyz);
|
|
625
643
|
}
|
|
644
|
+
}, {
|
|
645
|
+
key: "addPoints",
|
|
646
|
+
value: function addPoints(points) {
|
|
647
|
+
return _addPoints(this.bounds, points);
|
|
648
|
+
}
|
|
626
649
|
}, {
|
|
627
650
|
key: "addBounds",
|
|
628
651
|
value: function addBounds(xMin, xMax, yMin, yMax, zMin, zMax) {
|
|
@@ -772,6 +795,7 @@ var STATIC = {
|
|
|
772
795
|
setBounds: _setBounds,
|
|
773
796
|
reset: _reset,
|
|
774
797
|
addPoint: _addPoint,
|
|
798
|
+
addPoints: _addPoints,
|
|
775
799
|
addBounds: _addBounds,
|
|
776
800
|
setMinPoint: _setMinPoint,
|
|
777
801
|
setMaxPoint: _setMaxPoint,
|
|
@@ -805,4 +829,4 @@ var vtkBoundingBox = _objectSpread({
|
|
|
805
829
|
newInstance: newInstance
|
|
806
830
|
}, STATIC);
|
|
807
831
|
|
|
808
|
-
export { STATIC, _addBounds as addBounds, _addPoint as addPoint, _computeCornerPoints as computeCornerPoints, _computeLocalBounds as computeLocalBounds, _computeScale as computeScale3, contains, _containsPoint as containsPoint, _cutWithPlane as cutWithPlane, vtkBoundingBox as default, _equals as equals, _getCenter as getCenter, _getCorners as getCorners, _getDiagonalLength as getDiagonalLength, _getLength as getLength, _getLengths as getLengths, _getMaxLength as getMaxLength, _getMaxPoint as getMaxPoint, _getMinPoint as getMinPoint, _getXRange as getXRange, _getYRange as getYRange, _getZRange as getZRange, _inflate as inflate, _intersect as intersect, _intersectBox as intersectBox, _intersectPlane as intersectPlane, _intersects as intersects, _isValid as isValid, _reset as reset, _scale as scale, scaleAboutCenter, _setBounds as setBounds, _setMaxPoint as setMaxPoint, _setMinPoint as setMinPoint };
|
|
832
|
+
export { STATIC, _addBounds as addBounds, _addPoint as addPoint, _addPoints as addPoints, _computeCornerPoints as computeCornerPoints, _computeLocalBounds as computeLocalBounds, _computeScale as computeScale3, contains, _containsPoint as containsPoint, _cutWithPlane as cutWithPlane, vtkBoundingBox as default, _equals as equals, _getCenter as getCenter, _getCorners as getCorners, _getDiagonalLength as getDiagonalLength, _getLength as getLength, _getLengths as getLengths, _getMaxLength as getMaxLength, _getMaxPoint as getMaxPoint, _getMinPoint as getMinPoint, _getXRange as getXRange, _getYRange as getYRange, _getZRange as getZRange, _inflate as inflate, _intersect as intersect, _intersectBox as intersectBox, _intersectPlane as intersectPlane, _intersects as intersects, _isValid as isValid, _reset as reset, _scale as scale, scaleAboutCenter, _setBounds as setBounds, _setMaxPoint as setMaxPoint, _setMinPoint as setMinPoint };
|
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
import _slicedToArray from '@babel/runtime/helpers/slicedToArray';
|
|
2
|
+
import _toConsumableArray from '@babel/runtime/helpers/toConsumableArray';
|
|
2
3
|
import macro from '../../macros.js';
|
|
3
4
|
import { c as computeBoundsFromPoints, b as roundVector, e as clampVector } from '../Core/Math/index.js';
|
|
4
5
|
import vtkBoundingBox from './BoundingBox.js';
|
|
5
6
|
import vtkDataSet from './DataSet.js';
|
|
6
7
|
import vtkStructuredData from './StructuredData.js';
|
|
7
8
|
import { StructuredType } from './StructuredData/Constants.js';
|
|
8
|
-
import { mat3,
|
|
9
|
+
import { mat3, mat4, vec3 } from 'gl-matrix';
|
|
9
10
|
|
|
10
11
|
var vtkErrorMacro = macro.vtkErrorMacro; // ----------------------------------------------------------------------------
|
|
11
12
|
// vtkImageData methods
|
|
@@ -31,15 +32,8 @@ function vtkImageData(publicAPI, model) {
|
|
|
31
32
|
return false;
|
|
32
33
|
}
|
|
33
34
|
|
|
34
|
-
var changeDetected =
|
|
35
|
-
|
|
36
|
-
if (item !== extentArray[index]) {
|
|
37
|
-
if (changeDetected) {
|
|
38
|
-
return;
|
|
39
|
-
}
|
|
40
|
-
|
|
41
|
-
changeDetected = true;
|
|
42
|
-
}
|
|
35
|
+
var changeDetected = model.extent.some(function (item, index) {
|
|
36
|
+
return item !== extentArray[index];
|
|
43
37
|
});
|
|
44
38
|
|
|
45
39
|
if (changeDetected) {
|
|
@@ -196,49 +190,22 @@ function vtkImageData(publicAPI, model) {
|
|
|
196
190
|
|
|
197
191
|
publicAPI.extentToBounds = function (ex) {
|
|
198
192
|
// prettier-ignore
|
|
199
|
-
var corners = [ex[0], ex[2], ex[4], ex[1], ex[2], ex[4], ex[0], ex[3], ex[4], ex[1], ex[3], ex[4], ex[0], ex[2], ex[5], ex[1], ex[2], ex[5], ex[0], ex[3], ex[5], ex[1], ex[3], ex[5]];
|
|
200
|
-
var idx = new Float64Array([corners[0], corners[1], corners[2]]);
|
|
201
|
-
var vout = new Float64Array(3);
|
|
202
|
-
publicAPI.indexToWorld(idx, vout);
|
|
203
|
-
var bounds = [vout[0], vout[0], vout[1], vout[1], vout[2], vout[2]];
|
|
204
|
-
|
|
205
|
-
for (var i = 3; i < 24; i += 3) {
|
|
206
|
-
vec3.set(idx, corners[i], corners[i + 1], corners[i + 2]);
|
|
207
|
-
publicAPI.indexToWorld(idx, vout);
|
|
208
|
-
|
|
209
|
-
if (vout[0] < bounds[0]) {
|
|
210
|
-
bounds[0] = vout[0];
|
|
211
|
-
}
|
|
193
|
+
var corners = [[ex[0], ex[2], ex[4]], [ex[1], ex[2], ex[4]], [ex[0], ex[3], ex[4]], [ex[1], ex[3], ex[4]], [ex[0], ex[2], ex[5]], [ex[1], ex[2], ex[5]], [ex[0], ex[3], ex[5]], [ex[1], ex[3], ex[5]]];
|
|
212
194
|
|
|
213
|
-
|
|
214
|
-
bounds[2] = vout[1];
|
|
215
|
-
}
|
|
195
|
+
var bounds = _toConsumableArray(vtkBoundingBox.INIT_BOUNDS);
|
|
216
196
|
|
|
217
|
-
|
|
218
|
-
bounds[4] = vout[2];
|
|
219
|
-
}
|
|
197
|
+
var vout = [];
|
|
220
198
|
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
if (vout[1] > bounds[3]) {
|
|
226
|
-
bounds[3] = vout[1];
|
|
227
|
-
}
|
|
228
|
-
|
|
229
|
-
if (vout[2] > bounds[5]) {
|
|
230
|
-
bounds[5] = vout[2];
|
|
231
|
-
}
|
|
199
|
+
for (var i = 0; i < 8; ++i) {
|
|
200
|
+
publicAPI.indexToWorld(corners[i], vout);
|
|
201
|
+
vtkBoundingBox.addPoint.apply(vtkBoundingBox, [bounds].concat(vout));
|
|
232
202
|
}
|
|
233
203
|
|
|
234
204
|
return bounds;
|
|
235
205
|
};
|
|
236
206
|
|
|
237
207
|
publicAPI.getSpatialExtent = function () {
|
|
238
|
-
|
|
239
|
-
boundingBox.setBounds(model.extent);
|
|
240
|
-
boundingBox.inflate(0.5);
|
|
241
|
-
return boundingBox.getBounds();
|
|
208
|
+
return vtkBoundingBox.inflate(_toConsumableArray(model.extent), 0.5);
|
|
242
209
|
}; // Internal, shouldn't need to call this manually.
|
|
243
210
|
|
|
244
211
|
|
|
@@ -351,14 +318,7 @@ function vtkImageData(publicAPI, model) {
|
|
|
351
318
|
publicAPI.computeTransforms();
|
|
352
319
|
|
|
353
320
|
publicAPI.getCenter = function () {
|
|
354
|
-
|
|
355
|
-
var center = [];
|
|
356
|
-
|
|
357
|
-
for (var i = 0; i < 3; i++) {
|
|
358
|
-
center[i] = (bounds[2 * i + 1] + bounds[2 * i]) / 2;
|
|
359
|
-
}
|
|
360
|
-
|
|
361
|
-
return center;
|
|
321
|
+
return vtkBoundingBox.getCenter(publicAPI.getBounds());
|
|
362
322
|
};
|
|
363
323
|
|
|
364
324
|
publicAPI.computeHistogram = function (worldBounds) {
|
|
@@ -91,10 +91,8 @@ function vtkClipClosedSurface(publicAPI, model) {
|
|
|
91
91
|
} // Get the edge and interpolate the new point
|
|
92
92
|
|
|
93
93
|
|
|
94
|
-
var p0 =
|
|
95
|
-
var p1 =
|
|
96
|
-
points.getPoint(i0, p0);
|
|
97
|
-
points.getPoint(i1, p1);
|
|
94
|
+
var p0 = points.getPoint(i0);
|
|
95
|
+
var p1 = points.getPoint(i1);
|
|
98
96
|
var f = v0 / (v0 - v1);
|
|
99
97
|
var s = 1.0 - f;
|
|
100
98
|
var t = 1.0 - s;
|
|
@@ -114,9 +114,10 @@ function vtkImageStreamline(publicAPI, model) {
|
|
|
114
114
|
velAtArg[0] = 0.0;
|
|
115
115
|
velAtArg[1] = 0.0;
|
|
116
116
|
velAtArg[2] = 0.0;
|
|
117
|
+
var vel = new Array(3);
|
|
117
118
|
|
|
118
119
|
for (var i = 0; i < 8; i++) {
|
|
119
|
-
|
|
120
|
+
velArray.getTuple(voxelIndices[i], vel);
|
|
120
121
|
|
|
121
122
|
for (var j = 0; j < 3; j++) {
|
|
122
123
|
velAtArg[j] += weights[i] * vel[j];
|
|
@@ -212,9 +213,11 @@ function vtkImageStreamline(publicAPI, model) {
|
|
|
212
213
|
var offset = 0;
|
|
213
214
|
var datas = [];
|
|
214
215
|
var vectors = input.getPointData().getVectors();
|
|
216
|
+
var point = [];
|
|
215
217
|
|
|
216
218
|
for (var i = 0; i < nSeeds; i++) {
|
|
217
|
-
|
|
219
|
+
seedPts.getTuple(i, point);
|
|
220
|
+
var retVal = publicAPI.streamIntegrate(vectors, input, point, offset);
|
|
218
221
|
offset += retVal[0].length / 3;
|
|
219
222
|
datas.push(retVal);
|
|
220
223
|
}
|
|
@@ -89,10 +89,11 @@ function vtkPaintFilter(publicAPI, model) {
|
|
|
89
89
|
|
|
90
90
|
if (model.voxelFunc) {
|
|
91
91
|
var bgScalars = model.backgroundImage.getPointData().getScalars();
|
|
92
|
+
var voxel = [];
|
|
92
93
|
|
|
93
94
|
for (var _i = 0; _i < maskLabelMap.length; _i++) {
|
|
94
95
|
if (maskLabelMap[_i]) {
|
|
95
|
-
|
|
96
|
+
bgScalars.getTuple(_i, voxel); // might not fill up snapshot
|
|
96
97
|
|
|
97
98
|
if (model.voxelFunc(voxel, _i, label)) {
|
|
98
99
|
snapshot[diffIdx++] = [_i, data[_i]];
|
|
@@ -236,6 +236,7 @@ function vtkTubeFilter(publicAPI, model) {
|
|
|
236
236
|
var normal = [0.0, 0.0, 0.0];
|
|
237
237
|
var sFactor = 1.0;
|
|
238
238
|
var ptId = offset;
|
|
239
|
+
var vector = [];
|
|
239
240
|
|
|
240
241
|
for (var j = 0; j < npts; ++j) {
|
|
241
242
|
// First point
|
|
@@ -307,7 +308,7 @@ function vtkTubeFilter(publicAPI, model) {
|
|
|
307
308
|
if (inScalars && model.varyRadius === VaryRadius.VARY_RADIUS_BY_SCALAR) {
|
|
308
309
|
sFactor = 1.0 + (model.radiusFactor - 1.0) * (inScalars.getComponent(pts[j], 0) - range[0]) / (range[1] - range[0]);
|
|
309
310
|
} else if (inVectors && model.varyRadius === VaryRadius.VARY_RADIUS_BY_VECTOR) {
|
|
310
|
-
sFactor = Math.sqrt(maxSpeed / norm(inVectors.getTuple(pts[j])));
|
|
311
|
+
sFactor = Math.sqrt(maxSpeed / norm(inVectors.getTuple(pts[j], vector)));
|
|
311
312
|
|
|
312
313
|
if (sFactor > model.radiusFactor) {
|
|
313
314
|
sFactor = model.radiusFactor;
|
|
@@ -667,16 +668,10 @@ function vtkTubeFilter(publicAPI, model) {
|
|
|
667
668
|
var numStrips = 0;
|
|
668
669
|
var inLinesData = inLines.getData();
|
|
669
670
|
var npts = inLinesData[0];
|
|
670
|
-
var sidesShareVerticesMultiplier = model.sidesShareVertices ? 1 : 2;
|
|
671
671
|
|
|
672
672
|
for (var i = 0; i < inLinesData.length; i += npts + 1) {
|
|
673
|
-
numNewPts += sidesShareVerticesMultiplier * npts * model.numberOfSides;
|
|
674
|
-
|
|
675
|
-
if (model.capping) {
|
|
676
|
-
numNewPts += 2 * model.numberOfSides;
|
|
677
|
-
}
|
|
678
|
-
|
|
679
673
|
npts = inLinesData[i];
|
|
674
|
+
numNewPts = computeOffset(numNewPts, npts);
|
|
680
675
|
numStrips += (2 * npts + 1) * Math.ceil(model.numberOfSides / model.onRatio);
|
|
681
676
|
|
|
682
677
|
if (model.capping) {
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import _toConsumableArray from '@babel/runtime/helpers/toConsumableArray';
|
|
2
1
|
import macro from '../../macros.js';
|
|
3
2
|
import vtkBoundingBox from '../../Common/DataModel/BoundingBox.js';
|
|
4
3
|
import vtkDataArray from '../../Common/Core/DataArray.js';
|
|
@@ -177,13 +176,13 @@ function vtkWindowedSincPolyDataFilter(publicAPI, model) {
|
|
|
177
176
|
if (model.featureEdgeSmoothing) {
|
|
178
177
|
// TODO: support polygons
|
|
179
178
|
// vtkPolygon::ComputeNormal(inPts,npts,pts,normal);
|
|
180
|
-
vtkTriangle.computeNormal(
|
|
179
|
+
vtkTriangle.computeNormal(inPts.getPoint(_pts2[0]), inPts.getPoint(_pts2[1]), inPts.getPoint(_pts2[2]), normal);
|
|
181
180
|
|
|
182
181
|
var _mesh$getCellPoints = mesh.getCellPoints(nei),
|
|
183
182
|
cellPointIds = _mesh$getCellPoints.cellPointIds; // vtkPolygon::ComputeNormal(inPts,numNeiPts,neiPts,neiNormal);
|
|
184
183
|
|
|
185
184
|
|
|
186
|
-
vtkTriangle.computeNormal(
|
|
185
|
+
vtkTriangle.computeNormal(inPts.getPoint(cellPointIds[0]), inPts.getPoint(cellPointIds[1]), inPts.getPoint(cellPointIds[2]), neiNormal);
|
|
187
186
|
|
|
188
187
|
if (vtkMath.dot(normal, neiNormal) <= cosFeatureAngle) {
|
|
189
188
|
edge = VertexType.VTK_FEATURE_EDGE_VERTEX;
|
|
@@ -230,12 +229,11 @@ function vtkWindowedSincPolyDataFilter(publicAPI, model) {
|
|
|
230
229
|
verts[_i4].type = VertexType.VTK_FIXED_VERTEX;
|
|
231
230
|
} // check angle between edges
|
|
232
231
|
else {
|
|
233
|
-
var _x = [0
|
|
234
|
-
|
|
235
|
-
var _x2 =
|
|
236
|
-
|
|
237
|
-
var x3 = [
|
|
238
|
-
inPts.getPoint(verts[_i4].edges[1], x3);
|
|
232
|
+
var _x = inPts.getPoint(verts[_i4].edges[0]);
|
|
233
|
+
|
|
234
|
+
var _x2 = inPts.getPoint(_i4);
|
|
235
|
+
|
|
236
|
+
var x3 = inPts.getPoint(verts[_i4].edges[1]);
|
|
239
237
|
var l1 = [0, 0, 0];
|
|
240
238
|
var l2 = [0, 0, 0];
|
|
241
239
|
|
|
@@ -209,9 +209,11 @@ function vtkOpenGLPolyDataMapper2D(publicAPI, model) {
|
|
|
209
209
|
var p = vtkPoints.newInstance();
|
|
210
210
|
var numPts = points.getNumberOfPoints();
|
|
211
211
|
p.setNumberOfPoints(numPts);
|
|
212
|
+
var point = [];
|
|
212
213
|
|
|
213
214
|
for (var i = 0; i < numPts; ++i) {
|
|
214
|
-
|
|
215
|
+
points.getPoint(i, point);
|
|
216
|
+
transformCoordinate.setValue(point);
|
|
215
217
|
var v = transformCoordinate.getComputedDoubleViewportValue(ren);
|
|
216
218
|
p.setPoint(i, v[0], v[1], 0.0);
|
|
217
219
|
}
|
package/package.json
CHANGED