@kitware/vtk.js 34.15.2 → 34.15.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
@@ -33,7 +33,7 @@ Please follow the coding style:
33
33
  $ git checkout -b new_feature
34
34
  ```
35
35
 
36
- 4. Start hacking. Additional information on how to create class/test/example can be found
36
+ 6. Start hacking. Additional information on how to create class/test/example can be found
37
37
  [here](https://kitware.github.io/vtk-js/docs/) in the __Development__ section.
38
38
 
39
39
  ```sh
@@ -41,19 +41,26 @@ Please follow the coding style:
41
41
  $ git add file1 file2 file3
42
42
  ```
43
43
 
44
- 5. Use Commitizen to create commits
44
+ 7. Verify you have correctly formatted code, and that all tests pass:
45
+
46
+ ```sh
47
+ $ npm run reformat
48
+ $ npm run test
49
+ ```
50
+
51
+ 8. Use Commitizen to create commits
45
52
 
46
53
  ```sh
47
54
  $ npm run commit
48
55
  ```
49
56
 
50
- 6. Push commits in your feature branch to your fork in GitHub:
57
+ 9. Push commits in your feature branch to your fork in GitHub:
51
58
 
52
59
  ```sh
53
60
  $ git push origin new_feature
54
61
  ```
55
62
 
56
- 7. Visit your fork in Github, browse to the "**Pull Requests**" link on the left, and use the
63
+ 10. Visit your fork in Github, browse to the "**Pull Requests**" link on the left, and use the
57
64
  "**New Pull Request**" button in the upper right to create a Pull Request.
58
65
 
59
66
  For more information see:
@@ -62,7 +69,7 @@ Please follow the coding style:
62
69
  If committing changes to `vtk.js@next` or `vtk.js@next-major`, then set your base branch to be `next`
63
70
  or `next-major`, respectively. For more info see the section on release channels below.
64
71
 
65
- 8. vtk.js uses GitHub for code review and Github Actions to validate proposed patches before they are merged.
72
+ 11. vtk.js uses GitHub for code review and Github Actions to validate proposed patches before they are merged.
66
73
 
67
74
  ## Release Channels
68
75
 
@@ -40,13 +40,13 @@ function vtkIFCImporter(publicAPI, model) {
40
40
  const cells = vtkCellArray.newInstance();
41
41
  const pointValues = new Float32Array(vertices.length / 2);
42
42
  const normalsArray = new Float32Array(vertices.length / 2);
43
- for (let i = 0; i < vertices.length; i += 6) {
44
- pointValues[i / 2] = vertices[i];
45
- pointValues[i / 2 + 1] = vertices[i + 1];
46
- pointValues[i / 2 + 2] = vertices[i + 2];
47
- normalsArray[i / 2] = vertices[i + 3];
48
- normalsArray[i / 2 + 1] = vertices[i + 4];
49
- normalsArray[i / 2 + 2] = vertices[i + 5];
43
+ for (let i = 0, p = 0; i < vertices.length; p += 3) {
44
+ pointValues[p] = vertices[i++];
45
+ pointValues[p + 1] = vertices[i++];
46
+ pointValues[p + 2] = vertices[i++];
47
+ normalsArray[p] = vertices[i++];
48
+ normalsArray[p + 1] = vertices[i++];
49
+ normalsArray[p + 2] = vertices[i++];
50
50
  }
51
51
  const nCells = indices.length;
52
52
  cells.resize(3 * nCells / 3);
@@ -82,36 +82,30 @@ function vtkIFCImporter(publicAPI, model) {
82
82
  const normalsArray = new Float32Array(vertices.length / 2);
83
83
  const colorArray = new Float32Array(vertices.length / 2);
84
84
  if (userMatrix) {
85
- const transformMatrix = vtkMatrixBuilder.buildFromRadian().setMatrix(userMatrix);
86
- const normalMatrix = vtkMatrixBuilder.buildFromRadian().multiply3x3(mat3.fromMat4(mat3.create(), userMatrix));
87
- for (let i = 0; i < vertices.length; i += 6) {
88
- const point = [vertices[i], vertices[i + 1], vertices[i + 2]];
89
- const normal = [vertices[i + 3], vertices[i + 4], vertices[i + 5]];
90
- transformMatrix.apply(point);
91
- normalMatrix.apply(normal);
92
- pointValues[i / 2] = point[0];
93
- pointValues[i / 2 + 1] = point[1];
94
- pointValues[i / 2 + 2] = point[2];
95
- normalsArray[i / 2] = normal[0];
96
- normalsArray[i / 2 + 1] = normal[1];
97
- normalsArray[i / 2 + 2] = normal[2];
98
- const colorIndex = i / 2;
99
- colorArray[colorIndex] = color.x;
100
- colorArray[colorIndex + 1] = color.y;
101
- colorArray[colorIndex + 2] = color.z;
85
+ for (let i = 0, p = 0; i < vertices.length; p += 3) {
86
+ pointValues[p] = vertices[i++];
87
+ pointValues[p + 1] = vertices[i++];
88
+ pointValues[p + 2] = vertices[i++];
89
+ normalsArray[p] = vertices[i++];
90
+ normalsArray[p + 1] = vertices[i++];
91
+ normalsArray[p + 2] = vertices[i++];
92
+ colorArray[p] = color.x;
93
+ colorArray[p + 1] = color.y;
94
+ colorArray[p + 2] = color.z;
102
95
  }
96
+ vtkMatrixBuilder.buildFromRadian().setMatrix(userMatrix).apply(pointValues);
97
+ vtkMatrixBuilder.buildFromRadian().multiply3x3(mat3.fromMat4(mat3.create(), userMatrix)).apply(normalsArray);
103
98
  } else {
104
- for (let i = 0; i < vertices.length; i += 6) {
105
- pointValues[i / 2] = vertices[i];
106
- pointValues[i / 2 + 1] = vertices[i + 1];
107
- pointValues[i / 2 + 2] = vertices[i + 2];
108
- normalsArray[i / 2] = vertices[i + 3];
109
- normalsArray[i / 2 + 1] = vertices[i + 4];
110
- normalsArray[i / 2 + 2] = vertices[i + 5];
111
- const colorIndex = i / 2;
112
- colorArray[colorIndex] = color.x;
113
- colorArray[colorIndex + 1] = color.y;
114
- colorArray[colorIndex + 2] = color.z;
99
+ for (let i = 0, p = 0; i < vertices.length; p += 3) {
100
+ pointValues[p] = vertices[i++];
101
+ pointValues[p + 1] = vertices[i++];
102
+ pointValues[p + 2] = vertices[i++];
103
+ normalsArray[p] = vertices[i++];
104
+ normalsArray[p + 1] = vertices[i++];
105
+ normalsArray[p + 2] = vertices[i++];
106
+ colorArray[p] = color.x;
107
+ colorArray[p + 1] = color.y;
108
+ colorArray[p + 2] = color.z;
115
109
  }
116
110
  }
117
111
  const nCells = indices.length;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@kitware/vtk.js",
3
- "version": "34.15.2",
3
+ "version": "34.15.3",
4
4
  "description": "Visualization Toolkit for the Web",
5
5
  "keywords": [
6
6
  "3d",