@kitware/vtk.js 29.4.1 → 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.
@@ -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 * 2];
220
- ny = normals.getData()[i * 2 + 1];
221
- nz = normals.getData()[i * 2 + 2];
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 a pointer to the dataset that was picked (if any).
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(): null | vtkMapper;
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(): number[];
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(): number[];
44
+ getMapperPositionByReference(): Vector3;
42
45
 
43
46
  /**
44
- * Get a list of the points the actors returned by GetProp3Ds were intersected at.
47
+ * Get a list of the points the actors returned by getActors were intersected at.
45
48
  */
46
- getPickedPositions(): number[];
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
- * FIXME: this needs to be check again
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
- //invokePickChange(pickedPositions: number[]): any;
61
+ invokePickChange(pickedPositions: Vector3[]): void;
57
62
 
58
63
  /**
59
- * FIXME: this needs to be check again
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
- //onPickChange(pickedPositions: number[]): any;
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 vtkRenderer instance.
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: any, renderer: vtkRenderer): any;
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,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@kitware/vtk.js",
3
- "version": "29.4.1",
3
+ "version": "29.4.2",
4
4
  "description": "Visualization Toolkit for the Web",
5
5
  "keywords": [
6
6
  "3d",