@itwin/core-geometry 5.3.0-dev.8 → 5.4.0-dev.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.
Files changed (162) hide show
  1. package/CHANGELOG.md +21 -1
  2. package/lib/cjs/curve/Arc3d.d.ts +15 -1
  3. package/lib/cjs/curve/Arc3d.d.ts.map +1 -1
  4. package/lib/cjs/curve/Arc3d.js +31 -2
  5. package/lib/cjs/curve/Arc3d.js.map +1 -1
  6. package/lib/cjs/curve/CurveFactory.d.ts +25 -8
  7. package/lib/cjs/curve/CurveFactory.d.ts.map +1 -1
  8. package/lib/cjs/curve/CurveFactory.js +51 -55
  9. package/lib/cjs/curve/CurveFactory.js.map +1 -1
  10. package/lib/cjs/curve/spiral/AustralianRailCorpXYEvaluator.d.ts +10 -13
  11. package/lib/cjs/curve/spiral/AustralianRailCorpXYEvaluator.d.ts.map +1 -1
  12. package/lib/cjs/curve/spiral/AustralianRailCorpXYEvaluator.js +23 -22
  13. package/lib/cjs/curve/spiral/AustralianRailCorpXYEvaluator.js.map +1 -1
  14. package/lib/cjs/curve/spiral/ClothoidSeries.d.ts +10 -6
  15. package/lib/cjs/curve/spiral/ClothoidSeries.d.ts.map +1 -1
  16. package/lib/cjs/curve/spiral/ClothoidSeries.js +36 -19
  17. package/lib/cjs/curve/spiral/ClothoidSeries.js.map +1 -1
  18. package/lib/cjs/curve/spiral/CubicEvaluator.d.ts +7 -6
  19. package/lib/cjs/curve/spiral/CubicEvaluator.d.ts.map +1 -1
  20. package/lib/cjs/curve/spiral/CubicEvaluator.js +29 -14
  21. package/lib/cjs/curve/spiral/CubicEvaluator.js.map +1 -1
  22. package/lib/cjs/curve/spiral/CzechSpiralEvaluator.d.ts +34 -44
  23. package/lib/cjs/curve/spiral/CzechSpiralEvaluator.d.ts.map +1 -1
  24. package/lib/cjs/curve/spiral/CzechSpiralEvaluator.js +47 -53
  25. package/lib/cjs/curve/spiral/CzechSpiralEvaluator.js.map +1 -1
  26. package/lib/cjs/curve/spiral/DirectHalfCosineSpiralEvaluator.d.ts +2 -2
  27. package/lib/cjs/curve/spiral/DirectHalfCosineSpiralEvaluator.d.ts.map +1 -1
  28. package/lib/cjs/curve/spiral/DirectHalfCosineSpiralEvaluator.js +17 -7
  29. package/lib/cjs/curve/spiral/DirectHalfCosineSpiralEvaluator.js.map +1 -1
  30. package/lib/cjs/curve/spiral/DirectSpiral3d.d.ts +112 -104
  31. package/lib/cjs/curve/spiral/DirectSpiral3d.d.ts.map +1 -1
  32. package/lib/cjs/curve/spiral/DirectSpiral3d.js +143 -117
  33. package/lib/cjs/curve/spiral/DirectSpiral3d.js.map +1 -1
  34. package/lib/cjs/curve/spiral/IntegratedSpiral3d.d.ts +71 -53
  35. package/lib/cjs/curve/spiral/IntegratedSpiral3d.d.ts.map +1 -1
  36. package/lib/cjs/curve/spiral/IntegratedSpiral3d.js +99 -66
  37. package/lib/cjs/curve/spiral/IntegratedSpiral3d.js.map +1 -1
  38. package/lib/cjs/curve/spiral/MXCubicAlongArcSpiralEvaluator.d.ts +8 -12
  39. package/lib/cjs/curve/spiral/MXCubicAlongArcSpiralEvaluator.d.ts.map +1 -1
  40. package/lib/cjs/curve/spiral/MXCubicAlongArcSpiralEvaluator.js +11 -13
  41. package/lib/cjs/curve/spiral/MXCubicAlongArcSpiralEvaluator.js.map +1 -1
  42. package/lib/cjs/curve/spiral/NormalizedTransition.d.ts +36 -29
  43. package/lib/cjs/curve/spiral/NormalizedTransition.d.ts.map +1 -1
  44. package/lib/cjs/curve/spiral/NormalizedTransition.js +62 -40
  45. package/lib/cjs/curve/spiral/NormalizedTransition.js.map +1 -1
  46. package/lib/cjs/curve/spiral/PolishCubicSpiralEvaluator.d.ts +13 -18
  47. package/lib/cjs/curve/spiral/PolishCubicSpiralEvaluator.d.ts.map +1 -1
  48. package/lib/cjs/curve/spiral/PolishCubicSpiralEvaluator.js +21 -24
  49. package/lib/cjs/curve/spiral/PolishCubicSpiralEvaluator.js.map +1 -1
  50. package/lib/cjs/curve/spiral/TransitionConditionalProperties.d.ts +41 -27
  51. package/lib/cjs/curve/spiral/TransitionConditionalProperties.d.ts.map +1 -1
  52. package/lib/cjs/curve/spiral/TransitionConditionalProperties.js +50 -33
  53. package/lib/cjs/curve/spiral/TransitionConditionalProperties.js.map +1 -1
  54. package/lib/cjs/curve/spiral/TransitionSpiral3d.d.ts +45 -34
  55. package/lib/cjs/curve/spiral/TransitionSpiral3d.d.ts.map +1 -1
  56. package/lib/cjs/curve/spiral/TransitionSpiral3d.js +56 -38
  57. package/lib/cjs/curve/spiral/TransitionSpiral3d.js.map +1 -1
  58. package/lib/cjs/curve/spiral/XYCurveEvaluator.d.ts +27 -21
  59. package/lib/cjs/curve/spiral/XYCurveEvaluator.d.ts.map +1 -1
  60. package/lib/cjs/curve/spiral/XYCurveEvaluator.js +23 -18
  61. package/lib/cjs/curve/spiral/XYCurveEvaluator.js.map +1 -1
  62. package/lib/cjs/geometry3d/GrowableXYArray.d.ts +96 -98
  63. package/lib/cjs/geometry3d/GrowableXYArray.d.ts.map +1 -1
  64. package/lib/cjs/geometry3d/GrowableXYArray.js +121 -110
  65. package/lib/cjs/geometry3d/GrowableXYArray.js.map +1 -1
  66. package/lib/cjs/geometry3d/GrowableXYZArray.d.ts +135 -142
  67. package/lib/cjs/geometry3d/GrowableXYZArray.d.ts.map +1 -1
  68. package/lib/cjs/geometry3d/GrowableXYZArray.js +165 -160
  69. package/lib/cjs/geometry3d/GrowableXYZArray.js.map +1 -1
  70. package/lib/cjs/geometry3d/IndexedXYCollection.d.ts +51 -34
  71. package/lib/cjs/geometry3d/IndexedXYCollection.d.ts.map +1 -1
  72. package/lib/cjs/geometry3d/IndexedXYCollection.js +16 -6
  73. package/lib/cjs/geometry3d/IndexedXYCollection.js.map +1 -1
  74. package/lib/cjs/geometry3d/IndexedXYZCollection.d.ts +78 -77
  75. package/lib/cjs/geometry3d/IndexedXYZCollection.d.ts.map +1 -1
  76. package/lib/cjs/geometry3d/IndexedXYZCollection.js +38 -35
  77. package/lib/cjs/geometry3d/IndexedXYZCollection.js.map +1 -1
  78. package/lib/cjs/geometry3d/PolygonOps.d.ts +27 -7
  79. package/lib/cjs/geometry3d/PolygonOps.d.ts.map +1 -1
  80. package/lib/cjs/geometry3d/PolygonOps.js +30 -9
  81. package/lib/cjs/geometry3d/PolygonOps.js.map +1 -1
  82. package/lib/esm/curve/Arc3d.d.ts +15 -1
  83. package/lib/esm/curve/Arc3d.d.ts.map +1 -1
  84. package/lib/esm/curve/Arc3d.js +31 -2
  85. package/lib/esm/curve/Arc3d.js.map +1 -1
  86. package/lib/esm/curve/CurveFactory.d.ts +25 -8
  87. package/lib/esm/curve/CurveFactory.d.ts.map +1 -1
  88. package/lib/esm/curve/CurveFactory.js +51 -55
  89. package/lib/esm/curve/CurveFactory.js.map +1 -1
  90. package/lib/esm/curve/spiral/AustralianRailCorpXYEvaluator.d.ts +10 -13
  91. package/lib/esm/curve/spiral/AustralianRailCorpXYEvaluator.d.ts.map +1 -1
  92. package/lib/esm/curve/spiral/AustralianRailCorpXYEvaluator.js +23 -22
  93. package/lib/esm/curve/spiral/AustralianRailCorpXYEvaluator.js.map +1 -1
  94. package/lib/esm/curve/spiral/ClothoidSeries.d.ts +10 -6
  95. package/lib/esm/curve/spiral/ClothoidSeries.d.ts.map +1 -1
  96. package/lib/esm/curve/spiral/ClothoidSeries.js +36 -19
  97. package/lib/esm/curve/spiral/ClothoidSeries.js.map +1 -1
  98. package/lib/esm/curve/spiral/CubicEvaluator.d.ts +7 -6
  99. package/lib/esm/curve/spiral/CubicEvaluator.d.ts.map +1 -1
  100. package/lib/esm/curve/spiral/CubicEvaluator.js +29 -14
  101. package/lib/esm/curve/spiral/CubicEvaluator.js.map +1 -1
  102. package/lib/esm/curve/spiral/CzechSpiralEvaluator.d.ts +34 -44
  103. package/lib/esm/curve/spiral/CzechSpiralEvaluator.d.ts.map +1 -1
  104. package/lib/esm/curve/spiral/CzechSpiralEvaluator.js +47 -53
  105. package/lib/esm/curve/spiral/CzechSpiralEvaluator.js.map +1 -1
  106. package/lib/esm/curve/spiral/DirectHalfCosineSpiralEvaluator.d.ts +2 -2
  107. package/lib/esm/curve/spiral/DirectHalfCosineSpiralEvaluator.d.ts.map +1 -1
  108. package/lib/esm/curve/spiral/DirectHalfCosineSpiralEvaluator.js +17 -7
  109. package/lib/esm/curve/spiral/DirectHalfCosineSpiralEvaluator.js.map +1 -1
  110. package/lib/esm/curve/spiral/DirectSpiral3d.d.ts +112 -104
  111. package/lib/esm/curve/spiral/DirectSpiral3d.d.ts.map +1 -1
  112. package/lib/esm/curve/spiral/DirectSpiral3d.js +143 -117
  113. package/lib/esm/curve/spiral/DirectSpiral3d.js.map +1 -1
  114. package/lib/esm/curve/spiral/IntegratedSpiral3d.d.ts +71 -53
  115. package/lib/esm/curve/spiral/IntegratedSpiral3d.d.ts.map +1 -1
  116. package/lib/esm/curve/spiral/IntegratedSpiral3d.js +99 -66
  117. package/lib/esm/curve/spiral/IntegratedSpiral3d.js.map +1 -1
  118. package/lib/esm/curve/spiral/MXCubicAlongArcSpiralEvaluator.d.ts +8 -12
  119. package/lib/esm/curve/spiral/MXCubicAlongArcSpiralEvaluator.d.ts.map +1 -1
  120. package/lib/esm/curve/spiral/MXCubicAlongArcSpiralEvaluator.js +11 -13
  121. package/lib/esm/curve/spiral/MXCubicAlongArcSpiralEvaluator.js.map +1 -1
  122. package/lib/esm/curve/spiral/NormalizedTransition.d.ts +36 -29
  123. package/lib/esm/curve/spiral/NormalizedTransition.d.ts.map +1 -1
  124. package/lib/esm/curve/spiral/NormalizedTransition.js +62 -40
  125. package/lib/esm/curve/spiral/NormalizedTransition.js.map +1 -1
  126. package/lib/esm/curve/spiral/PolishCubicSpiralEvaluator.d.ts +13 -18
  127. package/lib/esm/curve/spiral/PolishCubicSpiralEvaluator.d.ts.map +1 -1
  128. package/lib/esm/curve/spiral/PolishCubicSpiralEvaluator.js +21 -24
  129. package/lib/esm/curve/spiral/PolishCubicSpiralEvaluator.js.map +1 -1
  130. package/lib/esm/curve/spiral/TransitionConditionalProperties.d.ts +41 -27
  131. package/lib/esm/curve/spiral/TransitionConditionalProperties.d.ts.map +1 -1
  132. package/lib/esm/curve/spiral/TransitionConditionalProperties.js +50 -33
  133. package/lib/esm/curve/spiral/TransitionConditionalProperties.js.map +1 -1
  134. package/lib/esm/curve/spiral/TransitionSpiral3d.d.ts +45 -34
  135. package/lib/esm/curve/spiral/TransitionSpiral3d.d.ts.map +1 -1
  136. package/lib/esm/curve/spiral/TransitionSpiral3d.js +56 -38
  137. package/lib/esm/curve/spiral/TransitionSpiral3d.js.map +1 -1
  138. package/lib/esm/curve/spiral/XYCurveEvaluator.d.ts +27 -21
  139. package/lib/esm/curve/spiral/XYCurveEvaluator.d.ts.map +1 -1
  140. package/lib/esm/curve/spiral/XYCurveEvaluator.js +23 -18
  141. package/lib/esm/curve/spiral/XYCurveEvaluator.js.map +1 -1
  142. package/lib/esm/geometry3d/GrowableXYArray.d.ts +96 -98
  143. package/lib/esm/geometry3d/GrowableXYArray.d.ts.map +1 -1
  144. package/lib/esm/geometry3d/GrowableXYArray.js +122 -111
  145. package/lib/esm/geometry3d/GrowableXYArray.js.map +1 -1
  146. package/lib/esm/geometry3d/GrowableXYZArray.d.ts +135 -142
  147. package/lib/esm/geometry3d/GrowableXYZArray.d.ts.map +1 -1
  148. package/lib/esm/geometry3d/GrowableXYZArray.js +165 -160
  149. package/lib/esm/geometry3d/GrowableXYZArray.js.map +1 -1
  150. package/lib/esm/geometry3d/IndexedXYCollection.d.ts +51 -34
  151. package/lib/esm/geometry3d/IndexedXYCollection.d.ts.map +1 -1
  152. package/lib/esm/geometry3d/IndexedXYCollection.js +14 -5
  153. package/lib/esm/geometry3d/IndexedXYCollection.js.map +1 -1
  154. package/lib/esm/geometry3d/IndexedXYZCollection.d.ts +78 -77
  155. package/lib/esm/geometry3d/IndexedXYZCollection.d.ts.map +1 -1
  156. package/lib/esm/geometry3d/IndexedXYZCollection.js +38 -35
  157. package/lib/esm/geometry3d/IndexedXYZCollection.js.map +1 -1
  158. package/lib/esm/geometry3d/PolygonOps.d.ts +27 -7
  159. package/lib/esm/geometry3d/PolygonOps.d.ts.map +1 -1
  160. package/lib/esm/geometry3d/PolygonOps.js +30 -9
  161. package/lib/esm/geometry3d/PolygonOps.js.map +1 -1
  162. package/package.json +3 -3
@@ -15,42 +15,38 @@ const Point3dVector3d_1 = require("./Point3dVector3d");
15
15
  const PointStreaming_1 = require("./PointStreaming");
16
16
  const Range_1 = require("./Range");
17
17
  const Transform_1 = require("./Transform");
18
- /** `GrowableXYArray` manages a (possibly growing) Float64Array to pack xy coordinates.
18
+ /**
19
+ * `GrowableXYZArray` manages a (possibly growing) Float64Array to pack xyz coordinates.
19
20
  * @public
20
21
  */
21
22
  class GrowableXYZArray extends IndexedXYZCollection_1.IndexedReadWriteXYZCollection {
22
- /**
23
- * array of packed xyz xyz xyz components
24
- */
23
+ /** Array of packed xyz xyz xyz components. */
25
24
  _data;
26
- /**
27
- * Number of xyz triples (not floats) in the array
28
- */
25
+ /** Number of xyz triples (not floats) in the array. */
29
26
  _xyzInUse;
30
- /**
31
- * capacity in xyz triples. (not floats)
32
- */
27
+ /** Capacity in xyz triples (not floats). */
33
28
  _xyzCapacity;
34
- /**
35
- * multiplier used by ensureCapacity to expand requested reallocation size
36
- */
29
+ /** Multiplier used by ensureCapacity to expand requested reallocation size. */
37
30
  _growthFactor;
38
- /** Construct a new GrowablePoint3d array.
39
- * @param numPoints initial capacity in xyz triples (default 8)
40
- * @param growthFactor used by ensureCapacity to expand requested reallocation size (default 1.5)
31
+ /**
32
+ * Construct a new GrowablePoint3d array.
33
+ * @param numPoints initial capacity in xyz triples (default 8).
34
+ * @param growthFactor used by ensureCapacity to expand requested reallocation size (default 1.5).
35
+ * @param data optional pre-existing Float64Array to use as the backing memory. If supplied, numPoints is ignored.
41
36
  */
42
- constructor(numPoints = 8, growthFactor) {
37
+ constructor(numPoints = 8, growthFactor, data) {
43
38
  super();
44
- this._data = new Float64Array(numPoints * 3); // 3 values per point
39
+ this._data = data || new Float64Array(numPoints * 3); // 3 values per point
45
40
  this._xyzInUse = 0;
46
- this._xyzCapacity = numPoints;
41
+ this._xyzCapacity = data ? data.length / 3 : numPoints;
47
42
  this._growthFactor = (undefined !== growthFactor && growthFactor >= 1.0) ? growthFactor : 1.5;
48
43
  }
49
- /** Copy xyz points from source array. Does not reallocate or change active point count.
50
- * @param source array to copy from
51
- * @param sourceCount copy the first sourceCount points; all points if undefined
52
- * @param destOffset copy to instance array starting at this point index; zero if undefined
53
- * @return count and offset of points copied
44
+ /**
45
+ * Copy xyz points from source array. Does not reallocate or change active point count.
46
+ * @param source array to copy from.
47
+ * @param sourceCount copy the first sourceCount points; all points if undefined.
48
+ * @param destOffset copy to instance array starting at this point index; zero if undefined.
49
+ * @return count and offset of points copied.
54
50
  */
55
51
  copyData(source, sourceCount, destOffset) {
56
52
  // validate inputs and convert from points to entries
@@ -79,30 +75,47 @@ class GrowableXYZArray extends IndexedXYZCollection_1.IndexedReadWriteXYZCollect
79
75
  return { count: myCount / 3, offset: myOffset / 3 };
80
76
  }
81
77
  /** The number of points in use. When the length is increased, the array is padded with zeroes. */
82
- get length() { return this._xyzInUse; }
83
- set length(newLength) { this.resize(newLength, true); }
78
+ get length() {
79
+ return this._xyzInUse;
80
+ }
81
+ set length(newLength) {
82
+ this.resize(newLength, true);
83
+ }
84
84
  /** Return the number of float64 in use. */
85
- get float64Length() { return this._xyzInUse * 3; }
86
- /** Return the raw packed data.
85
+ get float64Length() {
86
+ return this._xyzInUse * 3;
87
+ }
88
+ /**
89
+ * Return the raw packed data.
87
90
  * * Note that the length of the returned Float64Array is a count of doubles, and includes the excess capacity
88
91
  */
89
- float64Data() { return this._data; }
90
- /** If necessary, increase the capacity to the new number of points. Current coordinates and point count (length) are unchanged. */
92
+ float64Data() {
93
+ return this._data;
94
+ }
95
+ /**
96
+ * If necessary, increase the capacity to the new number of points. Current coordinates and point count (length) are
97
+ * unchanged.
98
+ */
91
99
  ensureCapacity(pointCapacity, applyGrowthFactor = true) {
92
100
  if (pointCapacity > this._xyzCapacity) {
93
101
  if (applyGrowthFactor)
94
- pointCapacity *= this._growthFactor;
102
+ pointCapacity = Math.trunc(pointCapacity * this._growthFactor);
95
103
  const prevData = this._data;
96
- this._data = new Float64Array(pointCapacity * 3);
104
+ if (this._data.buffer instanceof ArrayBuffer)
105
+ this._data = new Float64Array(new ArrayBuffer(pointCapacity * 3 * this._data.BYTES_PER_ELEMENT));
106
+ else
107
+ this._data = new Float64Array(new SharedArrayBuffer(pointCapacity * 3 * this._data.BYTES_PER_ELEMENT));
97
108
  this.copyData(prevData, this._xyzInUse);
98
109
  this._xyzCapacity = pointCapacity;
99
110
  }
100
111
  }
101
112
  /**
102
- * * If pointCount is less than current length, just reset current length to pointCount, effectively trimming active points but preserving original capacity.
103
- * * If pointCount is greater than current length, reallocate to exactly pointCount, copy existing points, and optionally pad excess with zero.
104
- * @param pointCount new number of active points in array
105
- * @param padWithZero when increasing point count, whether to zero out new points (default false)
113
+ * * If pointCount is less than current length, just reset current length to pointCount, effectively trimming active
114
+ * points but preserving original capacity.
115
+ * * If pointCount is greater than current length, reallocate to exactly pointCount, copy existing points, and
116
+ * optionally pad excess with zero.
117
+ * @param pointCount new number of active points in array.
118
+ * @param padWithZero when increasing point count, whether to zero out new points (default false).
106
119
  */
107
120
  resize(pointCount, padWithZero) {
108
121
  if (pointCount >= 0 && pointCount < this._xyzInUse)
@@ -114,10 +127,7 @@ class GrowableXYZArray extends IndexedXYZCollection_1.IndexedReadWriteXYZCollect
114
127
  this._xyzInUse = pointCount;
115
128
  }
116
129
  }
117
- /**
118
- * Make a copy of the (active) points in this array.
119
- * (The clone does NOT get excess capacity)
120
- */
130
+ /** Make a copy of the (active) points in this array (the clone does NOT get excess capacity). */
121
131
  clone(result) {
122
132
  if (!result)
123
133
  result = new GrowableXYZArray(this.length);
@@ -133,11 +143,11 @@ class GrowableXYZArray extends IndexedXYZCollection_1.IndexedReadWriteXYZCollect
133
143
  /**
134
144
  * Clone the input array with each successive duplicate point removed.
135
145
  * * First and last points are always preserved.
136
- * @param source the source array
137
- * @param tolerance optional distance tol for compression (default [[Geometry.smallMetricDistance]])
146
+ * @param source the source array.
147
+ * @param tolerance optional distance tol for compression (default [[Geometry.smallMetricDistance]]).
138
148
  * @param result optional pre-allocated object to populate and return. Can be a reference to `source`, in
139
149
  * which case the array is compressed in place and returned.
140
- * @see [[cloneCompressed]], [[compressInPlace]], [[PolylineOps.compressShortEdges]]
150
+ * @see [[cloneCompressed]], [[compressInPlace]], [[PolylineOps.compressShortEdges]].
141
151
  */
142
152
  static createCompressed(source, tolerance = Geometry_1.Geometry.smallMetricDistance, result) {
143
153
  const dupIndices = source.findOrderedDuplicates(tolerance, true);
@@ -171,9 +181,9 @@ class GrowableXYZArray extends IndexedXYZCollection_1.IndexedReadWriteXYZCollect
171
181
  /**
172
182
  * Compress the input array by removing successive duplicate points.
173
183
  * * First and last points are always preserved.
174
- * @param tolerance optional distance tol for compression (default [[Geometry.smallMetricDistance]])
184
+ * @param tolerance optional distance tol for compression (default [[Geometry.smallMetricDistance]]).
175
185
  * @returns the instance array.
176
- * @see [[createCompressed]], [[cloneCompressed]], [[PolylineOps.compressShortEdges]]
186
+ * @see [[createCompressed]], [[cloneCompressed]], [[PolylineOps.compressShortEdges]].
177
187
  */
178
188
  compressInPlace(tolerance = Geometry_1.Geometry.smallMetricDistance) {
179
189
  return GrowableXYZArray.createCompressed(this, tolerance, this);
@@ -204,23 +214,32 @@ class GrowableXYZArray extends IndexedXYZCollection_1.IndexedReadWriteXYZCollect
204
214
  result.pushFrom(data);
205
215
  return result;
206
216
  }
207
- /** Restructure MultiLineStringDataVariant as array of GrowableXYZArray */
217
+ /**
218
+ * Create a new GrowableXYZArray capturing the provided data. The data is not copied, just referenced.
219
+ * @param data source data to capture.
220
+ * @returns a new GrowableXYZArray object that references the provided data.
221
+ */
222
+ static createCapture(data) {
223
+ return new GrowableXYZArray(0, undefined, data);
224
+ }
225
+ /** Restructure MultiLineStringDataVariant as array of GrowableXYZArray. */
208
226
  static createArrayOfGrowableXYZArray(data) {
209
227
  const collector = new PointStreaming_1.PointStreamGrowableXYZArrayCollector();
210
228
  PointStreaming_1.VariantPointDataStream.streamXYZ(data, collector);
211
229
  return collector.claimArrayOfGrowableXYZArray();
212
230
  }
213
- /** push a point to the end of the array */
231
+ /** Push a point to the end of the array. */
214
232
  push(toPush) {
215
233
  this.pushXYZ(toPush.x, toPush.y, toPush.z);
216
234
  }
217
- /** push all points of an array */
235
+ /** Push all points of an array. */
218
236
  pushAll(points) {
219
237
  this.ensureCapacity(this._xyzInUse + points.length, false);
220
238
  for (const p of points)
221
239
  this.push(p);
222
240
  }
223
- /** Push copies of points from variant sources.
241
+ /**
242
+ * Push copies of points from variant sources.
224
243
  * Valid inputs are:
225
244
  * * Point2d
226
245
  * * Point3d
@@ -230,7 +249,7 @@ class GrowableXYZArray extends IndexedXYZCollection_1.IndexedReadWriteXYZCollect
230
249
  * * Any json object satisfying Point3d.isXYAndZ
231
250
  * * Any json object satisfying Point3d.isXAndY
232
251
  * * A Float64Array of doubles, interpreted as xyzxyz
233
- * * An array of any of the above
252
+ * * An array of any of the above.
234
253
  */
235
254
  pushFrom(p) {
236
255
  if (p instanceof Point3dVector3d_1.Point3d)
@@ -250,7 +269,7 @@ class GrowableXYZArray extends IndexedXYZCollection_1.IndexedReadWriteXYZCollect
250
269
  else if (Geometry_1.Geometry.isNumberArray(p, 2))
251
270
  this.pushXYZ(p[0], p[1], 0.0);
252
271
  else if (Array.isArray(p)) {
253
- // direct recursion re-wraps p and goes infinite. Unroll here.
272
+ // direct recursion re-wraps p and goes infinite; unroll here.
254
273
  for (const q of p)
255
274
  this.pushFrom(q);
256
275
  }
@@ -267,7 +286,7 @@ class GrowableXYZArray extends IndexedXYZCollection_1.IndexedReadWriteXYZCollect
267
286
  }
268
287
  /**
269
288
  * Replicate numWrap xyz values from the front of the array as new values at the end.
270
- * @param numWrap number of xyz values to replicate
289
+ * @param numWrap number of xyz values to replicate.
271
290
  */
272
291
  pushWrap(numWrap) {
273
292
  if (this._xyzInUse >= numWrap) {
@@ -278,7 +297,7 @@ class GrowableXYZArray extends IndexedXYZCollection_1.IndexedReadWriteXYZCollect
278
297
  }
279
298
  }
280
299
  }
281
- /** append a new point with given x,y,z */
300
+ /** Append a new point with given x,y,z. */
282
301
  pushXYZ(x, y, z) {
283
302
  this.ensureCapacity(this._xyzInUse + 1);
284
303
  const index = this._xyzInUse * 3;
@@ -287,10 +306,11 @@ class GrowableXYZArray extends IndexedXYZCollection_1.IndexedReadWriteXYZCollect
287
306
  this._data[index + 2] = z;
288
307
  this._xyzInUse++;
289
308
  }
290
- /** Shift all data forward to make space for numPoints at the front.
309
+ /**
310
+ * Shift all data forward to make space for numPoints at the front.
291
311
  * * Leading (3*numPoints) doubles are left with prior contents.
292
- * * _xyzInUse count is increased
293
- */
312
+ * * _xyzInUse count is increased.
313
+ */
294
314
  shiftForward(numPoints) {
295
315
  if (numPoints <= 0)
296
316
  return;
@@ -300,7 +320,8 @@ class GrowableXYZArray extends IndexedXYZCollection_1.IndexedReadWriteXYZCollect
300
320
  this._data.copyWithin(numAddedDouble, 0, lastIndex);
301
321
  this._xyzInUse += numPoints;
302
322
  }
303
- /** prepend a new point with given x,y,z
323
+ /**
324
+ * Prepend a new point with given x,y,z
304
325
  * * Remark: this copies all content forward.
305
326
  */
306
327
  pushFrontXYZ(x, y, z) {
@@ -309,13 +330,12 @@ class GrowableXYZArray extends IndexedXYZCollection_1.IndexedReadWriteXYZCollect
309
330
  this._data[1] = y;
310
331
  this._data[2] = z;
311
332
  }
312
- /** prepend a new point at the front of the array.
313
- *
314
- */
333
+ /** Prepend a new point at the front of the array. */
315
334
  pushFront(toPush) {
316
335
  this.pushFrontXYZ(toPush.x, toPush.y, toPush.z);
317
336
  }
318
- /** move the coordinates at fromIndex to toIndex.
337
+ /**
338
+ * Move the coordinates at fromIndex to toIndex.
319
339
  * * No action if either index is invalid.
320
340
  */
321
341
  moveIndexToIndex(fromIndex, toIndex) {
@@ -327,7 +347,8 @@ class GrowableXYZArray extends IndexedXYZCollection_1.IndexedReadWriteXYZCollect
327
347
  this._data[iB] = this._data[iA];
328
348
  }
329
349
  }
330
- /** Remove one point from the back.
350
+ /**
351
+ * Remove one point from the back.
331
352
  * * NOTE that (in the manner of std::vector native) this is "just" removing the point -- no point is NOT returned.
332
353
  * * Use `back ()` to get the last x,y,z assembled into a `Point3d `
333
354
  */
@@ -335,40 +356,41 @@ class GrowableXYZArray extends IndexedXYZCollection_1.IndexedReadWriteXYZCollect
335
356
  if (this._xyzInUse > 0)
336
357
  this._xyzInUse--;
337
358
  }
338
- /**
339
- * Clear all xyz data, but leave capacity unchanged.
340
- */
359
+ /** Clear all xyz data, but leave capacity unchanged. */
341
360
  clear() {
342
361
  this._xyzInUse = 0;
343
362
  }
344
363
  /**
345
- * Get a point by index, strongly typed as a Point3d. This is unchecked. Use [[getPoint3dAtCheckedPointIndex]] to have validity test.
346
- * @param pointIndex index to access
347
- * @param result optional result
364
+ * Get a point by index, strongly typed as a Point3d. This is unchecked. Use [[getPoint3dAtCheckedPointIndex]] to
365
+ * have validity test.
366
+ * @param pointIndex index to access.
367
+ * @param result optional result.
348
368
  */
349
369
  getPoint3dAtUncheckedPointIndex(pointIndex, result) {
350
370
  const index = 3 * pointIndex;
351
371
  return Point3dVector3d_1.Point3d.create(this._data[index], this._data[index + 1], this._data[index + 2], result);
352
372
  }
353
373
  /**
354
- * Get a point by index, strongly typed as a Point2d. This is unchecked. Use [[getPoint2dAtCheckedPointIndex]] to have validity test.
355
- * @param pointIndex index to access
356
- * @param result optional result
374
+ * Get a point by index, strongly typed as a Point2d. This is unchecked. Use [[getPoint2dAtCheckedPointIndex]] to
375
+ * have validity test.
376
+ * @param pointIndex index to access.
377
+ * @param result optional result.
357
378
  */
358
379
  getPoint2dAtUncheckedPointIndex(pointIndex, result) {
359
380
  const index = 3 * pointIndex;
360
381
  return Point2dVector2d_1.Point2d.create(this._data[index], this._data[index + 1], result);
361
382
  }
362
383
  /**
363
- * Get a vector by index, strongly typed as a Vector3d. This is unchecked. Use [[getVector3dAtCheckedVectorIndex]] to have validity test.
364
- * @param vectorIndex index to access
365
- * @param result optional result
384
+ * Get a vector by index, strongly typed as a Vector3d. This is unchecked. Use [[getVector3dAtCheckedVectorIndex]]
385
+ * to have validity test.
386
+ * @param vectorIndex index to access.
387
+ * @param result optional result.
366
388
  */
367
389
  getVector3dAtUncheckedVectorIndex(vectorIndex, result) {
368
390
  const index = 3 * vectorIndex;
369
391
  return Point3dVector3d_1.Vector3d.create(this._data[index], this._data[index + 1], this._data[index + 2], result);
370
392
  }
371
- /** copy xyz into strongly typed Point3d */
393
+ /** Copy xyz into strongly typed Point3d. */
372
394
  getPoint3dAtCheckedPointIndex(pointIndex, result) {
373
395
  if (this.isIndexValid(pointIndex)) {
374
396
  const index = 3 * pointIndex;
@@ -376,22 +398,22 @@ class GrowableXYZArray extends IndexedXYZCollection_1.IndexedReadWriteXYZCollect
376
398
  }
377
399
  return undefined;
378
400
  }
379
- /** access x of indexed point */
401
+ /** Access x of indexed point. */
380
402
  getXAtUncheckedPointIndex(pointIndex) {
381
403
  const index = 3 * pointIndex;
382
404
  return this._data[index];
383
405
  }
384
- /** access y of indexed point */
406
+ /** Access y of indexed point. */
385
407
  getYAtUncheckedPointIndex(pointIndex) {
386
408
  const index = 3 * pointIndex;
387
409
  return this._data[index + 1];
388
410
  }
389
- /** access y of indexed point */
411
+ /** Access z of indexed point. */
390
412
  getZAtUncheckedPointIndex(pointIndex) {
391
413
  const index = 3 * pointIndex;
392
414
  return this._data[index + 2];
393
415
  }
394
- /** copy xy into strongly typed Point2d */
416
+ /** Copy xy into strongly typed Point2d. */
395
417
  getPoint2dAtCheckedPointIndex(pointIndex, result) {
396
418
  if (this.isIndexValid(pointIndex)) {
397
419
  const index = 3 * pointIndex;
@@ -399,7 +421,7 @@ class GrowableXYZArray extends IndexedXYZCollection_1.IndexedReadWriteXYZCollect
399
421
  }
400
422
  return undefined;
401
423
  }
402
- /** copy xyz into strongly typed Vector3d */
424
+ /** Copy xyz into strongly typed Vector3d. */
403
425
  getVector3dAtCheckedVectorIndex(vectorIndex, result) {
404
426
  if (this.isIndexValid(vectorIndex)) {
405
427
  const index = 3 * vectorIndex;
@@ -409,9 +431,9 @@ class GrowableXYZArray extends IndexedXYZCollection_1.IndexedReadWriteXYZCollect
409
431
  }
410
432
  /**
411
433
  * Read coordinates from source array, place them at index within this array.
412
- * @param destIndex point index where coordinates are to be placed in this array
413
- * @param source source array
414
- * @param sourceIndex point index in source array
434
+ * @param destIndex point index where coordinates are to be placed in this array.
435
+ * @param source source array.
436
+ * @param sourceIndex point index in source array.
415
437
  * @returns true if destIndex and sourceIndex are both valid.
416
438
  */
417
439
  transferFromGrowableXYZArray(destIndex, source, sourceIndex) {
@@ -425,13 +447,13 @@ class GrowableXYZArray extends IndexedXYZCollection_1.IndexedReadWriteXYZCollect
425
447
  return false;
426
448
  }
427
449
  /**
428
- * push coordinates from the source array to the end of this array.
429
- * @param source source array
430
- * @param sourceIndex xyz index within the source. If undefined, entire source is pushed.
450
+ * Push coordinates from the source array to the end of this array.
451
+ * @param source source array.
452
+ * @param sourceIndex xyz index within the source. If undefined, entire source is pushed.
431
453
  * @returns number of points pushed.
432
454
  */
433
455
  pushFromGrowableXYZArray(source, sourceIndex) {
434
- // full array push . . .
456
+ // full array push
435
457
  if (sourceIndex === undefined) {
436
458
  const numXYZAdd = source.length;
437
459
  this.ensureCapacity(this.length + numXYZAdd, false);
@@ -439,7 +461,7 @@ class GrowableXYZArray extends IndexedXYZCollection_1.IndexedReadWriteXYZCollect
439
461
  this._xyzInUse += numXYZAdd;
440
462
  return numXYZAdd;
441
463
  }
442
- // single point push . . .
464
+ // single point push
443
465
  if (source.isIndexValid(sourceIndex)) {
444
466
  const j = sourceIndex * 3;
445
467
  this.pushXYZ(source._data[j], source._data[j + 1], source._data[j + 2]);
@@ -449,8 +471,8 @@ class GrowableXYZArray extends IndexedXYZCollection_1.IndexedReadWriteXYZCollect
449
471
  }
450
472
  /**
451
473
  * Set the coordinates of a single point.
452
- * @param pointIndex index of point to set
453
- * @param value coordinates to set
474
+ * @param pointIndex index of point to set.
475
+ * @param value coordinates to set.
454
476
  */
455
477
  setAtCheckedPointIndex(pointIndex, value) {
456
478
  if (!this.isIndexValid(pointIndex))
@@ -462,11 +484,11 @@ class GrowableXYZArray extends IndexedXYZCollection_1.IndexedReadWriteXYZCollect
462
484
  return true;
463
485
  }
464
486
  /**
465
- * Set the coordinates of a single point given as coordinates
466
- * @param pointIndex index of point to set
467
- * @param x x coordinate
468
- * @param y y coordinate
469
- * @param z z coordinate
487
+ * Set the coordinates of a single point given as coordinates.
488
+ * @param pointIndex index of point to set.
489
+ * @param x x coordinate.
490
+ * @param y y coordinate.
491
+ * @param z z coordinate.
470
492
  */
471
493
  setXYZAtCheckedPointIndex(pointIndex, x, y, z) {
472
494
  if (!this.isIndexValid(pointIndex))
@@ -477,9 +499,7 @@ class GrowableXYZArray extends IndexedXYZCollection_1.IndexedReadWriteXYZCollect
477
499
  this._data[index] = z;
478
500
  return true;
479
501
  }
480
- /**
481
- * Copy all points into a simple array of Point3d
482
- */
502
+ /** Copy all points into a simple array of Point3. */
483
503
  getPoint3dArray() {
484
504
  const n = 3 * this._xyzInUse;
485
505
  const result = [];
@@ -488,7 +508,7 @@ class GrowableXYZArray extends IndexedXYZCollection_1.IndexedReadWriteXYZCollect
488
508
  result.push(Point3dVector3d_1.Point3d.create(data[i], data[i + 1], data[i + 2]));
489
509
  return result;
490
510
  }
491
- /** multiply each point by the transform, replace values. */
511
+ /** Multiply each point by the transform, replace values. */
492
512
  static multiplyTransformInPlace(transform, data) {
493
513
  if (Array.isArray(data)) {
494
514
  for (const d of data)
@@ -498,7 +518,7 @@ class GrowableXYZArray extends IndexedXYZCollection_1.IndexedReadWriteXYZCollect
498
518
  data.multiplyTransformInPlace(transform);
499
519
  }
500
520
  }
501
- /** multiply each point by the transform, replace values. */
521
+ /** Multiply each point by the transform, replace values. */
502
522
  multiplyTransformInPlace(transform) {
503
523
  const data = this._data;
504
524
  const nDouble = this.float64Length;
@@ -519,7 +539,7 @@ class GrowableXYZArray extends IndexedXYZCollection_1.IndexedReadWriteXYZCollect
519
539
  data[i + 2] = coffs[6] * x + coffs[7] * y + coffs[8] * z + z0;
520
540
  }
521
541
  }
522
- /** reverse the order of points. */
542
+ /** Reverse the order of points. */
523
543
  reverseInPlace() {
524
544
  const n = this.length;
525
545
  let j0, j1;
@@ -543,7 +563,7 @@ class GrowableXYZArray extends IndexedXYZCollection_1.IndexedReadWriteXYZCollect
543
563
  data[j1] = a;
544
564
  }
545
565
  }
546
- /** multiply each xyz (as a vector) by matrix, replace values. */
566
+ /** Multiply each xyz (as a vector) by matrix, replace values. */
547
567
  multiplyMatrix3dInPlace(matrix) {
548
568
  const data = this._data;
549
569
  const nDouble = this.float64Length;
@@ -560,9 +580,10 @@ class GrowableXYZArray extends IndexedXYZCollection_1.IndexedReadWriteXYZCollect
560
580
  data[i + 2] = coffs[6] * x + coffs[7] * y + coffs[8] * z;
561
581
  }
562
582
  }
563
- /** multiply each xyz (as a vector) by matrix inverse transpose, renormalize the vector, replace values.
564
- * * This is the way to apply a matrix (possibly with skew and scale) to a surface normal, and
565
- * have it end up perpendicular to the transformed in-surface vectors.
583
+ /**
584
+ * Multiply each xyz (as a vector) by matrix inverse transpose, renormalize the vector, replace values.
585
+ * * This is the way to apply a matrix (possibly with skew and scale) to a surface normal, and have it end up
586
+ * perpendicular to the transformed in-surface vectors.
566
587
  * * Return false if matrix is not invertible or if any normalization fails.
567
588
  */
568
589
  multiplyAndRenormalizeMatrix3dInverseTransposeInPlace(matrix) {
@@ -590,7 +611,7 @@ class GrowableXYZArray extends IndexedXYZCollection_1.IndexedReadWriteXYZCollect
590
611
  z1 = coffs[2] * x + coffs[5] * y + coffs[8] * z;
591
612
  a = x1 * x1 + y1 * y1 + z1 * z1;
592
613
  if (a < tol) {
593
- // put the originals back ..
614
+ // put the originals back
594
615
  x1 = x;
595
616
  y1 = y;
596
617
  z1 = z;
@@ -601,16 +622,14 @@ class GrowableXYZArray extends IndexedXYZCollection_1.IndexedReadWriteXYZCollect
601
622
  x1 *= q;
602
623
  y1 *= q;
603
624
  z1 *= q;
604
- } // else -- q is near 1, no need to do the division !!
625
+ } // else if q is near 1, no need to do the division
605
626
  data[i] = x1;
606
627
  data[i + 1] = y1;
607
628
  data[i + 2] = z1;
608
629
  }
609
630
  return numFail === 0;
610
631
  }
611
- /** multiply each xyz (as a point) by a homogeneous matrix and update as the normalized point
612
- *
613
- */
632
+ /** Multiply each xyz (as a point) by a homogeneous matrix and update as the normalized point. */
614
633
  multiplyMatrix4dAndQuietRenormalizeMatrix4d(matrix) {
615
634
  const data = this._data;
616
635
  const nDouble = this.float64Length;
@@ -622,7 +641,7 @@ class GrowableXYZArray extends IndexedXYZCollection_1.IndexedReadWriteXYZCollect
622
641
  data[i + 2] = xyz1.z;
623
642
  }
624
643
  }
625
- /** multiply each point by the transform, replace values. */
644
+ /** Multiply each point by the transform, replace values. */
626
645
  tryTransformInverseInPlace(transform) {
627
646
  const data = this._data;
628
647
  const nDouble = this.float64Length;
@@ -661,7 +680,7 @@ class GrowableXYZArray extends IndexedXYZCollection_1.IndexedReadWriteXYZCollect
661
680
  rangeToExtend.extendXYZ(data[i], data[i + 1], data[i + 2]);
662
681
  }
663
682
  }
664
- /** get range of points. */
683
+ /** Get range of points. */
665
684
  getRange(transform, result) {
666
685
  let range = result;
667
686
  if (range)
@@ -679,7 +698,7 @@ class GrowableXYZArray extends IndexedXYZCollection_1.IndexedReadWriteXYZCollect
679
698
  /** Sum the lengths of segments between points. */
680
699
  sumLengths() {
681
700
  let sum = 0.0;
682
- const n = 3 * (this._xyzInUse - 1); // Length already takes into account what specifically is in use
701
+ const n = 3 * (this._xyzInUse - 1); // length already takes into account what specifically is in use
683
702
  const data = this._data;
684
703
  for (let i = 0; i < n; i += 3)
685
704
  sum += Geometry_1.Geometry.hypotenuseXYZ(data[i + 3] - data[i], data[i + 4] - data[i + 1], data[i + 5] - data[i + 2]);
@@ -687,7 +706,7 @@ class GrowableXYZArray extends IndexedXYZCollection_1.IndexedReadWriteXYZCollect
687
706
  }
688
707
  /**
689
708
  * Multiply each x,y,z by the scale factor.
690
- * @param factor
709
+ * @param factor scale factor.
691
710
  */
692
711
  scaleInPlace(factor) {
693
712
  if (this._data) {
@@ -696,7 +715,7 @@ class GrowableXYZArray extends IndexedXYZCollection_1.IndexedReadWriteXYZCollect
696
715
  this._data[i] = this._data[i] * factor;
697
716
  }
698
717
  }
699
- /** test if all points are within tolerance of a plane. */
718
+ /** Test if all points are within tolerance of a plane. */
700
719
  isCloseToPlane(plane, tolerance = Geometry_1.Geometry.smallMetricDistance) {
701
720
  const numCoordinate = 3 * this._xyzInUse;
702
721
  const data = this._data;
@@ -707,13 +726,12 @@ class GrowableXYZArray extends IndexedXYZCollection_1.IndexedReadWriteXYZCollect
707
726
  }
708
727
  /**
709
728
  * * If not already closed, push a copy of the first point.
710
- * * If already closed within tolerance, force exact copy
711
- * * otherwise leave unchanged.
729
+ * * If already closed within tolerance, force exact copy.
730
+ * * Otherwise leave unchanged.
712
731
  */
713
732
  forceClosure(tolerance = Geometry_1.Geometry.smallMetricDistance) {
714
733
  const d = this.distanceIndexIndex(0, this.length - 1);
715
- // leave the empty array alone.
716
- // Note that singleton will generate 0 distance and do nothing.
734
+ // leave the empty array alone; note that singleton will generate 0 distance and do nothing
717
735
  if (d === undefined) {
718
736
  }
719
737
  else if (d > tolerance)
@@ -725,7 +743,7 @@ class GrowableXYZArray extends IndexedXYZCollection_1.IndexedReadWriteXYZCollect
725
743
  this._data[i0 + i] = this._data[i];
726
744
  }
727
745
  }
728
- /** Compute a point at fractional coordinate between points i and j */
746
+ /** Compute a point at fractional coordinate between points i and j. */
729
747
  interpolate(i, fraction, j, result) {
730
748
  if (this.isIndexValid(i) && this.isIndexValid(j)) {
731
749
  const fraction0 = 1.0 - fraction;
@@ -736,10 +754,7 @@ class GrowableXYZArray extends IndexedXYZCollection_1.IndexedReadWriteXYZCollect
736
754
  }
737
755
  return undefined;
738
756
  }
739
- /**
740
- * * Compute a point at fractional coordinate between points i and j of source
741
- * * push onto this array.
742
- */
757
+ /** Compute a point at fractional coordinate between points i and j of source and push onto this array. */
743
758
  pushInterpolatedFromGrowableXYZArray(source, i, fraction, j) {
744
759
  if (source.isIndexValid(i) && source.isIndexValid(j)) {
745
760
  const fraction0 = 1.0 - fraction;
@@ -749,10 +764,10 @@ class GrowableXYZArray extends IndexedXYZCollection_1.IndexedReadWriteXYZCollect
749
764
  this.pushXYZ(fraction0 * data[i] + fraction * data[j], fraction0 * data[i + 1] + fraction * data[j + 1], fraction0 * data[i + 2] + fraction * data[j + 2]);
750
765
  }
751
766
  }
752
- /** Sum the signed areas of the projection to xy plane */
767
+ /** Sum the signed areas of the projection to xy plane. */
753
768
  areaXY() {
754
769
  let area = 0.0;
755
- const n = 3 * this._xyzInUse; // float count !!
770
+ const n = 3 * this._xyzInUse; // float count
756
771
  if (n > 6) {
757
772
  const x0 = this._data[n - 3];
758
773
  const y0 = this._data[n - 2];
@@ -797,21 +812,21 @@ class GrowableXYZArray extends IndexedXYZCollection_1.IndexedReadWriteXYZCollect
797
812
  }
798
813
  return undefined;
799
814
  }
800
- /** Compute the dot product of pointIndex with [x,y,z] */
815
+ /** Compute the dot product of pointIndex with [x,y,z]. */
801
816
  evaluateUncheckedIndexDotProductXYZ(pointIndex, x, y, z) {
802
817
  const i = pointIndex * 3;
803
818
  const data = this._data;
804
819
  return data[i] * x + data[i + 1] * y + data[i + 2] * z;
805
820
  }
806
- /** Compute the dot product of pointIndex with [x,y,z] */
821
+ /** Compute the dot product of pointIndex with [x,y,z]. */
807
822
  evaluateUncheckedIndexPlaneAltitude(pointIndex, plane) {
808
823
  const i = pointIndex * 3;
809
824
  const data = this._data;
810
825
  return plane.altitudeXYZ(data[i], data[i + 1], data[i + 2]);
811
826
  }
812
827
  /**
813
- * * compute the cross product from indexed origin t indexed targets targetAIndex and targetB index.
814
- * * accumulate it to the result.
828
+ * Compute the cross product from indexed origin t indexed targets targetAIndex and targetB index.
829
+ * * Accumulate it to the result.
815
830
  */
816
831
  accumulateCrossProductIndexIndexIndex(originIndex, targetAIndex, targetBIndex, result) {
817
832
  if (this.isIndexValid(originIndex) && this.isIndexValid(targetAIndex) && this.isIndexValid(targetBIndex)) {
@@ -823,8 +838,8 @@ class GrowableXYZArray extends IndexedXYZCollection_1.IndexedReadWriteXYZCollect
823
838
  }
824
839
  }
825
840
  /**
826
- * * compute the cross product from indexed origin t indexed targets targetAIndex and targetB index.
827
- * * accumulate it to the result.
841
+ * Compute the cross product from indexed origin t indexed targets targetAIndex and targetB index.
842
+ * * Accumulate it to the result.
828
843
  */
829
844
  accumulateScaledXYZ(index, scale, sum) {
830
845
  if (this.isIndexValid(index)) {
@@ -835,7 +850,7 @@ class GrowableXYZArray extends IndexedXYZCollection_1.IndexedReadWriteXYZCollect
835
850
  sum.z += scale * data[i + 2];
836
851
  }
837
852
  }
838
- /** Compute the cross product of vectors from from origin to indexed targets i and j */
853
+ /** Compute the cross product of vectors from from origin to indexed targets i and j. */
839
854
  crossProductXYAndZIndexIndex(origin, targetAIndex, targetBIndex, result) {
840
855
  if (this.isIndexValid(targetAIndex) && this.isIndexValid(targetBIndex)) {
841
856
  const j = targetAIndex * 3;
@@ -855,8 +870,8 @@ class GrowableXYZArray extends IndexedXYZCollection_1.IndexedReadWriteXYZCollect
855
870
  }
856
871
  /**
857
872
  * Return distance squared between indicated points.
858
- * @param i first point index
859
- * @param j second point index
873
+ * @param i first point index.
874
+ * @param j second point index.
860
875
  */
861
876
  distanceSquaredIndexIndex(i, j) {
862
877
  if (this.isIndexValid(i) && this.isIndexValid(j)) {
@@ -868,8 +883,8 @@ class GrowableXYZArray extends IndexedXYZCollection_1.IndexedReadWriteXYZCollect
868
883
  }
869
884
  /**
870
885
  * Return distance between indicated points.
871
- * @param i first point index
872
- * @param j second point index
886
+ * @param i first point index.
887
+ * @param j second point index.
873
888
  */
874
889
  distanceIndexIndex(i, j) {
875
890
  if (this.isIndexValid(i) && this.isIndexValid(j)) {
@@ -888,7 +903,7 @@ class GrowableXYZArray extends IndexedXYZCollection_1.IndexedReadWriteXYZCollect
888
903
  }
889
904
  return undefined;
890
905
  }
891
- /** test for near equality between two `GrowableXYZArray`. */
906
+ /** Test for near equality between two `GrowableXYZArray`. */
892
907
  static isAlmostEqual(dataA, dataB) {
893
908
  if (dataA && dataB) {
894
909
  if (dataA.length !== dataB.length)
@@ -901,7 +916,7 @@ class GrowableXYZArray extends IndexedXYZCollection_1.IndexedReadWriteXYZCollect
901
916
  // if both are null it is equal, otherwise unequal
902
917
  return (!dataA && !dataB);
903
918
  }
904
- /** Return an array of block indices sorted per compareLexicalBlock function */
919
+ /** Return an array of block indices sorted per compareLexicalBlock function. */
905
920
  sortIndicesLexical() {
906
921
  const n = this._xyzInUse;
907
922
  // let numCompare = 0;
@@ -915,7 +930,7 @@ class GrowableXYZArray extends IndexedXYZCollection_1.IndexedReadWriteXYZCollect
915
930
  // console.log (n, numCompare);
916
931
  return result;
917
932
  }
918
- /** compare two blocks in simple lexical order. */
933
+ /** Compare two blocks in simple lexical order. */
919
934
  compareLexicalBlock(ia, ib) {
920
935
  let ax = 0;
921
936
  let bx = 0;
@@ -927,19 +942,13 @@ class GrowableXYZArray extends IndexedXYZCollection_1.IndexedReadWriteXYZCollect
927
942
  if (ax < bx)
928
943
  return -1;
929
944
  }
930
- return ia - ib; // so original order is maintained among duplicates !!!!
945
+ return ia - ib; // so original order is maintained among duplicates
931
946
  }
932
- /** Access a single double at offset within a block. This has no index checking. */
947
+ /** Access a single double at offset within a block. This has no index checking. */
933
948
  component(pointIndex, componentIndex) {
934
949
  return this._data[3 * pointIndex + componentIndex];
935
950
  }
936
- /**
937
- * add points at regular steps from `other`
938
- * @param source
939
- * @param pointIndex0
940
- * @param step
941
- * @param numAdd
942
- */
951
+ /** Add points at regular steps from `other`. */
943
952
  addSteppedPoints(other, pointIndex0, step, numAdd) {
944
953
  const dataB = other._data;
945
954
  let b0 = pointIndex0 * 3;
@@ -953,9 +962,9 @@ class GrowableXYZArray extends IndexedXYZCollection_1.IndexedReadWriteXYZCollect
953
962
  }
954
963
  }
955
964
  /**
956
- * find the min and max distance between corresponding indexed points. Excess points are ignored.
957
- * @param arrayA first array
958
- * @param arrayB second array
965
+ * Find the min and max distance between corresponding indexed points. Excess points are ignored.
966
+ * @param arrayA first array.
967
+ * @param arrayB second array.
959
968
  */
960
969
  static distanceRangeBetweenCorrespondingPoints(arrayA, arrayB) {
961
970
  const dataA = arrayA._data;
@@ -971,11 +980,7 @@ class GrowableXYZArray extends IndexedXYZCollection_1.IndexedReadWriteXYZCollect
971
980
  }
972
981
  return range;
973
982
  }
974
- /**
975
- * remove trailing point(s) within tolerance of the start point.
976
- * @param points
977
- * @param tolerance
978
- */
983
+ /** Remove trailing point(s) within tolerance of the start point. */
979
984
  static removeClosure(points, tolerance = Geometry_1.Geometry.smallMetricDistance) {
980
985
  while (points.length > 1 && points.distanceIndexIndex(0, points.length - 1) < tolerance)
981
986
  points.pop();
@@ -983,8 +988,8 @@ class GrowableXYZArray extends IndexedXYZCollection_1.IndexedReadWriteXYZCollect
983
988
  /**
984
989
  * Compute frame for a triangle formed by three (unchecked!) points identified by index.
985
990
  * * z direction of frame is 001.
986
- * * Transform axes from origin to targetA and targetB
987
- * * in local coordinates (u,v,w) the xy interior of the triangle is `u>=0, v>= 0, w>= 0, u+v+w<1`
991
+ * * Transform axes from origin to targetA and targetB.
992
+ * * in local coordinates (u,v,w) the xy interior of the triangle is `u>=0, v>= 0, w>= 0, u+v+w<1`.
988
993
  * * Return undefined if transform is not invertible, e.g. if points are in a vertical plane.
989
994
  */
990
995
  fillLocalXYTriangleFrame(originIndex, targetAIndex, targetBIndex, result) {
@@ -1010,7 +1015,7 @@ class GrowableXYZArray extends IndexedXYZCollection_1.IndexedReadWriteXYZCollect
1010
1015
  /**
1011
1016
  * Pass the (x,y,z) of each point to a function which returns a replacement for one of the 3 components.
1012
1017
  * @param componentIndex Index (0,1,2) of component to be replaced.
1013
- * @param func function to be called as `func(x,y,z)`, returning a replacement value for componentIndex
1018
+ * @param func function to be called as `func(x,y,z)`, returning a replacement value for componentIndex.
1014
1019
  */
1015
1020
  mapComponent(componentIndex, func) {
1016
1021
  const n = this._data.length;