@kitware/vtk.js 34.10.0 → 34.11.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.
@@ -0,0 +1,217 @@
1
+ import { Bounds, Nullable, Vector3 } from './../../types';
2
+ import vtkPoints from './../Core/Points';
3
+ import vtkAbstractPointLocator, {
4
+ IAbstractPointLocatorInitialValues,
5
+ } from './AbstractPointLocator';
6
+ import vtkPolyData from './PolyData';
7
+
8
+ /**
9
+ *
10
+ */
11
+ export interface IPointLocatorInitialValues
12
+ extends IAbstractPointLocatorInitialValues {
13
+ numberOfPointsPerBucket?: number;
14
+ bucketSize?: number;
15
+ }
16
+
17
+ export interface IInsertPointResult {
18
+ inserted: boolean;
19
+ id: number;
20
+ }
21
+
22
+ interface IFindClosestPointResult {
23
+ id: number;
24
+ dist2: number;
25
+ }
26
+
27
+ export interface vtkPointLocator extends vtkAbstractPointLocator {
28
+ /**
29
+ * Find the closest inserted point to the given coordinates.
30
+ *
31
+ * @param {Vector3} x The query point
32
+ * @returns {Number} The id of the closest inserted point or -1 if not found
33
+ */
34
+ findClosestInsertedPoint(x: Vector3): number;
35
+
36
+ /**
37
+ * Find the closest point to a given point.
38
+ *
39
+ * @param {Vector3} x The point coordinates
40
+ * @returns The id of the closest point or -1 if not found
41
+ */
42
+ findClosestPoint(x: Vector3): number;
43
+
44
+ /**
45
+ * Find the closest point within a specified radius.
46
+ *
47
+ * @param {Number} radius The search radius
48
+ * @param {Vector3} x The point coordinates
49
+ * @param {Number} inputDataLength The length of the input data
50
+ * @returns {IFindClosestPointResult} The closest point result
51
+ */
52
+ findClosestPointWithinRadius(
53
+ radius: number,
54
+ x: Vector3,
55
+ inputDataLength?: number
56
+ ): IFindClosestPointResult;
57
+
58
+ /**
59
+ * Free the search structure and reset the locator.
60
+ */
61
+ freeSearchStructure(): void;
62
+
63
+ /**
64
+ * Generate a polydata representation of the point locator.
65
+ *
66
+ * @param {vtkPolyData} polydata The polydata to generate representation for
67
+ * @returns
68
+ */
69
+ generateRepresentation(polydata: vtkPolyData): boolean;
70
+
71
+ /**
72
+ * Get the number of points per bucket.
73
+ *
74
+ * @returns {Number} The number of points per bucket.
75
+ */
76
+ getNumberOfPointsPerBucket(): number;
77
+
78
+ /**
79
+ * Get the points in the specified bucket.
80
+ * @param {Vector3} x The point coordinates
81
+ * @returns {Number[]} The points in the bucket
82
+ */
83
+ getPointsInBucket(x: Vector3): number[];
84
+
85
+ /**
86
+ * Get the points stored in the point locator.
87
+ *
88
+ * @returns {Nullable<vtkPoints>} The vtkPoints object containing the points.
89
+ */
90
+ getPoints(): Nullable<vtkPoints>;
91
+
92
+ /**
93
+ * Initialize point insertion.
94
+ *
95
+ * @param {vtkPoints} points The points to insert
96
+ * @param {Bounds} bounds The bounds for the points
97
+ * @param {Number} estNumPts Estimated number of points for insertion
98
+ */
99
+ initPointInsertion(
100
+ points: vtkPoints,
101
+ bounds: Bounds,
102
+ estNumPts?: number
103
+ ): boolean;
104
+
105
+ /**
106
+ * Insert a point into the point locator.
107
+ * If the point is already present, it returns the existing ID.
108
+ * Otherwise, it inserts the point and returns a new ID.
109
+ *
110
+ * @param {Number} ptId The index of the point to insert.
111
+ * @param {Vector3} x The point to insert.
112
+ * @returns {IInsertPointResult} An object indicating if the point was inserted and its ID.
113
+ */
114
+ insertPoint(ptId: number, x: Vector3): IInsertPointResult;
115
+
116
+ /**
117
+ * Insert a point into the point locator.
118
+ * If the point is already present, it returns the existing ID.
119
+ * Otherwise, it inserts the point and returns a new ID.
120
+ *
121
+ * @param {Vector3} x The point to insert.
122
+ * @returns {IInsertPointResult} An object indicating if the point was inserted and its ID.
123
+ */
124
+ insertNextPoint(x: Vector3): IInsertPointResult;
125
+
126
+ /**
127
+ * Insert a point into the point locator.
128
+ * If the point is already present, it returns the existing ID.
129
+ * Otherwise, it inserts the point and returns a new ID.
130
+ *
131
+ * @param {Vector3} x The point to insert.
132
+ * @returns {IInsertPointResult} An object indicating if the point was inserted and its ID.
133
+ */
134
+ insertUniquePoint(x: Vector3): IInsertPointResult;
135
+
136
+ /**
137
+ * Check if a point is already inserted in the point locator.
138
+ *
139
+ * @param {Vector3} x The point to check.
140
+ * @returns {Number} The ID of the point if it exists, otherwise -1.
141
+ */
142
+ isInsertedPoint(x: Vector3): number;
143
+
144
+ /**
145
+ * Set the divisions of the point locator.
146
+ * @param {Vector3} divisions The number of divisions in each dimension.
147
+ * @returns {Boolean} True if the divisions were set successfully, false otherwise.
148
+ */
149
+ setDivisions(divisions: Vector3): boolean;
150
+
151
+ /**
152
+ * Set the divisions of the point locator.
153
+ * @param {Number} x The number of divisions in the x dimension.
154
+ * @param {Number} y The number of divisions in the y dimension.
155
+ * @param {Number} z The number of divisions in the z dimension.
156
+ * @returns {Boolean} True if the divisions were set successfully, false otherwise.
157
+ */
158
+ setDivisions(x: number, y: number, z: number): boolean;
159
+
160
+ /**
161
+ * Set the number of points per bucket.
162
+ *
163
+ * @param {Number} numberOfPointsPerBucket The number of points per bucket.
164
+ */
165
+ setNumberOfPointsPerBucket(numberOfPointsPerBucket: number): boolean;
166
+
167
+ /**
168
+ * Set the points for this point locator.
169
+ * This is typically used to initialize the locator with a set of points.
170
+ *
171
+ * @param {vtkPoints} points The vtkPoints object containing the points.
172
+ */
173
+ setPoints(points: vtkPoints): boolean;
174
+ }
175
+
176
+ /**
177
+ * Method use to decorate a given object (publicAPI+model) with vtkPointLocator characteristics.
178
+ *
179
+ * @param publicAPI object on which methods will be bounds (public)
180
+ * @param model object on which data structure will be bounds (protected)
181
+ * @param {object} [initialValues] (default: {})
182
+ */
183
+ export function extend(
184
+ publicAPI: object,
185
+ model: object,
186
+ initialValues?: IPointLocatorInitialValues
187
+ ): void;
188
+
189
+ // ----------------------------------------------------------------------------
190
+
191
+ /**
192
+ * Method use to create a new instance of vtkPointLocator
193
+ * @param {IPointLocatorInitialValues} [initialValues] for pre-setting some of its content
194
+ */
195
+ export function newInstance(
196
+ initialValues?: IPointLocatorInitialValues
197
+ ): vtkPointLocator;
198
+
199
+ /**
200
+ * vtkPointLocator is a spatial search object to quickly locate points in 3D.
201
+ *
202
+ * vtkPointLocator works by dividing a specified region of space into a regular
203
+ * array of "rectangular" buckets, and then keeping a list of points that lie in
204
+ * each bucket. Typical operation involves giving a position in 3D and finding
205
+ * the closest point.
206
+ *
207
+ * vtkPointLocator has two distinct methods of interaction. In the first method,
208
+ * you supply it with a dataset, and it operates on the points in the dataset.
209
+ * In the second method, you supply it with an array of points, and the object
210
+ * operates on the array.
211
+ */
212
+ export declare const vtkPointLocator: {
213
+ newInstance: typeof newInstance;
214
+ extend: typeof extend;
215
+ };
216
+
217
+ export default vtkPointLocator;