@kitware/vtk.js 24.7.1 → 24.10.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.
- package/Common/Core/Math/index.js +1 -1
- package/Common/Core/Math.js +1 -1
- package/Common/Core/ScalarsToColors/Constants.d.ts +18 -0
- package/Common/Core/ScalarsToColors.d.ts +6 -16
- package/Common/DataModel/Box.d.ts +4 -4
- package/Common/DataModel/CardinalSpline1D.d.ts +8 -4
- package/Common/DataModel/CardinalSpline1D.js +133 -4
- package/Common/DataModel/Cell.js +3 -1
- package/Common/DataModel/CellTypes.js +6 -1
- package/Common/DataModel/ITKHelper.d.ts +54 -0
- package/Common/DataModel/KochanekSpline1D.d.ts +8 -4
- package/Common/DataModel/KochanekSpline1D.js +103 -2
- package/Common/DataModel/Line.d.ts +8 -3
- package/Common/DataModel/Line.js +16 -11
- package/Common/DataModel/Plane.js +1 -1
- package/Common/DataModel/PolyData/Constants.d.ts +6 -0
- package/Common/DataModel/PolyLine.d.ts +63 -0
- package/Common/DataModel/PolyLine.js +84 -0
- package/Common/DataModel/Polygon.js +1 -1
- package/Common/DataModel/Spline1D/Constants.js +17 -0
- package/Common/DataModel/Spline1D.d.ts +20 -2
- package/Common/DataModel/Spline3D/Constants.d.ts +9 -0
- package/Common/DataModel/Spline3D.d.ts +4 -9
- package/Common/DataModel/Spline3D.js +20 -15
- package/Filters/General/ImageCropFilter.d.ts +9 -6
- package/Filters/Sources/LineSource.js +1 -1
- package/Filters/Sources/PlaneSource.js +1 -1
- package/Interaction/Manipulators/MouseCameraUnicamManipulator.js +1 -1
- package/Interaction/Manipulators/MouseCameraUnicamRotateManipulator.js +1 -1
- package/Interaction/Manipulators/MouseRangeManipulator.js +23 -6
- package/Interaction/Widgets/OrientationMarkerWidget/Constants.d.ts +11 -0
- package/Interaction/Widgets/OrientationMarkerWidget.d.ts +2 -6
- package/Rendering/Core/CellPicker.js +53 -32
- package/Rendering/Core/Mapper/Constants.d.ts +26 -0
- package/Rendering/Core/Mapper.d.ts +5 -21
- package/Rendering/Core/Property/Constants.d.ts +24 -0
- package/Rendering/Core/Property.d.ts +6 -20
- package/Rendering/Core/RenderWindowInteractor/Constants.d.ts +31 -0
- package/Rendering/Core/RenderWindowInteractor.d.ts +223 -121
- package/Rendering/Core/Viewport.d.ts +2 -4
- package/Rendering/Core/VolumeMapper/Constants.d.ts +19 -0
- package/Rendering/Core/VolumeMapper.d.ts +5 -9
- package/Rendering/Core/VolumeProperty.d.ts +5 -13
- package/Rendering/Misc/FullScreenRenderWindow.d.ts +3 -2
- package/Rendering/OpenGL/RenderWindow.d.ts +28 -10
- package/Widgets/Core/StateBuilder/manipulatorMixin.js +15 -15
- package/Widgets/Manipulators/AbstractManipulator.d.ts +221 -0
- package/Widgets/Manipulators/AbstractManipulator.js +57 -0
- package/Widgets/Manipulators/LineManipulator.d.ts +8 -74
- package/Widgets/Manipulators/LineManipulator.js +14 -11
- package/Widgets/Manipulators/PlaneManipulator.d.ts +8 -74
- package/Widgets/Manipulators/PlaneManipulator.js +12 -9
- package/Widgets/Manipulators/TrackballManipulator.d.ts +8 -44
- package/Widgets/Manipulators/TrackballManipulator.js +13 -10
- package/Widgets/Representations/ResliceCursorContextRepresentation.js +1 -1
- package/Widgets/Representations/SplineContextRepresentation.js +28 -9
- package/Widgets/Representations/WidgetRepresentation.js +1 -1
- package/Widgets/Widgets3D/AngleWidget/behavior.js +7 -4
- package/Widgets/Widgets3D/AngleWidget/state.js +2 -2
- package/Widgets/Widgets3D/AngleWidget.js +20 -3
- package/Widgets/Widgets3D/DistanceWidget/behavior.js +7 -2
- package/Widgets/Widgets3D/DistanceWidget/state.js +2 -2
- package/Widgets/Widgets3D/DistanceWidget.js +19 -2
- package/Widgets/Widgets3D/EllipseWidget.js +4 -3
- package/Widgets/Widgets3D/ImageCroppingWidget/behavior.js +3 -4
- package/Widgets/Widgets3D/ImageCroppingWidget.js +42 -13
- package/Widgets/Widgets3D/ImplicitPlaneWidget.js +5 -5
- package/Widgets/Widgets3D/LabelWidget/behavior.js +6 -2
- package/Widgets/Widgets3D/LabelWidget/state.js +2 -2
- package/Widgets/Widgets3D/LabelWidget.js +18 -3
- package/Widgets/Widgets3D/LineWidget/behavior.js +11 -4
- package/Widgets/Widgets3D/LineWidget/helpers.js +1 -1
- package/Widgets/Widgets3D/LineWidget/state.js +1 -1
- package/Widgets/Widgets3D/LineWidget.js +18 -1
- package/Widgets/Widgets3D/PaintWidget/behavior.js +12 -9
- package/Widgets/Widgets3D/PaintWidget.js +24 -8
- package/Widgets/Widgets3D/PolyLineWidget/behavior.js +11 -4
- package/Widgets/Widgets3D/PolyLineWidget/state.js +2 -2
- package/Widgets/Widgets3D/PolyLineWidget.js +21 -2
- package/Widgets/Widgets3D/RectangleWidget.js +6 -5
- package/Widgets/Widgets3D/ResliceCursorWidget/behavior.js +5 -5
- package/Widgets/Widgets3D/ResliceCursorWidget/helpers.js +1 -1
- package/Widgets/Widgets3D/ResliceCursorWidget.js +1 -1
- package/Widgets/Widgets3D/ShapeWidget/behavior.js +9 -5
- package/Widgets/Widgets3D/ShapeWidget.js +12 -2
- package/Widgets/Widgets3D/SphereWidget/behavior.js +4 -3
- package/Widgets/Widgets3D/SphereWidget.js +23 -2
- package/Widgets/Widgets3D/SplineWidget/behavior.js +7 -3
- package/Widgets/Widgets3D/SplineWidget/state.js +12 -2
- package/Widgets/Widgets3D/SplineWidget.js +22 -3
- package/index.d.ts +12 -1
- package/package.json +1 -1
|
@@ -1,9 +1,12 @@
|
|
|
1
1
|
import _defineProperty from '@babel/runtime/helpers/defineProperty';
|
|
2
2
|
import macro from '../../macros.js';
|
|
3
|
-
import
|
|
3
|
+
import vtkCellTypes from '../../Common/DataModel/CellTypes.js';
|
|
4
|
+
import vtkLine from '../../Common/DataModel/Line.js';
|
|
4
5
|
import vtkPicker from './Picker.js';
|
|
5
|
-
import
|
|
6
|
+
import vtkPolyLine from '../../Common/DataModel/PolyLine.js';
|
|
6
7
|
import vtkTriangle from '../../Common/DataModel/Triangle.js';
|
|
8
|
+
import { l as normalize } from '../../Common/Core/Math/index.js';
|
|
9
|
+
import { CellType } from '../../Common/DataModel/CellTypes/Constants.js';
|
|
7
10
|
import { vec3 } from 'gl-matrix';
|
|
8
11
|
|
|
9
12
|
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; }
|
|
@@ -12,6 +15,12 @@ function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { va
|
|
|
12
15
|
// Global methods
|
|
13
16
|
// ----------------------------------------------------------------------------
|
|
14
17
|
|
|
18
|
+
function createCellMap() {
|
|
19
|
+
var _ref;
|
|
20
|
+
|
|
21
|
+
return _ref = {}, _defineProperty(_ref, CellType.VTK_LINE, vtkLine.newInstance()), _defineProperty(_ref, CellType.VTK_POLY_LINE, vtkPolyLine.newInstance()), _defineProperty(_ref, CellType.VTK_TRIANGLE, vtkTriangle.newInstance()), _ref;
|
|
22
|
+
}
|
|
23
|
+
|
|
15
24
|
function clipLineWithPlane(mapper, matrix, p1, p2) {
|
|
16
25
|
var outObj = {
|
|
17
26
|
planeId: -1,
|
|
@@ -214,8 +223,10 @@ function vtkCellPicker(publicAPI, model) {
|
|
|
214
223
|
var minXYZ = [0, 0, 0];
|
|
215
224
|
var pDistMin = Number.MAX_VALUE;
|
|
216
225
|
var minPCoords = [0, 0, 0];
|
|
217
|
-
var minCellId =
|
|
218
|
-
var minCell =
|
|
226
|
+
var minCellId = null;
|
|
227
|
+
var minCell = null;
|
|
228
|
+
var minCellType = null;
|
|
229
|
+
var subId = null;
|
|
219
230
|
var x = [];
|
|
220
231
|
var data = mapper.getInputData();
|
|
221
232
|
|
|
@@ -235,30 +246,35 @@ function vtkCellPicker(publicAPI, model) {
|
|
|
235
246
|
}
|
|
236
247
|
}
|
|
237
248
|
|
|
238
|
-
if (data.
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
var cellId = 0;
|
|
243
|
-
var pointsIdList = [-1, -1, -1];
|
|
244
|
-
var cell = vtkTriangle.newInstance();
|
|
245
|
-
var cellPoints = vtkPoints.newInstance(); // cross all cells
|
|
249
|
+
if (data.getCells) {
|
|
250
|
+
if (!data.getCells()) {
|
|
251
|
+
data.buildLinks();
|
|
252
|
+
}
|
|
246
253
|
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
cellPoints.setNumberOfPoints(nbPointsInCell); // Extract cell points
|
|
254
|
+
var tempCellMap = createCellMap();
|
|
255
|
+
var minCellMap = createCellMap();
|
|
256
|
+
var numberOfCells = data.getNumberOfCells();
|
|
251
257
|
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
258
|
+
for (var cellId = 0; cellId < numberOfCells; cellId++) {
|
|
259
|
+
var pCoords = [0, 0, 0];
|
|
260
|
+
minCellType = data.getCellType(cellId);
|
|
261
|
+
var cell = tempCellMap[minCellType];
|
|
255
262
|
|
|
263
|
+
if (cell == null) {
|
|
264
|
+
// eslint-disable-next-line no-continue
|
|
265
|
+
continue;
|
|
266
|
+
}
|
|
256
267
|
|
|
257
|
-
|
|
268
|
+
minCell = minCellMap[minCellType];
|
|
269
|
+
data.getCell(cellId, cell);
|
|
258
270
|
var cellPicked = void 0;
|
|
259
271
|
|
|
260
272
|
{
|
|
261
|
-
|
|
273
|
+
if (vtkCellTypes.hasSubCells(minCellType)) {
|
|
274
|
+
cellPicked = cell.intersectWithLine(t1, t2, p1, p2, tol, x, pCoords);
|
|
275
|
+
} else {
|
|
276
|
+
cellPicked = cell.intersectWithLine(p1, p2, tol, x, pCoords);
|
|
277
|
+
}
|
|
262
278
|
}
|
|
263
279
|
|
|
264
280
|
if (cellPicked.intersect === 1 && cellPicked.t <= tMin + model.tolerance && cellPicked.t >= t1 && cellPicked.t <= t2) {
|
|
@@ -267,6 +283,7 @@ function vtkCellPicker(publicAPI, model) {
|
|
|
267
283
|
if (pDist < pDistMin || pDist === pDistMin && cellPicked.t < tMin) {
|
|
268
284
|
tMin = cellPicked.t;
|
|
269
285
|
pDistMin = pDist;
|
|
286
|
+
subId = cellPicked.subId;
|
|
270
287
|
minCellId = cellId;
|
|
271
288
|
cell.deepCopy(minCell);
|
|
272
289
|
|
|
@@ -281,17 +298,21 @@ function vtkCellPicker(publicAPI, model) {
|
|
|
281
298
|
|
|
282
299
|
if (minCellId >= 0 && tMin < model.globalTMin) {
|
|
283
300
|
resetPickInfo();
|
|
301
|
+
var nbPointsInCell = minCell.getNumberOfPoints();
|
|
302
|
+
var weights = new Array(nbPointsInCell);
|
|
284
303
|
|
|
285
|
-
var
|
|
286
|
-
|
|
287
|
-
var weights = new Array(_nbPointsInCell);
|
|
288
|
-
|
|
289
|
-
for (var _i = 0; _i < _nbPointsInCell; _i++) {
|
|
290
|
-
weights[_i] = 0.0;
|
|
304
|
+
for (var i = 0; i < nbPointsInCell; i++) {
|
|
305
|
+
weights[i] = 0.0;
|
|
291
306
|
}
|
|
292
307
|
|
|
293
308
|
var point = [];
|
|
294
|
-
|
|
309
|
+
|
|
310
|
+
if (vtkCellTypes.hasSubCells(minCellType)) {
|
|
311
|
+
minCell.evaluateLocation(subId, minPCoords, point, weights);
|
|
312
|
+
} else {
|
|
313
|
+
minCell.evaluateLocation(minPCoords, point, weights);
|
|
314
|
+
} // Return the polydata to the user
|
|
315
|
+
|
|
295
316
|
|
|
296
317
|
model.dataSet = data;
|
|
297
318
|
model.cellId = minCellId;
|
|
@@ -302,10 +323,10 @@ function vtkCellPicker(publicAPI, model) {
|
|
|
302
323
|
var maxWeight = 0;
|
|
303
324
|
var iMaxWeight = -1;
|
|
304
325
|
|
|
305
|
-
for (var
|
|
306
|
-
if (weights[
|
|
307
|
-
iMaxWeight =
|
|
308
|
-
maxWeight = weights[
|
|
326
|
+
for (var _i = 0; _i < nbPointsInCell; _i++) {
|
|
327
|
+
if (weights[_i] > maxWeight) {
|
|
328
|
+
iMaxWeight = _i;
|
|
329
|
+
maxWeight = weights[_i];
|
|
309
330
|
}
|
|
310
331
|
} // If maximum weight is found, use it to get the PointId
|
|
311
332
|
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
export declare enum ColorMode {
|
|
2
|
+
DEFAULT = 0,
|
|
3
|
+
MAP_SCALARS = 1,
|
|
4
|
+
DIRECT_SCALARS = 2,
|
|
5
|
+
}
|
|
6
|
+
|
|
7
|
+
export declare enum ScalarMode {
|
|
8
|
+
DEFAULT = 0,
|
|
9
|
+
USE_POINT_DATA = 1,
|
|
10
|
+
USE_CELL_DATA = 2,
|
|
11
|
+
USE_POINT_FIELD_DATA = 3,
|
|
12
|
+
USE_CELL_FIELD_DATA = 4,
|
|
13
|
+
USE_FIELD_DATA = 5,
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
export declare enum GetArray {
|
|
17
|
+
BY_ID = 0,
|
|
18
|
+
BY_NAME = 1,
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
declare const _default: {
|
|
22
|
+
ColorMode: typeof ColorMode;
|
|
23
|
+
ScalarMode: typeof ScalarMode;
|
|
24
|
+
GetArray: typeof GetArray;
|
|
25
|
+
};
|
|
26
|
+
export default _default;
|
|
@@ -1,25 +1,6 @@
|
|
|
1
1
|
import { Bounds, Nullable, Range } from './../../types';
|
|
2
2
|
import vtkAbstractMapper3D, { IAbstractMapper3DInitialValues } from './AbstractMapper3D';
|
|
3
|
-
|
|
4
|
-
export enum ColorMode {
|
|
5
|
-
DEFAULT,
|
|
6
|
-
MAP_SCALARS,
|
|
7
|
-
DIRECT_SCALARS,
|
|
8
|
-
}
|
|
9
|
-
|
|
10
|
-
export enum ScalarMode {
|
|
11
|
-
DEFAULT,
|
|
12
|
-
USE_POINT_DATA,
|
|
13
|
-
USE_CELL_DATA,
|
|
14
|
-
USE_POINT_FIELD_DATA,
|
|
15
|
-
USE_CELL_FIELD_DATA,
|
|
16
|
-
USE_FIELD_DATA,
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
export enum GetArray {
|
|
20
|
-
BY_ID,
|
|
21
|
-
BY_NAME,
|
|
22
|
-
}
|
|
3
|
+
import { ColorMode, GetArray, ScalarMode } from './Mapper/Constants';
|
|
23
4
|
|
|
24
5
|
interface IPrimitiveCount {
|
|
25
6
|
points: number;
|
|
@@ -166,7 +147,7 @@ export interface vtkMapper extends vtkAbstractMapper3D {
|
|
|
166
147
|
/**
|
|
167
148
|
* Return the method of coloring scalar data.
|
|
168
149
|
*/
|
|
169
|
-
getColorMode():
|
|
150
|
+
getColorMode(): ColorMode;
|
|
170
151
|
|
|
171
152
|
/**
|
|
172
153
|
* Return the method of coloring scalar data.
|
|
@@ -643,5 +624,8 @@ export declare const vtkMapper: {
|
|
|
643
624
|
getResolveCoincidentTopologyLineOffsetParameters: typeof getResolveCoincidentTopologyLineOffsetParameters;
|
|
644
625
|
getResolveCoincidentTopologyPointOffsetParameters: typeof getResolveCoincidentTopologyPointOffsetParameters;
|
|
645
626
|
getResolveCoincidentTopologyPolygonOffsetParameters: typeof getResolveCoincidentTopologyPolygonOffsetParameters;
|
|
627
|
+
ColorMode: typeof ColorMode;
|
|
628
|
+
ScalarMode: typeof ScalarMode;
|
|
629
|
+
GetArray: typeof GetArray;
|
|
646
630
|
}
|
|
647
631
|
export default vtkMapper;
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
export declare enum Shading {
|
|
2
|
+
FLAT = 0,
|
|
3
|
+
GOURAUD = 1,
|
|
4
|
+
PHONG = 2,
|
|
5
|
+
}
|
|
6
|
+
|
|
7
|
+
export declare enum Representation {
|
|
8
|
+
POINTS = 0,
|
|
9
|
+
WIREFRAME = 1,
|
|
10
|
+
SURFACE = 2,
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
export declare enum Interpolation {
|
|
14
|
+
FLAT = 0,
|
|
15
|
+
GOURAUD = 1,
|
|
16
|
+
PHONG = 2,
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
declare const _default: {
|
|
20
|
+
Shading: typeof Shading;
|
|
21
|
+
Representation: typeof Representation;
|
|
22
|
+
Interpolation: typeof Interpolation;
|
|
23
|
+
};
|
|
24
|
+
export default _default;
|
|
@@ -1,23 +1,6 @@
|
|
|
1
1
|
import { vtkObject } from './../../interfaces';
|
|
2
2
|
import { RGBColor } from './../../types';
|
|
3
|
-
|
|
4
|
-
export enum Shading {
|
|
5
|
-
FLAT,
|
|
6
|
-
GOURAUD,
|
|
7
|
-
PHONG,
|
|
8
|
-
}
|
|
9
|
-
|
|
10
|
-
export enum Representation {
|
|
11
|
-
POINTS,
|
|
12
|
-
WIREFRAME,
|
|
13
|
-
SURFACE,
|
|
14
|
-
}
|
|
15
|
-
|
|
16
|
-
export enum Interpolation {
|
|
17
|
-
FLAT,
|
|
18
|
-
GOURAUD,
|
|
19
|
-
PHONG,
|
|
20
|
-
}
|
|
3
|
+
import { Interpolation, Representation, Shading } from './Property/Constants';
|
|
21
4
|
|
|
22
5
|
export interface IPropertyInitialValues {
|
|
23
6
|
color?: RGBColor;
|
|
@@ -457,7 +440,10 @@ export function newInstance(initialValues?: IPropertyInitialValues): vtkProperty
|
|
|
457
440
|
* manipulated with this object.
|
|
458
441
|
*/
|
|
459
442
|
export declare const vtkProperty: {
|
|
460
|
-
newInstance: typeof newInstance
|
|
461
|
-
extend: typeof extend
|
|
443
|
+
newInstance: typeof newInstance;
|
|
444
|
+
extend: typeof extend;
|
|
445
|
+
Shading: typeof Shading;
|
|
446
|
+
Representation: typeof Representation;
|
|
447
|
+
Interpolation: typeof Interpolation;
|
|
462
448
|
};
|
|
463
449
|
export default vtkProperty;
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
export declare enum Device {
|
|
2
|
+
Unknown = 0,
|
|
3
|
+
LeftController = 1,
|
|
4
|
+
RightController = 2,
|
|
5
|
+
}
|
|
6
|
+
|
|
7
|
+
export declare enum Input {
|
|
8
|
+
Unknown = 0,
|
|
9
|
+
Trigger = 1,
|
|
10
|
+
TrackPad = 2,
|
|
11
|
+
Grip = 3,
|
|
12
|
+
Thumbstick = 4,
|
|
13
|
+
A = 5,
|
|
14
|
+
B = 6,
|
|
15
|
+
ApplicationMenu = 7, // Not exposed in WebXR API
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
export declare enum Axis {
|
|
19
|
+
Unknown = 0,
|
|
20
|
+
TouchpadX = 1,
|
|
21
|
+
TouchpadY = 2,
|
|
22
|
+
ThumbstickX = 3,
|
|
23
|
+
ThumbstickY = 4,
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
declare const _default: {
|
|
27
|
+
Device: typeof Device;
|
|
28
|
+
Input: typeof Input;
|
|
29
|
+
Axis: typeof Axis;
|
|
30
|
+
};
|
|
31
|
+
export default _default;
|