@itwin/core-geometry 5.3.0-dev.12 → 5.3.0-dev.16

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.
Files changed (42) hide show
  1. package/CHANGELOG.md +11 -1
  2. package/lib/cjs/curve/CurveFactory.d.ts +25 -8
  3. package/lib/cjs/curve/CurveFactory.d.ts.map +1 -1
  4. package/lib/cjs/curve/CurveFactory.js +51 -55
  5. package/lib/cjs/curve/CurveFactory.js.map +1 -1
  6. package/lib/cjs/geometry3d/GrowableXYArray.d.ts +96 -98
  7. package/lib/cjs/geometry3d/GrowableXYArray.d.ts.map +1 -1
  8. package/lib/cjs/geometry3d/GrowableXYArray.js +121 -110
  9. package/lib/cjs/geometry3d/GrowableXYArray.js.map +1 -1
  10. package/lib/cjs/geometry3d/GrowableXYZArray.d.ts +135 -142
  11. package/lib/cjs/geometry3d/GrowableXYZArray.d.ts.map +1 -1
  12. package/lib/cjs/geometry3d/GrowableXYZArray.js +165 -160
  13. package/lib/cjs/geometry3d/GrowableXYZArray.js.map +1 -1
  14. package/lib/cjs/geometry3d/IndexedXYCollection.d.ts +51 -34
  15. package/lib/cjs/geometry3d/IndexedXYCollection.d.ts.map +1 -1
  16. package/lib/cjs/geometry3d/IndexedXYCollection.js +16 -6
  17. package/lib/cjs/geometry3d/IndexedXYCollection.js.map +1 -1
  18. package/lib/cjs/geometry3d/IndexedXYZCollection.d.ts +78 -77
  19. package/lib/cjs/geometry3d/IndexedXYZCollection.d.ts.map +1 -1
  20. package/lib/cjs/geometry3d/IndexedXYZCollection.js +38 -35
  21. package/lib/cjs/geometry3d/IndexedXYZCollection.js.map +1 -1
  22. package/lib/esm/curve/CurveFactory.d.ts +25 -8
  23. package/lib/esm/curve/CurveFactory.d.ts.map +1 -1
  24. package/lib/esm/curve/CurveFactory.js +51 -55
  25. package/lib/esm/curve/CurveFactory.js.map +1 -1
  26. package/lib/esm/geometry3d/GrowableXYArray.d.ts +96 -98
  27. package/lib/esm/geometry3d/GrowableXYArray.d.ts.map +1 -1
  28. package/lib/esm/geometry3d/GrowableXYArray.js +122 -111
  29. package/lib/esm/geometry3d/GrowableXYArray.js.map +1 -1
  30. package/lib/esm/geometry3d/GrowableXYZArray.d.ts +135 -142
  31. package/lib/esm/geometry3d/GrowableXYZArray.d.ts.map +1 -1
  32. package/lib/esm/geometry3d/GrowableXYZArray.js +165 -160
  33. package/lib/esm/geometry3d/GrowableXYZArray.js.map +1 -1
  34. package/lib/esm/geometry3d/IndexedXYCollection.d.ts +51 -34
  35. package/lib/esm/geometry3d/IndexedXYCollection.d.ts.map +1 -1
  36. package/lib/esm/geometry3d/IndexedXYCollection.js +14 -5
  37. package/lib/esm/geometry3d/IndexedXYCollection.js.map +1 -1
  38. package/lib/esm/geometry3d/IndexedXYZCollection.d.ts +78 -77
  39. package/lib/esm/geometry3d/IndexedXYZCollection.d.ts.map +1 -1
  40. package/lib/esm/geometry3d/IndexedXYZCollection.js +38 -35
  41. package/lib/esm/geometry3d/IndexedXYZCollection.js.map +1 -1
  42. package/package.json +3 -3
@@ -7,45 +7,41 @@
7
7
  */
8
8
  import { Geometry } from "../Geometry";
9
9
  import { GrowableXYZArray } from "./GrowableXYZArray";
10
- import { IndexedXYCollection } from "./IndexedXYCollection";
10
+ import { IndexedReadWriteXYCollection, IndexedXYCollection } from "./IndexedXYCollection";
11
11
  import { Point2d, Vector2d } from "./Point2dVector2d";
12
12
  import { Point3d } from "./Point3dVector3d";
13
- /** `GrowableXYArray` manages a (possibly growing) Float64Array to pack xy coordinates.
13
+ /**
14
+ * `GrowableXYArray` manages a (possibly growing) Float64Array to pack xy coordinates.
14
15
  * @public
15
16
  */
16
- export class GrowableXYArray extends IndexedXYCollection {
17
- /**
18
- * array of packed xy xy xy components
19
- */
17
+ export class GrowableXYArray extends IndexedReadWriteXYCollection {
18
+ /** Array of packed xy xy xy components. */
20
19
  _data;
21
- /**
22
- * Number of xy tuples (not floats) in the array
23
- */
20
+ /** Number of xy tuples (not floats) in the array. */
24
21
  _xyInUse;
25
- /**
26
- * capacity in xy tuples. (not floats)
27
- */
22
+ /** Capacity in xy tuples. (not floats). */
28
23
  _xyCapacity;
29
- /**
30
- * multiplier used by ensureCapacity to expand requested reallocation size
31
- */
24
+ /** Multiplier used by ensureCapacity to expand requested reallocation size. */
32
25
  _growthFactor;
33
- /** Construct a new GrowablePoint2d array.
34
- * @param numPoints initial capacity in xy tuples (default 8)
35
- * @param growthFactor used by ensureCapacity to expand requested reallocation size (default 1.5)
26
+ /**
27
+ * Construct a new GrowablePoint2d array.
28
+ * @param numPoints initial capacity in xy tuples (default 8).
29
+ * @param growthFactor used by ensureCapacity to expand requested reallocation size (default 1.5).
30
+ * @param data optional pre-existing Float64Array to use as the backing memory. If supplied, numPoints is ignored.
36
31
  */
37
- constructor(numPoints = 8, growthFactor) {
32
+ constructor(numPoints = 8, growthFactor, data) {
38
33
  super();
39
- this._data = new Float64Array(numPoints * 2); // 2 values per point
34
+ this._data = data || new Float64Array(numPoints * 2); // 2 values per point
40
35
  this._xyInUse = 0;
41
- this._xyCapacity = numPoints;
36
+ this._xyCapacity = data ? data.length / 2 : numPoints;
42
37
  this._growthFactor = (undefined !== growthFactor && growthFactor >= 1.0) ? growthFactor : 1.5;
43
38
  }
44
- /** Copy xy points from source array. Does not reallocate or change active point count.
45
- * @param source array to copy from
46
- * @param sourceCount copy the first sourceCount points; all points if undefined
47
- * @param destOffset copy to instance array starting at this point index; zero if undefined
48
- * @return count and offset of points copied
39
+ /**
40
+ * Copy xy points from source array. Does not reallocate or change active point count.
41
+ * @param source array to copy from.
42
+ * @param sourceCount copy the first sourceCount points; all points if undefined.
43
+ * @param destOffset copy to instance array starting at this point index; zero if undefined.
44
+ * @return count and offset of points copied.
49
45
  */
50
46
  copyData(source, sourceCount, destOffset) {
51
47
  // validate inputs and convert from points to entries
@@ -74,30 +70,45 @@ export class GrowableXYArray extends IndexedXYCollection {
74
70
  return { count: myCount / 2, offset: myOffset / 2 };
75
71
  }
76
72
  /** The number of points in use. When the length is increased, the array is padded with zeroes. */
77
- get length() { return this._xyInUse; }
78
- set length(newLength) { this.resize(newLength, true); }
73
+ get length() {
74
+ return this._xyInUse;
75
+ }
76
+ set length(newLength) {
77
+ this.resize(newLength, true);
78
+ }
79
79
  /** Return the number of float64 in use. */
80
- get float64Length() { return this._xyInUse * 2; }
81
- /** Return the raw packed data.
80
+ get float64Length() {
81
+ return this._xyInUse * 2;
82
+ }
83
+ /**
84
+ * Return the raw packed data.
82
85
  * * Note that the length of the returned Float64Array is a count of doubles, and includes the excess capacity
83
86
  */
84
- float64Data() { return this._data; }
85
- /** If necessary, increase the capacity to a new pointCount. Current coordinates and point count (length) are unchanged. */
87
+ float64Data() {
88
+ return this._data;
89
+ }
90
+ /** If necessary, increase the capacity to a new pointCount. Current coordinates and point count (length) are unchanged. */
86
91
  ensureCapacity(pointCapacity, applyGrowthFactor = true) {
87
92
  if (pointCapacity > this._xyCapacity) {
88
93
  if (applyGrowthFactor)
89
- pointCapacity *= this._growthFactor;
94
+ pointCapacity = Math.trunc(pointCapacity * this._growthFactor);
90
95
  const prevData = this._data;
91
- this._data = new Float64Array(pointCapacity * 2);
96
+ if (this._data.buffer instanceof ArrayBuffer)
97
+ this._data = new Float64Array(new ArrayBuffer(pointCapacity * 2 * this._data.BYTES_PER_ELEMENT));
98
+ else
99
+ this._data = new Float64Array(new SharedArrayBuffer(pointCapacity * 2 * this._data.BYTES_PER_ELEMENT));
92
100
  this.copyData(prevData, this._xyInUse);
93
101
  this._xyCapacity = pointCapacity;
94
102
  }
95
103
  }
96
104
  /**
97
- * * If pointCount is less than current length, just reset current length to pointCount, effectively trimming active points but preserving original capacity.
98
- * * If pointCount is greater than current length, reallocate to exactly pointCount, copy existing points, and optionally pad excess with zero.
99
- * @param pointCount new number of active points in array
100
- * @param padWithZero when increasing point count, whether to zero out new points (default false)
105
+ * Resize the internal storage to hold a new number of points.
106
+ * * If pointCount is less than current length, just reset current length to pointCount, effectively trimming active
107
+ * points but preserving original capacity.
108
+ * * If pointCount is greater than current length, reallocate to exactly pointCount, copy existing points, and
109
+ * optionally pad excess with zero.
110
+ * @param pointCount new number of active points in array.
111
+ * @param padWithZero when increasing point count, whether to zero out new points (default false).
101
112
  */
102
113
  resize(pointCount, padWithZero) {
103
114
  if (pointCount >= 0 && pointCount < this._xyInUse)
@@ -109,10 +120,7 @@ export class GrowableXYArray extends IndexedXYCollection {
109
120
  this._xyInUse = pointCount;
110
121
  }
111
122
  }
112
- /**
113
- * Make a copy of the (active) points in this array.
114
- * (The clone does NOT get excess capacity)
115
- */
123
+ /** Make a copy of the (active) points in this array (the clone does NOT get excess capacity). */
116
124
  clone() {
117
125
  const newPoints = new GrowableXYArray(this.length);
118
126
  newPoints.copyData(this._data, this.length);
@@ -130,7 +138,9 @@ export class GrowableXYArray extends IndexedXYCollection {
130
138
  * * A GrowableXYArray
131
139
  * * Any json object satisfying Point3d.isXAndY
132
140
  * * A Float64Array of doubles, interpreted as xyxy
133
- * * An array of any of the above
141
+ * * An array of any of the above.
142
+ * @param data source points.
143
+ * @param result optional pre-allocated GrowableXYArray to clear and fill.
134
144
  */
135
145
  static create(data, result) {
136
146
  if (result) {
@@ -143,23 +153,32 @@ export class GrowableXYArray extends IndexedXYCollection {
143
153
  result.pushFrom(data);
144
154
  return result;
145
155
  }
146
- /** Restructure MultiLineStringDataVariant as array of GrowableXYZArray
156
+ /**
157
+ * Create a new GrowableXYArray capturing the provided data. The data is not copied, just referenced.
158
+ * @param data source data to capture.
159
+ * @returns a new GrowableXYArray object that references the provided data.
160
+ */
161
+ static createCapture(data) {
162
+ return new GrowableXYArray(0, undefined, data);
163
+ }
164
+ /**
165
+ * Restructure MultiLineStringDataVariant as array of GrowableXYZArray
147
166
  * @deprecated in 4.2.0 - will not be removed until after 2026-06-13. Moved to GrowableXYZArray class.
148
167
  */
149
168
  static createArrayOfGrowableXYZArray(data) {
150
169
  return GrowableXYZArray.createArrayOfGrowableXYZArray(data);
151
170
  }
152
- /** push a point to the end of the array */
171
+ /** Push a point to the end of the array. */
153
172
  push(toPush) {
154
173
  this.pushXY(toPush.x, toPush.y);
155
174
  }
156
- /** push all points of an array */
175
+ /** Push all points of an array. */
157
176
  pushAll(points) {
158
177
  this.ensureCapacity(this._xyInUse + points.length, false);
159
178
  for (const p of points)
160
179
  this.push(p);
161
180
  }
162
- /** push all points of an array */
181
+ /** Push all points of an array. */
163
182
  pushAllXYAndZ(points) {
164
183
  this.ensureCapacity(this._xyInUse + points.length, false);
165
184
  if (points instanceof GrowableXYZArray) {
@@ -173,7 +192,8 @@ export class GrowableXYArray extends IndexedXYCollection {
173
192
  this.pushXY(p.x, p.y);
174
193
  }
175
194
  }
176
- /** Push copies of points from variant sources.
195
+ /**
196
+ * Push copies of points from variant sources.
177
197
  * Valid inputs are:
178
198
  * * Point2d
179
199
  * * Point3d
@@ -182,7 +202,7 @@ export class GrowableXYArray extends IndexedXYCollection {
182
202
  * * A GrowableXYZArray
183
203
  * * Any json object satisfying Point3d.isXAndY
184
204
  * * A Float64Array of doubles, interpreted as xyxy
185
- * * An array of any of the above
205
+ * * An array of any of the above.
186
206
  */
187
207
  pushFrom(p) {
188
208
  if (p instanceof Point3d) {
@@ -204,7 +224,7 @@ export class GrowableXYArray extends IndexedXYCollection {
204
224
  this.pushXY(p[0], p[1]);
205
225
  }
206
226
  else if (Array.isArray(p)) {
207
- // direct recursion re-wraps p and goes infinite. Unroll here.
227
+ // direct recursion re-wraps p and goes infinite; unroll here.
208
228
  for (const q of p)
209
229
  this.pushFrom(q);
210
230
  }
@@ -220,7 +240,7 @@ export class GrowableXYArray extends IndexedXYCollection {
220
240
  }
221
241
  /**
222
242
  * Replicate numWrap xy values from the front of the array as new values at the end.
223
- * @param numWrap number of xy values to replicate
243
+ * @param numWrap number of xy values to replicate.
224
244
  */
225
245
  pushWrap(numWrap) {
226
246
  if (this._xyInUse >= numWrap) {
@@ -239,16 +259,17 @@ export class GrowableXYArray extends IndexedXYCollection {
239
259
  this._data[index + 1] = y;
240
260
  this._xyInUse++;
241
261
  }
242
- /** Remove one point from the back.
262
+ /**
263
+ * Remove one point from the back.
243
264
  * * NOTE that (in the manner of std::vector native) this is "just" removing the point -- no point is NOT returned.
244
- * * Use `back ()` to get the last x,y assembled into a `Point2d `
265
+ * * Use `back ()` to get the last x,y assembled into a `Point2d`.
245
266
  */
246
267
  pop() {
247
268
  if (this._xyInUse > 0)
248
269
  this._xyInUse--;
249
270
  }
250
271
  /**
251
- * Test if index is valid for an xy (point or vector) within this array
272
+ * Test if index is valid for an xy (point or vector) within this array.
252
273
  * @param index xy index to test.
253
274
  */
254
275
  isIndexValid(index) {
@@ -256,38 +277,34 @@ export class GrowableXYArray extends IndexedXYCollection {
256
277
  return false;
257
278
  return true;
258
279
  }
259
- /**
260
- * Clear all xy data, but leave capacity unchanged.
261
- */
280
+ /** Clear all xy data, but leave capacity unchanged. */
262
281
  clear() {
263
282
  this._xyInUse = 0;
264
283
  }
265
284
  /**
266
- * Get a point by index, strongly typed as a Point2d. This is unchecked. Use atPoint2dIndex to have validity test.
267
- * @param pointIndex index to access
268
- * @param result optional result
285
+ * Get a point by index, strongly typed as a `Point2d`. This is unchecked. Use atPoint2dIndex to have validity test.
286
+ * @param pointIndex index to access.
287
+ * @param result optional result.
269
288
  */
270
289
  getPoint2dAtUncheckedPointIndex(pointIndex, result) {
271
290
  const index = 2 * pointIndex;
272
291
  return Point2d.create(this._data[index], this._data[index + 1], result);
273
292
  }
274
293
  /**
275
- * Get x coordinate by point index, with no index checking
276
- * @param pointIndex index to access
294
+ * Get x coordinate by point index, with no index checking.
295
+ * @param pointIndex index to access.
277
296
  */
278
297
  getXAtUncheckedPointIndex(pointIndex) {
279
298
  return this._data[2 * pointIndex];
280
299
  }
281
300
  /**
282
- * Get y coordinate by point index, with no index checking
283
- * @param pointIndex index to access
301
+ * Get y coordinate by point index, with no index checking.
302
+ * @param pointIndex index to access.
284
303
  */
285
304
  getYAtUncheckedPointIndex(pointIndex) {
286
305
  return this._data[2 * pointIndex + 1];
287
306
  }
288
- /**
289
- * Gather all points as a Point2d[]
290
- */
307
+ /** Gather all points as a Point2d[]. */
291
308
  getPoint2dArray() {
292
309
  const n = 2 * this._xyInUse;
293
310
  const result = [];
@@ -296,7 +313,7 @@ export class GrowableXYArray extends IndexedXYCollection {
296
313
  result.push(Point2d.create(data[i], data[i + 1]));
297
314
  return result;
298
315
  }
299
- /** copy xy into strongly typed Point2d */
316
+ /** Copy xy into strongly typed Point2d. */
300
317
  getPoint2dAtCheckedPointIndex(pointIndex, result) {
301
318
  if (this.isIndexValid(pointIndex)) {
302
319
  const index = 2 * pointIndex;
@@ -304,7 +321,7 @@ export class GrowableXYArray extends IndexedXYCollection {
304
321
  }
305
322
  return undefined;
306
323
  }
307
- /** copy xy into strongly typed Vector2d */
324
+ /** Copy xy into strongly typed Vector2d. */
308
325
  getVector2dAtCheckedVectorIndex(vectorIndex, result) {
309
326
  if (this.isIndexValid(vectorIndex)) {
310
327
  const index = 2 * vectorIndex;
@@ -314,9 +331,9 @@ export class GrowableXYArray extends IndexedXYCollection {
314
331
  }
315
332
  /**
316
333
  * Read coordinates from source array, place them at index within this array.
317
- * @param destIndex point index where coordinates are to be placed in this array
318
- * @param source source array
319
- * @param sourceIndex point index in source array
334
+ * @param destIndex point index where coordinates are to be placed in this array.
335
+ * @param source source array.
336
+ * @param sourceIndex point index in source array.
320
337
  * @returns true if destIndex and sourceIndex are both valid.
321
338
  */
322
339
  transferFromGrowableXYArray(destIndex, source, sourceIndex) {
@@ -330,13 +347,13 @@ export class GrowableXYArray extends IndexedXYCollection {
330
347
  return false;
331
348
  }
332
349
  /**
333
- * push coordinates from the source array to the end of this array.
334
- * @param source source array
335
- * @param sourceIndex xy index within the source. If undefined, push entire contents of source
350
+ * Push coordinates from the source array to the end of this array.
351
+ * @param source source array.
352
+ * @param sourceIndex xy index within the source. If undefined, push entire contents of source.
336
353
  * @returns number of points pushed.
337
354
  */
338
355
  pushFromGrowableXYArray(source, sourceIndex) {
339
- // full array push . . .
356
+ // full array push
340
357
  if (sourceIndex === undefined) {
341
358
  const numXYAdd = source.length;
342
359
  this.ensureCapacity(this.length + numXYAdd, false);
@@ -344,7 +361,7 @@ export class GrowableXYArray extends IndexedXYCollection {
344
361
  this._xyInUse += numXYAdd;
345
362
  return numXYAdd;
346
363
  }
347
- // single point push . . .
364
+ // single point push
348
365
  if (source.isIndexValid(sourceIndex)) {
349
366
  const j = sourceIndex * 2;
350
367
  this.pushXY(source._data[j], source._data[j + 1]);
@@ -353,8 +370,8 @@ export class GrowableXYArray extends IndexedXYCollection {
353
370
  return 0;
354
371
  }
355
372
  /**
356
- * * Compute a point at fractional coordinate between points i and j of source
357
- * * push onto this array.
373
+ * * Compute a point at fractional coordinate between points i and j of source.
374
+ * * Push onto this array.
358
375
  */
359
376
  pushInterpolatedFromGrowableXYArray(source, i, fraction, j) {
360
377
  if (source.isIndexValid(i) && source.isIndexValid(j)) {
@@ -367,7 +384,7 @@ export class GrowableXYArray extends IndexedXYCollection {
367
384
  }
368
385
  /**
369
386
  * Create an array of xy points from source xyz points.
370
- * @param source source array of xyz
387
+ * @param source source array of xyz.
371
388
  * @param transform optional transform to apply to xyz points.
372
389
  * @param dest optional result.
373
390
  */
@@ -395,17 +412,13 @@ export class GrowableXYArray extends IndexedXYCollection {
395
412
  }
396
413
  return dest;
397
414
  }
398
- /**
399
- * Return the first point, or undefined if the array is empty.
400
- */
415
+ /** Return the first point, or undefined if the array is empty. */
401
416
  front(result) {
402
417
  if (this._xyInUse === 0)
403
418
  return undefined;
404
419
  return this.getPoint2dAtUncheckedPointIndex(0, result);
405
420
  }
406
- /**
407
- * Return the last point, or undefined if the array is empty.
408
- */
421
+ /** Return the last point, or undefined if the array is empty. */
409
422
  back(result) {
410
423
  if (this._xyInUse < 1)
411
424
  return undefined;
@@ -413,8 +426,8 @@ export class GrowableXYArray extends IndexedXYCollection {
413
426
  }
414
427
  /**
415
428
  * Set the coordinates of a single point.
416
- * @param pointIndex index of point to set
417
- * @param value coordinates to set
429
+ * @param pointIndex index of point to set.
430
+ * @param value coordinates to set.
418
431
  */
419
432
  setAtCheckedPointIndex(pointIndex, value) {
420
433
  if (!this.isIndexValid(pointIndex))
@@ -426,9 +439,9 @@ export class GrowableXYArray extends IndexedXYCollection {
426
439
  }
427
440
  /**
428
441
  * Set the coordinates of a single point given as coordinates.
429
- * @param pointIndex index of point to set
430
- * @param x x coordinate
431
- * @param y y coordinate
442
+ * @param pointIndex index of point to set.
443
+ * @param x x coordinate.
444
+ * @param y y coordinate.
432
445
  */
433
446
  setXYAtCheckedPointIndex(pointIndex, x, y) {
434
447
  if (!this.isIndexValid(pointIndex))
@@ -438,9 +451,7 @@ export class GrowableXYArray extends IndexedXYCollection {
438
451
  this._data[index + 1] = y;
439
452
  return true;
440
453
  }
441
- /**
442
- * Copy all points into a simple array of Point3d with given z.
443
- */
454
+ /** Copy all points into a simple array of Point3d with given z. */
444
455
  getPoint3dArray(z = 0) {
445
456
  const n = 2 * this._xyInUse;
446
457
  const result = [];
@@ -449,7 +460,7 @@ export class GrowableXYArray extends IndexedXYCollection {
449
460
  result.push(Point3d.create(data[i], data[i + 1], z));
450
461
  return result;
451
462
  }
452
- /** reverse the order of points. */
463
+ /** Reverse the order of points. */
453
464
  reverseInPlace() {
454
465
  const n = this.length;
455
466
  let j0, j1;
@@ -468,7 +479,7 @@ export class GrowableXYArray extends IndexedXYCollection {
468
479
  data[j1] = a;
469
480
  }
470
481
  }
471
- /** multiply each point by the transform, replace values. */
482
+ /** Multiply each point by the transform, replace values. */
472
483
  multiplyTransformInPlace(transform) {
473
484
  const data = this._data;
474
485
  const nDouble = this.float64Length;
@@ -485,7 +496,7 @@ export class GrowableXYArray extends IndexedXYCollection {
485
496
  data[i + 1] = coffs[3] * x + coffs[4] * y + y0;
486
497
  }
487
498
  }
488
- /** multiply each xy (as a vector) by matrix, replace values. */
499
+ /** Multiply each xy (as a vector) by matrix, replace values. */
489
500
  multiplyMatrix3dInPlace(matrix) {
490
501
  const data = this._data;
491
502
  const nDouble = this.float64Length;
@@ -499,7 +510,7 @@ export class GrowableXYArray extends IndexedXYCollection {
499
510
  data[i + 1] = coffs[3] * x + coffs[4] * y;
500
511
  }
501
512
  }
502
- /** multiply each point by the transform, replace values. */
513
+ /** Multiply each point by the transform, replace values. */
503
514
  tryTransformInverseInPlace(transform) {
504
515
  const data = this._data;
505
516
  const nDouble = this.float64Length;
@@ -534,7 +545,7 @@ export class GrowableXYArray extends IndexedXYCollection {
534
545
  rangeToExtend.extendXY(data[i], data[i + 1]);
535
546
  }
536
547
  }
537
- /** sum the lengths of segments between points. */
548
+ /** Sum the lengths of segments between points. */
538
549
  sumLengths() {
539
550
  let sum = 0.0;
540
551
  const n = 2 * (this._xyInUse - 1); // Length already takes into account what specifically is in use
@@ -545,7 +556,7 @@ export class GrowableXYArray extends IndexedXYCollection {
545
556
  }
546
557
  /**
547
558
  * Multiply each x,y by the scale factor.
548
- * @param factor
559
+ * @param factor scale factor.
549
560
  */
550
561
  scaleInPlace(factor) {
551
562
  if (this._data) {
@@ -554,7 +565,7 @@ export class GrowableXYArray extends IndexedXYCollection {
554
565
  this._data[i] = this._data[i] * factor;
555
566
  }
556
567
  }
557
- /** Compute a point at fractional coordinate between points i and j */
568
+ /** Compute a point at fractional coordinate between points i and j. */
558
569
  interpolate(i, fraction, j, result) {
559
570
  if (this.isIndexValid(i) && this.isIndexValid(j)) {
560
571
  const fraction0 = 1.0 - fraction;
@@ -565,10 +576,10 @@ export class GrowableXYArray extends IndexedXYCollection {
565
576
  }
566
577
  return undefined;
567
578
  }
568
- /** Sum the signed areas of the projection to xy plane */
579
+ /** Sum the signed areas of the projection to xy plane. */
569
580
  areaXY() {
570
581
  let area = 0.0;
571
- const n = 2 * this._xyInUse; // float count !!
582
+ const n = 2 * this._xyInUse; // float count
572
583
  if (n > 4) {
573
584
  const x0 = this._data[n - 2];
574
585
  const y0 = this._data[n - 1];
@@ -584,7 +595,7 @@ export class GrowableXYArray extends IndexedXYCollection {
584
595
  }
585
596
  return 0.5 * area;
586
597
  }
587
- /** Compute a vector from index origin i to indexed target j */
598
+ /** Compute a vector from index origin i to indexed target j. */
588
599
  vectorIndexIndex(i, j, result) {
589
600
  if (!this.isIndexValid(i) || !this.isIndexValid(j))
590
601
  return undefined;
@@ -593,7 +604,7 @@ export class GrowableXYArray extends IndexedXYCollection {
593
604
  j = 2 * j;
594
605
  return Vector2d.create(data[j] - data[i], data[j + 1] - data[i + 1], result);
595
606
  }
596
- /** Compute a vector from origin to indexed target j */
607
+ /** Compute a vector from origin to indexed target j. */
597
608
  vectorXAndYIndex(origin, j, result) {
598
609
  if (this.isIndexValid(j)) {
599
610
  const data = this._data;
@@ -602,7 +613,7 @@ export class GrowableXYArray extends IndexedXYCollection {
602
613
  }
603
614
  return undefined;
604
615
  }
605
- /** Compute the cross product of vectors from from indexed origin to indexed targets i and j */
616
+ /** Compute the cross product of vectors from from indexed origin to indexed targets i and j. */
606
617
  crossProductIndexIndexIndex(originIndex, targetAIndex, targetBIndex) {
607
618
  if (this.isIndexValid(originIndex) && this.isIndexValid(targetAIndex) && this.isIndexValid(targetBIndex)) {
608
619
  const i = originIndex * 2;
@@ -613,7 +624,7 @@ export class GrowableXYArray extends IndexedXYCollection {
613
624
  }
614
625
  return undefined;
615
626
  }
616
- /** Compute the cross product of vectors from from origin to indexed targets i and j */
627
+ /** Compute the cross product of vectors from from origin to indexed targets i and j. */
617
628
  crossProductXAndYIndexIndex(origin, targetAIndex, targetBIndex) {
618
629
  if (this.isIndexValid(targetAIndex) && this.isIndexValid(targetBIndex)) {
619
630
  const j = targetAIndex * 2;
@@ -653,7 +664,7 @@ export class GrowableXYArray extends IndexedXYCollection {
653
664
  // if both are null it is equal, otherwise unequal
654
665
  return (!dataA && !dataB);
655
666
  }
656
- /** Return an array of block indices sorted per compareLexicalBlock function */
667
+ /** Return an array of block indices sorted per compareLexicalBlock function. */
657
668
  sortIndicesLexical() {
658
669
  const n = this._xyInUse;
659
670
  // let numCompare = 0;
@@ -679,13 +690,13 @@ export class GrowableXYArray extends IndexedXYCollection {
679
690
  if (ax < bx)
680
691
  return -1;
681
692
  }
682
- return ia - ib; // so original order is maintained among duplicates !!!!
693
+ return ia - ib; // so original order is maintained among duplicates
683
694
  }
684
- /** Access a single double at offset within a block. This has no index checking. */
695
+ /** Access a single double at offset within a block. This has no index checking. */
685
696
  component(pointIndex, componentIndex) {
686
697
  return this._data[2 * pointIndex + componentIndex];
687
698
  }
688
- /** Toleranced equality test */
699
+ /** Toleranced equality test. */
689
700
  isAlmostEqual(other, tolerance = Geometry.smallMetricDistance) {
690
701
  const numXY = this._xyInUse;
691
702
  if (other._xyInUse !== numXY)