@kitware/vtk.js 28.8.1 → 28.8.3

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/CONTRIBUTING.md CHANGED
@@ -119,6 +119,10 @@ To create and debug a test:
119
119
  The vtk.js documentation is part of the code repository and is entirely written in
120
120
  [markdown](https://daringfireball.net/projects/markdown/).
121
121
 
122
+ If you create an example, please list it in the [examples landing page](Documentation/content/examples/index.md).
123
+
124
+ Images and GIF videos added to the [gallery](Documentation/content/docs/gallery) must be compressed as much as possible. You may want to use [ezgif.com](https://ezgif.com/).
125
+
122
126
  ## Reporting Issues
123
127
 
124
128
  If you encounter problems using vtk.js you may be able to find the solutions in the
@@ -1,13 +1,19 @@
1
+ import _defineProperty from '@babel/runtime/helpers/defineProperty';
1
2
  import macro from '../../macros.js';
2
3
  import vtkCubeSource from '../Sources/CubeSource.js';
3
4
 
5
+ function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
6
+
7
+ 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; }
4
8
  var vtkErrorMacro = macro.vtkErrorMacro; // ----------------------------------------------------------------------------
5
9
  // vtkImageDataOutlineFilter methods
6
10
  // ----------------------------------------------------------------------------
7
11
 
8
12
  function vtkImageDataOutlineFilter(publicAPI, model) {
9
13
  // Set our className
10
- model.classHierarchy.push('vtkImageDataOutlineFilter');
14
+ model.classHierarchy.push('vtkImageDataOutlineFilter'); // Capture "parentClass" api for internal use
15
+
16
+ var superClass = _objectSpread({}, publicAPI);
11
17
 
12
18
  publicAPI.requestData = function (inData, outData) {
13
19
  // implement requestData
@@ -34,21 +40,15 @@ function vtkImageDataOutlineFilter(publicAPI, model) {
34
40
  model._cubeSource.setMatrix(input.getIndexToWorld());
35
41
 
36
42
  outData[0] = model._cubeSource.getOutputData();
37
- }; // Forward calls for [set/get]Generate[Faces/Lines] functions to cubeSource:
38
-
39
-
40
- publicAPI.setGenerateFaces = function (generateFaces) {
41
- if (model._cubeSource.setGenerateFaces(generateFaces)) {
42
- publicAPI.modified();
43
- }
44
43
  };
45
44
 
46
- publicAPI.setGenerateLines = function (generateLines) {
47
- if (model._cubeSource.setGenerateLines(generateLines)) {
48
- publicAPI.modified();
49
- }
50
- };
45
+ publicAPI.getMTime = function () {
46
+ return Math.max(superClass.getMTime(), model._cubeSource.getMTime());
47
+ }; // Forward calls for [set/get]Generate[Faces/Lines] functions to cubeSource:
48
+
51
49
 
50
+ publicAPI.setGenerateFaces = model._cubeSource.setGenerateFaces;
51
+ publicAPI.setGenerateLines = model._cubeSource.setGenerateLines;
52
52
  publicAPI.getGenerateFaces = model._cubeSource.getGenerateFaces;
53
53
  publicAPI.getGenerateLines = model._cubeSource.getGenerateLines;
54
54
  } // ----------------------------------------------------------------------------
@@ -2,7 +2,6 @@ import _toConsumableArray from '@babel/runtime/helpers/toConsumableArray';
2
2
  import macro from '../../macros.js';
3
3
  import vtkCellArray from '../../Common/Core/CellArray.js';
4
4
  import vtkDataArray from '../../Common/Core/DataArray.js';
5
- import { IDENTITY } from '../../Common/Core/Math/Constants.js';
6
5
  import vtkPolyData from '../../Common/DataModel/PolyData.js';
7
6
  import vtkMatrixBuilder from '../../Common/Core/MatrixBuilder.js';
8
7
 
@@ -17,8 +16,6 @@ function vtkCubeSource(publicAPI, model) {
17
16
  model.classHierarchy.push('vtkCubeSource');
18
17
 
19
18
  function requestData(inData, outData) {
20
- var _vtkMatrixBuilder$bui;
21
-
22
19
  if (model.deleted) {
23
20
  return;
24
21
  }
@@ -177,15 +174,25 @@ function vtkCubeSource(publicAPI, model) {
177
174
  } // Apply rotation to the points coordinates and normals
178
175
 
179
176
 
180
- vtkMatrixBuilder.buildFromDegree().rotateX(model.rotations[0]).rotateY(model.rotations[1]).rotateZ(model.rotations[2]).apply(points).apply(normals); // Apply transformation to the points coordinates
177
+ if (model.rotations) {
178
+ vtkMatrixBuilder.buildFromDegree().rotateX(model.rotations[0]).rotateY(model.rotations[1]).rotateZ(model.rotations[2]).apply(points).apply(normals);
179
+ } // Apply transformation to the points coordinates
180
+
181
+
182
+ if (model.center) {
183
+ var _vtkMatrixBuilder$bui;
184
+
185
+ (_vtkMatrixBuilder$bui = vtkMatrixBuilder.buildFromRadian()).translate.apply(_vtkMatrixBuilder$bui, _toConsumableArray(model.center)).apply(points);
186
+ } // Apply optional additionally specified matrix transformation
181
187
 
182
- (_vtkMatrixBuilder$bui = vtkMatrixBuilder.buildFromRadian()).translate.apply(_vtkMatrixBuilder$bui, _toConsumableArray(model.center)).apply(points); // Apply optional additionally specified matrix transformation
183
188
 
189
+ if (model.matrix) {
190
+ vtkMatrixBuilder.buildFromRadian().setMatrix(model.matrix).apply(points); // prettier-ignore
184
191
 
185
- vtkMatrixBuilder.buildFromRadian().setMatrix(model.matrix).apply(points); // prettier-ignore
192
+ var rotMatrix = [model.matrix[0], model.matrix[1], model.matrix[2], 0, model.matrix[4], model.matrix[5], model.matrix[6], 0, model.matrix[8], model.matrix[9], model.matrix[10], 0, 0, 0, 0, 1];
193
+ vtkMatrixBuilder.buildFromRadian().setMatrix(rotMatrix).apply(normals);
194
+ } // Lastly, generate the necessary cell arrays.
186
195
 
187
- var rotMatrix = [model.matrix[0], model.matrix[1], model.matrix[2], 0, model.matrix[4], model.matrix[5], model.matrix[6], 0, model.matrix[8], model.matrix[9], model.matrix[10], 0, 0, 0, 0, 1];
188
- vtkMatrixBuilder.buildFromRadian().setMatrix(rotMatrix).apply(normals); // Lastly, generate the necessary cell arrays.
189
196
 
190
197
  if (model.generateFaces) {
191
198
  polyData.getPolys().deepCopy(model._polys);
@@ -236,9 +243,6 @@ var DEFAULT_VALUES = {
236
243
  xLength: 1.0,
237
244
  yLength: 1.0,
238
245
  zLength: 1.0,
239
- center: [0.0, 0.0, 0.0],
240
- rotations: [0.0, 0.0, 0.0],
241
- matrix: _toConsumableArray(IDENTITY),
242
246
  pointType: 'Float64Array',
243
247
  generate3DTextureCoordinates: false,
244
248
  generateFaces: true,
@@ -53,7 +53,7 @@ function vtkPolyLineRepresentation(publicAPI, model) {
53
53
  }
54
54
 
55
55
  if (closePolyLine) {
56
- cellData[cellSize - 1] = 0;
56
+ cellData[cellSize] = 0;
57
57
  }
58
58
 
59
59
  lines.setData(cellData);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@kitware/vtk.js",
3
- "version": "28.8.1",
3
+ "version": "28.8.3",
4
4
  "description": "Visualization Toolkit for the Web",
5
5
  "keywords": [
6
6
  "3d",