@itwin/core-geometry 5.3.0-dev.8 → 5.3.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.
Files changed (162) hide show
  1. package/CHANGELOG.md +28 -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
@@ -1 +1 @@
1
- {"version":3,"file":"IndexedXYCollection.js","sourceRoot":"","sources":["../../../src/geometry3d/IndexedXYCollection.ts"],"names":[],"mappings":"AAAA;;;+FAG+F;AAE/F;;GAEG;AAEH,OAAO,EAAE,OAAO,EAAE,QAAQ,EAAM,MAAM,mBAAmB,CAAC;AAG1D;;;;;;;;GAQG;AACH,MAAM,OAAgB,mBAAmB;IAwD/B,MAAM,CAAC,UAAU,CAAW;IAEpC;;OAEG;IACI,yBAAyB,CAAC,UAAkB;QACjD,MAAM,EAAE,GAAG,IAAI,CAAC,6BAA6B,CAAC,UAAU,EAAE,mBAAmB,CAAC,UAAU,CAAC,CAAC;QAC1F,IAAI,SAAS,KAAK,mBAAmB,CAAC,UAAU;YAC9C,mBAAmB,CAAC,UAAU,GAAG,EAAE,CAAC,CAAE,qBAAqB;QAC7D,OAAO,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC;IACzB,CAAC;IAED;;OAEG;IACI,yBAAyB,CAAC,UAAkB;QACjD,MAAM,EAAE,GAAG,IAAI,CAAC,6BAA6B,CAAC,UAAU,EAAE,mBAAmB,CAAC,UAAU,CAAC,CAAC;QAC1F,IAAI,SAAS,KAAK,mBAAmB,CAAC,UAAU;YAC9C,mBAAmB,CAAC,UAAU,GAAG,EAAE,CAAC,CAAE,qBAAqB;QAC7D,OAAO,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC;IACzB,CAAC;IAED;;;;OAIG;IACI,iBAAiB,CAAC,MAAgB,EAAE,MAA2B;QACpE,MAAM,CAAC,GAAG,IAAI,CAAC,GAAG,CAAC,IAAI,CAAC,MAAM,EAAE,MAAM,CAAC,MAAM,CAAC,CAAC;QAC/C,MAAM,GAAG,GAAG,CAAC,MAAM,YAAY,QAAQ,CAAC,CAAC,CAAC,CAAC,QAAQ,CAAC,UAAU,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,UAAU,CAAC,MAAM,CAAC,CAAC;QACpG,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,CAAC,EAAE,EAAE,CAAC,EAAE,CAAC;YAC3B,GAAG,CAAC,CAAC,IAAI,MAAM,CAAC,CAAC,CAAC,GAAG,IAAI,CAAC,yBAAyB,CAAC,CAAC,CAAC,CAAC;YACvD,GAAG,CAAC,CAAC,IAAI,MAAM,CAAC,CAAC,CAAC,GAAG,IAAI,CAAC,yBAAyB,CAAC,CAAC,CAAC,CAAC;QACzD,CAAC;QACD,OAAO,GAAG,CAAC;IACb,CAAC;CACF","sourcesContent":["/*---------------------------------------------------------------------------------------------\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n* See LICENSE.md in the project root for license terms and full copyright notice.\n*--------------------------------------------------------------------------------------------*/\n\n/** @packageDocumentation\n * @module ArraysAndInterfaces\n */\n\nimport { Point2d, Vector2d, XY } from \"./Point2dVector2d\";\nimport { XAndY } from \"./XYZProps\";\n\n/**\n * abstract base class for access to XY data with indexed reference.\n * * This allows algorithms to work with Point2d[] or GrowableXY.\n * * GrowableXYArray implements these for its data.\n * * Point2dArrayCarrier carries a (reference to) a Point2d[] and implements the methods with calls on that array reference.\n * * In addition to \"point by point\" accessors, other abstract members compute commonly useful vector data \"between points\".\n * * Methods that create vectors among multiple indices allow callers to avoid creating temporaries.\n * @public\n */\nexport abstract class IndexedXYCollection {\n /**\n * Get from `index` as a `Point2d`\n * @param index index of point within the array\n * @param result optional caller-allocated destination\n * @returns undefined if the index is out of bounds\n */\n public abstract getPoint2dAtCheckedPointIndex(index: number, result?: Point2d): Point2d | undefined;\n /**\n * Get from `index` as a `Vector2d`\n * @param index index of point within the array\n * @param result optional caller-allocated destination\n * @returns undefined if the index is out of bounds\n */\n public abstract getVector2dAtCheckedVectorIndex(index: number, result?: Vector2d): Vector2d | undefined;\n /**\n * Return a vector from the point at `indexA` to the point at `indexB`\n * @param indexA index of point within the array\n * @param indexB index of point within the array\n * @param result optional caller-allocated vector.\n * @returns undefined if either index is out of bounds\n */\n public abstract vectorIndexIndex(indexA: number, indexB: number, result?: Vector2d): Vector2d | undefined;\n /**\n * Return a vector from given origin to the point at `indexB`\n * @param origin origin for vector\n * @param indexB index of point within the array\n * @param result optional caller-allocated vector.\n * @returns undefined if index is out of bounds\n */\n public abstract vectorXAndYIndex(origin: XAndY, indexB: number, result?: Vector2d): Vector2d | undefined;\n\n /**\n * Return the cross product of vectors from `origin` to points at `indexA` and `indexB`\n * @param origin origin for vector\n * @param indexA index of first target within the array\n * @param indexB index of second target within the array\n * @param result optional caller-allocated vector.\n * @returns undefined if either index is out of bounds\n */\n public abstract crossProductXAndYIndexIndex(origin: XAndY, indexA: number, indexB: number): number | undefined;\n /**\n * Return the cross product of vectors from origin point at `indexA` to target points at `indexB` and `indexC`\n * @param origin index of origin\n * @param indexA index of first target within the array\n * @param indexB index of second target within the array\n * @param result optional caller - allocated vector.\n * @returns return true if indexA, indexB both valid\n */\n public abstract crossProductIndexIndexIndex(origin: number, indexA: number, indexB: number): number | undefined;\n\n /**\n * read-only property for number of XY in the collection.\n */\n public abstract get length(): number;\n\n private static _workPoint?: Point2d;\n\n /** access x of indexed point\n * * Subclasses may wish to override with a more efficient implementation.\n */\n public getXAtUncheckedPointIndex(pointIndex: number): number {\n const pt = this.getPoint2dAtCheckedPointIndex(pointIndex, IndexedXYCollection._workPoint);\n if (undefined === IndexedXYCollection._workPoint)\n IndexedXYCollection._workPoint = pt; // allocate the cache\n return pt ? pt.x : 0.0;\n }\n\n /** access y of indexed point\n * * Subclasses may wish to override with a more efficient implementation.\n */\n public getYAtUncheckedPointIndex(pointIndex: number): number {\n const pt = this.getPoint2dAtCheckedPointIndex(pointIndex, IndexedXYCollection._workPoint);\n if (undefined === IndexedXYCollection._workPoint)\n IndexedXYCollection._workPoint = pt; // allocate the cache\n return pt ? pt.y : 0.0;\n }\n\n /** Compute the linear combination s of the indexed p_i and given scales s_i.\n * @param scales array of scales. For best results, scales should have same length as the instance.\n * @param result optional pre-allocated object to fill and return\n * @return s = sum(p_i * s_i), where i ranges from 0 to min(this.length, scales.length).\n */\n public linearCombination(scales: number[], result?: Point2d | Vector2d): XY {\n const n = Math.min(this.length, scales.length);\n const sum = (result instanceof Vector2d) ? Vector2d.createZero(result) : Point2d.createZero(result);\n for (let i = 0; i < n; ++i) {\n sum.x += scales[i] * this.getXAtUncheckedPointIndex(i);\n sum.y += scales[i] * this.getYAtUncheckedPointIndex(i);\n }\n return sum;\n }\n}\n"]}
1
+ {"version":3,"file":"IndexedXYCollection.js","sourceRoot":"","sources":["../../../src/geometry3d/IndexedXYCollection.ts"],"names":[],"mappings":"AAAA;;;+FAG+F;AAE/F;;GAEG;AAEH,OAAO,EAAE,OAAO,EAAE,QAAQ,EAAM,MAAM,mBAAmB,CAAC;AAG1D;;;;;;;;GAQG;AACH,MAAM,OAAgB,mBAAmB;IAmD/B,MAAM,CAAC,UAAU,CAAW;IACpC;;;OAGG;IACI,yBAAyB,CAAC,UAAkB;QACjD,MAAM,EAAE,GAAG,IAAI,CAAC,6BAA6B,CAAC,UAAU,EAAE,mBAAmB,CAAC,UAAU,CAAC,CAAC;QAC1F,IAAI,SAAS,KAAK,mBAAmB,CAAC,UAAU;YAC9C,mBAAmB,CAAC,UAAU,GAAG,EAAE,CAAC,CAAE,qBAAqB;QAC7D,OAAO,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC;IACzB,CAAC;IACD;;;OAGG;IACI,yBAAyB,CAAC,UAAkB;QACjD,MAAM,EAAE,GAAG,IAAI,CAAC,6BAA6B,CAAC,UAAU,EAAE,mBAAmB,CAAC,UAAU,CAAC,CAAC;QAC1F,IAAI,SAAS,KAAK,mBAAmB,CAAC,UAAU;YAC9C,mBAAmB,CAAC,UAAU,GAAG,EAAE,CAAC,CAAE,qBAAqB;QAC7D,OAAO,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC;IACzB,CAAC;IACD;;;;;OAKG;IACI,iBAAiB,CAAC,MAAgB,EAAE,MAA2B;QACpE,MAAM,CAAC,GAAG,IAAI,CAAC,GAAG,CAAC,IAAI,CAAC,MAAM,EAAE,MAAM,CAAC,MAAM,CAAC,CAAC;QAC/C,MAAM,GAAG,GAAG,CAAC,MAAM,YAAY,QAAQ,CAAC,CAAC,CAAC,CAAC,QAAQ,CAAC,UAAU,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,UAAU,CAAC,MAAM,CAAC,CAAC;QACpG,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,CAAC,EAAE,EAAE,CAAC,EAAE,CAAC;YAC3B,GAAG,CAAC,CAAC,IAAI,MAAM,CAAC,CAAC,CAAC,GAAG,IAAI,CAAC,yBAAyB,CAAC,CAAC,CAAC,CAAC;YACvD,GAAG,CAAC,CAAC,IAAI,MAAM,CAAC,CAAC,CAAC,GAAG,IAAI,CAAC,yBAAyB,CAAC,CAAC,CAAC,CAAC;QACzD,CAAC;QACD,OAAO,GAAG,CAAC;IACb,CAAC;CACF;AAED;;;GAGG;AACH,MAAM,OAAgB,4BAA6B,SAAQ,mBAAmB;CAW7E","sourcesContent":["/*---------------------------------------------------------------------------------------------\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n* See LICENSE.md in the project root for license terms and full copyright notice.\n*--------------------------------------------------------------------------------------------*/\n\n/** @packageDocumentation\n * @module ArraysAndInterfaces\n */\n\nimport { Point2d, Vector2d, XY } from \"./Point2dVector2d\";\nimport { XAndY } from \"./XYZProps\";\n\n/**\n * Abstract base class for access to XY data with indexed reference.\n * * This allows algorithms to work with Point2d[] or GrowableXY.\n * * GrowableXYArray implements these for its data.\n * * Point2dArrayCarrier carries a (reference to) a Point2d[] and implements the methods with calls on that array reference.\n * * In addition to \"point by point\" accessors, other abstract members compute commonly useful vector data \"between points\".\n * * Methods that create vectors among multiple indices allow callers to avoid creating temporaries.\n * @public\n */\nexport abstract class IndexedXYCollection {\n /**\n * Get from `index` as a `Point2d`.\n * @param index index of point within the array.\n * @param result optional caller-allocated destination.\n * @returns undefined if the index is out of bounds.\n */\n public abstract getPoint2dAtCheckedPointIndex(index: number, result?: Point2d): Point2d | undefined;\n /**\n * Get from `index` as a `Vector2d`.\n * @param index index of point within the array.\n * @param result optional caller-allocated destination.\n * @returns undefined if the index is out of bounds.\n */\n public abstract getVector2dAtCheckedVectorIndex(index: number, result?: Vector2d): Vector2d | undefined;\n /**\n * Return a vector from the point at `indexA` to the point at `indexB`.\n * @param indexA index of point within the array.\n * @param indexB index of point within the array.\n * @param result optional caller-allocated vector.\n * @returns undefined if either index is out of bounds.\n */\n public abstract vectorIndexIndex(indexA: number, indexB: number, result?: Vector2d): Vector2d | undefined;\n /**\n * Return a vector from given origin to the point at `indexB`.\n * @param origin origin for vector.\n * @param indexB index of point within the array.\n * @param result optional caller-allocated vector.\n * @returns undefined if index is out of bounds.\n */\n public abstract vectorXAndYIndex(origin: XAndY, indexB: number, result?: Vector2d): Vector2d | undefined;\n /**\n * Return the cross product of vectors from `origin` to points at `indexA` and `indexB`.\n * @param origin origin for vector.\n * @param indexA index of first target within the array.\n * @param indexB index of second target within the array.\n * @param result optional caller-allocated vector.\n * @returns undefined if either index is out of bounds.\n */\n public abstract crossProductXAndYIndexIndex(origin: XAndY, indexA: number, indexB: number): number | undefined;\n /**\n * Return the cross product of vectors from origin point at `indexA` to target points at `indexB` and `indexC`.\n * @param origin index of origin.\n * @param indexA index of first target within the array.\n * @param indexB index of second target within the array.\n * @param result optional caller - allocated vector.\n * @returns return true if indexA, indexB both valid.\n */\n public abstract crossProductIndexIndexIndex(origin: number, indexA: number, indexB: number): number | undefined;\n /** Read-only property for number of XY in the collection. */\n public abstract get length(): number;\n private static _workPoint?: Point2d;\n /**\n * Access x of indexed point.\n * * Subclasses may wish to override with a more efficient implementation.\n */\n public getXAtUncheckedPointIndex(pointIndex: number): number {\n const pt = this.getPoint2dAtCheckedPointIndex(pointIndex, IndexedXYCollection._workPoint);\n if (undefined === IndexedXYCollection._workPoint)\n IndexedXYCollection._workPoint = pt; // allocate the cache\n return pt ? pt.x : 0.0;\n }\n /**\n * Access y of indexed point.\n * * Subclasses may wish to override with a more efficient implementation.\n */\n public getYAtUncheckedPointIndex(pointIndex: number): number {\n const pt = this.getPoint2dAtCheckedPointIndex(pointIndex, IndexedXYCollection._workPoint);\n if (undefined === IndexedXYCollection._workPoint)\n IndexedXYCollection._workPoint = pt; // allocate the cache\n return pt ? pt.y : 0.0;\n }\n /**\n * Compute the linear combination s of the indexed p_i and given scales s_i.\n * @param scales array of scales. For best results, scales should have same length as the instance.\n * @param result optional pre-allocated object to fill and return.\n * @return s = sum(p_i * s_i), where i ranges from 0 to min(this.length, scales.length).\n */\n public linearCombination(scales: number[], result?: Point2d | Vector2d): XY {\n const n = Math.min(this.length, scales.length);\n const sum = (result instanceof Vector2d) ? Vector2d.createZero(result) : Point2d.createZero(result);\n for (let i = 0; i < n; ++i) {\n sum.x += scales[i] * this.getXAtUncheckedPointIndex(i);\n sum.y += scales[i] * this.getYAtUncheckedPointIndex(i);\n }\n return sum;\n }\n}\n\n/**\n * Abstract base class extends [[IndexedXYCollection]] with methods that modify the collection.\n * @public\n */\nexport abstract class IndexedReadWriteXYCollection extends IndexedXYCollection {\n /** Push a (clone of) point onto the collection. */\n public abstract push(point: XAndY): void;\n /** Push a new point (given by xy coordinates) onto the collection. */\n public abstract pushXY(x?: number, y?: number): void;\n /** Remove the final point. */\n public abstract pop(): void;\n /** Remove all entries. */\n public abstract clear(): void;\n /** Reverse the points in place. */\n public abstract reverseInPlace(): void;\n}\n"]}
@@ -14,121 +14,119 @@ import { XAndY, XYAndZ } from "./XYZProps";
14
14
  export declare abstract class IndexedXYZCollection {
15
15
  /**
16
16
  * Return the point at `index` as a strongly typed Point3d.
17
- * @param index index of point within the array
18
- * @param result caller-allocated destination
19
- * @returns undefined if the index is out of bounds
17
+ * @param index index of point within the array.
18
+ * @param result caller-allocated destination.
19
+ * @returns undefined if the index is out of bounds.
20
20
  */
21
21
  abstract getPoint3dAtCheckedPointIndex(index: number, result?: Point3d): Point3d | undefined;
22
22
  /**
23
23
  * Return the point at `index` as a strongly typed Point3d, without checking the point index validity.
24
- * @param index index of point within the array
25
- * @param result caller-allocated destination
26
- * @returns undefined if the index is out of bounds
24
+ * @param index index of point within the array.
25
+ * @param result caller-allocated destination.
26
+ * @returns undefined if the index is out of bounds.
27
27
  */
28
28
  abstract getPoint3dAtUncheckedPointIndex(index: number, result?: Point3d): Point3d;
29
29
  /**
30
30
  * Get from `index` as a strongly typed Vector3d.
31
- * @param index index of point within the array
32
- * @param result caller-allocated destination
33
- * @returns undefined if the index is out of bounds
31
+ * @param index index of point within the array.
32
+ * @param result caller-allocated destination.
33
+ * @returns undefined if the index is out of bounds.
34
34
  */
35
35
  abstract getVector3dAtCheckedVectorIndex(index: number, result?: Vector3d): Vector3d | undefined;
36
36
  /**
37
- * Return a vector from the point at `indexA` to the point at `indexB`
38
- * @param indexA index of point within the array
39
- * @param indexB index of point within the array
37
+ * Return a vector from the point at `indexA` to the point at `indexB`.
38
+ * @param indexA index of point within the array.
39
+ * @param indexB index of point within the array.
40
40
  * @param result caller-allocated vector.
41
- * @returns undefined if either index is out of bounds
41
+ * @returns undefined if either index is out of bounds.
42
42
  */
43
43
  abstract vectorIndexIndex(indexA: number, indexB: number, result?: Vector3d): Vector3d | undefined;
44
44
  /**
45
- * Return a vector from `origin` to the point at `indexB`
46
- * @param origin origin for vector
47
- * @param indexB index of point within the array
45
+ * Return a vector from `origin` to the point at `indexB`.
46
+ * @param origin origin for vector.
47
+ * @param indexB index of point within the array.
48
48
  * @param result caller-allocated vector.
49
- * @returns undefined if index is out of bounds
49
+ * @returns undefined if index is out of bounds.
50
50
  */
51
51
  abstract vectorXYAndZIndex(origin: XYAndZ, indexB: number, result?: Vector3d): Vector3d | undefined;
52
52
  /**
53
- * Return a vector from the point at `indexA` to `target`
54
- * @param indexA index of point within the array
55
- * @param target target for vector
53
+ * Return a vector from the point at `indexA` to `target`.
54
+ * @param indexA index of point within the array.
55
+ * @param target target for vector.
56
56
  * @param result caller-allocated vector.
57
- * @returns undefined if index is out of bounds
57
+ * @returns undefined if index is out of bounds.
58
58
  */
59
59
  vectorIndexXYAndZ(indexA: number, target: XYAndZ, result?: Vector3d): Vector3d | undefined;
60
60
  /**
61
61
  * Return the dot product of the vectors from the point at `origin` to the points at `indexA` and `indexB`.
62
- * @param origin index of point within the array; origin of both vectors
63
- * @param indexA index of point within the array; target of the first vector
64
- * @param indexA index of point within the array; target of the second vector
65
- * @returns undefined if index is out of bounds
62
+ * @param origin index of point within the array; origin of both vectors.
63
+ * @param indexA index of point within the array; target of the first vector.
64
+ * @param indexB index of point within the array; target of the second vector.
65
+ * @returns undefined if index is out of bounds.
66
66
  */
67
67
  dotProductIndexIndexIndex(origin: number, indexA: number, indexB: number): number | undefined;
68
68
  /**
69
69
  * Return the dot product of the vectors from the point at `origin` to the point at `indexA` and to `targetB`.
70
- * @param origin index of point within the array; origin of both vectors
71
- * @param indexA index of point within the array; target of the first vector
72
- * @param targetB target for second vector
73
- * @returns undefined if index is out of bounds
70
+ * @param origin index of point within the array; origin of both vectors.
71
+ * @param indexA index of point within the array; target of the first vector.
72
+ * @param targetB target for second vector.
73
+ * @returns undefined if index is out of bounds.
74
74
  */
75
75
  dotProductIndexIndexXYAndZ(origin: number, indexA: number, targetB: XYAndZ): number | undefined;
76
76
  /**
77
- * Return the cross product of the vectors from `origin` to points at `indexA` and `indexB`
78
- * @param origin origin for vector
79
- * @param indexA index of first target within the array
80
- * @param indexB index of second target within the array
77
+ * Return the cross product of the vectors from `origin` to points at `indexA` and `indexB`.
78
+ * @param origin origin for vector.
79
+ * @param indexA index of first target within the array.
80
+ * @param indexB index of second target within the array.
81
81
  * @param result caller-allocated vector.
82
- * @returns undefined if either index is out of bounds
82
+ * @returns undefined if either index is out of bounds.
83
83
  */
84
84
  abstract crossProductXYAndZIndexIndex(origin: XYAndZ, indexA: number, indexB: number, result?: Vector3d): Vector3d | undefined;
85
85
  /**
86
- * Return the cross product of the vectors from `origin` to the point at `indexA` and to `targetB`
87
- * @param origin index of point within the array; origin of both vectors
88
- * @param indexA index of point within the array; target of the first vector
89
- * @param targetB target of second vector
90
- * @param result optional caller-allocated result to fill and return
91
- * @returns undefined if an index is out of bounds
86
+ * Return the cross product of the vectors from `origin` to the point at `indexA` and to `targetB`.
87
+ * @param origin index of point within the array; origin of both vectors.
88
+ * @param indexA index of point within the array; target of the first vector.
89
+ * @param targetB target of second vector.
90
+ * @param result optional caller-allocated result to fill and return.
91
+ * @returns undefined if an index is out of bounds.
92
92
  */
93
93
  crossProductIndexIndexXYAndZ(origin: number, indexA: number, targetB: XYAndZ, result?: Vector3d): Vector3d | undefined;
94
94
  /**
95
- * Return the cross product of vectors from `origin` to points at `indexA` and `indexB`
96
- * @param origin origin for vector
97
- * @param indexA index of first target within the array
98
- * @param indexB index of second target within the array
95
+ * Return the cross product of vectors from `origin` to points at `indexA` and `indexB`.
96
+ * @param origin origin for vector.
97
+ * @param indexA index of first target within the array.
98
+ * @param indexB index of second target within the array.
99
99
  * @param result optional caller-allocated vector.
100
- * @returns undefined if either index is out of bounds
100
+ * @returns undefined if either index is out of bounds.
101
101
  */
102
102
  abstract crossProductIndexIndexIndex(origin: number, indexA: number, indexB: number, result?: Vector3d): Vector3d | undefined;
103
103
  /**
104
- * Return the cross product of vectors from origin point at `indexA` to target points at `indexB` and `indexC`
105
- * @param origin index of origin
106
- * @param indexA index of first target within the array
107
- * @param indexB index of second target within the array
104
+ * Return the cross product of vectors from origin point at `indexA` to target points at `indexB` and `indexC`.
105
+ * @param origin index of origin.
106
+ * @param indexA index of first target within the array.
107
+ * @param indexB index of second target within the array.
108
108
  * @param result caller-allocated vector.
109
- * @returns return true if indexA, indexB both valid
109
+ * @returns return true if indexA, indexB both valid.
110
110
  */
111
111
  abstract accumulateCrossProductIndexIndexIndex(origin: number, indexA: number, indexB: number, result: Vector3d): void;
112
- /**
113
- * read-only property for number of XYZ in the collection.
114
- */
112
+ /** Read-only property for number of XYZ in the collection. */
115
113
  abstract get length(): number;
116
114
  /**
117
115
  * Return distance squared between indicated points.
118
- * @param index0 first point index
119
- * @param index1 second point index
116
+ * @param index0 first point index.
117
+ * @param index1 second point index.
120
118
  */
121
119
  abstract distanceSquaredIndexIndex(index0: number, index1: number): number | undefined;
122
120
  /**
123
121
  * Return distance squared between the point at index0 and target.
124
- * @param index0 first point index
125
- * @param target second point
122
+ * @param index0 first point index.
123
+ * @param target second point.
126
124
  */
127
125
  distanceSquaredIndexXYAndZ(index0: number, target: XYAndZ): number | undefined;
128
126
  /**
129
127
  * Return distance between indicated points.
130
- * @param index0 first point index
131
- * @param index1 second point index
128
+ * @param index0 first point index.
129
+ * @param index1 second point index.
132
130
  */
133
131
  abstract distanceIndexIndex(index0: number, index1: number): number | undefined;
134
132
  /**
@@ -144,18 +142,20 @@ export declare abstract class IndexedXYZCollection {
144
142
  * For each subset of `k` successive points within tolerance of the first point in the subset, return the indices of
145
143
  * the last `k-1` duplicates.
146
144
  * * Index `0` is never returned.
147
- * @param tolerance optional distance tol for compression (default [[Geometry.smallMetricDistance]])
145
+ * @param tolerance optional distance tol for compression (default [[Geometry.smallMetricDistance]]).
148
146
  * @param preserveLast if the last `k < this.length` points of the instance are duplicates, whether to return the
149
- * indices of the *first* `k-1` duplicates for this last run. If true, index `this.length - 1` is not returned
147
+ * indices of the *first* `k-1` duplicates for this last run. If true, index `this.length - 1` is not returned.
150
148
  * unless all points are duplicates, in which case all indices but `0` are returned. Default value is false.
151
149
  * @return ordered array of 0-based indices of duplicate points
152
150
  */
153
151
  findOrderedDuplicates(tolerance?: number, preserveLast?: boolean): number[];
154
- /** Accumulate scale times the x,y,z values at index.
152
+ /**
153
+ * Accumulate scale times the x,y,z values at index.
155
154
  * * No action if index is out of bounds.
156
155
  */
157
156
  abstract accumulateScaledXYZ(index: number, scale: number, sum: Point3d): void;
158
- /** Compute the linear combination s of the indexed p_i and given scales s_i.
157
+ /**
158
+ * Compute the linear combination s of the indexed p_i and given scales s_i.
159
159
  * @param scales array of scales. For best results, scales should have same length as the instance.
160
160
  * @param result optional pre-allocated object to fill and return
161
161
  * @return s = sum(p_i * s_i), where i ranges from 0 to min(this.length, scales.length).
@@ -163,26 +163,27 @@ export declare abstract class IndexedXYZCollection {
163
163
  linearCombination(scales: number[], result?: Point3d | Vector3d): XYZ;
164
164
  /**
165
165
  * Interpolate the points at the given indices.
166
- * @param index0 index of point p0 within the array
167
- * @param fraction fraction f such that returned point is p0 + f * (p1 - p0)
168
- * @param index1 index of point p1 within the array
169
- * @param result optional caller-allocated result to fill and return
170
- * @returns undefined if an index is out of bounds
166
+ * @param index0 index of point p0 within the array.
167
+ * @param fraction fraction f such that returned point is p0 + f * (p1 - p0).
168
+ * @param index1 index of point p1 within the array.
169
+ * @param result optional caller-allocated result to fill and return.
170
+ * @returns undefined if an index is out of bounds.
171
171
  */
172
172
  interpolateIndexIndex(index0: number, fraction: number, index1: number, result?: Point3d): Point3d | undefined;
173
- /** access x of indexed point */
173
+ /** Access x of indexed point. */
174
174
  abstract getXAtUncheckedPointIndex(pointIndex: number): number;
175
- /** access y of indexed point */
175
+ /** Access y of indexed point. */
176
176
  abstract getYAtUncheckedPointIndex(pointIndex: number): number;
177
- /** access z of indexed point */
177
+ /** Access z of indexed point. */
178
178
  abstract getZAtUncheckedPointIndex(pointIndex: number): number;
179
- /** Return iterator over the points in this collection. Usage:
179
+ /**
180
+ * Return iterator over the points in this collection. Usage:
180
181
  * ```ts
181
182
  * for (const point: Point3d of collection.points) { ... }
182
183
  * ```
183
184
  */
184
185
  get points(): Iterable<Point3d>;
185
- /** convert to Point3d[] */
186
+ /** Convert to Point3d[]. */
186
187
  getArray(): Point3d[];
187
188
  /** Return the first point, or undefined if the array is empty. */
188
189
  front(result?: Point3d): Point3d | undefined;
@@ -190,16 +191,16 @@ export declare abstract class IndexedXYZCollection {
190
191
  back(result?: Point3d): Point3d | undefined;
191
192
  /**
192
193
  * Test whether the indexed points are equal within tolerance.
193
- * @param index0 index of first point
194
- * @param index1 index of second point
194
+ * @param index0 index of first point.
195
+ * @param index1 index of second point.
195
196
  * @param tolerance max coordinate difference to be considered equal. For exact test, pass 0. Defaults to `Geometry.smallMetricDistance`.
196
197
  * @returns whether the points are equal within tolerance, or `undefined` if either index is invalid.
197
198
  */
198
199
  almostEqualIndexIndex(index0: number, index1: number, tolerance?: number): boolean | undefined;
199
200
  /**
200
201
  * Test whether the xy-coordinates of the indexed points are equal within tolerance. The z-coordinates are ignored.
201
- * @param index0 index of first point
202
- * @param index1 index of second point
202
+ * @param index0 index of first point.
203
+ * @param index1 index of second point.
203
204
  * @param tolerance max coordinate difference to be considered equal. For exact test, pass 0. Defaults to `Geometry.smallMetricDistance`.
204
205
  * @returns whether the xy-coordinates of the points are equal within tolerance, or `undefined` if either index is invalid.
205
206
  */
@@ -1 +1 @@
1
- {"version":3,"file":"IndexedXYZCollection.d.ts","sourceRoot":"","sources":["../../../src/geometry3d/IndexedXYZCollection.ts"],"names":[],"mappings":"AAUA,OAAO,EAAE,OAAO,EAAE,QAAQ,EAAE,GAAG,EAAE,MAAM,mBAAmB,CAAC;AAC3D,OAAO,EAAE,OAAO,EAAE,MAAM,SAAS,CAAC;AAClC,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AACxC,OAAO,EAAE,KAAK,EAAE,MAAM,EAAE,MAAM,YAAY,CAAC;AAwB3C;;;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IAM5B,kEAAkE;IAC3D,KAAK,CAAC,MAAM,CAAC,EAAE,OAAO,GAAG,OAAO,GAAG,SAAS;IAKnD,iEAAiE;IAC1D,IAAI,CAAC,MAAM,CAAC,EAAE,OAAO,GAAG,OAAO,GAAG,SAAS;IAKlD;;;;;;OAMG;IACI,qBAAqB,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,SAAS,SAA+B,GAAG,OAAO,GAAG,SAAS;IAO3H;;;;;;OAMG;IACI,uBAAuB,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,SAAS,SAA+B,GAAG,OAAO,GAAG,SAAS;CAM9H;AAED;;;GAGG;AACH,8BAAsB,6BAA8B,SAAQ,oBAAoB;IAC9E,mDAAmD;aACnC,IAAI,CAAC,KAAK,EAAE,MAAM,GAAG,IAAI;IACzC,uEAAuE;aACvD,OAAO,CAAC,CAAC,CAAC,EAAE,MAAM,EAAE,CAAC,CAAC,EAAE,MAAM,EAAE,CAAC,CAAC,EAAE,MAAM,GAAG,IAAI;IACjE,8BAA8B;aACd,GAAG,IAAI,IAAI;IAC3B,0BAA0B;aACV,KAAK,IAAI,IAAI;IAC7B,mCAAmC;aACnB,cAAc,IAAI,IAAI;CACvC;AAED;;;GAGG;AACH,MAAM,MAAM,qBAAqB,GAAG,oBAAoB,GAAG,MAAM,EAAE,GAAG,KAAK,EAAE,GAAG,MAAM,EAAE,EAAE,CAAC;AAE3F;;;GAGG;AACH,MAAM,MAAM,0BAA0B,GAAG,qBAAqB,GAAG,qBAAqB,EAAE,CAAC"}
@@ -16,7 +16,8 @@ class PointsIterator {
16
16
  }
17
17
  next() {
18
18
  if (++this._curIndex >= this._collection.length) {
19
- // The ECMAScript spec states that value=undefined is valid if done=true. The TypeScript interface violates the spec hence the cast to any and back below.
19
+ // the ECMAScript spec states that value=undefined is valid if done=true
20
+ // the TypeScript interface violates the spec hence the cast to any and back below
20
21
  return { done: true };
21
22
  }
22
23
  return {
@@ -37,11 +38,11 @@ class PointsIterator {
37
38
  */
38
39
  export class IndexedXYZCollection {
39
40
  /**
40
- * Return a vector from the point at `indexA` to `target`
41
- * @param indexA index of point within the array
42
- * @param target target for vector
41
+ * Return a vector from the point at `indexA` to `target`.
42
+ * @param indexA index of point within the array.
43
+ * @param target target for vector.
43
44
  * @param result caller-allocated vector.
44
- * @returns undefined if index is out of bounds
45
+ * @returns undefined if index is out of bounds.
45
46
  */
46
47
  vectorIndexXYAndZ(indexA, target, result) {
47
48
  const reversed = this.vectorXYAndZIndex(target, indexA, result);
@@ -49,10 +50,10 @@ export class IndexedXYZCollection {
49
50
  }
50
51
  /**
51
52
  * Return the dot product of the vectors from the point at `origin` to the points at `indexA` and `indexB`.
52
- * @param origin index of point within the array; origin of both vectors
53
- * @param indexA index of point within the array; target of the first vector
54
- * @param indexA index of point within the array; target of the second vector
55
- * @returns undefined if index is out of bounds
53
+ * @param origin index of point within the array; origin of both vectors.
54
+ * @param indexA index of point within the array; target of the first vector.
55
+ * @param indexB index of point within the array; target of the second vector.
56
+ * @returns undefined if index is out of bounds.
56
57
  */
57
58
  dotProductIndexIndexIndex(origin, indexA, indexB) {
58
59
  if (origin < 0 || origin >= this.length || indexA < 0 || indexA >= this.length || indexB < 0 || indexB >= this.length)
@@ -66,10 +67,10 @@ export class IndexedXYZCollection {
66
67
  }
67
68
  /**
68
69
  * Return the dot product of the vectors from the point at `origin` to the point at `indexA` and to `targetB`.
69
- * @param origin index of point within the array; origin of both vectors
70
- * @param indexA index of point within the array; target of the first vector
71
- * @param targetB target for second vector
72
- * @returns undefined if index is out of bounds
70
+ * @param origin index of point within the array; origin of both vectors.
71
+ * @param indexA index of point within the array; target of the first vector.
72
+ * @param targetB target for second vector.
73
+ * @returns undefined if index is out of bounds.
73
74
  */
74
75
  dotProductIndexIndexXYAndZ(origin, indexA, targetB) {
75
76
  if (origin < 0 || origin >= this.length || indexA < 0 || indexA >= this.length)
@@ -82,12 +83,12 @@ export class IndexedXYZCollection {
82
83
  (this.getZAtUncheckedPointIndex(indexA) - z0) * (targetB.z - z0);
83
84
  }
84
85
  /**
85
- * Return the cross product of the vectors from `origin` to the point at `indexA` and to `targetB`
86
- * @param origin index of point within the array; origin of both vectors
87
- * @param indexA index of point within the array; target of the first vector
88
- * @param targetB target of second vector
89
- * @param result optional caller-allocated result to fill and return
90
- * @returns undefined if an index is out of bounds
86
+ * Return the cross product of the vectors from `origin` to the point at `indexA` and to `targetB`.
87
+ * @param origin index of point within the array; origin of both vectors.
88
+ * @param indexA index of point within the array; target of the first vector.
89
+ * @param targetB target of second vector.
90
+ * @param result optional caller-allocated result to fill and return.
91
+ * @returns undefined if an index is out of bounds.
91
92
  */
92
93
  crossProductIndexIndexXYAndZ(origin, indexA, targetB, result) {
93
94
  if (origin < 0 || origin >= this.length || indexA < 0 || indexA >= this.length)
@@ -99,8 +100,8 @@ export class IndexedXYZCollection {
99
100
  }
100
101
  /**
101
102
  * Return distance squared between the point at index0 and target.
102
- * @param index0 first point index
103
- * @param target second point
103
+ * @param index0 first point index.
104
+ * @param target second point.
104
105
  */
105
106
  distanceSquaredIndexXYAndZ(index0, target) {
106
107
  if (index0 < 0 || index0 >= this.length)
@@ -137,9 +138,9 @@ export class IndexedXYZCollection {
137
138
  * For each subset of `k` successive points within tolerance of the first point in the subset, return the indices of
138
139
  * the last `k-1` duplicates.
139
140
  * * Index `0` is never returned.
140
- * @param tolerance optional distance tol for compression (default [[Geometry.smallMetricDistance]])
141
+ * @param tolerance optional distance tol for compression (default [[Geometry.smallMetricDistance]]).
141
142
  * @param preserveLast if the last `k < this.length` points of the instance are duplicates, whether to return the
142
- * indices of the *first* `k-1` duplicates for this last run. If true, index `this.length - 1` is not returned
143
+ * indices of the *first* `k-1` duplicates for this last run. If true, index `this.length - 1` is not returned.
143
144
  * unless all points are duplicates, in which case all indices but `0` are returned. Default value is false.
144
145
  * @return ordered array of 0-based indices of duplicate points
145
146
  */
@@ -162,7 +163,8 @@ export class IndexedXYZCollection {
162
163
  }
163
164
  return indices;
164
165
  }
165
- /** Compute the linear combination s of the indexed p_i and given scales s_i.
166
+ /**
167
+ * Compute the linear combination s of the indexed p_i and given scales s_i.
166
168
  * @param scales array of scales. For best results, scales should have same length as the instance.
167
169
  * @param result optional pre-allocated object to fill and return
168
170
  * @return s = sum(p_i * s_i), where i ranges from 0 to min(this.length, scales.length).
@@ -179,18 +181,19 @@ export class IndexedXYZCollection {
179
181
  }
180
182
  /**
181
183
  * Interpolate the points at the given indices.
182
- * @param index0 index of point p0 within the array
183
- * @param fraction fraction f such that returned point is p0 + f * (p1 - p0)
184
- * @param index1 index of point p1 within the array
185
- * @param result optional caller-allocated result to fill and return
186
- * @returns undefined if an index is out of bounds
184
+ * @param index0 index of point p0 within the array.
185
+ * @param fraction fraction f such that returned point is p0 + f * (p1 - p0).
186
+ * @param index1 index of point p1 within the array.
187
+ * @param result optional caller-allocated result to fill and return.
188
+ * @returns undefined if an index is out of bounds.
187
189
  */
188
190
  interpolateIndexIndex(index0, fraction, index1, result) {
189
191
  if (index0 < 0 || index0 >= this.length || index1 < 0 || index1 >= this.length)
190
192
  return undefined;
191
193
  return Point3d.create(Geometry.interpolate(this.getXAtUncheckedPointIndex(index0), fraction, this.getXAtUncheckedPointIndex(index1)), Geometry.interpolate(this.getYAtUncheckedPointIndex(index0), fraction, this.getYAtUncheckedPointIndex(index1)), Geometry.interpolate(this.getZAtUncheckedPointIndex(index0), fraction, this.getZAtUncheckedPointIndex(index1)), result);
192
194
  }
193
- /** Return iterator over the points in this collection. Usage:
195
+ /**
196
+ * Return iterator over the points in this collection. Usage:
194
197
  * ```ts
195
198
  * for (const point: Point3d of collection.points) { ... }
196
199
  * ```
@@ -198,7 +201,7 @@ export class IndexedXYZCollection {
198
201
  get points() {
199
202
  return new PointsIterator(this);
200
203
  }
201
- /** convert to Point3d[] */
204
+ /** Convert to Point3d[]. */
202
205
  getArray() {
203
206
  const result = [];
204
207
  for (const p of this.points)
@@ -219,8 +222,8 @@ export class IndexedXYZCollection {
219
222
  }
220
223
  /**
221
224
  * Test whether the indexed points are equal within tolerance.
222
- * @param index0 index of first point
223
- * @param index1 index of second point
225
+ * @param index0 index of first point.
226
+ * @param index1 index of second point.
224
227
  * @param tolerance max coordinate difference to be considered equal. For exact test, pass 0. Defaults to `Geometry.smallMetricDistance`.
225
228
  * @returns whether the points are equal within tolerance, or `undefined` if either index is invalid.
226
229
  */
@@ -233,8 +236,8 @@ export class IndexedXYZCollection {
233
236
  }
234
237
  /**
235
238
  * Test whether the xy-coordinates of the indexed points are equal within tolerance. The z-coordinates are ignored.
236
- * @param index0 index of first point
237
- * @param index1 index of second point
239
+ * @param index0 index of first point.
240
+ * @param index1 index of second point.
238
241
  * @param tolerance max coordinate difference to be considered equal. For exact test, pass 0. Defaults to `Geometry.smallMetricDistance`.
239
242
  * @returns whether the xy-coordinates of the points are equal within tolerance, or `undefined` if either index is invalid.
240
243
  */
@@ -1 +1 @@
1
- {"version":3,"file":"IndexedXYZCollection.js","sourceRoot":"","sources":["../../../src/geometry3d/IndexedXYZCollection.ts"],"names":[],"mappings":"AAAA;;;+FAG+F;AAE/F;;GAEG;AAEH,OAAO,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AACvC,OAAO,EAAE,OAAO,EAAE,QAAQ,EAAO,MAAM,mBAAmB,CAAC;AAC3D,OAAO,EAAE,OAAO,EAAE,MAAM,SAAS,CAAC;AAIlC,MAAM,cAAc;IACD,WAAW,CAAuB;IAC3C,SAAS,GAAG,CAAC,CAAC,CAAC;IAEvB,YAAmB,UAAgC;QACjD,IAAI,CAAC,WAAW,GAAG,UAAU,CAAC;IAChC,CAAC;IAEM,IAAI;QACT,IAAI,EAAE,IAAI,CAAC,SAAS,IAAI,IAAI,CAAC,WAAW,CAAC,MAAM,EAAE,CAAC;YAChD,0JAA0J;YAC1J,OAAO,EAAE,IAAI,EAAE,IAAI,EAAoC,CAAC;QAC1D,CAAC;QAED,OAAO;YACL,KAAK,EAAE,I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CAAC,EAAE,IAAI,CAAC,yBAAyB,CAAC,MAAM,CAAC,EAAE,SAAS,CAAC,CAAC;IAC5H,CAAC;CACF;AACD;;;GAGG;AACH,MAAM,OAAgB,6BAA8B,SAAQ,oBAAoB;CAW/E","sourcesContent":["/*---------------------------------------------------------------------------------------------\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n* See LICENSE.md in the project root for license terms and full copyright notice.\n*--------------------------------------------------------------------------------------------*/\n\n/** @packageDocumentation\n * @module ArraysAndInterfaces\n */\n\nimport { Geometry } from \"../Geometry\";\nimport { Point3d, Vector3d, XYZ } from \"./Point3dVector3d\";\nimport { Range3d } from \"./Range\";\nimport { Transform } from \"./Transform\";\nimport { XAndY, XYAndZ } from \"./XYZProps\";\n\nclass PointsIterator implements Iterator<Point3d>, Iterable<Point3d> {\n private readonly _collection: IndexedXYZCollection;\n private _curIndex = -1;\n\n public constructor(collection: IndexedXYZCollection) {\n this._collection = collection;\n }\n\n public next(): IteratorResult<Point3d> {\n if (++this._curIndex >= this._collection.length) {\n // The ECMAScript spec states that value=undefined is valid if done=true. The TypeScript interface violates the spec hence the cast to any and back below.\n return { done: true } as any as IteratorResult<Point3d>;\n }\n\n return {\n value: this._collection.getPoint3dAtUncheckedPointIndex(this._curIndex),\n done: false,\n };\n }\n\n public [Symbol.iterator](): Iterator<Point3d> { return this; }\n}\n/**\n * Abstract base class for read-only access to XYZ data with indexed reference.\n * * This allows algorithms to work with Point3d[] or [[GrowableXYZArray]].\n * * GrowableXYZArray implements these for its data.\n * * Point3dArrayCarrier carries a (reference to) a Point3d[] and implements the methods with calls on that array reference.\n * * In addition to \"point by point\" accessors, other abstract members compute commonly useful vector data \"between points\".\n * * Methods that create vectors among multiple indices allow callers to avoid creating temporaries.\n * @public\n */\nexport abstract class IndexedXYZCollection {\n /**\n * Return the point at `index` as a strongly typed Point3d.\n * @param index index of point within the array\n * @param result caller-allocated destination\n * @returns undefined if the index is out of bounds\n */\n public abstract getPoint3dAtCheckedPointIndex(index: number, result?: Point3d): Point3d | undefined;\n /**\n * Return the point at `index` as a strongly typed Point3d, without checking the point index validity.\n * @param index index of point within the array\n * @param result caller-allocated destination\n * @returns undefined if the index is out of bounds\n */\n public abstract getPoint3dAtUncheckedPointIndex(index: number, result?: Point3d): Point3d;\n /**\n * Get from `index` as a strongly typed Vector3d.\n * @param index index of point within the array\n * @param result caller-allocated destination\n * @returns undefined if the index is out of bounds\n */\n public abstract getVector3dAtCheckedVectorIndex(index: number, result?: Vector3d): Vector3d | undefined;\n /**\n * Return a vector from the point at `indexA` to the point at `indexB`\n * @param indexA index of point within the array\n * @param indexB index of point within the array\n * @param result caller-allocated vector.\n * @returns undefined if either index is out of bounds\n */\n public abstract vectorIndexIndex(indexA: number, indexB: number, result?: Vector3d): Vector3d | undefined;\n /**\n * Return a vector from `origin` to the point at `indexB`\n * @param origin origin for vector\n * @param indexB index of point within the array\n * @param result caller-allocated vector.\n * @returns undefined if index is out of bounds\n */\n public abstract vectorXYAndZIndex(origin: XYAndZ, indexB: number, result?: Vector3d): Vector3d | undefined;\n /**\n * Return a vector from the point at `indexA` to `target`\n * @param indexA index of point within the array\n * @param target target for vector\n * @param result caller-allocated vector.\n * @returns undefined if index is out of bounds\n */\n public vectorIndexXYAndZ(indexA: number, target: XYAndZ, result?: Vector3d): Vector3d | undefined {\n const reversed = this.vectorXYAndZIndex(target, indexA, result);\n return reversed?.negate(reversed);\n }\n /**\n * Return the dot product of the vectors from the point at `origin` to the points at `indexA` and `indexB`.\n * @param origin index of point within the array; origin of both vectors\n * @param indexA index of point within the array; target of the first vector\n * @param indexA index of point within the array; target of the second vector\n * @returns undefined if index is out of bounds\n */\n public dotProductIndexIndexIndex(origin: number, indexA: number, indexB: number): number | undefined {\n if (origin < 0 || origin >= this.length || indexA < 0 || indexA >= this.length || indexB < 0 || indexB >= this.length)\n return undefined;\n const x0 = this.getXAtUncheckedPointIndex(origin);\n const y0 = this.getYAtUncheckedPointIndex(origin);\n const z0 = this.getZAtUncheckedPointIndex(origin);\n return (this.getXAtUncheckedPointIndex(indexA) - x0) * (this.getXAtUncheckedPointIndex(indexB) - x0) +\n (this.getYAtUncheckedPointIndex(indexA) - y0) * (this.getYAtUncheckedPointIndex(indexB) - y0) +\n (this.getZAtUncheckedPointIndex(indexA) - z0) * (this.getZAtUncheckedPointIndex(indexB) - z0);\n }\n /**\n * Return the dot product of the vectors from the point at `origin` to the point at `indexA` and to `targetB`.\n * @param origin index of point within the array; origin of both vectors\n * @param indexA index of point within the array; target of the first vector\n * @param targetB target for second vector\n * @returns undefined if index is out of bounds\n */\n public dotProductIndexIndexXYAndZ(origin: number, indexA: number, targetB: XYAndZ): number | undefined {\n if (origin < 0 || origin >= this.length || indexA < 0 || indexA >= this.length)\n return undefined;\n const x0 = this.getXAtUncheckedPointIndex(origin);\n const y0 = this.getYAtUncheckedPointIndex(origin);\n const z0 = this.getZAtUncheckedPointIndex(origin);\n return (this.getXAtUncheckedPointIndex(indexA) - x0) * (targetB.x - x0) +\n (this.getYAtUncheckedPointIndex(indexA) - y0) * (targetB.y - y0) +\n (this.getZAtUncheckedPointIndex(indexA) - z0) * (targetB.z - z0);\n }\n /**\n * Return the cross product of the vectors from `origin` to points at `indexA` and `indexB`\n * @param origin origin for vector\n * @param indexA index of first target within the array\n * @param indexB index of second target within the array\n * @param result caller-allocated vector.\n * @returns undefined if either index is out of bounds\n */\n public abstract crossProductXYAndZIndexIndex(origin: XYAndZ, indexA: number, indexB: number, result?: Vector3d): Vector3d | undefined;\n /**\n * Return the cross product of the vectors from `origin` to the point at `indexA` and to `targetB`\n * @param origin index of point within the array; origin of both vectors\n * @param indexA index of point within the array; target of the first vector\n * @param targetB target of second vector\n * @param result optional caller-allocated result to fill and return\n * @returns undefined if an index is out of bounds\n */\n public crossProductIndexIndexXYAndZ(origin: number, indexA: number, targetB: XYAndZ, result?: Vector3d): Vector3d | undefined {\n if (origin < 0 || origin >= this.length || indexA < 0 || indexA >= this.length)\n return undefined;\n const x0 = this.getXAtUncheckedPointIndex(origin);\n const y0 = this.getYAtUncheckedPointIndex(origin);\n const z0 = this.getZAtUncheckedPointIndex(origin);\n return Vector3d.createCrossProduct(this.getXAtUncheckedPointIndex(indexA) - x0,\n this.getYAtUncheckedPointIndex(indexA) - y0,\n this.getZAtUncheckedPointIndex(indexA) - z0,\n targetB.x - x0,\n targetB.y - y0,\n targetB.z - z0, result);\n }\n /**\n * Return the cross product of vectors from `origin` to points at `indexA` and `indexB`\n * @param origin origin for vector\n * @param indexA index of first target within the array\n * @param indexB index of second target within the array\n * @param result optional caller-allocated vector.\n * @returns undefined if either index is out of bounds\n */\n public abstract crossProductIndexIndexIndex(origin: number, indexA: number, indexB: number, result?: Vector3d): Vector3d | undefined;\n /**\n * Return the cross product of vectors from origin point at `indexA` to target points at `indexB` and `indexC`\n * @param origin index of origin\n * @param indexA index of first target within the array\n * @param indexB index of second target within the array\n * @param result caller-allocated vector.\n * @returns return true if indexA, indexB both valid\n */\n public abstract accumulateCrossProductIndexIndexIndex(origin: number, indexA: number, indexB: number, result: Vector3d): void;\n\n /**\n * read-only property for number of XYZ in the collection.\n */\n public abstract get length(): number;\n /**\n * Return distance squared between indicated points.\n * @param index0 first point index\n * @param index1 second point index\n */\n public abstract distanceSquaredIndexIndex(index0: number, index1: number): number | undefined;\n /**\n * Return distance squared between the point at index0 and target.\n * @param index0 first point index\n * @param target second point\n */\n public distanceSquaredIndexXYAndZ(index0: number, target: XYAndZ): number | undefined {\n if (index0 < 0 || index0 >= this.length)\n return undefined;\n return Geometry.hypotenuseSquaredXYZ(\n target.x - this.getXAtUncheckedPointIndex(index0),\n target.y - this.getYAtUncheckedPointIndex(index0),\n target.z - this.getZAtUncheckedPointIndex(index0));\n }\n /**\n * Return distance between indicated points.\n * @param index0 first point index\n * @param index1 second point index\n */\n public abstract distanceIndexIndex(index0: number, index1: number): number | undefined;\n /**\n * Test if index is valid for an xyz within this array.\n * @param index xyz index to test.\n */\n public isIndexValid(index: number): boolean {\n return index >= 0 && index < this.length;\n }\n /** Adjust index into range by modulo with the length. */\n public cyclicIndex(i: number): number {\n return (i % this.length);\n }\n /** Return the range of the points. */\n public getRange(transform?: Transform, result?: Range3d): Range3d {\n let range = result;\n if (range)\n range.setNull();\n else\n range = Range3d.createNull();\n const n = this.length;\n const point = Point3d.create();\n for (let i = 0; i < n; i++) {\n this.getPoint3dAtUncheckedPointIndex(i, point);\n range.extendPoint(point, transform);\n }\n return range;\n }\n\n /**\n * For each subset of `k` successive points within tolerance of the first point in the subset, return the indices of\n * the last `k-1` duplicates.\n * * Index `0` is never returned.\n * @param tolerance optional distance tol for compression (default [[Geometry.smallMetricDistance]])\n * @param preserveLast if the last `k < this.length` points of the instance are duplicates, whether to return the\n * indices of the *first* `k-1` duplicates for this last run. If true, index `this.length - 1` is not returned\n * unless all points are duplicates, in which case all indices but `0` are returned. Default value is false.\n * @return ordered array of 0-based indices of duplicate points\n */\n public findOrderedDuplicates(tolerance: number = Geometry.smallMetricDistance, preserveLast: boolean = false): number[] {\n const indices: number[] = [];\n if (this.length > 1) {\n for (let i = 0; i < this.length - 1;) {\n let j = i + 1;\n for (; this.almostEqualIndexIndex(i, j, tolerance); ++j)\n indices.push(j);\n i = j; // found next unique point\n }\n if (preserveLast && indices.length > 0 && indices.length < this.length - 1) { // not all points are duplicate\n let numLastRun = 0;\n for (; numLastRun <= indices.length - 1 && indices[indices.length - 1 - numLastRun] === this.length - 1 - numLastRun; ++numLastRun);\n for (let i = 0; i < numLastRun; ++i)\n indices[indices.length - 1 - i] -= 1; // decrement the indices of the last run so that the last point is preserved\n }\n }\n return indices;\n }\n\n /** Accumulate scale times the x,y,z values at index.\n * * No action if index is out of bounds.\n */\n public abstract accumulateScaledXYZ(index: number, scale: number, sum: Point3d): void;\n\n /** Compute the linear combination s of the indexed p_i and given scales s_i.\n * @param scales array of scales. For best results, scales should have same length as the instance.\n * @param result optional pre-allocated object to fill and return\n * @return s = sum(p_i * s_i), where i ranges from 0 to min(this.length, scales.length).\n */\n public linearCombination(scales: number[], result?: Point3d | Vector3d): XYZ {\n const n = Math.min(this.length, scales.length);\n const sum = (result instanceof Vector3d) ? Vector3d.createZero(result) : Point3d.createZero(result);\n for (let i = 0; i < n; ++i) {\n sum.x += scales[i] * this.getXAtUncheckedPointIndex(i);\n sum.y += scales[i] * this.getYAtUncheckedPointIndex(i);\n sum.z += scales[i] * this.getZAtUncheckedPointIndex(i);\n }\n return sum;\n }\n\n /**\n * Interpolate the points at the given indices.\n * @param index0 index of point p0 within the array\n * @param fraction fraction f such that returned point is p0 + f * (p1 - p0)\n * @param index1 index of point p1 within the array\n * @param result optional caller-allocated result to fill and return\n * @returns undefined if an index is out of bounds\n */\n public interpolateIndexIndex(index0: number, fraction: number, index1: number, result?: Point3d): Point3d | undefined {\n if (index0 < 0 || index0 >= this.length || index1 < 0 || index1 >= this.length)\n return undefined;\n return Point3d.create(Geometry.interpolate(this.getXAtUncheckedPointIndex(index0), fraction, this.getXAtUncheckedPointIndex(index1)),\n Geometry.interpolate(this.getYAtUncheckedPointIndex(index0), fraction, this.getYAtUncheckedPointIndex(index1)),\n Geometry.interpolate(this.getZAtUncheckedPointIndex(index0), fraction, this.getZAtUncheckedPointIndex(index1)), result);\n }\n\n /** access x of indexed point */\n public abstract getXAtUncheckedPointIndex(pointIndex: number): number;\n\n /** access y of indexed point */\n public abstract getYAtUncheckedPointIndex(pointIndex: number): number;\n\n /** access z of indexed point */\n public abstract getZAtUncheckedPointIndex(pointIndex: number): number;\n\n /** Return iterator over the points in this collection. Usage:\n * ```ts\n * for (const point: Point3d of collection.points) { ... }\n * ```\n */\n public get points(): Iterable<Point3d> {\n return new PointsIterator(this);\n }\n /** convert to Point3d[] */\n public getArray(): Point3d[] {\n const result = [];\n for (const p of this.points)\n result.push(p);\n return result;\n }\n /** Return the first point, or undefined if the array is empty. */\n public front(result?: Point3d): Point3d | undefined {\n if (this.length === 0)\n return undefined;\n return this.getPoint3dAtUncheckedPointIndex(0, result);\n }\n /** Return the last point, or undefined if the array is empty. */\n public back(result?: Point3d): Point3d | undefined {\n if (this.length === 0)\n return undefined;\n return this.getPoint3dAtUncheckedPointIndex(this.length - 1, result);\n }\n /**\n * Test whether the indexed points are equal within tolerance.\n * @param index0 index of first point\n * @param index1 index of second point\n * @param tolerance max coordinate difference to be considered equal. For exact test, pass 0. Defaults to `Geometry.smallMetricDistance`.\n * @returns whether the points are equal within tolerance, or `undefined` if either index is invalid.\n */\n public almostEqualIndexIndex(index0: number, index1: number, tolerance = Geometry.smallMetricDistance): boolean | undefined {\n if (index0 < 0 || index0 >= this.length || index1 < 0 || index1 >= this.length)\n return undefined;\n return Geometry.isSameCoordinate(this.getXAtUncheckedPointIndex(index0), this.getXAtUncheckedPointIndex(index1), tolerance)\n && Geometry.isSameCoordinate(this.getYAtUncheckedPointIndex(index0), this.getYAtUncheckedPointIndex(index1), tolerance)\n && Geometry.isSameCoordinate(this.getZAtUncheckedPointIndex(index0), this.getZAtUncheckedPointIndex(index1), tolerance);\n }\n /**\n * Test whether the xy-coordinates of the indexed points are equal within tolerance. The z-coordinates are ignored.\n * @param index0 index of first point\n * @param index1 index of second point\n * @param tolerance max coordinate difference to be considered equal. For exact test, pass 0. Defaults to `Geometry.smallMetricDistance`.\n * @returns whether the xy-coordinates of the points are equal within tolerance, or `undefined` if either index is invalid.\n */\n public almostEqualXYIndexIndex(index0: number, index1: number, tolerance = Geometry.smallMetricDistance): boolean | undefined {\n if (index0 < 0 || index0 >= this.length || index1 < 0 || index1 >= this.length)\n return undefined;\n return Geometry.isSameCoordinate(this.getXAtUncheckedPointIndex(index0), this.getXAtUncheckedPointIndex(index1), tolerance)\n && Geometry.isSameCoordinate(this.getYAtUncheckedPointIndex(index0), this.getYAtUncheckedPointIndex(index1), tolerance);\n }\n}\n/**\n * Abstract base class extends [[IndexedXYZCollection]] with methods that modify the collection.\n * @public\n */\nexport abstract class IndexedReadWriteXYZCollection extends IndexedXYZCollection {\n /** Push a (clone of) point onto the collection. */\n public abstract push(point: XYAndZ): void;\n /** Push a new point (given by xyz coordinates) onto the collection. */\n public abstract pushXYZ(x?: number, y?: number, z?: number): void;\n /** Remove the final point. */\n public abstract pop(): void;\n /** Remove all entries. */\n public abstract clear(): void;\n /** Reverse the points in place. */\n public abstract reverseInPlace(): void;\n}\n\n/**\n * Type for use as signature for xyz data of a single linestring appearing in a parameter list.\n * @public\n */\nexport type LineStringDataVariant = IndexedXYZCollection | XYAndZ[] | XAndY[] | number[][];\n\n/**\n * Type for use as signature for multiple xyz data of multiple linestrings appearing in a parameter list.\n * @public\n */\nexport type MultiLineStringDataVariant = LineStringDataVariant | LineStringDataVariant[];\n"]}
1
+ {"version":3,"file":"IndexedXYZCollection.js","sourceRoot":"","sources":["../../../src/geometry3d/IndexedXYZCollection.ts"],"names":[],"mappings":"AAAA;;;+FAG+F;AAE/F;;GAEG;AAEH,OAAO,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AACvC,OAAO,EAAE,OAAO,EAAE,QAAQ,EAAO,MAAM,mBAAmB,CAAC;AAC3D,OAAO,EAAE,OAAO,EAAE,MAAM,SAAS,CAAC;AAIlC,MAAM,cAAc;IACD,WAAW,CAAuB;IAC3C,SAAS,GAAG,CAAC,CAAC,CAAC;IACvB,YAAmB,UAAgC;QACjD,IAAI,CAAC,WAAW,GAAG,UAAU,CAAC;IAChC,CAAC;IACM,IAAI;QACT,IAAI,EAAE,IAAI,CAAC,SAAS,IAAI,IAAI,CAAC,WAAW,CAAC,MAAM,EAAE,CAAC;YAChD,wEAAwE;YACxE,kFAAkF;YAClF,OAAO,EAAE,IAAI,EAAE,IAAI,EAAoC,CAAC;QAC1D,CAAC;QACD,OAAO;YACL,KAAK,EAAE,IAAI,CAAC,WAAW,CAAC,+BAA+B,CAAC,IAAI,CAAC,SAAS,CAAC;YACvE,IAAI,EAAE,KAAK;SACZ,CAAC;IACJ,CAAC;IACM,CAAC,MAAM,CAAC,QAAQ,CAAC,KAAwB,OAAO,IAAI,CAAC,CAAC,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------------------\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n* See LICENSE.md in the project root for license terms and full copyright notice.\n*--------------------------------------------------------------------------------------------*/\n\n/** @packageDocumentation\n * @module ArraysAndInterfaces\n */\n\nimport { Geometry } from \"../Geometry\";\nimport { Point3d, Vector3d, XYZ } from \"./Point3dVector3d\";\nimport { Range3d } from \"./Range\";\nimport { Transform } from \"./Transform\";\nimport { XAndY, XYAndZ } from \"./XYZProps\";\n\nclass PointsIterator implements Iterator<Point3d>, Iterable<Point3d> {\n private readonly _collection: IndexedXYZCollection;\n private _curIndex = -1;\n public constructor(collection: IndexedXYZCollection) {\n this._collection = collection;\n }\n public next(): IteratorResult<Point3d> {\n if (++this._curIndex >= this._collection.length) {\n // the ECMAScript spec states that value=undefined is valid if done=true\n // the TypeScript interface violates the spec hence the cast to any and back below\n return { done: true } as any as IteratorResult<Point3d>;\n }\n return {\n value: this._collection.getPoint3dAtUncheckedPointIndex(this._curIndex),\n done: false,\n };\n }\n public [Symbol.iterator](): Iterator<Point3d> { return this; }\n}\n/**\n * Abstract base class for read-only access to XYZ data with indexed reference.\n * * This allows algorithms to work with Point3d[] or [[GrowableXYZArray]].\n * * GrowableXYZArray implements these for its data.\n * * Point3dArrayCarrier carries a (reference to) a Point3d[] and implements the methods with calls on that array reference.\n * * In addition to \"point by point\" accessors, other abstract members compute commonly useful vector data \"between points\".\n * * Methods that create vectors among multiple indices allow callers to avoid creating temporaries.\n * @public\n */\nexport abstract class IndexedXYZCollection {\n /**\n * Return the point at `index` as a strongly typed Point3d.\n * @param index index of point within the array.\n * @param result caller-allocated destination.\n * @returns undefined if the index is out of bounds.\n */\n public abstract getPoint3dAtCheckedPointIndex(index: number, result?: Point3d): Point3d | undefined;\n /**\n * Return the point at `index` as a strongly typed Point3d, without checking the point index validity.\n * @param index index of point within the array.\n * @param result caller-allocated destination.\n * @returns undefined if the index is out of bounds.\n */\n public abstract getPoint3dAtUncheckedPointIndex(index: number, result?: Point3d): Point3d;\n /**\n * Get from `index` as a strongly typed Vector3d.\n * @param index index of point within the array.\n * @param result caller-allocated destination.\n * @returns undefined if the index is out of bounds.\n */\n public abstract getVector3dAtCheckedVectorIndex(index: number, result?: Vector3d): Vector3d | undefined;\n /**\n * Return a vector from the point at `indexA` to the point at `indexB`.\n * @param indexA index of point within the array.\n * @param indexB index of point within the array.\n * @param result caller-allocated vector.\n * @returns undefined if either index is out of bounds.\n */\n public abstract vectorIndexIndex(indexA: number, indexB: number, result?: Vector3d): Vector3d | undefined;\n /**\n * Return a vector from `origin` to the point at `indexB`.\n * @param origin origin for vector.\n * @param indexB index of point within the array.\n * @param result caller-allocated vector.\n * @returns undefined if index is out of bounds.\n */\n public abstract vectorXYAndZIndex(origin: XYAndZ, indexB: number, result?: Vector3d): Vector3d | undefined;\n /**\n * Return a vector from the point at `indexA` to `target`.\n * @param indexA index of point within the array.\n * @param target target for vector.\n * @param result caller-allocated vector.\n * @returns undefined if index is out of bounds.\n */\n public vectorIndexXYAndZ(indexA: number, target: XYAndZ, result?: Vector3d): Vector3d | undefined {\n const reversed = this.vectorXYAndZIndex(target, indexA, result);\n return reversed?.negate(reversed);\n }\n /**\n * Return the dot product of the vectors from the point at `origin` to the points at `indexA` and `indexB`.\n * @param origin index of point within the array; origin of both vectors.\n * @param indexA index of point within the array; target of the first vector.\n * @param indexB index of point within the array; target of the second vector.\n * @returns undefined if index is out of bounds.\n */\n public dotProductIndexIndexIndex(origin: number, indexA: number, indexB: number): number | undefined {\n if (origin < 0 || origin >= this.length || indexA < 0 || indexA >= this.length || indexB < 0 || indexB >= this.length)\n return undefined;\n const x0 = this.getXAtUncheckedPointIndex(origin);\n const y0 = this.getYAtUncheckedPointIndex(origin);\n const z0 = this.getZAtUncheckedPointIndex(origin);\n return (this.getXAtUncheckedPointIndex(indexA) - x0) * (this.getXAtUncheckedPointIndex(indexB) - x0) +\n (this.getYAtUncheckedPointIndex(indexA) - y0) * (this.getYAtUncheckedPointIndex(indexB) - y0) +\n (this.getZAtUncheckedPointIndex(indexA) - z0) * (this.getZAtUncheckedPointIndex(indexB) - z0);\n }\n /**\n * Return the dot product of the vectors from the point at `origin` to the point at `indexA` and to `targetB`.\n * @param origin index of point within the array; origin of both vectors.\n * @param indexA index of point within the array; target of the first vector.\n * @param targetB target for second vector.\n * @returns undefined if index is out of bounds.\n */\n public dotProductIndexIndexXYAndZ(origin: number, indexA: number, targetB: XYAndZ): number | undefined {\n if (origin < 0 || origin >= this.length || indexA < 0 || indexA >= this.length)\n return undefined;\n const x0 = this.getXAtUncheckedPointIndex(origin);\n const y0 = this.getYAtUncheckedPointIndex(origin);\n const z0 = this.getZAtUncheckedPointIndex(origin);\n return (this.getXAtUncheckedPointIndex(indexA) - x0) * (targetB.x - x0) +\n (this.getYAtUncheckedPointIndex(indexA) - y0) * (targetB.y - y0) +\n (this.getZAtUncheckedPointIndex(indexA) - z0) * (targetB.z - z0);\n }\n /**\n * Return the cross product of the vectors from `origin` to points at `indexA` and `indexB`.\n * @param origin origin for vector.\n * @param indexA index of first target within the array.\n * @param indexB index of second target within the array.\n * @param result caller-allocated vector.\n * @returns undefined if either index is out of bounds.\n */\n public abstract crossProductXYAndZIndexIndex(origin: XYAndZ, indexA: number, indexB: number, result?: Vector3d): Vector3d | undefined;\n /**\n * Return the cross product of the vectors from `origin` to the point at `indexA` and to `targetB`.\n * @param origin index of point within the array; origin of both vectors.\n * @param indexA index of point within the array; target of the first vector.\n * @param targetB target of second vector.\n * @param result optional caller-allocated result to fill and return.\n * @returns undefined if an index is out of bounds.\n */\n public crossProductIndexIndexXYAndZ(origin: number, indexA: number, targetB: XYAndZ, result?: Vector3d): Vector3d | undefined {\n if (origin < 0 || origin >= this.length || indexA < 0 || indexA >= this.length)\n return undefined;\n const x0 = this.getXAtUncheckedPointIndex(origin);\n const y0 = this.getYAtUncheckedPointIndex(origin);\n const z0 = this.getZAtUncheckedPointIndex(origin);\n return Vector3d.createCrossProduct(\n this.getXAtUncheckedPointIndex(indexA) - x0,\n this.getYAtUncheckedPointIndex(indexA) - y0,\n this.getZAtUncheckedPointIndex(indexA) - z0,\n targetB.x - x0,\n targetB.y - y0,\n targetB.z - z0,\n result,\n );\n }\n /**\n * Return the cross product of vectors from `origin` to points at `indexA` and `indexB`.\n * @param origin origin for vector.\n * @param indexA index of first target within the array.\n * @param indexB index of second target within the array.\n * @param result optional caller-allocated vector.\n * @returns undefined if either index is out of bounds.\n */\n public abstract crossProductIndexIndexIndex(origin: number, indexA: number, indexB: number, result?: Vector3d): Vector3d | undefined;\n /**\n * Return the cross product of vectors from origin point at `indexA` to target points at `indexB` and `indexC`.\n * @param origin index of origin.\n * @param indexA index of first target within the array.\n * @param indexB index of second target within the array.\n * @param result caller-allocated vector.\n * @returns return true if indexA, indexB both valid.\n */\n public abstract accumulateCrossProductIndexIndexIndex(origin: number, indexA: number, indexB: number, result: Vector3d): void;\n /** Read-only property for number of XYZ in the collection. */\n public abstract get length(): number;\n /**\n * Return distance squared between indicated points.\n * @param index0 first point index.\n * @param index1 second point index.\n */\n public abstract distanceSquaredIndexIndex(index0: number, index1: number): number | undefined;\n /**\n * Return distance squared between the point at index0 and target.\n * @param index0 first point index.\n * @param target second point.\n */\n public distanceSquaredIndexXYAndZ(index0: number, target: XYAndZ): number | undefined {\n if (index0 < 0 || index0 >= this.length)\n return undefined;\n return Geometry.hypotenuseSquaredXYZ(\n target.x - this.getXAtUncheckedPointIndex(index0),\n target.y - this.getYAtUncheckedPointIndex(index0),\n target.z - this.getZAtUncheckedPointIndex(index0),\n );\n }\n /**\n * Return distance between indicated points.\n * @param index0 first point index.\n * @param index1 second point index.\n */\n public abstract distanceIndexIndex(index0: number, index1: number): number | undefined;\n /**\n * Test if index is valid for an xyz within this array.\n * @param index xyz index to test.\n */\n public isIndexValid(index: number): boolean {\n return index >= 0 && index < this.length;\n }\n /** Adjust index into range by modulo with the length. */\n public cyclicIndex(i: number): number {\n return (i % this.length);\n }\n /** Return the range of the points. */\n public getRange(transform?: Transform, result?: Range3d): Range3d {\n let range = result;\n if (range)\n range.setNull();\n else\n range = Range3d.createNull();\n const n = this.length;\n const point = Point3d.create();\n for (let i = 0; i < n; i++) {\n this.getPoint3dAtUncheckedPointIndex(i, point);\n range.extendPoint(point, transform);\n }\n return range;\n }\n /**\n * For each subset of `k` successive points within tolerance of the first point in the subset, return the indices of\n * the last `k-1` duplicates.\n * * Index `0` is never returned.\n * @param tolerance optional distance tol for compression (default [[Geometry.smallMetricDistance]]).\n * @param preserveLast if the last `k < this.length` points of the instance are duplicates, whether to return the\n * indices of the *first* `k-1` duplicates for this last run. If true, index `this.length - 1` is not returned.\n * unless all points are duplicates, in which case all indices but `0` are returned. Default value is false.\n * @return ordered array of 0-based indices of duplicate points\n */\n public findOrderedDuplicates(tolerance: number = Geometry.smallMetricDistance, preserveLast: boolean = false): number[] {\n const indices: number[] = [];\n if (this.length > 1) {\n for (let i = 0; i < this.length - 1;) {\n let j = i + 1;\n for (; this.almostEqualIndexIndex(i, j, tolerance); ++j)\n indices.push(j);\n i = j; // found next unique point\n }\n if (preserveLast && indices.length > 0 && indices.length < this.length - 1) { // not all points are duplicate\n let numLastRun = 0;\n for (; numLastRun <= indices.length - 1 && indices[indices.length - 1 - numLastRun] === this.length - 1 - numLastRun; ++numLastRun);\n for (let i = 0; i < numLastRun; ++i)\n indices[indices.length - 1 - i] -= 1; // decrement the indices of the last run so that the last point is preserved\n }\n }\n return indices;\n }\n /**\n * Accumulate scale times the x,y,z values at index.\n * * No action if index is out of bounds.\n */\n public abstract accumulateScaledXYZ(index: number, scale: number, sum: Point3d): void;\n /**\n * Compute the linear combination s of the indexed p_i and given scales s_i.\n * @param scales array of scales. For best results, scales should have same length as the instance.\n * @param result optional pre-allocated object to fill and return\n * @return s = sum(p_i * s_i), where i ranges from 0 to min(this.length, scales.length).\n */\n public linearCombination(scales: number[], result?: Point3d | Vector3d): XYZ {\n const n = Math.min(this.length, scales.length);\n const sum = (result instanceof Vector3d) ? Vector3d.createZero(result) : Point3d.createZero(result);\n for (let i = 0; i < n; ++i) {\n sum.x += scales[i] * this.getXAtUncheckedPointIndex(i);\n sum.y += scales[i] * this.getYAtUncheckedPointIndex(i);\n sum.z += scales[i] * this.getZAtUncheckedPointIndex(i);\n }\n return sum;\n }\n /**\n * Interpolate the points at the given indices.\n * @param index0 index of point p0 within the array.\n * @param fraction fraction f such that returned point is p0 + f * (p1 - p0).\n * @param index1 index of point p1 within the array.\n * @param result optional caller-allocated result to fill and return.\n * @returns undefined if an index is out of bounds.\n */\n public interpolateIndexIndex(index0: number, fraction: number, index1: number, result?: Point3d): Point3d | undefined {\n if (index0 < 0 || index0 >= this.length || index1 < 0 || index1 >= this.length)\n return undefined;\n return Point3d.create(Geometry.interpolate(this.getXAtUncheckedPointIndex(index0), fraction, this.getXAtUncheckedPointIndex(index1)),\n Geometry.interpolate(this.getYAtUncheckedPointIndex(index0), fraction, this.getYAtUncheckedPointIndex(index1)),\n Geometry.interpolate(this.getZAtUncheckedPointIndex(index0), fraction, this.getZAtUncheckedPointIndex(index1)), result);\n }\n /** Access x of indexed point. */\n public abstract getXAtUncheckedPointIndex(pointIndex: number): number;\n /** Access y of indexed point. */\n public abstract getYAtUncheckedPointIndex(pointIndex: number): number;\n /** Access z of indexed point. */\n public abstract getZAtUncheckedPointIndex(pointIndex: number): number;\n /**\n * Return iterator over the points in this collection. Usage:\n * ```ts\n * for (const point: Point3d of collection.points) { ... }\n * ```\n */\n public get points(): Iterable<Point3d> {\n return new PointsIterator(this);\n }\n /** Convert to Point3d[]. */\n public getArray(): Point3d[] {\n const result = [];\n for (const p of this.points)\n result.push(p);\n return result;\n }\n /** Return the first point, or undefined if the array is empty. */\n public front(result?: Point3d): Point3d | undefined {\n if (this.length === 0)\n return undefined;\n return this.getPoint3dAtUncheckedPointIndex(0, result);\n }\n /** Return the last point, or undefined if the array is empty. */\n public back(result?: Point3d): Point3d | undefined {\n if (this.length === 0)\n return undefined;\n return this.getPoint3dAtUncheckedPointIndex(this.length - 1, result);\n }\n /**\n * Test whether the indexed points are equal within tolerance.\n * @param index0 index of first point.\n * @param index1 index of second point.\n * @param tolerance max coordinate difference to be considered equal. For exact test, pass 0. Defaults to `Geometry.smallMetricDistance`.\n * @returns whether the points are equal within tolerance, or `undefined` if either index is invalid.\n */\n public almostEqualIndexIndex(index0: number, index1: number, tolerance = Geometry.smallMetricDistance): boolean | undefined {\n if (index0 < 0 || index0 >= this.length || index1 < 0 || index1 >= this.length)\n return undefined;\n return Geometry.isSameCoordinate(this.getXAtUncheckedPointIndex(index0), this.getXAtUncheckedPointIndex(index1), tolerance)\n && Geometry.isSameCoordinate(this.getYAtUncheckedPointIndex(index0), this.getYAtUncheckedPointIndex(index1), tolerance)\n && Geometry.isSameCoordinate(this.getZAtUncheckedPointIndex(index0), this.getZAtUncheckedPointIndex(index1), tolerance);\n }\n /**\n * Test whether the xy-coordinates of the indexed points are equal within tolerance. The z-coordinates are ignored.\n * @param index0 index of first point.\n * @param index1 index of second point.\n * @param tolerance max coordinate difference to be considered equal. For exact test, pass 0. Defaults to `Geometry.smallMetricDistance`.\n * @returns whether the xy-coordinates of the points are equal within tolerance, or `undefined` if either index is invalid.\n */\n public almostEqualXYIndexIndex(index0: number, index1: number, tolerance = Geometry.smallMetricDistance): boolean | undefined {\n if (index0 < 0 || index0 >= this.length || index1 < 0 || index1 >= this.length)\n return undefined;\n return Geometry.isSameCoordinate(this.getXAtUncheckedPointIndex(index0), this.getXAtUncheckedPointIndex(index1), tolerance)\n && Geometry.isSameCoordinate(this.getYAtUncheckedPointIndex(index0), this.getYAtUncheckedPointIndex(index1), tolerance);\n }\n}\n\n/**\n * Abstract base class extends [[IndexedXYZCollection]] with methods that modify the collection.\n * @public\n */\nexport abstract class IndexedReadWriteXYZCollection extends IndexedXYZCollection {\n /** Push a (clone of) point onto the collection. */\n public abstract push(point: XYAndZ): void;\n /** Push a new point (given by xyz coordinates) onto the collection. */\n public abstract pushXYZ(x?: number, y?: number, z?: number): void;\n /** Remove the final point. */\n public abstract pop(): void;\n /** Remove all entries. */\n public abstract clear(): void;\n /** Reverse the points in place. */\n public abstract reverseInPlace(): void;\n}\n\n/**\n * Type for use as signature for xyz data of a single linestring appearing in a parameter list.\n * @public\n */\nexport type LineStringDataVariant = IndexedXYZCollection | XYAndZ[] | XAndY[] | number[][];\n\n/**\n * Type for use as signature for multiple xyz data of multiple linestrings appearing in a parameter list.\n * @public\n */\nexport type MultiLineStringDataVariant = LineStringDataVariant | LineStringDataVariant[];\n"]}