@kitware/vtk.js 28.11.0 → 28.12.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.
@@ -1,431 +1,440 @@
1
- import { vtkObject, vtkRange } from './../../interfaces';
2
- import { float, int, Nullable, Range, TypedArray } from './../../types';
3
-
4
-
5
- /**
6
- * Output of the rangeHelper instance
7
- */
8
- interface VtkStatisticInformation {
9
- min: number;
10
- max: number;
11
- count: number;
12
- sum: number;
13
- mean: number;
14
- }
15
-
16
- /**
17
- * Helper class used to compute data range of a set of numbers
18
- */
19
- interface vtkRangeHelper {
20
- add(value: number): void;
21
- get(): VtkStatisticInformation;
22
- getRange(): vtkRange;
23
- }
24
-
25
- /**
26
- * The inital values of a vtkDataArray.
27
- */
28
- export interface IDataArrayInitialValues {
29
- dataType?: string;
30
- empty?: boolean;
31
- name?: string;
32
- numberOfComponents?: number;
33
- rangeTuple?: Range;
34
- size?: number;
35
- values?: Array<number>|TypedArray;
36
- }
37
-
38
- export interface vtkDataArray extends vtkObject {
39
-
40
- /**
41
- * Get the size, in bytes, of the lowest-level element of an array.
42
- */
43
- getElementComponentSize(): number;
44
-
45
- /**
46
- * Get the component for a given tupleIdx.
47
- * @param {Number} tupleIdx
48
- * @param {Number} [componentIndex] (default: 0)
49
- */
50
- getComponent(tupleIdx: number, componentIndex?: number): number;
51
-
52
- /**
53
- * Set the component value for a given tupleIdx and componentIndex.
54
- * @param {Number} tupleIdx
55
- * @param {Number} componentIndex
56
- * @param {Number} value
57
- */
58
- setComponent(tupleIdx: number, componentIndex: number, value: number): void;
59
-
60
- /**
61
- *
62
- */
63
- getData(): number[]|TypedArray;
64
-
65
- /**
66
- * Get the range of the given component.
67
- *
68
- * @param {Number} componentIndex (default: -1)
69
- */
70
- getRange(componentIndex?: number): Range;
71
-
72
- /**
73
- *
74
- * @param {vtkRange} rangeValue
75
- * @param {Number} componentIndex
76
- */
77
- setRange(rangeValue: vtkRange, componentIndex: number): Range;
78
-
79
- /**
80
- * Set the given tuple at the given index.
81
- * @param {Number} idx
82
- * @param {Array<Number>|TypedArray} tuple
83
- */
84
- setTuple(idx: number, tuple: Array<number>|TypedArray): void;
85
-
86
- /**
87
- * Set the given tuples starting at the given index.
88
- * @param {Number} idx
89
- * @param {Array<Number>|TypedArray} tuples
90
- */
91
- setTuples(idx: number, tuples: Array<number>|TypedArray): void;
92
-
93
- /**
94
- * Get the tuple at the given index.
95
- *
96
- * For performance reasons, it is advised to pass a 'tupleToFill':
97
- * `const x = [];`
98
- * `for (int i = 0; i < N; ++i) {
99
- * ` dataArray.getTuple(idx, x);`
100
- * ` ...`
101
- * instead of:
102
- * `for (int i = 0; i < N; ++i) {
103
- * ` const x = dataArray.getTuple(idx);`
104
- * `...`
105
- * @param {Number} idx
106
- * @param {Number[]|TypedArray} [tupleToFill] (default [])
107
- * @returns {Number[]|TypedArray}
108
- */
109
- getTuple(idx: number, tupleToFill?: number[]|TypedArray): number[]|TypedArray;
110
-
111
- /**
112
- * Get the tuples between fromId (inclusive) and toId (exclusive).
113
- *
114
- * If fromId or toId is negative, it refers to a tuple index from the
115
- * end of the underlying typedArray.
116
- * If the range between fromId and toId is invalid, getTuples returns
117
- * null.
118
- *
119
- * NOTE: Any changes to the returned TypedArray will result in changes to
120
- * this DataArray's underlying TypedArray.
121
- *
122
- * @param {Number} [fromId] (default: 0)
123
- * @param {Number} [toId] (default: publicAPI.getNumberOfTuples())
124
- * @returns {Nullable<TypedArray>}
125
- */
126
- getTuples(fromId?: number, toId?: number): Nullable<TypedArray>;
127
-
128
- /**
129
- * Insert the given tuple at the given index.
130
- * NOTE: May resize the data values array. "Safe" version of setTuple.
131
- *
132
- * A typical usage is when `vtkDataArray` is initialized with
133
- * `initialValues = { size: 0, values: new Uint8Array(1000) }`, where
134
- * an empty but pre-allocated array with 1'000 components is created.
135
- * The component values can then be inserted with `insertTuple()` or
136
- * `insertNextTuple()` without requiring new memory allocation until
137
- * the size of 1'000 is exceeded (e.g. after inserting the 250th
138
- * 4-component tuple).
139
- *
140
- * `insertTuple` increases the number of tuples (`getNumberOfTuples()`).
141
- *
142
- * @see insertNextTuple
143
- * @see getNumberOfTuples
144
- *
145
- * @param {Number} idx
146
- * @param {Array<Number>|TypedArray} tuple
147
- * @returns {Number} Index of the inserted tuple
148
- */
149
- insertTuple(idx: number, tuple: Array<number>|TypedArray): number;
150
-
151
- /**
152
- * Insert tuples starting at the given idx.
153
- *
154
- * @param {Number} idx
155
- * @param {Array<Number>|TypedArray} tuples Flat array of tuples to insert
156
- * @returns The index of the last inserted tuple
157
- */
158
- insertTuples(idx: number, tuples: Array<number>|TypedArray): number;
159
-
160
- /**
161
- * Insert the given tuple at the next available slot and return the index of the insertion.
162
- * NOTE: May resize the data values array. "Safe" version of setTuple.
163
- *
164
- * @see insertTuple
165
- *
166
- * @param {Array<Number>|TypedArray} tuple
167
- * @returns {Number} Index of the inserted tuple.
168
- */
169
- insertNextTuple(tuple: Array<number>|TypedArray): number;
170
-
171
- /**
172
- * Convenience function to insert an array of tuples with insertNextTuple.
173
- * NOTE: tuples.length must be a multiple of `getNumberOfComponents`.
174
- * @param {Array<Number>|TypedArray} tuples
175
- * @returns The index of the last inserted tuple
176
- */
177
- insertNextTuples(tuples: Array<number>|TypedArray): number;
178
-
179
- /**
180
- *
181
- * @param {Number} [idx] (default: 1)
182
- * @returns {Number}
183
- */
184
- getTupleLocation(idx?: number): number;
185
-
186
- /**
187
- * Get the dimension (n) of the components.
188
- * @returns {Number}
189
- */
190
- getNumberOfComponents(): number;
191
-
192
- /**
193
- * Get the actual number of values in the array, which is equal to `getNumberOfTuples() * getNumberOfComponents()`.
194
- * @returns {Number}
195
- */
196
- getNumberOfValues(): number;
197
-
198
- /**
199
- * Get the actual number of complete tuples (a component group) in the array.
200
- * @returns {Number}
201
- */
202
- getNumberOfTuples(): number;
203
-
204
- /**
205
- * Get the data type of this array as a string.
206
- * @returns {String}
207
- */
208
- getDataType(): string;
209
-
210
- /**
211
- * Return a clone of this array.
212
- * @returns {vtkDataArray}
213
- */
214
- newClone(): vtkDataArray;
215
-
216
- /**
217
- * Get the name of the array.
218
- * @returns {String}
219
- */
220
- getName(): string;
221
-
222
- /**
223
- * Set the data of this array.
224
- * Optionally pass ´numberOfComponents´ to overwrite this dataArray's
225
- * numberOfComponents.
226
- * If this dataArray's numberOfComponents doesn't divide the given array's
227
- * length, this dataArray's numberOfComponents is set to 1.
228
- *
229
- * @param {Number[]|TypedArray} typedArray The Array value.
230
- * @param {Number} [numberOfComponents]
231
- */
232
- setData(typedArray: number[]|TypedArray, numberOfComponents?: number): void;
233
-
234
- /**
235
- * Get the state of this array.
236
- * @returns {object}
237
- */
238
- getState(): object;
239
-
240
- /**
241
- * Deep copy of another vtkDataArray into this one.
242
- * @param {vtkDataArray} other
243
- */
244
- deepCopy(other: vtkDataArray): void;
245
-
246
- /**
247
- * Interpolate between the tuples retrieved from source1
248
- * and source2 with the resp. indices and set the
249
- * resulting tuple to the idx of this DataArray.
250
- *
251
- * @param {int} idx,
252
- * @param {vtkDataArray} source1,
253
- * @param {int} source1Idx,
254
- * @param {vtkDataArray} source2,
255
- * @param {int} source2Idx,
256
- * @param {float} t
257
- */
258
- interpolateTuple(
259
- idx: int,
260
- source1: vtkDataArray,
261
- source1Idx: int,
262
- source2: vtkDataArray,
263
- source2Idx: int,
264
- t: float
265
- ): void;
266
-
267
- /**
268
- * Resize the array to the requested number of tuples and preserve data.
269
- * Increasing the array size may allocate extra memory beyond what was
270
- * requested.
271
- * Decreasing the array size will trim memory to the requested size.
272
- * model.size WILL be modified according ot the new size.
273
- * If requestedNumTuples > getNumberOfTuples(),
274
- * it creates a new typed array and copies the old values to the new array.
275
- * If requestedNumTuples < getNumberOfTuples(), the typed array is untouched,
276
- * only model.size is modified.
277
- * @param {Number} requestedNumTuples Final expected number of tuples; must be >= 0
278
- * @returns {Boolean} True if a resize occured, false otherwise
279
- * @see insertNextTuple
280
- * @see insertNextTuples
281
- * @see initialize
282
- */
283
- resize(requestedNumTuples: number): boolean;
284
-
285
- /**
286
- * Reset this array.
287
- * NOTE: This won't touch the actual memory of the underlying typedArray.
288
- * @see insertNextTuple
289
- * @see insertNextTuples
290
- */
291
- initialize(): void;
292
-
293
- // --- via macro --
294
-
295
- /**
296
- * Set the name of this array.
297
- * @param {String} name
298
- * @returns {Boolean}
299
- */
300
- setName(name: string): boolean;
301
-
302
- /**
303
- * Set the dimension (n) of the components.
304
- * @param {Number} numberOfComponents
305
- */
306
- setNumberOfComponents(numberOfComponents: number): boolean;
307
- }
308
-
309
- // ----------------------------------------------------------------------------
310
- // Static API
311
- // ----------------------------------------------------------------------------
312
-
313
- /**
314
- * Compute range of a given array. The array could be composed of tuples and
315
- * individual component range could be computed as well as magnitude.
316
- *
317
- * ```js
318
- * const array = [x0, y0, z0, x1, y1, z1, ..., xn, yn, zn];
319
- * const { min: yMin, max: yMax } = computeRange(array, 1, 3);
320
- * const { min: minMagnitude, max: maxMagnitude } = computeRange(array, -1, 3);
321
- * ```
322
- *
323
- * @param {Number[]} values Array to go through to extract the range from
324
- * @param {Number} [component] (default: 0) indice to use inside tuple size
325
- * @param {Number} [numberOfComponents] (default: 1) size of the tuple
326
- */
327
- export function computeRange(values: number[], component?: number, numberOfComponents?: number): vtkRange;
328
-
329
- /**
330
- * Compute range of a given array, it only supports 1D arrays.
331
- *
332
- * @param {Number[]} values Array to go through to extract the range from
333
- * @param {Number} offset offset index to select the desired component in the tuple
334
- * @param {Number} numberOfComponents size of tuple in a multi-channel array
335
- */
336
- export function fastComputeRange(values: number[], offset: number, numberOfComponents: number): vtkRange;
337
-
338
- /**
339
- * @deprecated please use `fastComputeRange` instead
340
- * Create helper object that can be used to gather min, max, count, sum of
341
- * a set of values.
342
- */
343
- export function createRangeHelper(): vtkRangeHelper
344
-
345
- /**
346
- * Return the name of a typed array
347
- *
348
- * ```js
349
- * const isFloat32 = ('Float32Array' === getDataType(array));
350
- * const clone = new macro.TYPED_ARRAYS[getDataType(array)](array.length);
351
- * ```
352
- *
353
- * @param typedArray to extract its type from
354
- */
355
- export function getDataType(typedArray: TypedArray): string
356
-
357
- /**
358
- * Return the max norm of a given vtkDataArray
359
- *
360
- * @param dataArray to process
361
- */
362
- export function getMaxNorm(dataArray: vtkDataArray): number
363
-
364
- /**
365
- * Method use to decorate a given object (publicAPI+model) with vtkDataArray characteristics.
366
- *
367
- * @param publicAPI object on which methods will be bounds (public)
368
- * @param model object on which data structure will be bounds (protected)
369
- * @param {object} [initialValues] (default: {}) Must pass a number > 0 for `size` except if `empty: true` is also passed or a non-empty typed array for `values`.
370
- */
371
- export function extend(publicAPI: object, model: object, initialValues?: IDataArrayInitialValues): void;
372
-
373
- // ----------------------------------------------------------------------------
374
-
375
- /**
376
- * Method use to create a new instance of vtkDataArray
377
- * @param {object} [initialValues] for pre-setting some of its content
378
- */
379
- export function newInstance(initialValues?: object): vtkDataArray;
380
-
381
- /**
382
- * Constants capturing the number of bytes per element based on its data type.
383
- */
384
- export enum DataTypeByteSize {
385
- Int8Array,
386
- Uint8Array,
387
- Uint8ClampedArray,
388
- Int16Array,
389
- Uint16Array,
390
- Int32Array,
391
- Uint32Array,
392
- Float32Array,
393
- Float64Array,
394
- }
395
-
396
- /**
397
- * Constants capturing the various VTK data types.
398
- */
399
- export enum VtkDataTypes {
400
- VOID,
401
- CHAR,
402
- SIGNED_CHAR,
403
- UNSIGNED_CHAR,
404
- SHORT,
405
- UNSIGNED_SHORT,
406
- INT,
407
- UNSIGNED_INT,
408
- FLOAT,
409
- DOUBLE,
410
- }
411
-
412
- /**
413
- * vtkDataArray is an abstract superclass for data array objects containing
414
- * numeric data.
415
- */
416
- export declare const vtkDataArray: {
417
- newInstance: typeof newInstance,
418
- extend: typeof extend,
419
- // static
420
- computeRange: typeof computeRange,
421
- createRangeHelper: typeof createRangeHelper,
422
- fastComputeRange: typeof fastComputeRange,
423
- getDataType: typeof getDataType,
424
- getMaxNorm: typeof getMaxNorm,
425
- // constants
426
- DataTypeByteSize: typeof DataTypeByteSize,
427
- VtkDataTypes: typeof VtkDataTypes,
428
- DefaultDataType: VtkDataTypes,
429
- };
430
-
431
- export default vtkDataArray;
1
+ import { vtkObject, vtkRange } from './../../interfaces';
2
+ import { float, int, Nullable, Range, TypedArray } from './../../types';
3
+
4
+
5
+ /**
6
+ * Output of the rangeHelper instance
7
+ */
8
+ interface VtkStatisticInformation {
9
+ min: number;
10
+ max: number;
11
+ count: number;
12
+ sum: number;
13
+ mean: number;
14
+ }
15
+
16
+ /**
17
+ * Helper class used to compute data range of a set of numbers
18
+ */
19
+ interface vtkRangeHelper {
20
+ add(value: number): void;
21
+ get(): VtkStatisticInformation;
22
+ getRange(): vtkRange;
23
+ }
24
+
25
+ /**
26
+ * The inital values of a vtkDataArray.
27
+ */
28
+ export interface IDataArrayInitialValues {
29
+ dataType?: string;
30
+ empty?: boolean;
31
+ name?: string;
32
+ numberOfComponents?: number;
33
+ rangeTuple?: Range;
34
+ size?: number;
35
+ values?: Array<number>|TypedArray;
36
+ }
37
+
38
+ export interface vtkDataArray extends vtkObject {
39
+
40
+ /**
41
+ * Get the size, in bytes, of the lowest-level element of an array.
42
+ */
43
+ getElementComponentSize(): number;
44
+
45
+ /**
46
+ * Get the component for a given tupleIdx.
47
+ * @param {Number} tupleIdx
48
+ * @param {Number} [componentIndex] (default: 0)
49
+ */
50
+ getComponent(tupleIdx: number, componentIndex?: number): number;
51
+
52
+ /**
53
+ * Set the component value for a given tupleIdx and componentIndex.
54
+ * @param {Number} tupleIdx
55
+ * @param {Number} componentIndex
56
+ * @param {Number} value
57
+ */
58
+ setComponent(tupleIdx: number, componentIndex: number, value: number): void;
59
+
60
+ /**
61
+ *
62
+ */
63
+ getData(): number[]|TypedArray;
64
+
65
+ /**
66
+ * Get the range of the given component.
67
+ *
68
+ * @param {Number} componentIndex (default: -1)
69
+ */
70
+ getRange(componentIndex?: number): Range;
71
+
72
+ /**
73
+ *
74
+ * @param {vtkRange} rangeValue
75
+ * @param {Number} componentIndex
76
+ */
77
+ setRange(rangeValue: vtkRange, componentIndex: number): Range;
78
+
79
+ /**
80
+ * Set the given tuple at the given index.
81
+ * @param {Number} idx
82
+ * @param {Array<Number>|TypedArray} tuple
83
+ */
84
+ setTuple(idx: number, tuple: Array<number>|TypedArray): void;
85
+
86
+ /**
87
+ * Set the given tuples starting at the given index.
88
+ * @param {Number} idx
89
+ * @param {Array<Number>|TypedArray} tuples
90
+ */
91
+ setTuples(idx: number, tuples: Array<number>|TypedArray): void;
92
+
93
+ /**
94
+ * Get the tuple at the given index.
95
+ *
96
+ * For performance reasons, it is advised to pass a 'tupleToFill':
97
+ * `const x = [];`
98
+ * `for (int i = 0; i < N; ++i) {
99
+ * ` dataArray.getTuple(idx, x);`
100
+ * ` ...`
101
+ * instead of:
102
+ * `for (int i = 0; i < N; ++i) {
103
+ * ` const x = dataArray.getTuple(idx);`
104
+ * `...`
105
+ * @param {Number} idx
106
+ * @param {Number[]|TypedArray} [tupleToFill] (default [])
107
+ * @returns {Number[]|TypedArray}
108
+ */
109
+ getTuple(idx: number, tupleToFill?: number[]|TypedArray): number[]|TypedArray;
110
+
111
+ /**
112
+ * Get the tuples between fromId (inclusive) and toId (exclusive).
113
+ *
114
+ * If fromId or toId is negative, it refers to a tuple index from the
115
+ * end of the underlying typedArray.
116
+ * If the range between fromId and toId is invalid, getTuples returns
117
+ * null.
118
+ *
119
+ * NOTE: Any changes to the returned TypedArray will result in changes to
120
+ * this DataArray's underlying TypedArray.
121
+ *
122
+ * @param {Number} [fromId] (default: 0)
123
+ * @param {Number} [toId] (default: publicAPI.getNumberOfTuples())
124
+ * @returns {Nullable<TypedArray>}
125
+ */
126
+ getTuples(fromId?: number, toId?: number): Nullable<TypedArray>;
127
+
128
+ /**
129
+ * Insert the given tuple at the given index.
130
+ * NOTE: May resize the data values array. "Safe" version of setTuple.
131
+ *
132
+ * A typical usage is when `vtkDataArray` is initialized with
133
+ * `initialValues = { size: 0, values: new Uint8Array(1000) }`, where
134
+ * an empty but pre-allocated array with 1'000 components is created.
135
+ * The component values can then be inserted with `insertTuple()` or
136
+ * `insertNextTuple()` without requiring new memory allocation until
137
+ * the size of 1'000 is exceeded (e.g. after inserting the 250th
138
+ * 4-component tuple).
139
+ *
140
+ * `insertTuple` increases the number of tuples (`getNumberOfTuples()`).
141
+ *
142
+ * @see insertNextTuple
143
+ * @see getNumberOfTuples
144
+ *
145
+ * @param {Number} idx
146
+ * @param {Array<Number>|TypedArray} tuple
147
+ * @returns {Number} Index of the inserted tuple
148
+ */
149
+ insertTuple(idx: number, tuple: Array<number>|TypedArray): number;
150
+
151
+ /**
152
+ * Insert tuples starting at the given idx.
153
+ *
154
+ * @param {Number} idx
155
+ * @param {Array<Number>|TypedArray} tuples Flat array of tuples to insert
156
+ * @returns The index of the last inserted tuple
157
+ */
158
+ insertTuples(idx: number, tuples: Array<number>|TypedArray): number;
159
+
160
+ /**
161
+ * Insert the given tuple at the next available slot and return the index of the insertion.
162
+ * NOTE: May resize the data values array. "Safe" version of setTuple.
163
+ *
164
+ * @see insertTuple
165
+ *
166
+ * @param {Array<Number>|TypedArray} tuple
167
+ * @returns {Number} Index of the inserted tuple.
168
+ */
169
+ insertNextTuple(tuple: Array<number>|TypedArray): number;
170
+
171
+ /**
172
+ * Convenience function to insert an array of tuples with insertNextTuple.
173
+ * NOTE: tuples.length must be a multiple of `getNumberOfComponents`.
174
+ * @param {Array<Number>|TypedArray} tuples
175
+ * @returns The index of the last inserted tuple
176
+ */
177
+ insertNextTuples(tuples: Array<number>|TypedArray): number;
178
+
179
+ /**
180
+ *
181
+ * @param {Number} [idx] (default: 1)
182
+ * @returns {Number}
183
+ */
184
+ getTupleLocation(idx?: number): number;
185
+
186
+ /**
187
+ * Get the dimension (n) of the components.
188
+ * @returns {Number}
189
+ */
190
+ getNumberOfComponents(): number;
191
+
192
+ /**
193
+ * Get the actual number of values in the array, which is equal to `getNumberOfTuples() * getNumberOfComponents()`.
194
+ * @returns {Number}
195
+ */
196
+ getNumberOfValues(): number;
197
+
198
+ /**
199
+ * Get the actual number of complete tuples (a component group) in the array.
200
+ * @returns {Number}
201
+ */
202
+ getNumberOfTuples(): number;
203
+
204
+ /**
205
+ * Convenient method to search the index of the first matching tuple in the array.
206
+ * This is a naïve search, consider using a "locator" instead.
207
+ * @param {Array<Number>|TypedArray} tupleToSearch
208
+ * @param {Number} precision (1e-6 by default)
209
+ * @returns {Number} the index of the tuple if found, -1 otherwise.
210
+ */
211
+ findTuple(tupleToSearch: Array<number>|TypedArray, precision?: number): number;
212
+
213
+ /**
214
+ * Get the data type of this array as a string.
215
+ * @returns {String}
216
+ */
217
+ getDataType(): string;
218
+
219
+ /**
220
+ * Return a clone of this array.
221
+ * @returns {vtkDataArray}
222
+ */
223
+ newClone(): vtkDataArray;
224
+
225
+ /**
226
+ * Get the name of the array.
227
+ * @returns {String}
228
+ */
229
+ getName(): string;
230
+
231
+ /**
232
+ * Set the data of this array.
233
+ * Optionally pass ´numberOfComponents´ to overwrite this dataArray's
234
+ * numberOfComponents.
235
+ * If this dataArray's numberOfComponents doesn't divide the given array's
236
+ * length, this dataArray's numberOfComponents is set to 1.
237
+ *
238
+ * @param {Number[]|TypedArray} typedArray The Array value.
239
+ * @param {Number} [numberOfComponents]
240
+ */
241
+ setData(typedArray: number[]|TypedArray, numberOfComponents?: number): void;
242
+
243
+ /**
244
+ * Get the state of this array.
245
+ * @returns {object}
246
+ */
247
+ getState(): object;
248
+
249
+ /**
250
+ * Deep copy of another vtkDataArray into this one.
251
+ * @param {vtkDataArray} other
252
+ */
253
+ deepCopy(other: vtkDataArray): void;
254
+
255
+ /**
256
+ * Interpolate between the tuples retrieved from source1
257
+ * and source2 with the resp. indices and set the
258
+ * resulting tuple to the idx of this DataArray.
259
+ *
260
+ * @param {int} idx,
261
+ * @param {vtkDataArray} source1,
262
+ * @param {int} source1Idx,
263
+ * @param {vtkDataArray} source2,
264
+ * @param {int} source2Idx,
265
+ * @param {float} t
266
+ */
267
+ interpolateTuple(
268
+ idx: int,
269
+ source1: vtkDataArray,
270
+ source1Idx: int,
271
+ source2: vtkDataArray,
272
+ source2Idx: int,
273
+ t: float
274
+ ): void;
275
+
276
+ /**
277
+ * Resize the array to the requested number of tuples and preserve data.
278
+ * Increasing the array size may allocate extra memory beyond what was
279
+ * requested.
280
+ * Decreasing the array size will trim memory to the requested size.
281
+ * model.size WILL be modified according ot the new size.
282
+ * If requestedNumTuples > getNumberOfTuples(),
283
+ * it creates a new typed array and copies the old values to the new array.
284
+ * If requestedNumTuples < getNumberOfTuples(), the typed array is untouched,
285
+ * only model.size is modified.
286
+ * @param {Number} requestedNumTuples Final expected number of tuples; must be >= 0
287
+ * @returns {Boolean} True if a resize occured, false otherwise
288
+ * @see insertNextTuple
289
+ * @see insertNextTuples
290
+ * @see initialize
291
+ */
292
+ resize(requestedNumTuples: number): boolean;
293
+
294
+ /**
295
+ * Reset this array.
296
+ * NOTE: This won't touch the actual memory of the underlying typedArray.
297
+ * @see insertNextTuple
298
+ * @see insertNextTuples
299
+ */
300
+ initialize(): void;
301
+
302
+ // --- via macro --
303
+
304
+ /**
305
+ * Set the name of this array.
306
+ * @param {String} name
307
+ * @returns {Boolean}
308
+ */
309
+ setName(name: string): boolean;
310
+
311
+ /**
312
+ * Set the dimension (n) of the components.
313
+ * @param {Number} numberOfComponents
314
+ */
315
+ setNumberOfComponents(numberOfComponents: number): boolean;
316
+ }
317
+
318
+ // ----------------------------------------------------------------------------
319
+ // Static API
320
+ // ----------------------------------------------------------------------------
321
+
322
+ /**
323
+ * Compute range of a given array. The array could be composed of tuples and
324
+ * individual component range could be computed as well as magnitude.
325
+ *
326
+ * ```js
327
+ * const array = [x0, y0, z0, x1, y1, z1, ..., xn, yn, zn];
328
+ * const { min: yMin, max: yMax } = computeRange(array, 1, 3);
329
+ * const { min: minMagnitude, max: maxMagnitude } = computeRange(array, -1, 3);
330
+ * ```
331
+ *
332
+ * @param {Number[]} values Array to go through to extract the range from
333
+ * @param {Number} [component] (default: 0) indice to use inside tuple size
334
+ * @param {Number} [numberOfComponents] (default: 1) size of the tuple
335
+ */
336
+ export function computeRange(values: number[], component?: number, numberOfComponents?: number): vtkRange;
337
+
338
+ /**
339
+ * Compute range of a given array, it only supports 1D arrays.
340
+ *
341
+ * @param {Number[]} values Array to go through to extract the range from
342
+ * @param {Number} offset offset index to select the desired component in the tuple
343
+ * @param {Number} numberOfComponents size of tuple in a multi-channel array
344
+ */
345
+ export function fastComputeRange(values: number[], offset: number, numberOfComponents: number): vtkRange;
346
+
347
+ /**
348
+ * @deprecated please use `fastComputeRange` instead
349
+ * Create helper object that can be used to gather min, max, count, sum of
350
+ * a set of values.
351
+ */
352
+ export function createRangeHelper(): vtkRangeHelper
353
+
354
+ /**
355
+ * Return the name of a typed array
356
+ *
357
+ * ```js
358
+ * const isFloat32 = ('Float32Array' === getDataType(array));
359
+ * const clone = new macro.TYPED_ARRAYS[getDataType(array)](array.length);
360
+ * ```
361
+ *
362
+ * @param typedArray to extract its type from
363
+ */
364
+ export function getDataType(typedArray: TypedArray): string
365
+
366
+ /**
367
+ * Return the max norm of a given vtkDataArray
368
+ *
369
+ * @param dataArray to process
370
+ */
371
+ export function getMaxNorm(dataArray: vtkDataArray): number
372
+
373
+ /**
374
+ * Method use to decorate a given object (publicAPI+model) with vtkDataArray characteristics.
375
+ *
376
+ * @param publicAPI object on which methods will be bounds (public)
377
+ * @param model object on which data structure will be bounds (protected)
378
+ * @param {object} [initialValues] (default: {}) Must pass a number > 0 for `size` except if `empty: true` is also passed or a non-empty typed array for `values`.
379
+ */
380
+ export function extend(publicAPI: object, model: object, initialValues?: IDataArrayInitialValues): void;
381
+
382
+ // ----------------------------------------------------------------------------
383
+
384
+ /**
385
+ * Method use to create a new instance of vtkDataArray
386
+ * @param {object} [initialValues] for pre-setting some of its content
387
+ */
388
+ export function newInstance(initialValues?: object): vtkDataArray;
389
+
390
+ /**
391
+ * Constants capturing the number of bytes per element based on its data type.
392
+ */
393
+ export enum DataTypeByteSize {
394
+ Int8Array,
395
+ Uint8Array,
396
+ Uint8ClampedArray,
397
+ Int16Array,
398
+ Uint16Array,
399
+ Int32Array,
400
+ Uint32Array,
401
+ Float32Array,
402
+ Float64Array,
403
+ }
404
+
405
+ /**
406
+ * Constants capturing the various VTK data types.
407
+ */
408
+ export enum VtkDataTypes {
409
+ VOID,
410
+ CHAR,
411
+ SIGNED_CHAR,
412
+ UNSIGNED_CHAR,
413
+ SHORT,
414
+ UNSIGNED_SHORT,
415
+ INT,
416
+ UNSIGNED_INT,
417
+ FLOAT,
418
+ DOUBLE,
419
+ }
420
+
421
+ /**
422
+ * vtkDataArray is an abstract superclass for data array objects containing
423
+ * numeric data.
424
+ */
425
+ export declare const vtkDataArray: {
426
+ newInstance: typeof newInstance,
427
+ extend: typeof extend,
428
+ // static
429
+ computeRange: typeof computeRange,
430
+ createRangeHelper: typeof createRangeHelper,
431
+ fastComputeRange: typeof fastComputeRange,
432
+ getDataType: typeof getDataType,
433
+ getMaxNorm: typeof getMaxNorm,
434
+ // constants
435
+ DataTypeByteSize: typeof DataTypeByteSize,
436
+ VtkDataTypes: typeof VtkDataTypes,
437
+ DefaultDataType: VtkDataTypes,
438
+ };
439
+
440
+ export default vtkDataArray;