@kitware/vtk.js 24.9.0 → 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 +3 -3
- 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/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/Manipulators/LineManipulator.js +1 -1
- 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.js +1 -1
- package/Widgets/Widgets3D/LineWidget/behavior.js +1 -1
- package/Widgets/Widgets3D/LineWidget/helpers.js +1 -1
- package/Widgets/Widgets3D/ResliceCursorWidget/behavior.js +1 -1
- package/Widgets/Widgets3D/ResliceCursorWidget/helpers.js +1 -1
- package/Widgets/Widgets3D/ResliceCursorWidget.js +1 -1
- package/Widgets/Widgets3D/SplineWidget/state.js +10 -0
- package/Widgets/Widgets3D/SplineWidget.js +1 -1
- package/index.d.ts +9 -0
- package/package.json +1 -1
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
import _defineProperty from '@babel/runtime/helpers/defineProperty';
|
|
2
|
+
import macro from '../../macros.js';
|
|
3
|
+
import vtkCell from './Cell.js';
|
|
4
|
+
import vtkLine from './Line.js';
|
|
5
|
+
|
|
6
|
+
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; }
|
|
7
|
+
|
|
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
|
+
|
|
10
|
+
function vtkPolyLine(publicAPI, model) {
|
|
11
|
+
model.classHierarchy.push('vtkPolyLine');
|
|
12
|
+
|
|
13
|
+
var superClass = _objectSpread({}, publicAPI);
|
|
14
|
+
|
|
15
|
+
var line = vtkLine.newInstance();
|
|
16
|
+
line.getPoints().setNumberOfPoints(2);
|
|
17
|
+
|
|
18
|
+
publicAPI.getCellDimension = function () {
|
|
19
|
+
return 1;
|
|
20
|
+
};
|
|
21
|
+
|
|
22
|
+
publicAPI.intersectWithLine = function (t1, t2, p1, p2, tol, x, pcoords) {
|
|
23
|
+
var outObj = {
|
|
24
|
+
intersect: 0,
|
|
25
|
+
t: Number.MAX_VALUE,
|
|
26
|
+
subId: 0,
|
|
27
|
+
betweenPoints: null
|
|
28
|
+
};
|
|
29
|
+
var numLines = superClass.getPoints().getNumberOfPoints() - 1;
|
|
30
|
+
var pDistMin = Number.MAX_VALUE;
|
|
31
|
+
var minXYZ = [0, 0, 0];
|
|
32
|
+
var minPCoords = [0, 0, 0];
|
|
33
|
+
|
|
34
|
+
for (var subId = 0; subId < numLines; subId++) {
|
|
35
|
+
var pCoords = [0, 0, 0];
|
|
36
|
+
line.getPoints().getData().set(model.points.getData().subarray(3 * subId, 3 * (subId + 2)));
|
|
37
|
+
var lineIntersected = line.intersectWithLine(p1, p2, tol, x, pcoords);
|
|
38
|
+
|
|
39
|
+
if (lineIntersected.intersect === 1 && lineIntersected.t <= outObj.t + tol && lineIntersected.t >= t1 && lineIntersected.t <= t2) {
|
|
40
|
+
outObj.intersect = 1;
|
|
41
|
+
var pDist = line.getParametricDistance(pCoords);
|
|
42
|
+
|
|
43
|
+
if (pDist < pDistMin || pDist === pDistMin && lineIntersected.t < outObj.t) {
|
|
44
|
+
outObj.subId = subId;
|
|
45
|
+
outObj.t = lineIntersected.t;
|
|
46
|
+
pDistMin = pDist;
|
|
47
|
+
|
|
48
|
+
for (var k = 0; k < 3; k++) {
|
|
49
|
+
minXYZ[k] = x[k];
|
|
50
|
+
minPCoords[k] = pCoords[k];
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
return outObj;
|
|
57
|
+
};
|
|
58
|
+
|
|
59
|
+
publicAPI.evaluateLocation = function (subId, pcoords, x, weights) {
|
|
60
|
+
line.getPoints().getData().set(model.points.getData().subarray(3 * subId, 3 * (subId + 2)));
|
|
61
|
+
return line.evaluateLocation(pcoords, x, weights);
|
|
62
|
+
};
|
|
63
|
+
} // ----------------------------------------------------------------------------
|
|
64
|
+
// Object factory
|
|
65
|
+
// ----------------------------------------------------------------------------
|
|
66
|
+
|
|
67
|
+
|
|
68
|
+
var DEFAULT_VALUES = {}; // ----------------------------------------------------------------------------
|
|
69
|
+
|
|
70
|
+
function extend(publicAPI, model) {
|
|
71
|
+
var initialValues = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
|
|
72
|
+
Object.assign(model, DEFAULT_VALUES, initialValues);
|
|
73
|
+
vtkCell.extend(publicAPI, model, initialValues);
|
|
74
|
+
vtkPolyLine(publicAPI, model);
|
|
75
|
+
} // ----------------------------------------------------------------------------
|
|
76
|
+
|
|
77
|
+
var newInstance = macro.newInstance(extend, 'vtkPolyLine'); // ----------------------------------------------------------------------------
|
|
78
|
+
|
|
79
|
+
var vtkPolyLine$1 = {
|
|
80
|
+
newInstance: newInstance,
|
|
81
|
+
extend: extend
|
|
82
|
+
};
|
|
83
|
+
|
|
84
|
+
export { vtkPolyLine$1 as default, extend, newInstance };
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import _toConsumableArray from '@babel/runtime/helpers/toConsumableArray';
|
|
2
2
|
import macro from '../../macros.js';
|
|
3
|
-
import { l as normalize,
|
|
3
|
+
import { l as normalize, s as subtract, j as cross, k as add, d as dot, n as norm } from '../Core/Math/index.js';
|
|
4
4
|
import vtkLine from './Line.js';
|
|
5
5
|
import vtkPlane from './Plane.js';
|
|
6
6
|
import vtkPriorityQueue from '../Core/PriorityQueue.js';
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
// Boundary conditions available to compute open splines
|
|
2
|
+
// DEFAULT : desired slope at boundary point is derivative from two points (boundary and second interior)
|
|
3
|
+
// DERIVATIVE : desired slope at boundary point is the boundary value given.
|
|
4
|
+
// SECOND_DERIVATIVE : second derivative at boundary point is the boundary value given.
|
|
5
|
+
// SECOND_DERIVATIVE_INTERIOR_POINT : desired second derivative at boundary point is the boundary value given times second derivative
|
|
6
|
+
// at first interior point.
|
|
7
|
+
var BoundaryCondition = {
|
|
8
|
+
DEFAULT: 0,
|
|
9
|
+
DERIVATIVE: 1,
|
|
10
|
+
SECOND_DERIVATIVE: 2,
|
|
11
|
+
SECOND_DERIVATIVE_INTERIOR_POINT: 3
|
|
12
|
+
};
|
|
13
|
+
var Constants = {
|
|
14
|
+
BoundaryCondition: BoundaryCondition
|
|
15
|
+
};
|
|
16
|
+
|
|
17
|
+
export { BoundaryCondition, Constants as default };
|
|
@@ -3,6 +3,19 @@ import { vtkObject } from './../../interfaces' ;
|
|
|
3
3
|
|
|
4
4
|
export interface ISpline1DInitialValues {}
|
|
5
5
|
|
|
6
|
+
// Boundary conditions available to compute open splines
|
|
7
|
+
// DEFAULT : desired slope at boundary point is derivative from two points (boundary and second interior)
|
|
8
|
+
// DERIVATIVE : desired slope at boundary point is the boundary value given.
|
|
9
|
+
// SECOND_DERIVATIVE : second derivative at boundary point is the boundary value given.
|
|
10
|
+
// SECOND_DERIVATIVE_INTERIOR_POINT : desired second derivative at boundary point is the boundary value given times second derivative
|
|
11
|
+
// at first interior point.
|
|
12
|
+
export enum BoundaryCondition {
|
|
13
|
+
DEFAULT,
|
|
14
|
+
DERIVATIVE,
|
|
15
|
+
SECOND_DERIVATIVE,
|
|
16
|
+
SECOND_DERIVATIVE_INTERIOR_POINT,
|
|
17
|
+
}
|
|
18
|
+
|
|
6
19
|
export interface vtkSpline1D extends vtkObject {
|
|
7
20
|
|
|
8
21
|
/**
|
|
@@ -19,9 +32,14 @@ export interface vtkSpline1D extends vtkObject {
|
|
|
19
32
|
* @param {Number} size
|
|
20
33
|
* @param {Float32Array} work
|
|
21
34
|
* @param {Number[]} x
|
|
22
|
-
* @param {Number[]} y
|
|
35
|
+
* @param {Number[]} y
|
|
36
|
+
* @param {Object} options
|
|
37
|
+
* @param {BoundaryCondition} options.leftConstraint
|
|
38
|
+
* @param {Number} options.leftValue
|
|
39
|
+
* @param {BoundaryCondition} options.rightConstraint
|
|
40
|
+
* @param {Number} options.rightValue
|
|
23
41
|
*/
|
|
24
|
-
computeOpenCoefficients(size: number, work: Float32Array, x: number[], y: number[]): void;
|
|
42
|
+
computeOpenCoefficients(size: number, work: Float32Array, x: number[], y: number[], options: { leftConstraint: BoundaryCondition, leftValue: number, rightConstraint: BoundaryCondition, rightValue: Number }): void;
|
|
25
43
|
|
|
26
44
|
/**
|
|
27
45
|
*
|
|
@@ -1,10 +1,5 @@
|
|
|
1
|
-
import { vtkObject } from './../../interfaces'
|
|
2
|
-
|
|
3
|
-
export enum splineKind {
|
|
4
|
-
CARDINAL_SPLINE,
|
|
5
|
-
KOCHANEK_SPLINE,
|
|
6
|
-
}
|
|
7
|
-
|
|
1
|
+
import { vtkObject } from './../../interfaces';
|
|
2
|
+
import { splineKind } from './Spline3D/Constants';
|
|
8
3
|
|
|
9
4
|
export interface ISpline3DInitialValues {
|
|
10
5
|
close?: boolean;
|
|
@@ -52,7 +47,7 @@ export function newInstance(initialValues?: ISpline3DInitialValues): vtkSpline3D
|
|
|
52
47
|
* at any given point inside the spline intervals.
|
|
53
48
|
*/
|
|
54
49
|
export declare const vtkSpline3D: {
|
|
55
|
-
newInstance: typeof newInstance
|
|
56
|
-
extend: typeof extend
|
|
50
|
+
newInstance: typeof newInstance;
|
|
51
|
+
extend: typeof extend;
|
|
57
52
|
};
|
|
58
53
|
export default vtkSpline3D;
|
|
@@ -11,7 +11,7 @@ function vtkSpline3D(publicAPI, model) {
|
|
|
11
11
|
// Set our classname
|
|
12
12
|
model.classHierarchy.push('vtkSpline3D'); // --------------------------------------------------------------------------
|
|
13
13
|
|
|
14
|
-
function computeCoefficients1D(spline, points) {
|
|
14
|
+
function computeCoefficients1D(spline, points, boundaryConditionValue) {
|
|
15
15
|
if (points.length === 0) {
|
|
16
16
|
vtkErrorMacro('Splines require at least one points');
|
|
17
17
|
} // If we have only one point we create a spline
|
|
@@ -25,23 +25,27 @@ function vtkSpline3D(publicAPI, model) {
|
|
|
25
25
|
var size = points.length;
|
|
26
26
|
var work = null;
|
|
27
27
|
var intervals = null;
|
|
28
|
+
work = new Float32Array(size);
|
|
28
29
|
|
|
29
|
-
if (model.
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
if (model.intervals.length === 0) {
|
|
33
|
-
intervals = new Float32Array(size);
|
|
30
|
+
if (model.intervals.length === 0) {
|
|
31
|
+
intervals = new Float32Array(size);
|
|
34
32
|
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
}
|
|
38
|
-
} else {
|
|
39
|
-
intervals = model.intervals;
|
|
33
|
+
for (var i = 0; i < intervals.length; i++) {
|
|
34
|
+
intervals[i] = i;
|
|
40
35
|
}
|
|
36
|
+
} else {
|
|
37
|
+
intervals = model.intervals;
|
|
38
|
+
}
|
|
41
39
|
|
|
40
|
+
if (model.close) {
|
|
42
41
|
spline.computeCloseCoefficients(size, work, intervals, points);
|
|
43
42
|
} else {
|
|
44
|
-
|
|
43
|
+
spline.computeOpenCoefficients(size, work, intervals, points, {
|
|
44
|
+
leftConstraint: model.boundaryCondition,
|
|
45
|
+
leftValue: boundaryConditionValue,
|
|
46
|
+
rightConstraint: model.boundaryCondition,
|
|
47
|
+
rightValue: boundaryConditionValue
|
|
48
|
+
});
|
|
45
49
|
}
|
|
46
50
|
} // --------------------------------------------------------------------------
|
|
47
51
|
|
|
@@ -56,9 +60,9 @@ function vtkSpline3D(publicAPI, model) {
|
|
|
56
60
|
var z = points.map(function (pt) {
|
|
57
61
|
return pt[2];
|
|
58
62
|
});
|
|
59
|
-
computeCoefficients1D(model.splineX, x);
|
|
60
|
-
computeCoefficients1D(model.splineY, y);
|
|
61
|
-
computeCoefficients1D(model.splineZ, z);
|
|
63
|
+
computeCoefficients1D(model.splineX, x, model.boundaryConditionValues[0]);
|
|
64
|
+
computeCoefficients1D(model.splineY, y, model.boundaryConditionValues[1]);
|
|
65
|
+
computeCoefficients1D(model.splineZ, z, model.boundaryConditionValues[2]);
|
|
62
66
|
}; // --------------------------------------------------------------------------
|
|
63
67
|
|
|
64
68
|
|
|
@@ -101,6 +105,7 @@ var DEFAULT_VALUES = {
|
|
|
101
105
|
close: false,
|
|
102
106
|
intervals: [],
|
|
103
107
|
kind: splineKind.KOCHANEK_SPLINE,
|
|
108
|
+
boundaryConditionValues: [0, 0, 0],
|
|
104
109
|
// Passed to the vtkKochanekSpline1D
|
|
105
110
|
tension: 0,
|
|
106
111
|
continuity: 0,
|
|
@@ -1,10 +1,12 @@
|
|
|
1
1
|
import { vtkAlgorithm, vtkObject } from './../../interfaces';
|
|
2
2
|
|
|
3
|
+
type CroppingPlanes = number[];
|
|
4
|
+
|
|
3
5
|
/**
|
|
4
6
|
*
|
|
5
7
|
*/
|
|
6
|
-
interface IImageCropFilterInitialValues {
|
|
7
|
-
croppingPlanes?:
|
|
8
|
+
export interface IImageCropFilterInitialValues {
|
|
9
|
+
croppingPlanes?: CroppingPlanes;
|
|
8
10
|
}
|
|
9
11
|
|
|
10
12
|
type vtkImageCropFilterBase = vtkObject & vtkAlgorithm;
|
|
@@ -15,18 +17,19 @@ export interface vtkImageCropFilter extends vtkImageCropFilterBase {
|
|
|
15
17
|
* Get The cropping planes, in IJK space.
|
|
16
18
|
* @default [0, 0, 0, 0, 0, 0].
|
|
17
19
|
*/
|
|
18
|
-
getCroppingPlanes():
|
|
20
|
+
getCroppingPlanes(): CroppingPlanes;
|
|
19
21
|
|
|
20
22
|
/**
|
|
21
23
|
* Get The cropping planes, in IJK space.
|
|
22
24
|
* @default [0, 0, 0, 0, 0, 0].
|
|
23
25
|
*/
|
|
24
|
-
getCroppingPlanesByReference():
|
|
26
|
+
getCroppingPlanesByReference(): CroppingPlanes;
|
|
25
27
|
|
|
26
28
|
/**
|
|
27
29
|
*
|
|
28
30
|
*/
|
|
29
31
|
isResetAvailable(): boolean;
|
|
32
|
+
|
|
30
33
|
/**
|
|
31
34
|
*
|
|
32
35
|
*/
|
|
@@ -43,13 +46,13 @@ export interface vtkImageCropFilter extends vtkImageCropFilterBase {
|
|
|
43
46
|
*
|
|
44
47
|
* @param croppingPlanes
|
|
45
48
|
*/
|
|
46
|
-
setCroppingPlanes(croppingPlanes:
|
|
49
|
+
setCroppingPlanes(croppingPlanes: CroppingPlanes): boolean;
|
|
47
50
|
|
|
48
51
|
/**
|
|
49
52
|
*
|
|
50
53
|
* @param croppingPlanes
|
|
51
54
|
*/
|
|
52
|
-
setCroppingPlanesFrom(croppingPlanes:
|
|
55
|
+
setCroppingPlanesFrom(croppingPlanes: CroppingPlanes): boolean;
|
|
53
56
|
}
|
|
54
57
|
|
|
55
58
|
/**
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import macro from '../../macros.js';
|
|
2
2
|
import vtkPolyData from '../../Common/DataModel/PolyData.js';
|
|
3
|
-
import {
|
|
3
|
+
import { s as subtract, n as norm } from '../../Common/Core/Math/index.js';
|
|
4
4
|
|
|
5
5
|
var vtkWarningMacro = macro.vtkWarningMacro; // ----------------------------------------------------------------------------
|
|
6
6
|
// vtkLineSource methods
|
|
@@ -2,7 +2,7 @@ import _toConsumableArray from '@babel/runtime/helpers/toConsumableArray';
|
|
|
2
2
|
import { mat4, vec3 } from 'gl-matrix';
|
|
3
3
|
import macro from '../../macros.js';
|
|
4
4
|
import vtkDataArray from '../../Common/Core/DataArray.js';
|
|
5
|
-
import {
|
|
5
|
+
import { s as subtract, l as normalize, d as dot, j as cross, r as radiansFromDegrees } from '../../Common/Core/Math/index.js';
|
|
6
6
|
import vtkMatrixBuilder from '../../Common/Core/MatrixBuilder.js';
|
|
7
7
|
import vtkPolyData from '../../Common/DataModel/PolyData.js';
|
|
8
8
|
|
|
@@ -5,7 +5,7 @@ import vtkCompositeMouseManipulator from './CompositeMouseManipulator.js';
|
|
|
5
5
|
import vtkInteractorStyleConstants from '../../Rendering/Core/InteractorStyle/Constants.js';
|
|
6
6
|
import vtkMouseCameraUnicamRotateManipulator from './MouseCameraUnicamRotateManipulator.js';
|
|
7
7
|
import macro from '../../macros.js';
|
|
8
|
-
import {
|
|
8
|
+
import { s as subtract, x as multiplyScalar, l as normalize, d as dot, r as radiansFromDegrees, j as cross } from '../../Common/Core/Math/index.js';
|
|
9
9
|
|
|
10
10
|
var States = vtkInteractorStyleConstants.States; // ----------------------------------------------------------------------------
|
|
11
11
|
// vtkMouseCameraUnicamManipulator methods
|
|
@@ -10,7 +10,7 @@ import vtkSphereSource from '../../Filters/Sources/SphereSource.js';
|
|
|
10
10
|
import { FieldAssociations } from '../../Common/DataModel/DataSet/Constants.js';
|
|
11
11
|
import { mat4, vec3 } from 'gl-matrix';
|
|
12
12
|
import macro from '../../macros.js';
|
|
13
|
-
import { B as areEquals, l as normalize, d as dot, C as clampValue,
|
|
13
|
+
import { B as areEquals, l as normalize, d as dot, C as clampValue, s as subtract, j as cross, x as multiplyScalar, f as distance2BetweenPoints } from '../../Common/Core/Math/index.js';
|
|
14
14
|
|
|
15
15
|
var States = vtkInteractorStyleConstants.States; // ----------------------------------------------------------------------------
|
|
16
16
|
// vtkMouseCameraUnicamRotateManipulator methods
|
|
@@ -4,13 +4,8 @@ import vtkAxesActor from './../../Rendering/Core/AxesActor';
|
|
|
4
4
|
import vtkRenderer from './../../Rendering/Core/Renderer';
|
|
5
5
|
import vtkRenderWindowInteractor from './../../Rendering/Core/RenderWindowInteractor';
|
|
6
6
|
import { Nullable } from './../../types';
|
|
7
|
+
import { Corners } from './OrientationMarkerWidget/Constants';
|
|
7
8
|
|
|
8
|
-
export enum Corners {
|
|
9
|
-
TOP_LEFT,
|
|
10
|
-
TOP_RIGHT,
|
|
11
|
-
BOTTOM_LEFT,
|
|
12
|
-
BOTTOM_RIGHT,
|
|
13
|
-
}
|
|
14
9
|
|
|
15
10
|
/**
|
|
16
11
|
*
|
|
@@ -177,5 +172,6 @@ export function newInstance(initialValues?: IOrientationMarkerWidgetInitialValue
|
|
|
177
172
|
export declare const vtkOrientationMarkerWidget: {
|
|
178
173
|
newInstance: typeof newInstance;
|
|
179
174
|
extend: typeof extend;
|
|
175
|
+
Corners: typeof Corners;
|
|
180
176
|
}
|
|
181
177
|
export default vtkOrientationMarkerWidget;
|
|
@@ -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;
|