@kitware/vtk.js 34.6.0 → 34.8.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 (42) hide show
  1. package/Common/Core/Math/index.js +12 -1
  2. package/Common/Core/Math.d.ts +24 -18
  3. package/Common/Core/Math.js +1 -1
  4. package/Common/DataModel/Polygon.d.ts +13 -0
  5. package/Common/DataModel/Polygon.js +29 -2
  6. package/Common/DataModel/Triangle.js +8 -13
  7. package/Filters/Core/Cutter.js +1 -0
  8. package/Filters/General/ShrinkPolyData.d.ts +85 -0
  9. package/Filters/General/ShrinkPolyData.js +317 -0
  10. package/Filters/General.js +2 -0
  11. package/Filters/Sources/ArcSource.d.ts +244 -0
  12. package/Filters/Sources/ArcSource.js +138 -0
  13. package/Filters/Sources/EllipseArcSource.d.ts +212 -0
  14. package/Filters/Sources/EllipseArcSource.js +159 -0
  15. package/Filters/Sources/PlatonicSolidSource/Constants.d.ts +12 -0
  16. package/Filters/Sources/PlatonicSolidSource/Constants.js +12 -0
  17. package/Filters/Sources/PlatonicSolidSource.d.ts +109 -0
  18. package/Filters/Sources/PlatonicSolidSource.js +149 -0
  19. package/Filters/Sources.js +6 -0
  20. package/IO/Misc/OBJWriter.d.ts +103 -0
  21. package/IO/Misc/OBJWriter.js +237 -0
  22. package/IO/Misc.js +2 -0
  23. package/Interaction/Style/InteractorStyleManipulator.js +75 -2
  24. package/Proxy/Representations/GlyphRepresentationProxy.js +3 -0
  25. package/Rendering/Core/Camera.d.ts +3 -3
  26. package/Rendering/Core/Camera.js +33 -3
  27. package/Rendering/Core/ColorTransferFunction/CssFilters.js +1 -1
  28. package/Rendering/Core/ColorTransferFunction.js +1 -1
  29. package/Rendering/Core/Coordinate.js +1 -1
  30. package/Rendering/Core/CubeAxesActor.js +1 -1
  31. package/Rendering/Core/ImageMapper.js +1 -1
  32. package/Rendering/Core/Renderer.js +1 -1
  33. package/Rendering/Core/ScalarBarActor.js +1 -1
  34. package/Rendering/Core/TextActor.js +1 -1
  35. package/Rendering/Core/VolumeProperty.js +1 -1
  36. package/Rendering/OpenGL/PolyDataMapper2D.js +1 -1
  37. package/Rendering/OpenGL/Texture.js +1 -1
  38. package/Widgets/Widgets3D/AngleWidget.js +1 -1
  39. package/Widgets/Widgets3D/ResliceCursorWidget/behavior.js +1 -1
  40. package/Widgets/Widgets3D/ResliceCursorWidget/helpers.js +1 -1
  41. package/index.d.ts +6 -0
  42. package/package.json +1 -1
@@ -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 { J as identity, K 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, L as floor, M as isInf, N as rgb2hsv, O as rgb2lab, P 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 { Q as round, L 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 { R as normalize2D, S 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 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 { F as clampValue, T as multiply3x3_vect3, I as createUninitializedBounds, U 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 {
@@ -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 { V as areBoundsInitialized, u as uninitializeBounds, r as radiansFromDegrees, d as dot, I 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 { S 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 { W 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,5 +1,5 @@
1
1
  import { m as macro } from '../../macros2.js';
2
- import { F as clampValue, L 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 { Q 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 { X as isPowerOfTwo, S 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';
@@ -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, Y 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,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, x as multiplyScalar, Z 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, x as multiplyScalar, m as multiplyAccumulate, Z 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
 
package/index.d.ts CHANGED
@@ -67,9 +67,11 @@
67
67
  /// <reference path="./Filters/General/ImageStreamline.d.ts" />
68
68
  /// <reference path="./Filters/General/LineFilter.d.ts" />
69
69
  /// <reference path="./Filters/General/OutlineFilter.d.ts" />
70
+ /// <reference path="./Filters/General/ShrinkPolyData.d.ts" />
70
71
  /// <reference path="./Filters/General/TransformPolyDataFilter.d.ts" />
71
72
  /// <reference path="./Filters/General/TriangleFilter.d.ts" />
72
73
  /// <reference path="./Filters/General/TubeFilter.d.ts" />
74
+ /// <reference path="./Filters/Sources/ArcSource.d.ts" />
73
75
  /// <reference path="./Filters/Sources/Arrow2DSource.d.ts" />
74
76
  /// <reference path="./Filters/Sources/ArrowSource.d.ts" />
75
77
  /// <reference path="./Filters/Sources/CircleSource.d.ts" />
@@ -78,8 +80,11 @@
78
80
  /// <reference path="./Filters/Sources/Cursor3D.d.ts" />
79
81
  /// <reference path="./Filters/Sources/CylinderSource.d.ts" />
80
82
  /// <reference path="./Filters/Sources/DiskSource.d.ts" />
83
+ /// <reference path="./Filters/Sources/EllipseArcSource.d.ts" />
81
84
  /// <reference path="./Filters/Sources/LineSource.d.ts" />
82
85
  /// <reference path="./Filters/Sources/PlaneSource.d.ts" />
86
+ /// <reference path="./Filters/Sources/PlatonicSolidSource/Constants.d.ts" />
87
+ /// <reference path="./Filters/Sources/PlatonicSolidSource.d.ts" />
83
88
  /// <reference path="./Filters/Sources/PointSource.d.ts" />
84
89
  /// <reference path="./Filters/Sources/SphereSource.d.ts" />
85
90
  /// <reference path="./Filters/Texture/TextureMapToPlane.d.ts" />
@@ -113,6 +118,7 @@
113
118
  /// <reference path="./IO/Misc/JSONReader.d.ts" />
114
119
  /// <reference path="./IO/Misc/MTLReader.d.ts" />
115
120
  /// <reference path="./IO/Misc/OBJReader.d.ts" />
121
+ /// <reference path="./IO/Misc/OBJWriter.d.ts" />
116
122
  /// <reference path="./IO/Misc/PDBReader.d.ts" />
117
123
  /// <reference path="./IO/XML/XMLImageDataReader.d.ts" />
118
124
  /// <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.6.0",
3
+ "version": "34.8.0",
4
4
  "description": "Visualization Toolkit for the Web",
5
5
  "keywords": [
6
6
  "3d",