@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
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
import { Vector2, Vector3 } from './../../types';
|
|
2
|
+
import vtkCell, { ICellInitialValues } from './Cell';
|
|
3
|
+
import { IIntersectWithLine } from './Line';
|
|
4
|
+
|
|
5
|
+
export interface IPolyLineInitialValues extends ICellInitialValues { }
|
|
6
|
+
|
|
7
|
+
export interface vtkPolyLine extends vtkCell {
|
|
8
|
+
|
|
9
|
+
/**
|
|
10
|
+
* Get the topological dimensional of the cell (0, 1, 2 or 3).
|
|
11
|
+
*/
|
|
12
|
+
getCellDimension(): number;
|
|
13
|
+
|
|
14
|
+
/**
|
|
15
|
+
* @param {number} t1
|
|
16
|
+
* @param {number} t2
|
|
17
|
+
* @param {Vector3} p1 The first point coordinate.
|
|
18
|
+
* @param {Vector3} p2 The second point coordinate.
|
|
19
|
+
* @param {Number} tol The tolerance to use.
|
|
20
|
+
* @param {Vector3} x The point which intersect the line.
|
|
21
|
+
* @param {Vector3} pcoords The parametric coordinates.
|
|
22
|
+
*/
|
|
23
|
+
intersectWithLine(t1: number, t2: number, p1: Vector3, p2: Vector3, tol: number, x: Vector3, pcoords: Vector3): IIntersectWithLine;
|
|
24
|
+
|
|
25
|
+
/**
|
|
26
|
+
* Determine global coordinate (x[3]) from subId and parametric coordinates.
|
|
27
|
+
* Also returns interpolation weights. (The number of weights is equal to
|
|
28
|
+
* the number of points in the cell.)
|
|
29
|
+
*
|
|
30
|
+
* @param {number} subId
|
|
31
|
+
* @param {Vector3} pcoords The parametric coordinates
|
|
32
|
+
* @param {Vector3} x The global coordinate
|
|
33
|
+
* @param {Vector2} weights The interpolation weights
|
|
34
|
+
*/
|
|
35
|
+
evaluateLocation(subId: number, pcoords: Vector3, x: Vector3, weights: Vector2): void
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
/**
|
|
39
|
+
* Method used to decorate a given object (publicAPI+model) with vtkPolyLine characteristics.
|
|
40
|
+
*
|
|
41
|
+
* @param publicAPI object on which methods will be bounds (public)
|
|
42
|
+
* @param model object on which data structure will be bounds (protected)
|
|
43
|
+
* @param {IPolyLineInitialValues} [initialValues] (default: {})
|
|
44
|
+
*/
|
|
45
|
+
export function extend(publicAPI: object, model: object, initialValues?: IPolyLineInitialValues): void;
|
|
46
|
+
|
|
47
|
+
/**
|
|
48
|
+
* Method used to create a new instance of vtkPolyLine.
|
|
49
|
+
* @param {IPolyLineInitialValues} [initialValues] for pre-setting some of its content
|
|
50
|
+
*/
|
|
51
|
+
export function newInstance(initialValues?: IPolyLineInitialValues): vtkPolyLine;
|
|
52
|
+
|
|
53
|
+
/**
|
|
54
|
+
* vtkPolyLine is a cell which representant a poly line.
|
|
55
|
+
*
|
|
56
|
+
* @see vtkCell
|
|
57
|
+
*/
|
|
58
|
+
export declare const vtkPolyLine: {
|
|
59
|
+
newInstance: typeof newInstance,
|
|
60
|
+
extend: typeof extend;
|
|
61
|
+
};
|
|
62
|
+
|
|
63
|
+
export default vtkPolyLine;
|
|
@@ -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
|
|
@@ -18,9 +18,13 @@ function vtkMouseRangeManipulator(publicAPI, model) {
|
|
|
18
18
|
|
|
19
19
|
|
|
20
20
|
function processDelta(listener, delta) {
|
|
21
|
-
var oldValue = listener.getValue(); //
|
|
21
|
+
var oldValue = listener.getValue(); // if exponential scroll is enabled, we raise our scale to the
|
|
22
|
+
// exponent of the net delta of the interaction. The further away
|
|
23
|
+
// the user's cursor is from the start of the interaction, the more
|
|
24
|
+
// their movements will effect the value.
|
|
22
25
|
|
|
23
|
-
var
|
|
26
|
+
var scalingFactor = listener.exponentialScroll ? Math.pow(listener.scale, Math.log2(Math.abs(model.interactionNetDelta) + 2)) : listener.scale;
|
|
27
|
+
var newDelta = delta * scalingFactor + incrementalDelta.get(listener);
|
|
24
28
|
var value = oldValue + newDelta; // Compute new value based on step
|
|
25
29
|
|
|
26
30
|
var difference = value - listener.min;
|
|
@@ -52,6 +56,7 @@ function vtkMouseRangeManipulator(publicAPI, model) {
|
|
|
52
56
|
|
|
53
57
|
publicAPI.setHorizontalListener = function (min, max, step, getValue, setValue) {
|
|
54
58
|
var scale = arguments.length > 5 && arguments[5] !== undefined ? arguments[5] : 1;
|
|
59
|
+
var exponentialScroll = arguments.length > 6 && arguments[6] !== undefined ? arguments[6] : false;
|
|
55
60
|
var getFn = Number.isFinite(getValue) ? function () {
|
|
56
61
|
return getValue;
|
|
57
62
|
} : getValue;
|
|
@@ -61,7 +66,8 @@ function vtkMouseRangeManipulator(publicAPI, model) {
|
|
|
61
66
|
step: step,
|
|
62
67
|
getValue: getFn,
|
|
63
68
|
setValue: setValue,
|
|
64
|
-
scale: scale
|
|
69
|
+
scale: scale,
|
|
70
|
+
exponentialScroll: exponentialScroll
|
|
65
71
|
};
|
|
66
72
|
incrementalDelta.set(model.horizontalListener, 0);
|
|
67
73
|
publicAPI.modified();
|
|
@@ -70,6 +76,7 @@ function vtkMouseRangeManipulator(publicAPI, model) {
|
|
|
70
76
|
|
|
71
77
|
publicAPI.setVerticalListener = function (min, max, step, getValue, setValue) {
|
|
72
78
|
var scale = arguments.length > 5 && arguments[5] !== undefined ? arguments[5] : 1;
|
|
79
|
+
var exponentialScroll = arguments.length > 6 && arguments[6] !== undefined ? arguments[6] : false;
|
|
73
80
|
var getFn = Number.isFinite(getValue) ? function () {
|
|
74
81
|
return getValue;
|
|
75
82
|
} : getValue;
|
|
@@ -79,7 +86,8 @@ function vtkMouseRangeManipulator(publicAPI, model) {
|
|
|
79
86
|
step: step,
|
|
80
87
|
getValue: getFn,
|
|
81
88
|
setValue: setValue,
|
|
82
|
-
scale: scale
|
|
89
|
+
scale: scale,
|
|
90
|
+
exponentialScroll: exponentialScroll
|
|
83
91
|
};
|
|
84
92
|
incrementalDelta.set(model.verticalListener, 0);
|
|
85
93
|
publicAPI.modified();
|
|
@@ -88,6 +96,7 @@ function vtkMouseRangeManipulator(publicAPI, model) {
|
|
|
88
96
|
|
|
89
97
|
publicAPI.setScrollListener = function (min, max, step, getValue, setValue) {
|
|
90
98
|
var scale = arguments.length > 5 && arguments[5] !== undefined ? arguments[5] : 1;
|
|
99
|
+
var exponentialScroll = arguments.length > 6 && arguments[6] !== undefined ? arguments[6] : false;
|
|
91
100
|
var getFn = Number.isFinite(getValue) ? function () {
|
|
92
101
|
return getValue;
|
|
93
102
|
} : getValue;
|
|
@@ -97,7 +106,8 @@ function vtkMouseRangeManipulator(publicAPI, model) {
|
|
|
97
106
|
step: step,
|
|
98
107
|
getValue: getFn,
|
|
99
108
|
setValue: setValue,
|
|
100
|
-
scale: scale
|
|
109
|
+
scale: scale,
|
|
110
|
+
exponentialScroll: exponentialScroll
|
|
101
111
|
};
|
|
102
112
|
incrementalDelta.set(model.scrollListener, 0);
|
|
103
113
|
publicAPI.modified();
|
|
@@ -140,6 +150,7 @@ function vtkMouseRangeManipulator(publicAPI, model) {
|
|
|
140
150
|
|
|
141
151
|
publicAPI.onButtonDown = function (interactor, renderer, position) {
|
|
142
152
|
model.previousPosition = position;
|
|
153
|
+
model.interactionNetDelta = 0;
|
|
143
154
|
var glRenderWindow = interactor.getView(); // Ratio is the dom size vs renderwindow size
|
|
144
155
|
|
|
145
156
|
var ratio = glRenderWindow.getContainerSize()[0] / glRenderWindow.getSize()[0]; // Get proper pixel range used by viewport in rw size space
|
|
@@ -216,12 +227,14 @@ function vtkMouseRangeManipulator(publicAPI, model) {
|
|
|
216
227
|
if (model.horizontalListener) {
|
|
217
228
|
var dxNorm = (position.x - model.previousPosition.x) / model.containerSize[0];
|
|
218
229
|
var dx = scaleDeltaToRange(model.horizontalListener, dxNorm);
|
|
230
|
+
model.interactionNetDelta += dx;
|
|
219
231
|
processDelta(model.horizontalListener, dx);
|
|
220
232
|
}
|
|
221
233
|
|
|
222
234
|
if (model.verticalListener) {
|
|
223
235
|
var dyNorm = (position.y - model.previousPosition.y) / model.containerSize[1];
|
|
224
236
|
var dy = scaleDeltaToRange(model.verticalListener, dyNorm);
|
|
237
|
+
model.interactionNetDelta += dy;
|
|
225
238
|
processDelta(model.verticalListener, dy);
|
|
226
239
|
}
|
|
227
240
|
|
|
@@ -234,10 +247,14 @@ function vtkMouseRangeManipulator(publicAPI, model) {
|
|
|
234
247
|
return;
|
|
235
248
|
}
|
|
236
249
|
|
|
250
|
+
model.interactionNetDelta += delta * model.scrollListener.step;
|
|
237
251
|
processDelta(model.scrollListener, delta * model.scrollListener.step);
|
|
238
252
|
};
|
|
239
253
|
|
|
240
|
-
publicAPI.onStartScroll =
|
|
254
|
+
publicAPI.onStartScroll = function (payload) {
|
|
255
|
+
model.interactionNetDelta = 0;
|
|
256
|
+
publicAPI.onScroll(payload);
|
|
257
|
+
};
|
|
241
258
|
} // ----------------------------------------------------------------------------
|
|
242
259
|
// Object factory
|
|
243
260
|
// ----------------------------------------------------------------------------
|
|
@@ -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;
|