@kitware/vtk.js 29.4.0 → 29.4.2
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/IO/Geometry/PLYWriter.js
CHANGED
|
@@ -216,9 +216,9 @@ function writePLY(polyData, format, dataByteOrder, headerComments, textureFileNa
|
|
|
216
216
|
b = scalars.getData()[i * 3 + 2];
|
|
217
217
|
}
|
|
218
218
|
if (normals) {
|
|
219
|
-
nx = normals.getData()[i *
|
|
220
|
-
ny = normals.getData()[i *
|
|
221
|
-
nz = normals.getData()[i *
|
|
219
|
+
nx = normals.getData()[i * 3];
|
|
220
|
+
ny = normals.getData()[i * 3 + 1];
|
|
221
|
+
nz = normals.getData()[i * 3 + 2];
|
|
222
222
|
}
|
|
223
223
|
writer.writeVertice(x, y, z, nx, ny, nz, u, v, r, g, b);
|
|
224
224
|
}
|
|
@@ -1,8 +1,9 @@
|
|
|
1
|
-
import { Vector3 } from './../../types';
|
|
1
|
+
import { Vector3, Nullable } from './../../types';
|
|
2
2
|
import vtkAbstractPicker, { IAbstractPickerInitialValues } from './AbstractPicker';
|
|
3
3
|
import vtkActor from './Actor';
|
|
4
4
|
import vtkMapper from './Mapper';
|
|
5
5
|
import vtkRenderer from './Renderer';
|
|
6
|
+
import { vtkSubscription } from './../../interfaces';
|
|
6
7
|
|
|
7
8
|
|
|
8
9
|
export interface IPickerInitialValues extends IAbstractPickerInitialValues {
|
|
@@ -13,6 +14,8 @@ export interface IPickerInitialValues extends IAbstractPickerInitialValues {
|
|
|
13
14
|
globalTMin?: number;
|
|
14
15
|
}
|
|
15
16
|
|
|
17
|
+
type OnPickChangeCallback = (pickedPositions: Vector3[]) => void
|
|
18
|
+
|
|
16
19
|
export interface vtkPicker extends vtkAbstractPicker {
|
|
17
20
|
|
|
18
21
|
/**
|
|
@@ -21,29 +24,29 @@ export interface vtkPicker extends vtkAbstractPicker {
|
|
|
21
24
|
getActors(): vtkActor[];
|
|
22
25
|
|
|
23
26
|
/**
|
|
24
|
-
* Get
|
|
27
|
+
* Get the dataset that was picked (if any).
|
|
25
28
|
*/
|
|
26
29
|
getDataSet(): any;
|
|
27
30
|
|
|
28
31
|
/**
|
|
29
32
|
* Get mapper that was picked (if any)
|
|
30
33
|
*/
|
|
31
|
-
getMapper():
|
|
34
|
+
getMapper(): Nullable<vtkMapper>;
|
|
32
35
|
|
|
33
36
|
/**
|
|
34
37
|
* Get position in mapper (i.e., non-transformed) coordinates of pick point.
|
|
35
38
|
*/
|
|
36
|
-
getMapperPosition():
|
|
39
|
+
getMapperPosition(): Vector3;
|
|
37
40
|
|
|
38
41
|
/**
|
|
39
|
-
*
|
|
42
|
+
* Get position in mapper (i.e., non-transformed) coordinates of pick point.
|
|
40
43
|
*/
|
|
41
|
-
getMapperPositionByReference():
|
|
44
|
+
getMapperPositionByReference(): Vector3;
|
|
42
45
|
|
|
43
46
|
/**
|
|
44
|
-
* Get a list of the points the actors returned by
|
|
47
|
+
* Get a list of the points the actors returned by getActors were intersected at.
|
|
45
48
|
*/
|
|
46
|
-
getPickedPositions():
|
|
49
|
+
getPickedPositions(): Vector3[];
|
|
47
50
|
|
|
48
51
|
/**
|
|
49
52
|
* Get tolerance for performing pick operation.
|
|
@@ -51,14 +54,18 @@ export interface vtkPicker extends vtkAbstractPicker {
|
|
|
51
54
|
getTolerance(): number;
|
|
52
55
|
|
|
53
56
|
/**
|
|
54
|
-
*
|
|
57
|
+
* Invoke a pick change event with the list of picked points.
|
|
58
|
+
* This function is called internally by VTK.js and is not intended for public use.
|
|
59
|
+
* @param {Vector3[]} pickedPositions
|
|
55
60
|
*/
|
|
56
|
-
|
|
61
|
+
invokePickChange(pickedPositions: Vector3[]): void;
|
|
57
62
|
|
|
58
63
|
/**
|
|
59
|
-
*
|
|
64
|
+
* Execute the given callback when the pickChange event is fired.
|
|
65
|
+
* The callback receives an array of picked point positions.
|
|
66
|
+
* @param {OnPickChangeCallback}
|
|
60
67
|
*/
|
|
61
|
-
|
|
68
|
+
onPickChange(callback: OnPickChangeCallback): vtkSubscription;
|
|
62
69
|
|
|
63
70
|
/**
|
|
64
71
|
* Intersect data with specified ray.
|
|
@@ -72,10 +79,10 @@ export interface vtkPicker extends vtkAbstractPicker {
|
|
|
72
79
|
|
|
73
80
|
/**
|
|
74
81
|
* Perform pick operation with selection point provided.
|
|
75
|
-
* @param selection
|
|
76
|
-
* @param {vtkRenderer} renderer The
|
|
82
|
+
* @param {Vector3} selection First two values should be x-y pixel coordinate, the third is usually zero.
|
|
83
|
+
* @param {vtkRenderer} renderer The renderer on which you want to do picking.
|
|
77
84
|
*/
|
|
78
|
-
pick(selection:
|
|
85
|
+
pick(selection: Vector3, renderer: vtkRenderer): void;
|
|
79
86
|
|
|
80
87
|
/**
|
|
81
88
|
* Set position in mapper coordinates of pick point.
|
|
@@ -92,7 +99,9 @@ export interface vtkPicker extends vtkAbstractPicker {
|
|
|
92
99
|
setMapperPositionFrom(mapperPosition: Vector3): boolean;
|
|
93
100
|
|
|
94
101
|
/**
|
|
95
|
-
* Specify tolerance for performing pick operation.
|
|
102
|
+
* Specify tolerance for performing pick operation. Tolerance is specified
|
|
103
|
+
* as fraction of rendering window size. (Rendering window size is measured
|
|
104
|
+
* across diagonal.)
|
|
96
105
|
* @param {Number} tolerance The tolerance value.
|
|
97
106
|
*/
|
|
98
107
|
setTolerance(tolerance: number): boolean;
|
|
@@ -127,6 +136,11 @@ export function newInstance(initialValues?: IPickerInitialValues): vtkPicker;
|
|
|
127
136
|
* the prop itself, the data set, and the mapper.
|
|
128
137
|
* For vtkPicker the closest prop is the one whose center point (i.e., center of bounding box) projected on the view ray is closest
|
|
129
138
|
* to the camera. Subclasses of vtkPicker use other methods for computing the pick point.
|
|
139
|
+
*
|
|
140
|
+
* vtkPicker is used for quick geometric picking. If you desire more precise
|
|
141
|
+
* picking of points or cells based on the geometry of any vtkProp3D, use the
|
|
142
|
+
* subclasses vtkPointPicker or vtkCellPicker. For hardware-accelerated
|
|
143
|
+
* picking of any type of vtkProp, use vtkPropPicker or vtkWorldPointPicker.
|
|
130
144
|
*/
|
|
131
145
|
export declare const vtkPicker: {
|
|
132
146
|
newInstance: typeof newInstance,
|
|
@@ -1,5 +1,16 @@
|
|
|
1
|
+
import { Vector3 } from '../../../types';
|
|
1
2
|
import { ViewTypes } from '../../Core/WidgetManager/Constants';
|
|
2
3
|
|
|
4
|
+
// Different types of plane from ViewTypes:
|
|
5
|
+
export type PlaneViewType = ViewTypes.YZ_PLANE | ViewTypes.XZ_PLANE | ViewTypes.XY_PLANE;
|
|
6
|
+
|
|
7
|
+
// 0, 1, 2 for X, Y, Z
|
|
8
|
+
export type AxisIndex = 0 | 1 | 2;
|
|
9
|
+
|
|
10
|
+
// Should be X, Y, Z
|
|
11
|
+
export type PlaneName = typeof planeNames extends (infer U)[] ? U : never;
|
|
12
|
+
|
|
13
|
+
|
|
3
14
|
export declare enum ScrollingMethods {
|
|
4
15
|
MIDDLE_MOUSE_BUTTON = 0,
|
|
5
16
|
LEFT_MOUSE_BUTTON = 1,
|
|
@@ -15,48 +26,29 @@ export declare enum InteractionMethodsName {
|
|
|
15
26
|
TranslateCenterAndUpdatePlanes = 'translateCenterAndUpdatePlanes',
|
|
16
27
|
}
|
|
17
28
|
|
|
18
|
-
export declare
|
|
19
|
-
[ViewTypes.YZ_PLANE]: [0, 0, 1], // Sagittal
|
|
20
|
-
[ViewTypes.XZ_PLANE]: [0, 0, 1], // Coronal
|
|
21
|
-
[ViewTypes.XY_PLANE]: [0, -1, 0], // Axial
|
|
22
|
-
}
|
|
29
|
+
export declare const defaultViewUpFromViewType: { [plane in PlaneViewType]: Vector3 };
|
|
23
30
|
|
|
24
|
-
export declare
|
|
25
|
-
ViewTypes.YZ_PLANE,
|
|
26
|
-
ViewTypes.XZ_PLANE,
|
|
27
|
-
ViewTypes.XY_PLANE,
|
|
28
|
-
];
|
|
31
|
+
export declare const xyzToViewType: [PlaneViewType, PlaneViewType, PlaneViewType];
|
|
29
32
|
|
|
30
|
-
export declare
|
|
31
|
-
[ViewTypes.YZ_PLANE]: 0,
|
|
32
|
-
[ViewTypes.XZ_PLANE]: 1,
|
|
33
|
-
[ViewTypes.XY_PLANE]: 2,
|
|
34
|
-
}
|
|
33
|
+
export declare const viewTypeToXYZ: { [plane in PlaneViewType]: AxisIndex };
|
|
35
34
|
|
|
36
|
-
export declare
|
|
35
|
+
export declare const planeNames: ['X', 'Y', 'Z'];
|
|
37
36
|
|
|
38
|
-
export declare
|
|
39
|
-
[ViewTypes.YZ_PLANE]: 'X',
|
|
40
|
-
[ViewTypes.XZ_PLANE]: 'Y',
|
|
41
|
-
[ViewTypes.XY_PLANE]: 'Z',
|
|
42
|
-
}
|
|
37
|
+
export declare const viewTypeToPlaneName: { [plane in PlaneViewType]: PlaneName };
|
|
43
38
|
|
|
44
|
-
export declare
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
Z: ViewTypes.XY_PLANE,
|
|
48
|
-
}
|
|
49
|
-
export declare type lineNames = ['YinX', 'ZinX', 'XinY', 'ZinY', 'XinZ', 'YinZ'];
|
|
39
|
+
export declare const planeNameToViewType: { [planeName in PlaneName]: PlaneViewType };
|
|
40
|
+
|
|
41
|
+
export declare const lineNames: ['YinX', 'ZinX', 'XinY', 'ZinY', 'XinZ', 'YinZ'];
|
|
50
42
|
|
|
51
43
|
declare const _default: {
|
|
52
44
|
ScrollingMethods: typeof ScrollingMethods;
|
|
53
45
|
InteractionMethodsName: typeof InteractionMethodsName;
|
|
54
|
-
xyzToViewType: xyzToViewType;
|
|
55
|
-
viewTypeToXYZ: viewTypeToXYZ;
|
|
56
|
-
planeNames: planeNames;
|
|
57
|
-
viewTypeToPlaneName: viewTypeToPlaneName;
|
|
58
|
-
planeNameToViewType: planeNameToViewType;
|
|
59
|
-
lineNames: lineNames;
|
|
60
|
-
}
|
|
46
|
+
xyzToViewType: typeof xyzToViewType;
|
|
47
|
+
viewTypeToXYZ: typeof viewTypeToXYZ;
|
|
48
|
+
planeNames: typeof planeNames;
|
|
49
|
+
viewTypeToPlaneName: typeof viewTypeToPlaneName;
|
|
50
|
+
planeNameToViewType: typeof planeNameToViewType;
|
|
51
|
+
lineNames: typeof lineNames;
|
|
52
|
+
};
|
|
61
53
|
|
|
62
54
|
export default _default;
|