@itwin/core-geometry 4.2.0-dev.9 → 4.3.0-dev.1

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 (478) hide show
  1. package/CHANGELOG.md +36 -1
  2. package/lib/cjs/Geometry.d.ts +4 -4
  3. package/lib/cjs/Geometry.d.ts.map +1 -1
  4. package/lib/cjs/Geometry.js +2 -2
  5. package/lib/cjs/Geometry.js.map +1 -1
  6. package/lib/cjs/clipping/AlternatingConvexClipTree.d.ts +4 -3
  7. package/lib/cjs/clipping/AlternatingConvexClipTree.d.ts.map +1 -1
  8. package/lib/cjs/clipping/AlternatingConvexClipTree.js +1 -1
  9. package/lib/cjs/clipping/AlternatingConvexClipTree.js.map +1 -1
  10. package/lib/cjs/clipping/BooleanClipNode.d.ts +4 -3
  11. package/lib/cjs/clipping/BooleanClipNode.d.ts.map +1 -1
  12. package/lib/cjs/clipping/BooleanClipNode.js.map +1 -1
  13. package/lib/cjs/clipping/ClipPlane.d.ts +2 -1
  14. package/lib/cjs/clipping/ClipPlane.d.ts.map +1 -1
  15. package/lib/cjs/clipping/ClipPlane.js.map +1 -1
  16. package/lib/cjs/clipping/ClipUtils.d.ts +17 -11
  17. package/lib/cjs/clipping/ClipUtils.d.ts.map +1 -1
  18. package/lib/cjs/clipping/ClipUtils.js +14 -8
  19. package/lib/cjs/clipping/ClipUtils.js.map +1 -1
  20. package/lib/cjs/clipping/ClipVector.d.ts +6 -5
  21. package/lib/cjs/clipping/ClipVector.d.ts.map +1 -1
  22. package/lib/cjs/clipping/ClipVector.js +1 -1
  23. package/lib/cjs/clipping/ClipVector.js.map +1 -1
  24. package/lib/cjs/clipping/ConvexClipPlaneSet.d.ts +3 -2
  25. package/lib/cjs/clipping/ConvexClipPlaneSet.d.ts.map +1 -1
  26. package/lib/cjs/clipping/ConvexClipPlaneSet.js.map +1 -1
  27. package/lib/cjs/clipping/UnionOfConvexClipPlaneSets.d.ts +2 -1
  28. package/lib/cjs/clipping/UnionOfConvexClipPlaneSets.d.ts.map +1 -1
  29. package/lib/cjs/clipping/UnionOfConvexClipPlaneSets.js.map +1 -1
  30. package/lib/cjs/core-geometry.d.ts +1 -3
  31. package/lib/cjs/core-geometry.d.ts.map +1 -1
  32. package/lib/cjs/core-geometry.js +1 -3
  33. package/lib/cjs/core-geometry.js.map +1 -1
  34. package/lib/cjs/curve/Arc3d.d.ts.map +1 -1
  35. package/lib/cjs/curve/Arc3d.js +4 -4
  36. package/lib/cjs/curve/Arc3d.js.map +1 -1
  37. package/lib/cjs/curve/CurveChainWithDistanceIndex.d.ts +93 -91
  38. package/lib/cjs/curve/CurveChainWithDistanceIndex.d.ts.map +1 -1
  39. package/lib/cjs/curve/CurveChainWithDistanceIndex.js +171 -152
  40. package/lib/cjs/curve/CurveChainWithDistanceIndex.js.map +1 -1
  41. package/lib/cjs/curve/CurveCollection.d.ts +19 -19
  42. package/lib/cjs/curve/CurveCollection.d.ts.map +1 -1
  43. package/lib/cjs/curve/CurveCollection.js +20 -22
  44. package/lib/cjs/curve/CurveCollection.js.map +1 -1
  45. package/lib/cjs/curve/CurveCurve.d.ts +47 -30
  46. package/lib/cjs/curve/CurveCurve.d.ts.map +1 -1
  47. package/lib/cjs/curve/CurveCurve.js +81 -46
  48. package/lib/cjs/curve/CurveCurve.js.map +1 -1
  49. package/lib/cjs/curve/CurveFactory.d.ts +1 -1
  50. package/lib/cjs/curve/CurveFactory.js.map +1 -1
  51. package/lib/cjs/curve/CurveLocationDetail.d.ts +17 -5
  52. package/lib/cjs/curve/CurveLocationDetail.d.ts.map +1 -1
  53. package/lib/cjs/curve/CurveLocationDetail.js +14 -2
  54. package/lib/cjs/curve/CurveLocationDetail.js.map +1 -1
  55. package/lib/cjs/curve/CurveOps.d.ts +1 -1
  56. package/lib/cjs/curve/CurveOps.js.map +1 -1
  57. package/lib/cjs/curve/CurvePrimitive.d.ts +1 -2
  58. package/lib/cjs/curve/CurvePrimitive.d.ts.map +1 -1
  59. package/lib/cjs/curve/CurvePrimitive.js +2 -2
  60. package/lib/cjs/curve/CurvePrimitive.js.map +1 -1
  61. package/lib/cjs/curve/CurveProcessor.d.ts +1 -1
  62. package/lib/cjs/curve/CurveProcessor.js.map +1 -1
  63. package/lib/cjs/curve/{CurveChain.d.ts → CurveTypes.d.ts} +6 -6
  64. package/lib/cjs/curve/CurveTypes.d.ts.map +1 -0
  65. package/lib/cjs/curve/{CurveChain.js → CurveTypes.js} +1 -1
  66. package/lib/cjs/curve/CurveTypes.js.map +1 -0
  67. package/lib/cjs/curve/CurveWireMomentsXYZ.d.ts +1 -1
  68. package/lib/cjs/curve/CurveWireMomentsXYZ.js.map +1 -1
  69. package/lib/cjs/curve/ParityRegion.d.ts +3 -3
  70. package/lib/cjs/curve/ParityRegion.d.ts.map +1 -1
  71. package/lib/cjs/curve/ParityRegion.js +2 -2
  72. package/lib/cjs/curve/ParityRegion.js.map +1 -1
  73. package/lib/cjs/curve/Query/ConsolidateAdjacentPrimitivesContext.d.ts +3 -2
  74. package/lib/cjs/curve/Query/ConsolidateAdjacentPrimitivesContext.d.ts.map +1 -1
  75. package/lib/cjs/curve/Query/ConsolidateAdjacentPrimitivesContext.js +2 -2
  76. package/lib/cjs/curve/Query/ConsolidateAdjacentPrimitivesContext.js.map +1 -1
  77. package/lib/cjs/curve/Query/CurveSplitContext.d.ts +1 -1
  78. package/lib/cjs/curve/Query/CurveSplitContext.js.map +1 -1
  79. package/lib/cjs/curve/Query/CylindricalRange.d.ts +1 -1
  80. package/lib/cjs/curve/Query/CylindricalRange.js.map +1 -1
  81. package/lib/cjs/curve/Query/InOutTests.d.ts +1 -1
  82. package/lib/cjs/curve/Query/InOutTests.js.map +1 -1
  83. package/lib/cjs/curve/Query/StrokeCountChain.d.ts +1 -1
  84. package/lib/cjs/curve/Query/StrokeCountChain.js.map +1 -1
  85. package/lib/cjs/curve/RegionOps.d.ts +54 -5
  86. package/lib/cjs/curve/RegionOps.d.ts.map +1 -1
  87. package/lib/cjs/curve/RegionOps.js +154 -3
  88. package/lib/cjs/curve/RegionOps.js.map +1 -1
  89. package/lib/cjs/curve/RegionOpsClassificationSweeps.d.ts +1 -1
  90. package/lib/cjs/curve/RegionOpsClassificationSweeps.js.map +1 -1
  91. package/lib/cjs/curve/StrokeOptions.d.ts +20 -11
  92. package/lib/cjs/curve/StrokeOptions.d.ts.map +1 -1
  93. package/lib/cjs/curve/StrokeOptions.js +22 -11
  94. package/lib/cjs/curve/StrokeOptions.js.map +1 -1
  95. package/lib/cjs/curve/UnionRegion.d.ts +3 -3
  96. package/lib/cjs/curve/UnionRegion.d.ts.map +1 -1
  97. package/lib/cjs/curve/UnionRegion.js +2 -2
  98. package/lib/cjs/curve/UnionRegion.js.map +1 -1
  99. package/lib/cjs/curve/internalContexts/ClosestPointStrokeHandler.d.ts +1 -1
  100. package/lib/cjs/curve/internalContexts/ClosestPointStrokeHandler.d.ts.map +1 -1
  101. package/lib/cjs/curve/internalContexts/ClosestPointStrokeHandler.js +2 -2
  102. package/lib/cjs/curve/internalContexts/ClosestPointStrokeHandler.js.map +1 -1
  103. package/lib/cjs/curve/internalContexts/CurveCurveCloseApproachXY.d.ts +233 -0
  104. package/lib/cjs/curve/internalContexts/CurveCurveCloseApproachXY.d.ts.map +1 -0
  105. package/lib/cjs/curve/{CurveCurveCloseApproachXY.js → internalContexts/CurveCurveCloseApproachXY.js} +299 -202
  106. package/lib/cjs/curve/internalContexts/CurveCurveCloseApproachXY.js.map +1 -0
  107. package/lib/{esm/curve → cjs/curve/internalContexts}/CurveCurveIntersectXY.d.ts +45 -51
  108. package/lib/cjs/curve/internalContexts/CurveCurveIntersectXY.d.ts.map +1 -0
  109. package/lib/cjs/curve/{CurveCurveIntersectXY.js → internalContexts/CurveCurveIntersectXY.js} +104 -115
  110. package/lib/cjs/curve/internalContexts/CurveCurveIntersectXY.js.map +1 -0
  111. package/lib/cjs/curve/{CurveCurveIntersectXYZ.d.ts → internalContexts/CurveCurveIntersectXYZ.d.ts} +18 -18
  112. package/lib/cjs/curve/internalContexts/CurveCurveIntersectXYZ.d.ts.map +1 -0
  113. package/lib/cjs/curve/{CurveCurveIntersectXYZ.js → internalContexts/CurveCurveIntersectXYZ.js} +134 -108
  114. package/lib/cjs/curve/internalContexts/CurveCurveIntersectXYZ.js.map +1 -0
  115. package/lib/cjs/curve/internalContexts/CurveOffsetXYHandler.d.ts +2 -2
  116. package/lib/cjs/curve/internalContexts/CurveOffsetXYHandler.d.ts.map +1 -1
  117. package/lib/cjs/curve/internalContexts/CurveOffsetXYHandler.js +9 -5
  118. package/lib/cjs/curve/internalContexts/CurveOffsetXYHandler.js.map +1 -1
  119. package/lib/cjs/curve/internalContexts/MultiChainCollector.d.ts +1 -1
  120. package/lib/cjs/curve/internalContexts/MultiChainCollector.js.map +1 -1
  121. package/lib/cjs/geometry3d/BarycentricTriangle.d.ts +1 -0
  122. package/lib/cjs/geometry3d/BarycentricTriangle.d.ts.map +1 -1
  123. package/lib/cjs/geometry3d/BarycentricTriangle.js +1 -0
  124. package/lib/cjs/geometry3d/BarycentricTriangle.js.map +1 -1
  125. package/lib/cjs/geometry3d/FrameBuilder.d.ts +28 -11
  126. package/lib/cjs/geometry3d/FrameBuilder.d.ts.map +1 -1
  127. package/lib/cjs/geometry3d/FrameBuilder.js +57 -45
  128. package/lib/cjs/geometry3d/FrameBuilder.js.map +1 -1
  129. package/lib/cjs/geometry3d/GeometryHandler.d.ts +15 -26
  130. package/lib/cjs/geometry3d/GeometryHandler.d.ts.map +1 -1
  131. package/lib/cjs/geometry3d/GeometryHandler.js +23 -32
  132. package/lib/cjs/geometry3d/GeometryHandler.js.map +1 -1
  133. package/lib/cjs/geometry3d/GrowableXYZArray.d.ts +0 -8
  134. package/lib/cjs/geometry3d/GrowableXYZArray.d.ts.map +1 -1
  135. package/lib/cjs/geometry3d/GrowableXYZArray.js +0 -16
  136. package/lib/cjs/geometry3d/GrowableXYZArray.js.map +1 -1
  137. package/lib/cjs/geometry3d/IndexedXYZCollection.d.ts +4 -4
  138. package/lib/cjs/geometry3d/IndexedXYZCollection.d.ts.map +1 -1
  139. package/lib/cjs/geometry3d/IndexedXYZCollection.js +12 -0
  140. package/lib/cjs/geometry3d/IndexedXYZCollection.js.map +1 -1
  141. package/lib/cjs/geometry3d/Matrix3d.d.ts.map +1 -1
  142. package/lib/cjs/geometry3d/Matrix3d.js +3 -6
  143. package/lib/cjs/geometry3d/Matrix3d.js.map +1 -1
  144. package/lib/cjs/geometry3d/Point3dArrayCarrier.d.ts.map +1 -1
  145. package/lib/cjs/geometry3d/Point3dArrayCarrier.js.map +1 -1
  146. package/lib/cjs/geometry3d/Point3dVector3d.d.ts +1 -2
  147. package/lib/cjs/geometry3d/Point3dVector3d.d.ts.map +1 -1
  148. package/lib/cjs/geometry3d/Point3dVector3d.js +0 -1
  149. package/lib/cjs/geometry3d/Point3dVector3d.js.map +1 -1
  150. package/lib/cjs/geometry3d/PolygonOps.d.ts +2 -2
  151. package/lib/cjs/geometry3d/PolygonOps.d.ts.map +1 -1
  152. package/lib/cjs/geometry3d/PolygonOps.js +2 -3
  153. package/lib/cjs/geometry3d/PolygonOps.js.map +1 -1
  154. package/lib/cjs/geometry3d/Range.d.ts +1 -1
  155. package/lib/cjs/geometry3d/Range.d.ts.map +1 -1
  156. package/lib/cjs/geometry3d/Range.js +1 -1
  157. package/lib/cjs/geometry3d/Range.js.map +1 -1
  158. package/lib/cjs/geometry3d/Ray3d.d.ts +3 -1
  159. package/lib/cjs/geometry3d/Ray3d.d.ts.map +1 -1
  160. package/lib/cjs/geometry3d/Ray3d.js +4 -3
  161. package/lib/cjs/geometry3d/Ray3d.js.map +1 -1
  162. package/lib/cjs/geometry3d/ReusableObjectCache.d.ts +2 -1
  163. package/lib/cjs/geometry3d/ReusableObjectCache.d.ts.map +1 -1
  164. package/lib/cjs/geometry3d/ReusableObjectCache.js +1 -1
  165. package/lib/cjs/geometry3d/ReusableObjectCache.js.map +1 -1
  166. package/lib/cjs/geometry3d/SortablePolygon.d.ts +1 -1
  167. package/lib/cjs/geometry3d/SortablePolygon.js.map +1 -1
  168. package/lib/cjs/geometry3d/Transform.d.ts.map +1 -1
  169. package/lib/cjs/geometry3d/Transform.js +4 -6
  170. package/lib/cjs/geometry3d/Transform.js.map +1 -1
  171. package/lib/cjs/geometry3d/YawPitchRollAngles.js +1 -1
  172. package/lib/cjs/geometry3d/YawPitchRollAngles.js.map +1 -1
  173. package/lib/cjs/geometry4d/Map4d.d.ts +14 -8
  174. package/lib/cjs/geometry4d/Map4d.d.ts.map +1 -1
  175. package/lib/cjs/geometry4d/Map4d.js +38 -16
  176. package/lib/cjs/geometry4d/Map4d.js.map +1 -1
  177. package/lib/cjs/geometry4d/Matrix4d.d.ts.map +1 -1
  178. package/lib/cjs/geometry4d/Matrix4d.js +4 -2
  179. package/lib/cjs/geometry4d/Matrix4d.js.map +1 -1
  180. package/lib/cjs/geometry4d/Point4d.js.map +1 -1
  181. package/lib/cjs/numerics/Polynomials.d.ts +2 -2
  182. package/lib/cjs/numerics/Polynomials.d.ts.map +1 -1
  183. package/lib/cjs/numerics/Polynomials.js +2 -2
  184. package/lib/cjs/numerics/Polynomials.js.map +1 -1
  185. package/lib/cjs/polyface/PolyfaceBuilder.d.ts +18 -6
  186. package/lib/cjs/polyface/PolyfaceBuilder.d.ts.map +1 -1
  187. package/lib/cjs/polyface/PolyfaceBuilder.js +55 -25
  188. package/lib/cjs/polyface/PolyfaceBuilder.js.map +1 -1
  189. package/lib/cjs/polyface/PolyfaceClip.d.ts +16 -7
  190. package/lib/cjs/polyface/PolyfaceClip.d.ts.map +1 -1
  191. package/lib/cjs/polyface/PolyfaceClip.js +38 -7
  192. package/lib/cjs/polyface/PolyfaceClip.js.map +1 -1
  193. package/lib/cjs/polyface/PolyfaceData.d.ts +5 -39
  194. package/lib/cjs/polyface/PolyfaceData.d.ts.map +1 -1
  195. package/lib/cjs/polyface/PolyfaceData.js +7 -41
  196. package/lib/cjs/polyface/PolyfaceData.js.map +1 -1
  197. package/lib/cjs/polyface/PolyfaceQuery.d.ts +10 -8
  198. package/lib/cjs/polyface/PolyfaceQuery.d.ts.map +1 -1
  199. package/lib/cjs/polyface/PolyfaceQuery.js +64 -18
  200. package/lib/cjs/polyface/PolyfaceQuery.js.map +1 -1
  201. package/lib/cjs/serialization/GeometrySamples.d.ts +6 -0
  202. package/lib/cjs/serialization/GeometrySamples.d.ts.map +1 -1
  203. package/lib/cjs/serialization/GeometrySamples.js +68 -2
  204. package/lib/cjs/serialization/GeometrySamples.js.map +1 -1
  205. package/lib/cjs/solid/LinearSweep.d.ts +1 -1
  206. package/lib/cjs/solid/LinearSweep.js.map +1 -1
  207. package/lib/cjs/solid/RotationalSweep.d.ts +1 -1
  208. package/lib/cjs/solid/RotationalSweep.js.map +1 -1
  209. package/lib/cjs/solid/RuledSweep.d.ts +1 -1
  210. package/lib/cjs/solid/RuledSweep.js.map +1 -1
  211. package/lib/cjs/solid/SweepContour.d.ts +35 -26
  212. package/lib/cjs/solid/SweepContour.d.ts.map +1 -1
  213. package/lib/cjs/solid/SweepContour.js +84 -100
  214. package/lib/cjs/solid/SweepContour.js.map +1 -1
  215. package/lib/cjs/topology/Graph.d.ts +29 -11
  216. package/lib/cjs/topology/Graph.d.ts.map +1 -1
  217. package/lib/cjs/topology/Graph.js +45 -26
  218. package/lib/cjs/topology/Graph.js.map +1 -1
  219. package/lib/cjs/topology/HalfEdgeMarkSet.d.ts +2 -2
  220. package/lib/cjs/topology/HalfEdgeMarkSet.d.ts.map +1 -1
  221. package/lib/cjs/topology/HalfEdgeMarkSet.js +4 -4
  222. package/lib/cjs/topology/HalfEdgeMarkSet.js.map +1 -1
  223. package/lib/cjs/topology/Merging.d.ts +3 -0
  224. package/lib/cjs/topology/Merging.d.ts.map +1 -1
  225. package/lib/cjs/topology/Merging.js +19 -5
  226. package/lib/cjs/topology/Merging.js.map +1 -1
  227. package/lib/cjs/topology/Triangulation.d.ts +15 -7
  228. package/lib/cjs/topology/Triangulation.d.ts.map +1 -1
  229. package/lib/cjs/topology/Triangulation.js +89 -47
  230. package/lib/cjs/topology/Triangulation.js.map +1 -1
  231. package/lib/esm/Geometry.d.ts +4 -4
  232. package/lib/esm/Geometry.d.ts.map +1 -1
  233. package/lib/esm/Geometry.js +2 -2
  234. package/lib/esm/Geometry.js.map +1 -1
  235. package/lib/esm/clipping/AlternatingConvexClipTree.d.ts +4 -3
  236. package/lib/esm/clipping/AlternatingConvexClipTree.d.ts.map +1 -1
  237. package/lib/esm/clipping/AlternatingConvexClipTree.js +1 -1
  238. package/lib/esm/clipping/AlternatingConvexClipTree.js.map +1 -1
  239. package/lib/esm/clipping/BooleanClipNode.d.ts +4 -3
  240. package/lib/esm/clipping/BooleanClipNode.d.ts.map +1 -1
  241. package/lib/esm/clipping/BooleanClipNode.js.map +1 -1
  242. package/lib/esm/clipping/ClipPlane.d.ts +2 -1
  243. package/lib/esm/clipping/ClipPlane.d.ts.map +1 -1
  244. package/lib/esm/clipping/ClipPlane.js.map +1 -1
  245. package/lib/esm/clipping/ClipUtils.d.ts +17 -11
  246. package/lib/esm/clipping/ClipUtils.d.ts.map +1 -1
  247. package/lib/esm/clipping/ClipUtils.js +14 -8
  248. package/lib/esm/clipping/ClipUtils.js.map +1 -1
  249. package/lib/esm/clipping/ClipVector.d.ts +6 -5
  250. package/lib/esm/clipping/ClipVector.d.ts.map +1 -1
  251. package/lib/esm/clipping/ClipVector.js +1 -1
  252. package/lib/esm/clipping/ClipVector.js.map +1 -1
  253. package/lib/esm/clipping/ConvexClipPlaneSet.d.ts +3 -2
  254. package/lib/esm/clipping/ConvexClipPlaneSet.d.ts.map +1 -1
  255. package/lib/esm/clipping/ConvexClipPlaneSet.js.map +1 -1
  256. package/lib/esm/clipping/UnionOfConvexClipPlaneSets.d.ts +2 -1
  257. package/lib/esm/clipping/UnionOfConvexClipPlaneSets.d.ts.map +1 -1
  258. package/lib/esm/clipping/UnionOfConvexClipPlaneSets.js.map +1 -1
  259. package/lib/esm/core-geometry.d.ts +1 -3
  260. package/lib/esm/core-geometry.d.ts.map +1 -1
  261. package/lib/esm/core-geometry.js +1 -3
  262. package/lib/esm/core-geometry.js.map +1 -1
  263. package/lib/esm/curve/Arc3d.d.ts.map +1 -1
  264. package/lib/esm/curve/Arc3d.js +4 -4
  265. package/lib/esm/curve/Arc3d.js.map +1 -1
  266. package/lib/esm/curve/CurveChainWithDistanceIndex.d.ts +93 -91
  267. package/lib/esm/curve/CurveChainWithDistanceIndex.d.ts.map +1 -1
  268. package/lib/esm/curve/CurveChainWithDistanceIndex.js +171 -152
  269. package/lib/esm/curve/CurveChainWithDistanceIndex.js.map +1 -1
  270. package/lib/esm/curve/CurveCollection.d.ts +19 -19
  271. package/lib/esm/curve/CurveCollection.d.ts.map +1 -1
  272. package/lib/esm/curve/CurveCollection.js +19 -20
  273. package/lib/esm/curve/CurveCollection.js.map +1 -1
  274. package/lib/esm/curve/CurveCurve.d.ts +47 -30
  275. package/lib/esm/curve/CurveCurve.d.ts.map +1 -1
  276. package/lib/esm/curve/CurveCurve.js +81 -46
  277. package/lib/esm/curve/CurveCurve.js.map +1 -1
  278. package/lib/esm/curve/CurveFactory.d.ts +1 -1
  279. package/lib/esm/curve/CurveFactory.js.map +1 -1
  280. package/lib/esm/curve/CurveLocationDetail.d.ts +17 -5
  281. package/lib/esm/curve/CurveLocationDetail.d.ts.map +1 -1
  282. package/lib/esm/curve/CurveLocationDetail.js +12 -1
  283. package/lib/esm/curve/CurveLocationDetail.js.map +1 -1
  284. package/lib/esm/curve/CurveOps.d.ts +1 -1
  285. package/lib/esm/curve/CurveOps.js.map +1 -1
  286. package/lib/esm/curve/CurvePrimitive.d.ts +1 -2
  287. package/lib/esm/curve/CurvePrimitive.d.ts.map +1 -1
  288. package/lib/esm/curve/CurvePrimitive.js +2 -2
  289. package/lib/esm/curve/CurvePrimitive.js.map +1 -1
  290. package/lib/esm/curve/CurveProcessor.d.ts +1 -1
  291. package/lib/esm/curve/CurveProcessor.js.map +1 -1
  292. package/lib/esm/curve/{CurveChain.d.ts → CurveTypes.d.ts} +6 -6
  293. package/lib/esm/curve/CurveTypes.d.ts.map +1 -0
  294. package/lib/esm/curve/{CurveChain.js → CurveTypes.js} +1 -1
  295. package/lib/esm/curve/CurveTypes.js.map +1 -0
  296. package/lib/esm/curve/CurveWireMomentsXYZ.d.ts +1 -1
  297. package/lib/esm/curve/CurveWireMomentsXYZ.js.map +1 -1
  298. package/lib/esm/curve/ParityRegion.d.ts +3 -3
  299. package/lib/esm/curve/ParityRegion.d.ts.map +1 -1
  300. package/lib/esm/curve/ParityRegion.js +2 -2
  301. package/lib/esm/curve/ParityRegion.js.map +1 -1
  302. package/lib/esm/curve/Query/ConsolidateAdjacentPrimitivesContext.d.ts +3 -2
  303. package/lib/esm/curve/Query/ConsolidateAdjacentPrimitivesContext.d.ts.map +1 -1
  304. package/lib/esm/curve/Query/ConsolidateAdjacentPrimitivesContext.js +1 -1
  305. package/lib/esm/curve/Query/ConsolidateAdjacentPrimitivesContext.js.map +1 -1
  306. package/lib/esm/curve/Query/CurveSplitContext.d.ts +1 -1
  307. package/lib/esm/curve/Query/CurveSplitContext.js.map +1 -1
  308. package/lib/esm/curve/Query/CylindricalRange.d.ts +1 -1
  309. package/lib/esm/curve/Query/CylindricalRange.js.map +1 -1
  310. package/lib/esm/curve/Query/InOutTests.d.ts +1 -1
  311. package/lib/esm/curve/Query/InOutTests.js.map +1 -1
  312. package/lib/esm/curve/Query/StrokeCountChain.d.ts +1 -1
  313. package/lib/esm/curve/Query/StrokeCountChain.js.map +1 -1
  314. package/lib/esm/curve/RegionOps.d.ts +54 -5
  315. package/lib/esm/curve/RegionOps.d.ts.map +1 -1
  316. package/lib/esm/curve/RegionOps.js +153 -3
  317. package/lib/esm/curve/RegionOps.js.map +1 -1
  318. package/lib/esm/curve/RegionOpsClassificationSweeps.d.ts +1 -1
  319. package/lib/esm/curve/RegionOpsClassificationSweeps.js.map +1 -1
  320. package/lib/esm/curve/StrokeOptions.d.ts +20 -11
  321. package/lib/esm/curve/StrokeOptions.d.ts.map +1 -1
  322. package/lib/esm/curve/StrokeOptions.js +22 -11
  323. package/lib/esm/curve/StrokeOptions.js.map +1 -1
  324. package/lib/esm/curve/UnionRegion.d.ts +3 -3
  325. package/lib/esm/curve/UnionRegion.d.ts.map +1 -1
  326. package/lib/esm/curve/UnionRegion.js +2 -2
  327. package/lib/esm/curve/UnionRegion.js.map +1 -1
  328. package/lib/esm/curve/internalContexts/ClosestPointStrokeHandler.d.ts +1 -1
  329. package/lib/esm/curve/internalContexts/ClosestPointStrokeHandler.d.ts.map +1 -1
  330. package/lib/esm/curve/internalContexts/ClosestPointStrokeHandler.js +2 -2
  331. package/lib/esm/curve/internalContexts/ClosestPointStrokeHandler.js.map +1 -1
  332. package/lib/esm/curve/internalContexts/CurveCurveCloseApproachXY.d.ts +233 -0
  333. package/lib/esm/curve/internalContexts/CurveCurveCloseApproachXY.d.ts.map +1 -0
  334. package/lib/esm/curve/{CurveCurveCloseApproachXY.js → internalContexts/CurveCurveCloseApproachXY.js} +299 -202
  335. package/lib/esm/curve/internalContexts/CurveCurveCloseApproachXY.js.map +1 -0
  336. package/lib/{cjs/curve → esm/curve/internalContexts}/CurveCurveIntersectXY.d.ts +45 -51
  337. package/lib/esm/curve/internalContexts/CurveCurveIntersectXY.d.ts.map +1 -0
  338. package/lib/esm/curve/{CurveCurveIntersectXY.js → internalContexts/CurveCurveIntersectXY.js} +103 -113
  339. package/lib/esm/curve/internalContexts/CurveCurveIntersectXY.js.map +1 -0
  340. package/lib/esm/curve/{CurveCurveIntersectXYZ.d.ts → internalContexts/CurveCurveIntersectXYZ.d.ts} +18 -18
  341. package/lib/esm/curve/internalContexts/CurveCurveIntersectXYZ.d.ts.map +1 -0
  342. package/lib/esm/curve/{CurveCurveIntersectXYZ.js → internalContexts/CurveCurveIntersectXYZ.js} +134 -108
  343. package/lib/esm/curve/internalContexts/CurveCurveIntersectXYZ.js.map +1 -0
  344. package/lib/esm/curve/internalContexts/CurveOffsetXYHandler.d.ts +2 -2
  345. package/lib/esm/curve/internalContexts/CurveOffsetXYHandler.d.ts.map +1 -1
  346. package/lib/esm/curve/internalContexts/CurveOffsetXYHandler.js +9 -5
  347. package/lib/esm/curve/internalContexts/CurveOffsetXYHandler.js.map +1 -1
  348. package/lib/esm/curve/internalContexts/MultiChainCollector.d.ts +1 -1
  349. package/lib/esm/curve/internalContexts/MultiChainCollector.js.map +1 -1
  350. package/lib/esm/geometry3d/BarycentricTriangle.d.ts +1 -0
  351. package/lib/esm/geometry3d/BarycentricTriangle.d.ts.map +1 -1
  352. package/lib/esm/geometry3d/BarycentricTriangle.js +1 -0
  353. package/lib/esm/geometry3d/BarycentricTriangle.js.map +1 -1
  354. package/lib/esm/geometry3d/FrameBuilder.d.ts +28 -11
  355. package/lib/esm/geometry3d/FrameBuilder.d.ts.map +1 -1
  356. package/lib/esm/geometry3d/FrameBuilder.js +57 -45
  357. package/lib/esm/geometry3d/FrameBuilder.js.map +1 -1
  358. package/lib/esm/geometry3d/GeometryHandler.d.ts +15 -26
  359. package/lib/esm/geometry3d/GeometryHandler.d.ts.map +1 -1
  360. package/lib/esm/geometry3d/GeometryHandler.js +23 -32
  361. package/lib/esm/geometry3d/GeometryHandler.js.map +1 -1
  362. package/lib/esm/geometry3d/GrowableXYZArray.d.ts +0 -8
  363. package/lib/esm/geometry3d/GrowableXYZArray.d.ts.map +1 -1
  364. package/lib/esm/geometry3d/GrowableXYZArray.js +0 -16
  365. package/lib/esm/geometry3d/GrowableXYZArray.js.map +1 -1
  366. package/lib/esm/geometry3d/IndexedXYZCollection.d.ts +4 -4
  367. package/lib/esm/geometry3d/IndexedXYZCollection.d.ts.map +1 -1
  368. package/lib/esm/geometry3d/IndexedXYZCollection.js +12 -0
  369. package/lib/esm/geometry3d/IndexedXYZCollection.js.map +1 -1
  370. package/lib/esm/geometry3d/Matrix3d.d.ts.map +1 -1
  371. package/lib/esm/geometry3d/Matrix3d.js +3 -6
  372. package/lib/esm/geometry3d/Matrix3d.js.map +1 -1
  373. package/lib/esm/geometry3d/Point3dArrayCarrier.d.ts.map +1 -1
  374. package/lib/esm/geometry3d/Point3dArrayCarrier.js.map +1 -1
  375. package/lib/esm/geometry3d/Point3dVector3d.d.ts +1 -2
  376. package/lib/esm/geometry3d/Point3dVector3d.d.ts.map +1 -1
  377. package/lib/esm/geometry3d/Point3dVector3d.js +0 -1
  378. package/lib/esm/geometry3d/Point3dVector3d.js.map +1 -1
  379. package/lib/esm/geometry3d/PolygonOps.d.ts +2 -2
  380. package/lib/esm/geometry3d/PolygonOps.d.ts.map +1 -1
  381. package/lib/esm/geometry3d/PolygonOps.js +2 -3
  382. package/lib/esm/geometry3d/PolygonOps.js.map +1 -1
  383. package/lib/esm/geometry3d/Range.d.ts +1 -1
  384. package/lib/esm/geometry3d/Range.d.ts.map +1 -1
  385. package/lib/esm/geometry3d/Range.js +1 -1
  386. package/lib/esm/geometry3d/Range.js.map +1 -1
  387. package/lib/esm/geometry3d/Ray3d.d.ts +3 -1
  388. package/lib/esm/geometry3d/Ray3d.d.ts.map +1 -1
  389. package/lib/esm/geometry3d/Ray3d.js +4 -3
  390. package/lib/esm/geometry3d/Ray3d.js.map +1 -1
  391. package/lib/esm/geometry3d/ReusableObjectCache.d.ts +2 -1
  392. package/lib/esm/geometry3d/ReusableObjectCache.d.ts.map +1 -1
  393. package/lib/esm/geometry3d/ReusableObjectCache.js +1 -1
  394. package/lib/esm/geometry3d/ReusableObjectCache.js.map +1 -1
  395. package/lib/esm/geometry3d/SortablePolygon.d.ts +1 -1
  396. package/lib/esm/geometry3d/SortablePolygon.js.map +1 -1
  397. package/lib/esm/geometry3d/Transform.d.ts.map +1 -1
  398. package/lib/esm/geometry3d/Transform.js +4 -6
  399. package/lib/esm/geometry3d/Transform.js.map +1 -1
  400. package/lib/esm/geometry3d/YawPitchRollAngles.js +1 -1
  401. package/lib/esm/geometry3d/YawPitchRollAngles.js.map +1 -1
  402. package/lib/esm/geometry4d/Map4d.d.ts +14 -8
  403. package/lib/esm/geometry4d/Map4d.d.ts.map +1 -1
  404. package/lib/esm/geometry4d/Map4d.js +38 -16
  405. package/lib/esm/geometry4d/Map4d.js.map +1 -1
  406. package/lib/esm/geometry4d/Matrix4d.d.ts.map +1 -1
  407. package/lib/esm/geometry4d/Matrix4d.js +4 -2
  408. package/lib/esm/geometry4d/Matrix4d.js.map +1 -1
  409. package/lib/esm/geometry4d/Point4d.js.map +1 -1
  410. package/lib/esm/numerics/Polynomials.d.ts +2 -2
  411. package/lib/esm/numerics/Polynomials.d.ts.map +1 -1
  412. package/lib/esm/numerics/Polynomials.js +2 -2
  413. package/lib/esm/numerics/Polynomials.js.map +1 -1
  414. package/lib/esm/polyface/PolyfaceBuilder.d.ts +18 -6
  415. package/lib/esm/polyface/PolyfaceBuilder.d.ts.map +1 -1
  416. package/lib/esm/polyface/PolyfaceBuilder.js +55 -25
  417. package/lib/esm/polyface/PolyfaceBuilder.js.map +1 -1
  418. package/lib/esm/polyface/PolyfaceClip.d.ts +16 -7
  419. package/lib/esm/polyface/PolyfaceClip.d.ts.map +1 -1
  420. package/lib/esm/polyface/PolyfaceClip.js +38 -7
  421. package/lib/esm/polyface/PolyfaceClip.js.map +1 -1
  422. package/lib/esm/polyface/PolyfaceData.d.ts +5 -39
  423. package/lib/esm/polyface/PolyfaceData.d.ts.map +1 -1
  424. package/lib/esm/polyface/PolyfaceData.js +7 -41
  425. package/lib/esm/polyface/PolyfaceData.js.map +1 -1
  426. package/lib/esm/polyface/PolyfaceQuery.d.ts +10 -8
  427. package/lib/esm/polyface/PolyfaceQuery.d.ts.map +1 -1
  428. package/lib/esm/polyface/PolyfaceQuery.js +64 -18
  429. package/lib/esm/polyface/PolyfaceQuery.js.map +1 -1
  430. package/lib/esm/serialization/GeometrySamples.d.ts +6 -0
  431. package/lib/esm/serialization/GeometrySamples.d.ts.map +1 -1
  432. package/lib/esm/serialization/GeometrySamples.js +68 -2
  433. package/lib/esm/serialization/GeometrySamples.js.map +1 -1
  434. package/lib/esm/solid/LinearSweep.d.ts +1 -1
  435. package/lib/esm/solid/LinearSweep.js.map +1 -1
  436. package/lib/esm/solid/RotationalSweep.d.ts +1 -1
  437. package/lib/esm/solid/RotationalSweep.js.map +1 -1
  438. package/lib/esm/solid/RuledSweep.d.ts +1 -1
  439. package/lib/esm/solid/RuledSweep.js.map +1 -1
  440. package/lib/esm/solid/SweepContour.d.ts +35 -26
  441. package/lib/esm/solid/SweepContour.d.ts.map +1 -1
  442. package/lib/esm/solid/SweepContour.js +84 -100
  443. package/lib/esm/solid/SweepContour.js.map +1 -1
  444. package/lib/esm/topology/Graph.d.ts +29 -11
  445. package/lib/esm/topology/Graph.d.ts.map +1 -1
  446. package/lib/esm/topology/Graph.js +45 -26
  447. package/lib/esm/topology/Graph.js.map +1 -1
  448. package/lib/esm/topology/HalfEdgeMarkSet.d.ts +2 -2
  449. package/lib/esm/topology/HalfEdgeMarkSet.d.ts.map +1 -1
  450. package/lib/esm/topology/HalfEdgeMarkSet.js +2 -2
  451. package/lib/esm/topology/HalfEdgeMarkSet.js.map +1 -1
  452. package/lib/esm/topology/Merging.d.ts +3 -0
  453. package/lib/esm/topology/Merging.d.ts.map +1 -1
  454. package/lib/esm/topology/Merging.js +19 -5
  455. package/lib/esm/topology/Merging.js.map +1 -1
  456. package/lib/esm/topology/Triangulation.d.ts +15 -7
  457. package/lib/esm/topology/Triangulation.d.ts.map +1 -1
  458. package/lib/esm/topology/Triangulation.js +89 -47
  459. package/lib/esm/topology/Triangulation.js.map +1 -1
  460. package/package.json +4 -4
  461. package/lib/cjs/curve/CurveChain.d.ts.map +0 -1
  462. package/lib/cjs/curve/CurveChain.js.map +0 -1
  463. package/lib/cjs/curve/CurveCurveCloseApproachXY.d.ts +0 -175
  464. package/lib/cjs/curve/CurveCurveCloseApproachXY.d.ts.map +0 -1
  465. package/lib/cjs/curve/CurveCurveCloseApproachXY.js.map +0 -1
  466. package/lib/cjs/curve/CurveCurveIntersectXY.d.ts.map +0 -1
  467. package/lib/cjs/curve/CurveCurveIntersectXY.js.map +0 -1
  468. package/lib/cjs/curve/CurveCurveIntersectXYZ.d.ts.map +0 -1
  469. package/lib/cjs/curve/CurveCurveIntersectXYZ.js.map +0 -1
  470. package/lib/esm/curve/CurveChain.d.ts.map +0 -1
  471. package/lib/esm/curve/CurveChain.js.map +0 -1
  472. package/lib/esm/curve/CurveCurveCloseApproachXY.d.ts +0 -175
  473. package/lib/esm/curve/CurveCurveCloseApproachXY.d.ts.map +0 -1
  474. package/lib/esm/curve/CurveCurveCloseApproachXY.js.map +0 -1
  475. package/lib/esm/curve/CurveCurveIntersectXY.d.ts.map +0 -1
  476. package/lib/esm/curve/CurveCurveIntersectXY.js.map +0 -1
  477. package/lib/esm/curve/CurveCurveIntersectXYZ.d.ts.map +0 -1
  478. package/lib/esm/curve/CurveCurveIntersectXYZ.js.map +0 -1
@@ -5,6 +5,7 @@
5
5
  /** @packageDocumentation
6
6
  * @module Curve
7
7
  */
8
+ import { assert } from "@itwin/core-bentley";
8
9
  import { CurvePrimitive } from "../curve/CurvePrimitive";
9
10
  import { StrokeCountMap } from "../curve/Query/StrokeCountMap";
10
11
  import { Geometry } from "../Geometry";
@@ -17,14 +18,14 @@ import { PlaneAltitudeRangeContext } from "./internalContexts/PlaneAltitudeRange
17
18
  import { OffsetOptions } from "./OffsetOptions";
18
19
  import { Path } from "./Path";
19
20
  /**
20
- * Annotation of an interval of a curve.
21
+ * Annotation of a fragment, i.e. an interval of a curve.
21
22
  * * The interval is marked with two pairs of numbers:
22
- * * * fraction0, fraction1 = fraction parameters along the child curve
23
- * * * distance0,distance1 = distances within containing CurveChainWithDistanceIndex
23
+ * * * fraction0, fraction1 = fraction parameters along the child curve.
24
+ * * * distance0, distance1 = distances within containing CurveChainWithDistanceIndex.
24
25
  * @public
25
26
  */
26
27
  export class PathFragment {
27
- /** Create a fragment with complete fraction, distance and child data. */
28
+ /** Create a fragment with complete fraction, distance, and child data. */
28
29
  constructor(childFraction0, childFraction1, distance0, distance1, childCurve, range) {
29
30
  this.childFraction0 = childFraction0;
30
31
  this.childFraction1 = childFraction1;
@@ -34,68 +35,64 @@ export class PathFragment {
34
35
  this.range = range;
35
36
  this.a = 0;
36
37
  }
37
- /**
38
- * Return true if the distance is within the distance limits of this fragment.
39
- * @param distance
40
- */
38
+ /** Return true if the distance is within the distance limits of this fragment. */
41
39
  containsChainDistance(distance) {
42
40
  return distance >= this.chainDistance0 && distance <= this.chainDistance1;
43
41
  }
44
- /** Return a quick distance to the curve. This may be SMALLER than true distance but may not be larger */
42
+ /**
43
+ * Return a quick minimum distance from spacePoint to the curve.
44
+ * * The returned distance is to the curve's range box if defined; otherwise, the true distance is computed.
45
+ * * Thus the returned distance may be SMALLER than the true distance to the curve, but not larger.
46
+ */
45
47
  quickMinDistanceToChildCurve(spacePoint) {
46
- if (this.range) {
48
+ if (this.range)
47
49
  return this.range.distanceToPoint(spacePoint);
48
- }
49
- // ugh. have to do real computation ..
50
50
  const detail = this.childCurve.closestPoint(spacePoint, false);
51
51
  if (detail)
52
52
  return detail.a;
53
53
  return 0;
54
54
  }
55
55
  /**
56
- * Return an array with (references to) all the path fragments, sorted smallest to largest on the "a" value
57
- * equal to the quick min distance to the fragment
56
+ * Return an array with (references to) all the input path fragments, sorted smallest to largest on the "a" value,
57
+ * initialized with `quickMinDistanceToChildCurve`
58
58
  */
59
59
  static collectSortedQuickMinDistances(fragments, spacePoint) {
60
60
  const sortedFragments = [];
61
- for (const f of fragments) {
62
- f.a = f.quickMinDistanceToChildCurve(spacePoint);
63
- sortedFragments.push(f);
61
+ for (const frag of fragments) {
62
+ frag.a = frag.quickMinDistanceToChildCurve(spacePoint);
63
+ sortedFragments.push(frag);
64
64
  }
65
- sortedFragments.sort((a, b) => a.a - b.a);
65
+ sortedFragments.sort((frag1, frag2) => frag1.a - frag2.a);
66
66
  return sortedFragments;
67
67
  }
68
- /**
69
- * Return true if this fragment addresses `curve` and brackets `fraction`
70
- * @param distance
71
- */
68
+ /** Return true if `this` fragment addresses `curve` and brackets `fraction`. */
72
69
  containsChildCurveAndChildFraction(curve, fraction) {
73
70
  return this.childCurve === curve && fraction >= this.childFraction0 && fraction <= this.childFraction1;
74
71
  }
75
72
  /**
76
- * Convert distance to local fraction, and apply that to interpolate between the stored curve fractions.
77
- * Note that proportional calculation does NOT account for nonuniform parameterization in the child curve.
73
+ * Convert distance to local fraction and apply that to interpolate between the stored curve fractions.
74
+ * Note that proportional calculation does NOT account for non-uniform parameterization in the child curve.
78
75
  */
79
76
  chainDistanceToInterpolatedChildFraction(distance) {
80
- return Geometry.inverseInterpolate(this.childFraction0, this.chainDistance0, this.childFraction1, this.chainDistance1, distance, this.childFraction0); // the interval "must" have nonzero length, division should be safe . ..
77
+ return Geometry.inverseInterpolate(this.childFraction0, this.chainDistance0, this.childFraction1, this.chainDistance1, distance, this.childFraction0); // the interval must have nonzero length so division should be safe
81
78
  }
82
- /** Convert chainDistance to true chidFraction, using detailed moveSignedDistanceFromFraction */
79
+ /** Convert the given chainDistance to a fraction along this childCurve using `moveSignedDistanceFromFraction`. */
83
80
  chainDistanceToAccurateChildFraction(chainDistance, allowExtrapolation) {
84
- // The fragments are really expected to do good mappings in their distance range ...
85
81
  const childDetail = this.childCurve.moveSignedDistanceFromFraction(this.childFraction0, chainDistance - this.chainDistance0, allowExtrapolation ?? false);
86
82
  return childDetail.fraction;
87
83
  }
88
84
  /**
89
- * Return the scale factor to map childCurve fraction derivatives to chain fraction derivatives
90
- * @param globalDistance total length of the global curve.
85
+ * Return the scale factor to map childCurve fraction derivatives to chain fraction derivatives.
86
+ * @param globalDistance total length of the global curve
91
87
  */
92
88
  fractionScaleFactor(globalDistance) {
93
89
  return globalDistance * (this.childFraction1 - this.childFraction0) / (this.chainDistance1 - this.chainDistance0);
94
90
  }
95
91
  /**
96
92
  * Reverse the fraction and distance data.
97
- * * each child fraction `f` is replaced by `1-f`
98
- * * each `chainDistance` is replaced by `totalDistance-chainDistance`
93
+ * * Each child fraction `f` is replaced by `1-f`
94
+ * * Each `chainDistance` is replaced by `totalDistance - chainDistance`
95
+ * @param totalDistance the total distance
99
96
  */
100
97
  reverseFractionsAndDistances(totalDistance) {
101
98
  const f0 = this.childFraction0;
@@ -107,14 +104,14 @@ export class PathFragment {
107
104
  this.chainDistance0 = totalDistance - d1;
108
105
  this.chainDistance1 = totalDistance - d0;
109
106
  }
110
- /** @deprecated in 3.x. Use childFractionToChainDistance */
107
+ /** @deprecated in 3.x. Use `PathFragment.childFractionToChainDistance`. */
111
108
  childFractionTChainDistance(fraction) {
112
109
  return this.childFractionToChainDistance(fraction);
113
110
  }
114
111
  /**
115
- * Convert a fractional position on the childCurve to distance in the chain space.
116
- * * Return value is SIGNED -- will be negative when fraction < this.childFraction0.
117
- * @param fraction fraction along the curve within this fragment
112
+ * Convert a fractional position on the childCurve of this fragment to distance on the curve chain.
113
+ * * Return value is SIGNED and will be negative when `fraction < this.childFraction0`.
114
+ * @param fraction the fractional position on the childCurve of this fragment
118
115
  */
119
116
  childFractionToChainDistance(fraction) {
120
117
  let d = this.childCurve.curveLengthBetweenFractions(this.childFraction0, fraction);
@@ -123,7 +120,7 @@ export class PathFragment {
123
120
  return this.chainDistance0 + d;
124
121
  }
125
122
  }
126
- /** Non-instantiable class to build a distance index for a path. */
123
+ /** Non-instantiable class to build a distance index for a curve chain. */
127
124
  class DistanceIndexConstructionContext {
128
125
  constructor() {
129
126
  this._accumulatedDistance = 0;
@@ -135,7 +132,6 @@ class DistanceIndexConstructionContext {
135
132
  endParentCurvePrimitive(_cp) { }
136
133
  endCurvePrimitive(_cp) { }
137
134
  announcePointTangent(_xyz, _fraction, _tangent) { }
138
- /** Announce numPoints interpolated between point0 and point1, with associated fractions */
139
135
  announceSegmentInterval(cp, point0, point1, numStrokes, fraction0, fraction1) {
140
136
  const fragmentPoint0 = point0.clone();
141
137
  const fragmentPoint1 = point1.clone();
@@ -167,7 +163,10 @@ class DistanceIndexConstructionContext {
167
163
  this._fragments.push(new PathFragment(f0, f1, d0, this._accumulatedDistance, cp, range));
168
164
  }
169
165
  }
170
- needPrimaryGeometryForStrokes() { return true; }
166
+ needPrimaryGeometryForStrokes() {
167
+ return true;
168
+ }
169
+ /** Create an array of PathFragment from input curve chain. */
171
170
  static createPathFragmentIndex(path, options) {
172
171
  const handler = new DistanceIndexConstructionContext();
173
172
  for (const curve of path.children) {
@@ -182,12 +181,11 @@ class DistanceIndexConstructionContext {
182
181
  * distance along a CurveChain.
183
182
  * * For example if the total length of the chain is `L`, then the distance along the chain from parameters `t0`
184
183
  * to `t1` is easily computed as `L*(t1-t0)`.
185
- * * The curve chain can be any type derived from CurveChain.
186
- * * * i.e. either a `Path` or a `Loop`
184
+ * * The curve chain can be any type derived from `CurveChain`, i.e., either a `Path` or a `Loop`.
187
185
  * @public
188
186
  */
189
187
  class CurveChainWithDistanceIndex extends CurvePrimitive {
190
- /** Test if other is a `CurveChainWithDistanceIndex` */
188
+ /** Test if `other` is a `CurveChainWithDistanceIndex` */
191
189
  isSameGeometryClass(other) {
192
190
  return other instanceof CurveChainWithDistanceIndex;
193
191
  }
@@ -212,7 +210,7 @@ class CurveChainWithDistanceIndex extends CurvePrimitive {
212
210
  }
213
211
  /**
214
212
  * Reference to the contained path.
215
- * * Do not modify the path. The distance index will be wrong.
213
+ * * Do not modify the path. The distance index will be wrong.
216
214
  */
217
215
  get path() {
218
216
  return this._path;
@@ -306,14 +304,14 @@ class CurveChainWithDistanceIndex extends CurvePrimitive {
306
304
  }
307
305
  return true;
308
306
  }
309
- /** Return the start point of the primitive. The default implementation returns fractionToPoint (0.0) */
307
+ /** Return the start point of `this` curve. */
310
308
  startPoint(result) {
311
309
  const c = this._path.cyclicCurvePrimitive(0);
312
310
  if (c)
313
311
  return c.startPoint(result);
314
312
  return Point3d.createZero(result);
315
313
  }
316
- /** Return the end point of the primitive. The default implementation returns fractionToPoint(1.0) */
314
+ /** Return the end point of of `this` curve. */
317
315
  endPoint(result) {
318
316
  const c = this._path.cyclicCurvePrimitive(-1);
319
317
  if (c)
@@ -349,7 +347,7 @@ class CurveChainWithDistanceIndex extends CurvePrimitive {
349
347
  /**
350
348
  * Return an array containing only the curve primitives.
351
349
  * @param collectorArray array to receive primitives (pushed -- the array is not cleared)
352
- * @param smallestPossiblePrimitives if true, recurse on the (otherwise hidden) children. If false, only push `this`.
350
+ * @param smallestPossiblePrimitives if true, recurse on the children. If false, only push `this`.
353
351
  * @param explodeLinestrings (if smallestPossiblePrimitives is true) whether to push a [[LineSegment3d]] for each
354
352
  * segment of a [[LineString3d]] child. If false, push only the [[LineString3d]].
355
353
  */
@@ -376,21 +374,17 @@ class CurveChainWithDistanceIndex extends CurvePrimitive {
376
374
  CurvePrimitive.installStrokeCountMap(this, myMap, parentStrokeMap);
377
375
  }
378
376
  /**
379
- * Second step of double dispatch: call `this._path.dispatchToGeometryHandler (handler)`
377
+ * Second step of double dispatch: call `this._path.dispatchToGeometryHandler (handler)`
380
378
  * * Note that this exposes the children individually to the handler.
381
379
  */
382
380
  dispatchToGeometryHandler(handler) {
383
- return this._path.dispatchToGeometryHandler(handler);
381
+ return handler.handleCurveChainWithDistanceIndex(this);
384
382
  }
385
- /** Extend (increase) `rangeToExtend` as needed to include these curves (optionally transformed) */
383
+ /** Extend `rangeToExtend` as needed to include these curves (optionally transformed) */
386
384
  extendRange(rangeToExtend, transform) {
387
385
  this._path.extendRange(rangeToExtend, transform);
388
386
  }
389
- /**
390
- * Curve length is always positive.
391
- * @returns Returns a (high accuracy) length of the curve between fractional positions
392
- * @returns Returns the length of the curve.
393
- */
387
+ /** Return a (high accuracy and positive) length of the curve between fractional positions */
394
388
  curveLengthBetweenFractions(fraction0, fraction1) {
395
389
  return Math.abs(fraction1 - fraction0) * this._totalLength;
396
390
  }
@@ -404,9 +398,10 @@ class CurveChainWithDistanceIndex extends CurvePrimitive {
404
398
  return result;
405
399
  }
406
400
  /**
407
- * Resolve a fraction of the CurveChain to a PathFragment
408
- * @param distance
409
- * @param allowExtrapolation
401
+ * Return the PathFragment object at the given `distance` along the chain.
402
+ * @param distance distance along the chain.
403
+ * @param allowExtrapolation if `true`, returns first fragment for negative distances and returns last fragment
404
+ * for distances larger than curve length. If `false` returns `undefined` for those out of bound distances.
410
405
  */
411
406
  chainDistanceToFragment(distance, allowExtrapolation = false) {
412
407
  const i = this.chainDistanceToFragmentIndex(distance, allowExtrapolation);
@@ -415,9 +410,10 @@ class CurveChainWithDistanceIndex extends CurvePrimitive {
415
410
  return undefined;
416
411
  }
417
412
  /**
418
- * Resolve a fraction of the CurveChain to a PathFragment index
419
- * @param distance
420
- * @param allowExtrapolation
413
+ * Return the index of the PathFragment at the given `distance` along the chain.
414
+ * @param distance distance along the chain.
415
+ * @param allowExtrapolation if `true`, returns 0 for negative distances and returns last fragment index for
416
+ * distances larger than curve length. If `false` returns `undefined` for those out of bound distances.
421
417
  */
422
418
  chainDistanceToFragmentIndex(distance, allowExtrapolation = false) {
423
419
  const numFragments = this._fragments.length;
@@ -427,7 +423,7 @@ class CurveChainWithDistanceIndex extends CurvePrimitive {
427
423
  return allowExtrapolation ? 0 : undefined;
428
424
  if (distance > this._totalLength)
429
425
  return allowExtrapolation ? (numFragments - 1) : undefined;
430
- // humbug, linear search
426
+ // linear search (opportunity for improvement)
431
427
  for (let i = 0; i < numFragments; i++) {
432
428
  if (fragments[i].containsChainDistance(distance))
433
429
  return i;
@@ -437,33 +433,29 @@ class CurveChainWithDistanceIndex extends CurvePrimitive {
437
433
  }
438
434
  /**
439
435
  * Convert distance along the chain to fraction along the chain.
440
- * @param distance distance along the chain
436
+ * @param distance distance along the chain.
441
437
  */
442
438
  chainDistanceToChainFraction(distance) {
443
439
  return distance / this._totalLength;
444
440
  }
445
- /**
446
- * Resolve a fraction within a specific curve to a fragment.
447
- * @param curve
448
- * @param fraction
449
- */
441
+ /** Return the PathFragment object containing the point at the given `fraction` of the given child curve. */
450
442
  curveAndChildFractionToFragment(curve, fraction) {
451
443
  const numFragments = this._fragments.length;
452
444
  const fragments = this._fragments;
453
445
  if (numFragments > 0) {
454
- // humbug, linear search
446
+ if (fraction < 0)
447
+ return fragments[0];
448
+ if (fraction > 1.0)
449
+ return fragments[numFragments - 1];
450
+ // linear search (opportunity for improvement)
455
451
  for (const fragment of fragments) {
456
452
  if (fragment.containsChildCurveAndChildFraction(curve, fraction))
457
453
  return fragment;
458
454
  }
459
- if (fraction <= 0)
460
- return fragments[0];
461
- if (fraction > 1.0)
462
- return fragments[numFragments - 1];
463
455
  }
464
456
  return undefined;
465
457
  }
466
- /** Returns the total length of curves. */
458
+ /** Returns the total length of `this` curve. */
467
459
  curveLength() {
468
460
  return this._totalLength;
469
461
  }
@@ -476,52 +468,59 @@ class CurveChainWithDistanceIndex extends CurvePrimitive {
476
468
  }
477
469
  /**
478
470
  * Return the point (x,y,z) on the curve at fractional position along the chain.
479
- * @param fraction fractional position along the geometry.
480
- * @returns Returns a point on the curve.
471
+ * @param fraction fractional position along the curve.
472
+ * @returns a point on the curve.
481
473
  */
482
474
  fractionToPoint(fraction, result) {
483
- const chainDistance = fraction * this._totalLength;
484
- const fragment = this.chainDistanceToFragment(chainDistance, true);
475
+ const distanceAlongPath = fraction * this._totalLength;
476
+ const fragment = this.chainDistanceToFragment(distanceAlongPath, true);
485
477
  if (fragment) {
486
- const childFraction = fragment.chainDistanceToAccurateChildFraction(chainDistance, true);
478
+ const childFraction = fragment.chainDistanceToAccurateChildFraction(distanceAlongPath, true);
487
479
  return fragment.childCurve.fractionToPoint(childFraction, result);
488
480
  }
489
- // no fragment found. Use _fragments[0]
490
- // fragment = this.chainDistanceToFragment(chainDistance, true);
481
+ assert(false); // we never expect to get here
482
+ // no fragment found. just return the first point on the curve.
491
483
  return this._fragments[0].childCurve.fractionToPoint(0.0, result);
492
484
  }
493
485
  /**
494
486
  * Return the point (x,y,z) and derivative on the curve at fractional position.
495
- * * Note that this derivative is "derivative of xyz with respect to fraction."
496
- * * this derivative shows the speed of the "fractional point" moving along the curve.
497
- * * this is not generally a unit vector. use fractionToPointAndUnitTangent for a unit vector.
487
+ * * Note that the derivative is "derivative of xyz with respect to fraction".
488
+ * * The derivative shows the speed of the "fractional point" moving along the curve.
489
+ * * The derivative is not generally a unit vector. Use `fractionToPointAndUnitTangent` for a unit vector.
498
490
  * @param fraction fractional position along the geometry.
499
- * @returns Returns a ray whose origin is the curve point and direction is the derivative with respect to the fraction.
491
+ * @param result optional receiver for the result.
492
+ * @returns a ray whose origin is the curve point and direction is the derivative with respect to the fraction.
500
493
  */
501
494
  fractionToPointAndDerivative(fraction, result) {
502
495
  const distanceAlongPath = fraction * this._totalLength;
503
496
  const fragment = this.chainDistanceToFragment(distanceAlongPath, true);
504
- const curveFraction = fragment.chainDistanceToAccurateChildFraction(distanceAlongPath, true);
505
- result = fragment.childCurve.fractionToPointAndDerivative(curveFraction, result);
506
- // Fractional arc length parameterization for the curve C is f=f(t)=s(t)/L, where
507
- // L is total length of C, f'=||C'||/L, and inverse t=t(f), t'=1/f'=L/||C'||.
508
- // Then d/df(C(t(f)))=C't'=C'L/||C'||. The fragment gave us C', so the
509
- // derivative we seek is just a scale away.
510
- const a = this._totalLength / result.direction.magnitude();
497
+ const childFraction = fragment.chainDistanceToAccurateChildFraction(distanceAlongPath, true);
498
+ result = fragment.childCurve.fractionToPointAndDerivative(childFraction, result);
499
+ // Recall the standard arclength formula s(t) for the curve C = C(t), with derivative s'(t) = ||C'||.
500
+ // Define fractional arclength for C by f = f(t) = s(t)/L, where L is the total length of C. Then f' = ||C'||/L.
501
+ // Denote the inverse of f by t = t(f). Then C = C(t(f)) is a parameterization of C by its fractional arclength f.
502
+ // Since the derivative of t is t'=1/f'=L/||C'||, the derivative we seek is d/df(C(t(f))) = C' t' = C' L/||C'||.
503
+ // The fragment gives us C', so we're just a scale away.
504
+ // Math details can be found at core/geometry/internaldocs/Curve.md
505
+ const a = this._totalLength / result.direction.magnitude(); // L/||C'||
511
506
  result.direction.scaleInPlace(a);
512
507
  return result;
513
508
  }
514
509
  /**
515
- * Returns a ray whose origin is the curve point and direction is the unit tangent.
510
+ * Return the point (x,y,z) and normalized derivative on the curve at fractional position.
511
+ * * Note that the derivative is "derivative of xyz with respect to fraction".
512
+ * * The un-normalized derivative shows the speed of the "fractional point" moving along the curve.
513
+ * * To find the un-normalized derivative, use `fractionToPointAndDerivative`.
516
514
  * @param fraction fractional position on the curve
517
515
  * @param result optional receiver for the result.
518
- * Returns a ray whose origin is the curve point and direction is the unit tangent.
516
+ * @returns a ray whose origin is the curve point and direction is the normalized derivative with respect to
517
+ * the fraction.
519
518
  */
520
519
  fractionToPointAndUnitTangent(fraction, result) {
521
520
  const distanceAlongPath = fraction * this._totalLength;
522
521
  const fragment = this.chainDistanceToFragment(distanceAlongPath, true);
523
- const curveFraction = fragment.chainDistanceToAccurateChildFraction(distanceAlongPath, true);
524
- result = fragment.childCurve.fractionToPointAndDerivative(curveFraction, result);
522
+ const childFraction = fragment.chainDistanceToAccurateChildFraction(distanceAlongPath, true);
523
+ result = fragment.childCurve.fractionToPointAndDerivative(childFraction, result);
525
524
  result.direction.normalizeInPlace();
526
525
  return result;
527
526
  }
@@ -530,34 +529,39 @@ class CurveChainWithDistanceIndex extends CurvePrimitive {
530
529
  * * origin at fractional position along the curve
531
530
  * * vectorU is the first derivative, i.e. tangent vector with length equal to the rate of change with respect to
532
531
  * the fraction.
533
- * * vectorV is the second derivative, i.e.derivative of vectorU.
532
+ * * vectorV is the second derivative, i.e. derivative of vectorU which points in the direction of the curve's
533
+ * derivative's change.
534
534
  */
535
535
  fractionToPointAnd2Derivatives(fraction, result) {
536
536
  const distanceAlongPath = fraction * this._totalLength;
537
537
  const fragment = this.chainDistanceToFragment(distanceAlongPath, true);
538
- const curveFraction = fragment.chainDistanceToAccurateChildFraction(distanceAlongPath, true);
539
- result = fragment.childCurve.fractionToPointAnd2Derivatives(curveFraction, result);
538
+ const childFraction = fragment.chainDistanceToAccurateChildFraction(distanceAlongPath, true);
539
+ result = fragment.childCurve.fractionToPointAnd2Derivatives(childFraction, result);
540
540
  if (!result)
541
541
  return undefined;
542
- // See fractionToPointAndDerivative for derivation of d/df(C(t(f)))=L C'/||C'||.
543
- // For the 2nd deriv, use quotient rule, d/dt||x(t)||=x.x'/||x|| and ||x||^2=x.x :
544
- // d/df(C'(t(f))) = L d/df(C'/||C'||)
545
- // = L (||C'|| d/df(C') - C' d/df||C'||) / ||C'||^2
542
+ // See fractionToPointAndDerivative, where we show d/df(C(t(f))) = L C'/||C'||.
543
+ // Here we seek the 2nd derivative. We'll use the quotient rule, and the identities
544
+ // d/dt||x(t)|| = x.x'/||x|| and ||x||^2 = x.x, where "." is the dot product.
545
+ // d2/df2(C(t(f))) = L d/df(C'/||C'||) = L (||C'|| d/df(C') - C' d/df||C'||) / ||C'||^2
546
546
  // = L (||C'|| C" L/||C'|| - C' C'.C"/||C'|| L/||C'||) / ||C'||^2
547
- // = (L/||C'||)^2 (C" - C' C'.C"/C'.C' )
548
- // We have C' and C" from the fragment.
549
- const magU = result.vectorU.magnitude();
550
- const dotUU = magU * magU;
551
- const dotUV = result.vectorU.dotProduct(result.vectorV);
552
- result.vectorV.addScaledInPlace(result.vectorU, -dotUV / dotUU);
553
- const scale = this._totalLength / magU;
554
- result.vectorU.scaleInPlace(scale);
555
- result.vectorV.scaleInPlace(scale * scale);
547
+ // = (L/||C'||)^2 (C" - C' C'.C"/C'.C' ), where C' and C" are given by the fragment.
548
+ // The second derivative that fractionToPointAnd2Derivatives returns is C", so the second
549
+ // derivative we seek is just few scales away.
550
+ // Math details can be found at core/geometry/internaldocs/Curve.md
551
+ const magU = result.vectorU.magnitude(); // ||C'||
552
+ const dotUU = magU * magU; // ||C'||^2
553
+ const dotUV = result.vectorU.dotProduct(result.vectorV); // C'.C"
554
+ result.vectorV.addScaledInPlace(result.vectorU, -dotUV / dotUU); // add -(C'*C'.C")/(||C'||^2) to vectorV
555
+ const scale = this._totalLength / magU; // L/||C'||
556
+ result.vectorU.scaleInPlace(scale); // scale vectorU by L/||C'||
557
+ result.vectorV.scaleInPlace(scale * scale); // scale vectorV by (L/||C'(t)||)^2
556
558
  return result;
557
559
  }
558
560
  /**
559
561
  * Attempt to transform in place.
560
- * * Warning: If any child fails, this object becomes invalid. But that should never happen.
562
+ * * Warning: If any child transform fails, `this` object becomes invalid but that should never happen.
563
+ * @param transform the transform to be applied.
564
+ * @returns true if all of child transforms succeed and false otherwise.
561
565
  */
562
566
  tryTransformInPlace(transform) {
563
567
  let numFail = 0;
@@ -570,48 +574,45 @@ class CurveChainWithDistanceIndex extends CurvePrimitive {
570
574
  /** Reverse the curve's data so that its fractional stroking moves in the opposite direction. */
571
575
  reverseInPlace() {
572
576
  this._path.reverseChildrenInPlace();
573
- const totalLength = this._totalLength;
574
577
  for (const fragment of this._fragments) {
575
- fragment.reverseFractionsAndDistances(totalLength);
578
+ fragment.reverseFractionsAndDistances(this._totalLength);
576
579
  }
577
580
  this._fragments.reverse();
578
581
  }
579
582
  /**
580
- * Test for equality conditions:
581
- * * Mismatched totalLength is a quick exit condition
582
- * * If totalLength matches, recurse to the path for matching primitives.
583
- * @param other
583
+ * Test for equality conditions.
584
+ * * Mismatched total length is a quick exit condition.
585
+ * * If total length matches, recurse to the path for matching primitives.
584
586
  */
585
587
  isAlmostEqual(other) {
586
588
  if (other instanceof CurveChainWithDistanceIndex) {
587
- return Geometry.isSameCoordinate(this._totalLength, other._totalLength)
588
- && this._path.isAlmostEqual(other._path);
589
+ return Geometry.isSameCoordinate(this._totalLength, other._totalLength) && this._path.isAlmostEqual(other._path);
589
590
  }
590
591
  return false;
591
592
  }
592
593
  /**
593
- * Implement moveSignedDistanceFromFraction.
594
- * * See `CurvePrimitive` for parameter details.
595
- * * The returned location directly identifies fractional position along the CurveChainWithDistanceIndex, and
594
+ * (Attempt to) find a position on the curve at a signed distance from start fraction.
595
+ * * See `CurvePrimitive.moveSignedDistanceFromFraction` for parameter details.
596
+ * * The returned location directly identifies fractional position along the CurveChainWithDistanceIndex and
596
597
  * has pointer to an additional detail for the child curve.
597
598
  */
598
599
  moveSignedDistanceFromFraction(startFraction, signedDistance, allowExtension, result) {
599
600
  const distanceA = startFraction * this._totalLength;
600
601
  const distanceB = distanceA + signedDistance;
601
602
  const fragmentB = this.chainDistanceToFragment(distanceB, true);
602
- const childDetail = fragmentB.childCurve.moveSignedDistanceFromFraction(fragmentB.childFraction0, distanceB - fragmentB.chainDistance0, allowExtension, result);
603
+ const childDetail = fragmentB.childCurve.moveSignedDistanceFromFraction(fragmentB.childFraction0, distanceB - fragmentB.chainDistance0, allowExtension, result); // local detail related to the child curve
603
604
  const endFraction = startFraction + (signedDistance / this._totalLength);
604
- const chainDetail = CurveLocationDetail.createConditionalMoveSignedDistance(allowExtension, this, startFraction, endFraction, signedDistance, result);
605
+ const chainDetail = CurveLocationDetail.createConditionalMoveSignedDistance(allowExtension, this, startFraction, endFraction, signedDistance, result); // global detail related to the curve chain
605
606
  chainDetail.childDetail = childDetail;
606
607
  return chainDetail;
607
608
  }
608
609
  /**
610
+ * Return an object summarizing closest point test counts.
609
611
  * The returned object has
610
612
  * * numCalls = number of times closestPoint was called.
611
- * * numCurvesTested = number of curves tested with full closestPoint
612
- * * numAssigned = number of times a new minimum value was recorded
613
+ * * numCurvesTested = number of curves tested with full closestPoint.
614
+ * * numAssigned = number of times a new minimum value was recorded.
613
615
  * * numCandidate = number of curves that would be tested in worst case.
614
- * return an object summarizing closest point test counts
615
616
  * @param clear if true, counts are cleared after the return object is formed.
616
617
  */
617
618
  static getClosestPointTestCounts(clear = true) {
@@ -628,13 +629,13 @@ class CurveChainWithDistanceIndex extends CurvePrimitive {
628
629
  }
629
630
  /**
630
631
  * Search for the curve point that is closest to the spacePoint.
631
- * * The CurveChainWithDistanceIndex invokes the base class CurvePrimitive method, which
632
- * (via a handler) determines a CurveLocation detail among the children.
633
- * * The returned detail directly identifies fractional position along the CurveChainWithDistanceIndex, and
632
+ * * The CurveChainWithDistanceIndex invokes the base class CurvePrimitive method, which (via a handler)
633
+ * determines a CurveLocation detail among the children.
634
+ * * The returned detail directly identifies fractional position along the CurveChainWithDistanceIndex and
634
635
  * has pointer to an additional detail for the child curve.
635
636
  * @param spacePoint point in space
636
637
  * @param extend true to extend the curve
637
- * @returns Returns a CurveLocationDetail structure that holds the details of the close point.
638
+ * @returns a CurveLocationDetail structure that holds the details of the close point.
638
639
  */
639
640
  closestPoint(spacePoint, extend) {
640
641
  let childDetail;
@@ -645,44 +646,43 @@ class CurveChainWithDistanceIndex extends CurvePrimitive {
645
646
  }
646
647
  else {
647
648
  const sortedFragments = PathFragment.collectSortedQuickMinDistances(this._fragments, spacePoint);
648
- const extend0 = [CurveExtendOptions.resolveVariantCurveExtendParameterToCurveExtendMode(extend, 0), CurveExtendMode.None];
649
- const extend1 = [CurveExtendMode.None, CurveExtendOptions.resolveVariantCurveExtendParameterToCurveExtendMode(extend, 1)];
649
+ const extend0 = [
650
+ CurveExtendOptions.resolveVariantCurveExtendParameterToCurveExtendMode(extend, 0),
651
+ CurveExtendMode.None,
652
+ ];
653
+ const extend1 = [
654
+ CurveExtendMode.None,
655
+ CurveExtendOptions.resolveVariantCurveExtendParameterToCurveExtendMode(extend, 1),
656
+ ];
650
657
  const fragment0 = this._fragments[0];
651
658
  const fragment1 = this._fragments[this._fragments.length - 1];
652
659
  CurveChainWithDistanceIndex._numCalls++;
653
660
  CurveChainWithDistanceIndex._numCandidate += sortedFragments.length;
654
- for (const f of sortedFragments) {
655
- if (f.a > aMin)
661
+ let detailA;
662
+ for (const sortedFragment of sortedFragments) {
663
+ if (sortedFragment.a > aMin)
664
+ // sortedFragments help early exit because it is likely that one of the first few fragments
665
+ // in sortedFragments is the fragment with minimum distance from space point to the curve.
656
666
  break;
657
667
  CurveChainWithDistanceIndex._numTested++;
658
- const child = f.childCurve;
659
- const detailA = child.closestPoint(spacePoint, f === fragment0 ? extend0 : f === fragment1 ? extend1 : false);
668
+ const child = sortedFragment.childCurve;
669
+ detailA = child.closestPoint(spacePoint, sortedFragment === fragment0 ? extend0 : sortedFragment === fragment1 ? extend1 : false, detailA);
660
670
  if (detailA && detailA.a < aMin) {
661
671
  aMin = detailA.a;
662
- childDetail = CurveLocationDetail.createCurveFractionPoint(detailA.curve, detailA.fraction, detailA.point, childDetail);
663
- childDetail.a = detailA.a;
672
+ childDetail = detailA.clone(childDetail);
664
673
  CurveChainWithDistanceIndex._numAssigned++;
665
674
  }
666
675
  }
667
676
  }
668
677
  if (!childDetail)
669
678
  return undefined;
670
- const fragment = this.curveAndChildFractionToFragment(childDetail.curve, childDetail.fraction);
671
- if (fragment) {
672
- const chainDistance = fragment.childFractionToChainDistance(childDetail.fraction);
673
- const chainFraction = this.chainDistanceToChainFraction(chainDistance);
674
- const chainDetail = CurveLocationDetail.createCurveFractionPoint(this, chainFraction, childDetail.point);
675
- chainDetail.childDetail = childDetail;
676
- chainDetail.a = childDetail.a;
677
- return chainDetail;
678
- }
679
- return undefined;
679
+ return this.computeChainDetail(childDetail);
680
680
  }
681
681
  /**
682
682
  * Construct an offset of each child as viewed in the xy-plane (ignoring z).
683
- * * No attempt is made to join the offset children. Use RegionOps.constructCurveXYOffset() to return a fully
683
+ * * No attempt is made to join the offset children. Use RegionOps.constructCurveXYOffset to return a fully
684
684
  * joined offset.
685
- * @param offsetDistanceOrOptions offset distance (positive to left of the instance curve), or options object
685
+ * @param offsetDistanceOrOptions offset distance (positive to left of the instance curve) or offset options object.
686
686
  */
687
687
  constructOffsetXY(offsetDistanceOrOptions) {
688
688
  const options = OffsetOptions.create(offsetDistanceOrOptions);
@@ -702,13 +702,32 @@ class CurveChainWithDistanceIndex extends CurvePrimitive {
702
702
  * Project instance geometry (via dispatch) onto the given ray, and return the extreme fractional parameters of
703
703
  * projection.
704
704
  * @param ray ray onto which the instance is projected. A `Vector3d` is treated as a `Ray3d` with zero origin.
705
- * @param lowHigh optional receiver for output
705
+ * @param lowHigh optional receiver for output.
706
706
  * @returns range of fractional projection parameters onto the ray, where 0.0 is start of the ray and 1.0 is the
707
707
  * end of the ray.
708
708
  */
709
709
  projectedParameterRange(ray, lowHigh) {
710
710
  return PlaneAltitudeRangeContext.findExtremeFractionsAlongDirection(this, ray, lowHigh);
711
711
  }
712
+ /**
713
+ * Compute the global chain detail corresponding to a local child detail.
714
+ * @param childDetail the local detail, with respect to a child of this chain.
715
+ * @returns the global detail, with respect to this chain.
716
+ */
717
+ computeChainDetail(childDetail) {
718
+ if (!childDetail.curve)
719
+ return undefined;
720
+ const fragment = this.curveAndChildFractionToFragment(childDetail.curve, childDetail.fraction);
721
+ if (fragment) {
722
+ const chainDistance = fragment.childFractionToChainDistance(childDetail.fraction);
723
+ const chainFraction = this.chainDistanceToChainFraction(chainDistance);
724
+ const chainDetail = CurveLocationDetail.createCurveFractionPoint(this, chainFraction, childDetail.point);
725
+ chainDetail.childDetail = childDetail;
726
+ chainDetail.a = childDetail.a;
727
+ return chainDetail;
728
+ }
729
+ return undefined;
730
+ }
712
731
  }
713
732
  CurveChainWithDistanceIndex._numCalls = 0;
714
733
  CurveChainWithDistanceIndex._numTested = 0;