@itwin/core-geometry 4.2.0-dev.3 → 4.2.0-dev.31

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 (462) hide show
  1. package/CHANGELOG.md +69 -1
  2. package/lib/cjs/Geometry.d.ts +2 -2
  3. package/lib/cjs/Geometry.d.ts.map +1 -1
  4. package/lib/cjs/Geometry.js.map +1 -1
  5. package/lib/cjs/clipping/AlternatingConvexClipTree.d.ts +4 -3
  6. package/lib/cjs/clipping/AlternatingConvexClipTree.d.ts.map +1 -1
  7. package/lib/cjs/clipping/AlternatingConvexClipTree.js +1 -1
  8. package/lib/cjs/clipping/AlternatingConvexClipTree.js.map +1 -1
  9. package/lib/cjs/clipping/BooleanClipNode.d.ts +4 -3
  10. package/lib/cjs/clipping/BooleanClipNode.d.ts.map +1 -1
  11. package/lib/cjs/clipping/BooleanClipNode.js.map +1 -1
  12. package/lib/cjs/clipping/ClipPlane.d.ts +12 -8
  13. package/lib/cjs/clipping/ClipPlane.d.ts.map +1 -1
  14. package/lib/cjs/clipping/ClipPlane.js +5 -3
  15. package/lib/cjs/clipping/ClipPlane.js.map +1 -1
  16. package/lib/cjs/clipping/ClipUtils.d.ts +27 -9
  17. package/lib/cjs/clipping/ClipUtils.d.ts.map +1 -1
  18. package/lib/cjs/clipping/ClipUtils.js +84 -3
  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 +6 -4
  25. package/lib/cjs/clipping/ConvexClipPlaneSet.d.ts.map +1 -1
  26. package/lib/cjs/clipping/ConvexClipPlaneSet.js +3 -2
  27. package/lib/cjs/clipping/ConvexClipPlaneSet.js.map +1 -1
  28. package/lib/cjs/clipping/UnionOfConvexClipPlaneSets.d.ts +4 -3
  29. package/lib/cjs/clipping/UnionOfConvexClipPlaneSets.d.ts.map +1 -1
  30. package/lib/cjs/clipping/UnionOfConvexClipPlaneSets.js +2 -2
  31. package/lib/cjs/clipping/UnionOfConvexClipPlaneSets.js.map +1 -1
  32. package/lib/cjs/core-geometry.d.ts +1 -3
  33. package/lib/cjs/core-geometry.d.ts.map +1 -1
  34. package/lib/cjs/core-geometry.js +1 -3
  35. package/lib/cjs/core-geometry.js.map +1 -1
  36. package/lib/cjs/curve/Arc3d.d.ts.map +1 -1
  37. package/lib/cjs/curve/Arc3d.js +4 -4
  38. package/lib/cjs/curve/Arc3d.js.map +1 -1
  39. package/lib/cjs/curve/CoordinateXYZ.d.ts +15 -15
  40. package/lib/cjs/curve/CoordinateXYZ.d.ts.map +1 -1
  41. package/lib/cjs/curve/CoordinateXYZ.js +15 -15
  42. package/lib/cjs/curve/CoordinateXYZ.js.map +1 -1
  43. package/lib/cjs/curve/CurveChainWithDistanceIndex.js +1 -1
  44. package/lib/cjs/curve/CurveChainWithDistanceIndex.js.map +1 -1
  45. package/lib/cjs/curve/CurveCollection.d.ts +20 -20
  46. package/lib/cjs/curve/CurveCollection.d.ts.map +1 -1
  47. package/lib/cjs/curve/CurveCollection.js +21 -23
  48. package/lib/cjs/curve/CurveCollection.js.map +1 -1
  49. package/lib/cjs/curve/CurveCurve.d.ts +41 -26
  50. package/lib/cjs/curve/CurveCurve.d.ts.map +1 -1
  51. package/lib/cjs/curve/CurveCurve.js +73 -40
  52. package/lib/cjs/curve/CurveCurve.js.map +1 -1
  53. package/lib/cjs/curve/CurveFactory.d.ts +1 -1
  54. package/lib/cjs/curve/CurveFactory.js.map +1 -1
  55. package/lib/cjs/curve/CurveLocationDetail.d.ts +12 -1
  56. package/lib/cjs/curve/CurveLocationDetail.d.ts.map +1 -1
  57. package/lib/cjs/curve/CurveLocationDetail.js +13 -2
  58. package/lib/cjs/curve/CurveLocationDetail.js.map +1 -1
  59. package/lib/cjs/curve/CurveOps.d.ts +1 -1
  60. package/lib/cjs/curve/CurveOps.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/CurveTypes.d.ts +19 -0
  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/Path.d.ts +1 -1
  74. package/lib/cjs/curve/Path.d.ts.map +1 -1
  75. package/lib/cjs/curve/Path.js +1 -1
  76. package/lib/cjs/curve/Path.js.map +1 -1
  77. package/lib/cjs/curve/Query/ConsolidateAdjacentPrimitivesContext.d.ts +3 -2
  78. package/lib/cjs/curve/Query/ConsolidateAdjacentPrimitivesContext.d.ts.map +1 -1
  79. package/lib/cjs/curve/Query/ConsolidateAdjacentPrimitivesContext.js +2 -2
  80. package/lib/cjs/curve/Query/ConsolidateAdjacentPrimitivesContext.js.map +1 -1
  81. package/lib/cjs/curve/Query/CurveSplitContext.d.ts +1 -1
  82. package/lib/cjs/curve/Query/CurveSplitContext.js.map +1 -1
  83. package/lib/cjs/curve/Query/CylindricalRange.d.ts +1 -1
  84. package/lib/cjs/curve/Query/CylindricalRange.js.map +1 -1
  85. package/lib/cjs/curve/Query/InOutTests.d.ts +1 -1
  86. package/lib/cjs/curve/Query/InOutTests.js.map +1 -1
  87. package/lib/cjs/curve/Query/StrokeCountChain.d.ts +1 -1
  88. package/lib/cjs/curve/Query/StrokeCountChain.js.map +1 -1
  89. package/lib/cjs/curve/RegionOps.d.ts +54 -5
  90. package/lib/cjs/curve/RegionOps.d.ts.map +1 -1
  91. package/lib/cjs/curve/RegionOps.js +154 -3
  92. package/lib/cjs/curve/RegionOps.js.map +1 -1
  93. package/lib/cjs/curve/RegionOpsClassificationSweeps.d.ts +1 -1
  94. package/lib/cjs/curve/RegionOpsClassificationSweeps.js.map +1 -1
  95. package/lib/cjs/curve/StrokeOptions.d.ts +20 -11
  96. package/lib/cjs/curve/StrokeOptions.d.ts.map +1 -1
  97. package/lib/cjs/curve/StrokeOptions.js +22 -11
  98. package/lib/cjs/curve/StrokeOptions.js.map +1 -1
  99. package/lib/cjs/curve/UnionRegion.d.ts +3 -3
  100. package/lib/cjs/curve/UnionRegion.d.ts.map +1 -1
  101. package/lib/cjs/curve/UnionRegion.js +3 -3
  102. package/lib/cjs/curve/UnionRegion.js.map +1 -1
  103. package/lib/cjs/curve/internalContexts/CurveCurveCloseApproachXY.d.ts +225 -0
  104. package/lib/cjs/curve/internalContexts/CurveCurveCloseApproachXY.d.ts.map +1 -0
  105. package/lib/cjs/curve/{CurveCurveCloseApproachXY.js → internalContexts/CurveCurveCloseApproachXY.js} +249 -189
  106. package/lib/cjs/curve/internalContexts/CurveCurveCloseApproachXY.js.map +1 -0
  107. package/lib/{esm/curve → cjs/curve/internalContexts}/CurveCurveIntersectXY.d.ts +14 -27
  108. package/lib/cjs/curve/internalContexts/CurveCurveIntersectXY.d.ts.map +1 -0
  109. package/lib/cjs/curve/{CurveCurveIntersectXY.js → internalContexts/CurveCurveIntersectXY.js} +31 -42
  110. package/lib/cjs/curve/internalContexts/CurveCurveIntersectXY.js.map +1 -0
  111. package/lib/cjs/curve/{CurveCurveIntersectXYZ.d.ts → internalContexts/CurveCurveIntersectXYZ.d.ts} +11 -12
  112. package/lib/cjs/curve/internalContexts/CurveCurveIntersectXYZ.d.ts.map +1 -0
  113. package/lib/cjs/curve/{CurveCurveIntersectXYZ.js → internalContexts/CurveCurveIntersectXYZ.js} +12 -14
  114. package/lib/cjs/curve/internalContexts/CurveCurveIntersectXYZ.js.map +1 -0
  115. package/lib/cjs/curve/internalContexts/MultiChainCollector.d.ts +1 -1
  116. package/lib/cjs/curve/internalContexts/MultiChainCollector.js.map +1 -1
  117. package/lib/cjs/geometry3d/BarycentricTriangle.d.ts +1 -0
  118. package/lib/cjs/geometry3d/BarycentricTriangle.d.ts.map +1 -1
  119. package/lib/cjs/geometry3d/BarycentricTriangle.js +1 -0
  120. package/lib/cjs/geometry3d/BarycentricTriangle.js.map +1 -1
  121. package/lib/cjs/geometry3d/FrameBuilder.d.ts +57 -36
  122. package/lib/cjs/geometry3d/FrameBuilder.d.ts.map +1 -1
  123. package/lib/cjs/geometry3d/FrameBuilder.js +99 -74
  124. package/lib/cjs/geometry3d/FrameBuilder.js.map +1 -1
  125. package/lib/cjs/geometry3d/GeometryHandler.d.ts +3 -10
  126. package/lib/cjs/geometry3d/GeometryHandler.d.ts.map +1 -1
  127. package/lib/cjs/geometry3d/GeometryHandler.js +2 -6
  128. package/lib/cjs/geometry3d/GeometryHandler.js.map +1 -1
  129. package/lib/cjs/geometry3d/GrowableXYZArray.d.ts +0 -8
  130. package/lib/cjs/geometry3d/GrowableXYZArray.d.ts.map +1 -1
  131. package/lib/cjs/geometry3d/GrowableXYZArray.js +0 -16
  132. package/lib/cjs/geometry3d/GrowableXYZArray.js.map +1 -1
  133. package/lib/cjs/geometry3d/IndexedXYZCollection.d.ts +4 -4
  134. package/lib/cjs/geometry3d/IndexedXYZCollection.d.ts.map +1 -1
  135. package/lib/cjs/geometry3d/IndexedXYZCollection.js +12 -0
  136. package/lib/cjs/geometry3d/IndexedXYZCollection.js.map +1 -1
  137. package/lib/cjs/geometry3d/Matrix3d.d.ts.map +1 -1
  138. package/lib/cjs/geometry3d/Matrix3d.js +3 -6
  139. package/lib/cjs/geometry3d/Matrix3d.js.map +1 -1
  140. package/lib/cjs/geometry3d/Point3dArrayCarrier.d.ts.map +1 -1
  141. package/lib/cjs/geometry3d/Point3dArrayCarrier.js.map +1 -1
  142. package/lib/cjs/geometry3d/Point3dVector3d.d.ts +1 -2
  143. package/lib/cjs/geometry3d/Point3dVector3d.d.ts.map +1 -1
  144. package/lib/cjs/geometry3d/Point3dVector3d.js +0 -1
  145. package/lib/cjs/geometry3d/Point3dVector3d.js.map +1 -1
  146. package/lib/cjs/geometry3d/PolygonOps.d.ts +2 -2
  147. package/lib/cjs/geometry3d/PolygonOps.d.ts.map +1 -1
  148. package/lib/cjs/geometry3d/PolygonOps.js +2 -3
  149. package/lib/cjs/geometry3d/PolygonOps.js.map +1 -1
  150. package/lib/cjs/geometry3d/Range.d.ts +1 -1
  151. package/lib/cjs/geometry3d/Range.js +1 -1
  152. package/lib/cjs/geometry3d/Range.js.map +1 -1
  153. package/lib/cjs/geometry3d/Ray3d.d.ts +3 -1
  154. package/lib/cjs/geometry3d/Ray3d.d.ts.map +1 -1
  155. package/lib/cjs/geometry3d/Ray3d.js +4 -3
  156. package/lib/cjs/geometry3d/Ray3d.js.map +1 -1
  157. package/lib/cjs/geometry3d/ReusableObjectCache.d.ts +2 -1
  158. package/lib/cjs/geometry3d/ReusableObjectCache.d.ts.map +1 -1
  159. package/lib/cjs/geometry3d/ReusableObjectCache.js +1 -1
  160. package/lib/cjs/geometry3d/ReusableObjectCache.js.map +1 -1
  161. package/lib/cjs/geometry3d/SortablePolygon.d.ts +1 -1
  162. package/lib/cjs/geometry3d/SortablePolygon.js.map +1 -1
  163. package/lib/cjs/geometry3d/Transform.d.ts.map +1 -1
  164. package/lib/cjs/geometry3d/Transform.js +4 -6
  165. package/lib/cjs/geometry3d/Transform.js.map +1 -1
  166. package/lib/cjs/geometry3d/YawPitchRollAngles.js +1 -1
  167. package/lib/cjs/geometry3d/YawPitchRollAngles.js.map +1 -1
  168. package/lib/cjs/geometry4d/Matrix4d.d.ts.map +1 -1
  169. package/lib/cjs/geometry4d/Matrix4d.js +4 -2
  170. package/lib/cjs/geometry4d/Matrix4d.js.map +1 -1
  171. package/lib/cjs/geometry4d/Point4d.js.map +1 -1
  172. package/lib/cjs/numerics/Polynomials.d.ts +2 -2
  173. package/lib/cjs/numerics/Polynomials.d.ts.map +1 -1
  174. package/lib/cjs/numerics/Polynomials.js +2 -2
  175. package/lib/cjs/numerics/Polynomials.js.map +1 -1
  176. package/lib/cjs/polyface/PolyfaceBuilder.d.ts +18 -6
  177. package/lib/cjs/polyface/PolyfaceBuilder.d.ts.map +1 -1
  178. package/lib/cjs/polyface/PolyfaceBuilder.js +48 -15
  179. package/lib/cjs/polyface/PolyfaceBuilder.js.map +1 -1
  180. package/lib/cjs/polyface/PolyfaceClip.d.ts +16 -7
  181. package/lib/cjs/polyface/PolyfaceClip.d.ts.map +1 -1
  182. package/lib/cjs/polyface/PolyfaceClip.js +38 -7
  183. package/lib/cjs/polyface/PolyfaceClip.js.map +1 -1
  184. package/lib/cjs/polyface/PolyfaceData.d.ts +5 -39
  185. package/lib/cjs/polyface/PolyfaceData.d.ts.map +1 -1
  186. package/lib/cjs/polyface/PolyfaceData.js +7 -41
  187. package/lib/cjs/polyface/PolyfaceData.js.map +1 -1
  188. package/lib/cjs/polyface/PolyfaceQuery.d.ts +10 -8
  189. package/lib/cjs/polyface/PolyfaceQuery.d.ts.map +1 -1
  190. package/lib/cjs/polyface/PolyfaceQuery.js +64 -18
  191. package/lib/cjs/polyface/PolyfaceQuery.js.map +1 -1
  192. package/lib/cjs/serialization/GeometrySamples.d.ts +6 -0
  193. package/lib/cjs/serialization/GeometrySamples.d.ts.map +1 -1
  194. package/lib/cjs/serialization/GeometrySamples.js +61 -1
  195. package/lib/cjs/serialization/GeometrySamples.js.map +1 -1
  196. package/lib/cjs/solid/LinearSweep.d.ts +1 -1
  197. package/lib/cjs/solid/LinearSweep.js.map +1 -1
  198. package/lib/cjs/solid/RotationalSweep.d.ts +1 -1
  199. package/lib/cjs/solid/RotationalSweep.js.map +1 -1
  200. package/lib/cjs/solid/RuledSweep.d.ts +1 -1
  201. package/lib/cjs/solid/RuledSweep.js.map +1 -1
  202. package/lib/cjs/solid/SweepContour.d.ts +35 -26
  203. package/lib/cjs/solid/SweepContour.d.ts.map +1 -1
  204. package/lib/cjs/solid/SweepContour.js +84 -100
  205. package/lib/cjs/solid/SweepContour.js.map +1 -1
  206. package/lib/cjs/topology/Graph.d.ts +29 -11
  207. package/lib/cjs/topology/Graph.d.ts.map +1 -1
  208. package/lib/cjs/topology/Graph.js +45 -26
  209. package/lib/cjs/topology/Graph.js.map +1 -1
  210. package/lib/cjs/topology/HalfEdgeMarkSet.d.ts +2 -2
  211. package/lib/cjs/topology/HalfEdgeMarkSet.d.ts.map +1 -1
  212. package/lib/cjs/topology/HalfEdgeMarkSet.js +4 -4
  213. package/lib/cjs/topology/HalfEdgeMarkSet.js.map +1 -1
  214. package/lib/cjs/topology/Merging.d.ts +3 -0
  215. package/lib/cjs/topology/Merging.d.ts.map +1 -1
  216. package/lib/cjs/topology/Merging.js +19 -5
  217. package/lib/cjs/topology/Merging.js.map +1 -1
  218. package/lib/cjs/topology/Triangulation.d.ts +15 -7
  219. package/lib/cjs/topology/Triangulation.d.ts.map +1 -1
  220. package/lib/cjs/topology/Triangulation.js +89 -47
  221. package/lib/cjs/topology/Triangulation.js.map +1 -1
  222. package/lib/esm/Geometry.d.ts +2 -2
  223. package/lib/esm/Geometry.d.ts.map +1 -1
  224. package/lib/esm/Geometry.js.map +1 -1
  225. package/lib/esm/clipping/AlternatingConvexClipTree.d.ts +4 -3
  226. package/lib/esm/clipping/AlternatingConvexClipTree.d.ts.map +1 -1
  227. package/lib/esm/clipping/AlternatingConvexClipTree.js +1 -1
  228. package/lib/esm/clipping/AlternatingConvexClipTree.js.map +1 -1
  229. package/lib/esm/clipping/BooleanClipNode.d.ts +4 -3
  230. package/lib/esm/clipping/BooleanClipNode.d.ts.map +1 -1
  231. package/lib/esm/clipping/BooleanClipNode.js.map +1 -1
  232. package/lib/esm/clipping/ClipPlane.d.ts +12 -8
  233. package/lib/esm/clipping/ClipPlane.d.ts.map +1 -1
  234. package/lib/esm/clipping/ClipPlane.js +5 -3
  235. package/lib/esm/clipping/ClipPlane.js.map +1 -1
  236. package/lib/esm/clipping/ClipUtils.d.ts +27 -9
  237. package/lib/esm/clipping/ClipUtils.d.ts.map +1 -1
  238. package/lib/esm/clipping/ClipUtils.js +84 -3
  239. package/lib/esm/clipping/ClipUtils.js.map +1 -1
  240. package/lib/esm/clipping/ClipVector.d.ts +6 -5
  241. package/lib/esm/clipping/ClipVector.d.ts.map +1 -1
  242. package/lib/esm/clipping/ClipVector.js +1 -1
  243. package/lib/esm/clipping/ClipVector.js.map +1 -1
  244. package/lib/esm/clipping/ConvexClipPlaneSet.d.ts +6 -4
  245. package/lib/esm/clipping/ConvexClipPlaneSet.d.ts.map +1 -1
  246. package/lib/esm/clipping/ConvexClipPlaneSet.js +3 -2
  247. package/lib/esm/clipping/ConvexClipPlaneSet.js.map +1 -1
  248. package/lib/esm/clipping/UnionOfConvexClipPlaneSets.d.ts +4 -3
  249. package/lib/esm/clipping/UnionOfConvexClipPlaneSets.d.ts.map +1 -1
  250. package/lib/esm/clipping/UnionOfConvexClipPlaneSets.js +2 -2
  251. package/lib/esm/clipping/UnionOfConvexClipPlaneSets.js.map +1 -1
  252. package/lib/esm/core-geometry.d.ts +1 -3
  253. package/lib/esm/core-geometry.d.ts.map +1 -1
  254. package/lib/esm/core-geometry.js +1 -3
  255. package/lib/esm/core-geometry.js.map +1 -1
  256. package/lib/esm/curve/Arc3d.d.ts.map +1 -1
  257. package/lib/esm/curve/Arc3d.js +4 -4
  258. package/lib/esm/curve/Arc3d.js.map +1 -1
  259. package/lib/esm/curve/CoordinateXYZ.d.ts +15 -15
  260. package/lib/esm/curve/CoordinateXYZ.d.ts.map +1 -1
  261. package/lib/esm/curve/CoordinateXYZ.js +15 -15
  262. package/lib/esm/curve/CoordinateXYZ.js.map +1 -1
  263. package/lib/esm/curve/CurveChainWithDistanceIndex.js +1 -1
  264. package/lib/esm/curve/CurveChainWithDistanceIndex.js.map +1 -1
  265. package/lib/esm/curve/CurveCollection.d.ts +20 -20
  266. package/lib/esm/curve/CurveCollection.d.ts.map +1 -1
  267. package/lib/esm/curve/CurveCollection.js +20 -21
  268. package/lib/esm/curve/CurveCollection.js.map +1 -1
  269. package/lib/esm/curve/CurveCurve.d.ts +41 -26
  270. package/lib/esm/curve/CurveCurve.d.ts.map +1 -1
  271. package/lib/esm/curve/CurveCurve.js +73 -40
  272. package/lib/esm/curve/CurveCurve.js.map +1 -1
  273. package/lib/esm/curve/CurveFactory.d.ts +1 -1
  274. package/lib/esm/curve/CurveFactory.js.map +1 -1
  275. package/lib/esm/curve/CurveLocationDetail.d.ts +12 -1
  276. package/lib/esm/curve/CurveLocationDetail.d.ts.map +1 -1
  277. package/lib/esm/curve/CurveLocationDetail.js +11 -1
  278. package/lib/esm/curve/CurveLocationDetail.js.map +1 -1
  279. package/lib/esm/curve/CurveOps.d.ts +1 -1
  280. package/lib/esm/curve/CurveOps.js.map +1 -1
  281. package/lib/esm/curve/CurveProcessor.d.ts +1 -1
  282. package/lib/esm/curve/CurveProcessor.js.map +1 -1
  283. package/lib/esm/curve/CurveTypes.d.ts +19 -0
  284. package/lib/esm/curve/CurveTypes.d.ts.map +1 -0
  285. package/lib/esm/curve/{CurveChain.js → CurveTypes.js} +1 -1
  286. package/lib/esm/curve/CurveTypes.js.map +1 -0
  287. package/lib/esm/curve/CurveWireMomentsXYZ.d.ts +1 -1
  288. package/lib/esm/curve/CurveWireMomentsXYZ.js.map +1 -1
  289. package/lib/esm/curve/ParityRegion.d.ts +3 -3
  290. package/lib/esm/curve/ParityRegion.d.ts.map +1 -1
  291. package/lib/esm/curve/ParityRegion.js +2 -2
  292. package/lib/esm/curve/ParityRegion.js.map +1 -1
  293. package/lib/esm/curve/Path.d.ts +1 -1
  294. package/lib/esm/curve/Path.d.ts.map +1 -1
  295. package/lib/esm/curve/Path.js +1 -1
  296. package/lib/esm/curve/Path.js.map +1 -1
  297. package/lib/esm/curve/Query/ConsolidateAdjacentPrimitivesContext.d.ts +3 -2
  298. package/lib/esm/curve/Query/ConsolidateAdjacentPrimitivesContext.d.ts.map +1 -1
  299. package/lib/esm/curve/Query/ConsolidateAdjacentPrimitivesContext.js +1 -1
  300. package/lib/esm/curve/Query/ConsolidateAdjacentPrimitivesContext.js.map +1 -1
  301. package/lib/esm/curve/Query/CurveSplitContext.d.ts +1 -1
  302. package/lib/esm/curve/Query/CurveSplitContext.js.map +1 -1
  303. package/lib/esm/curve/Query/CylindricalRange.d.ts +1 -1
  304. package/lib/esm/curve/Query/CylindricalRange.js.map +1 -1
  305. package/lib/esm/curve/Query/InOutTests.d.ts +1 -1
  306. package/lib/esm/curve/Query/InOutTests.js.map +1 -1
  307. package/lib/esm/curve/Query/StrokeCountChain.d.ts +1 -1
  308. package/lib/esm/curve/Query/StrokeCountChain.js.map +1 -1
  309. package/lib/esm/curve/RegionOps.d.ts +54 -5
  310. package/lib/esm/curve/RegionOps.d.ts.map +1 -1
  311. package/lib/esm/curve/RegionOps.js +153 -3
  312. package/lib/esm/curve/RegionOps.js.map +1 -1
  313. package/lib/esm/curve/RegionOpsClassificationSweeps.d.ts +1 -1
  314. package/lib/esm/curve/RegionOpsClassificationSweeps.js.map +1 -1
  315. package/lib/esm/curve/StrokeOptions.d.ts +20 -11
  316. package/lib/esm/curve/StrokeOptions.d.ts.map +1 -1
  317. package/lib/esm/curve/StrokeOptions.js +22 -11
  318. package/lib/esm/curve/StrokeOptions.js.map +1 -1
  319. package/lib/esm/curve/UnionRegion.d.ts +3 -3
  320. package/lib/esm/curve/UnionRegion.d.ts.map +1 -1
  321. package/lib/esm/curve/UnionRegion.js +3 -3
  322. package/lib/esm/curve/UnionRegion.js.map +1 -1
  323. package/lib/esm/curve/internalContexts/CurveCurveCloseApproachXY.d.ts +225 -0
  324. package/lib/esm/curve/internalContexts/CurveCurveCloseApproachXY.d.ts.map +1 -0
  325. package/lib/esm/curve/{CurveCurveCloseApproachXY.js → internalContexts/CurveCurveCloseApproachXY.js} +249 -189
  326. package/lib/esm/curve/internalContexts/CurveCurveCloseApproachXY.js.map +1 -0
  327. package/lib/{cjs/curve → esm/curve/internalContexts}/CurveCurveIntersectXY.d.ts +14 -27
  328. package/lib/esm/curve/internalContexts/CurveCurveIntersectXY.d.ts.map +1 -0
  329. package/lib/esm/curve/{CurveCurveIntersectXY.js → internalContexts/CurveCurveIntersectXY.js} +30 -40
  330. package/lib/esm/curve/internalContexts/CurveCurveIntersectXY.js.map +1 -0
  331. package/lib/esm/curve/{CurveCurveIntersectXYZ.d.ts → internalContexts/CurveCurveIntersectXYZ.d.ts} +11 -12
  332. package/lib/esm/curve/internalContexts/CurveCurveIntersectXYZ.d.ts.map +1 -0
  333. package/lib/esm/curve/{CurveCurveIntersectXYZ.js → internalContexts/CurveCurveIntersectXYZ.js} +11 -13
  334. package/lib/esm/curve/internalContexts/CurveCurveIntersectXYZ.js.map +1 -0
  335. package/lib/esm/curve/internalContexts/MultiChainCollector.d.ts +1 -1
  336. package/lib/esm/curve/internalContexts/MultiChainCollector.js.map +1 -1
  337. package/lib/esm/geometry3d/BarycentricTriangle.d.ts +1 -0
  338. package/lib/esm/geometry3d/BarycentricTriangle.d.ts.map +1 -1
  339. package/lib/esm/geometry3d/BarycentricTriangle.js +1 -0
  340. package/lib/esm/geometry3d/BarycentricTriangle.js.map +1 -1
  341. package/lib/esm/geometry3d/FrameBuilder.d.ts +57 -36
  342. package/lib/esm/geometry3d/FrameBuilder.d.ts.map +1 -1
  343. package/lib/esm/geometry3d/FrameBuilder.js +99 -74
  344. package/lib/esm/geometry3d/FrameBuilder.js.map +1 -1
  345. package/lib/esm/geometry3d/GeometryHandler.d.ts +3 -10
  346. package/lib/esm/geometry3d/GeometryHandler.d.ts.map +1 -1
  347. package/lib/esm/geometry3d/GeometryHandler.js +2 -6
  348. package/lib/esm/geometry3d/GeometryHandler.js.map +1 -1
  349. package/lib/esm/geometry3d/GrowableXYZArray.d.ts +0 -8
  350. package/lib/esm/geometry3d/GrowableXYZArray.d.ts.map +1 -1
  351. package/lib/esm/geometry3d/GrowableXYZArray.js +0 -16
  352. package/lib/esm/geometry3d/GrowableXYZArray.js.map +1 -1
  353. package/lib/esm/geometry3d/IndexedXYZCollection.d.ts +4 -4
  354. package/lib/esm/geometry3d/IndexedXYZCollection.d.ts.map +1 -1
  355. package/lib/esm/geometry3d/IndexedXYZCollection.js +12 -0
  356. package/lib/esm/geometry3d/IndexedXYZCollection.js.map +1 -1
  357. package/lib/esm/geometry3d/Matrix3d.d.ts.map +1 -1
  358. package/lib/esm/geometry3d/Matrix3d.js +3 -6
  359. package/lib/esm/geometry3d/Matrix3d.js.map +1 -1
  360. package/lib/esm/geometry3d/Point3dArrayCarrier.d.ts.map +1 -1
  361. package/lib/esm/geometry3d/Point3dArrayCarrier.js.map +1 -1
  362. package/lib/esm/geometry3d/Point3dVector3d.d.ts +1 -2
  363. package/lib/esm/geometry3d/Point3dVector3d.d.ts.map +1 -1
  364. package/lib/esm/geometry3d/Point3dVector3d.js +0 -1
  365. package/lib/esm/geometry3d/Point3dVector3d.js.map +1 -1
  366. package/lib/esm/geometry3d/PolygonOps.d.ts +2 -2
  367. package/lib/esm/geometry3d/PolygonOps.d.ts.map +1 -1
  368. package/lib/esm/geometry3d/PolygonOps.js +2 -3
  369. package/lib/esm/geometry3d/PolygonOps.js.map +1 -1
  370. package/lib/esm/geometry3d/Range.d.ts +1 -1
  371. package/lib/esm/geometry3d/Range.js +1 -1
  372. package/lib/esm/geometry3d/Range.js.map +1 -1
  373. package/lib/esm/geometry3d/Ray3d.d.ts +3 -1
  374. package/lib/esm/geometry3d/Ray3d.d.ts.map +1 -1
  375. package/lib/esm/geometry3d/Ray3d.js +4 -3
  376. package/lib/esm/geometry3d/Ray3d.js.map +1 -1
  377. package/lib/esm/geometry3d/ReusableObjectCache.d.ts +2 -1
  378. package/lib/esm/geometry3d/ReusableObjectCache.d.ts.map +1 -1
  379. package/lib/esm/geometry3d/ReusableObjectCache.js +1 -1
  380. package/lib/esm/geometry3d/ReusableObjectCache.js.map +1 -1
  381. package/lib/esm/geometry3d/SortablePolygon.d.ts +1 -1
  382. package/lib/esm/geometry3d/SortablePolygon.js.map +1 -1
  383. package/lib/esm/geometry3d/Transform.d.ts.map +1 -1
  384. package/lib/esm/geometry3d/Transform.js +4 -6
  385. package/lib/esm/geometry3d/Transform.js.map +1 -1
  386. package/lib/esm/geometry3d/YawPitchRollAngles.js +1 -1
  387. package/lib/esm/geometry3d/YawPitchRollAngles.js.map +1 -1
  388. package/lib/esm/geometry4d/Matrix4d.d.ts.map +1 -1
  389. package/lib/esm/geometry4d/Matrix4d.js +4 -2
  390. package/lib/esm/geometry4d/Matrix4d.js.map +1 -1
  391. package/lib/esm/geometry4d/Point4d.js.map +1 -1
  392. package/lib/esm/numerics/Polynomials.d.ts +2 -2
  393. package/lib/esm/numerics/Polynomials.d.ts.map +1 -1
  394. package/lib/esm/numerics/Polynomials.js +2 -2
  395. package/lib/esm/numerics/Polynomials.js.map +1 -1
  396. package/lib/esm/polyface/PolyfaceBuilder.d.ts +18 -6
  397. package/lib/esm/polyface/PolyfaceBuilder.d.ts.map +1 -1
  398. package/lib/esm/polyface/PolyfaceBuilder.js +48 -15
  399. package/lib/esm/polyface/PolyfaceBuilder.js.map +1 -1
  400. package/lib/esm/polyface/PolyfaceClip.d.ts +16 -7
  401. package/lib/esm/polyface/PolyfaceClip.d.ts.map +1 -1
  402. package/lib/esm/polyface/PolyfaceClip.js +38 -7
  403. package/lib/esm/polyface/PolyfaceClip.js.map +1 -1
  404. package/lib/esm/polyface/PolyfaceData.d.ts +5 -39
  405. package/lib/esm/polyface/PolyfaceData.d.ts.map +1 -1
  406. package/lib/esm/polyface/PolyfaceData.js +7 -41
  407. package/lib/esm/polyface/PolyfaceData.js.map +1 -1
  408. package/lib/esm/polyface/PolyfaceQuery.d.ts +10 -8
  409. package/lib/esm/polyface/PolyfaceQuery.d.ts.map +1 -1
  410. package/lib/esm/polyface/PolyfaceQuery.js +64 -18
  411. package/lib/esm/polyface/PolyfaceQuery.js.map +1 -1
  412. package/lib/esm/serialization/GeometrySamples.d.ts +6 -0
  413. package/lib/esm/serialization/GeometrySamples.d.ts.map +1 -1
  414. package/lib/esm/serialization/GeometrySamples.js +61 -1
  415. package/lib/esm/serialization/GeometrySamples.js.map +1 -1
  416. package/lib/esm/solid/LinearSweep.d.ts +1 -1
  417. package/lib/esm/solid/LinearSweep.js.map +1 -1
  418. package/lib/esm/solid/RotationalSweep.d.ts +1 -1
  419. package/lib/esm/solid/RotationalSweep.js.map +1 -1
  420. package/lib/esm/solid/RuledSweep.d.ts +1 -1
  421. package/lib/esm/solid/RuledSweep.js.map +1 -1
  422. package/lib/esm/solid/SweepContour.d.ts +35 -26
  423. package/lib/esm/solid/SweepContour.d.ts.map +1 -1
  424. package/lib/esm/solid/SweepContour.js +84 -100
  425. package/lib/esm/solid/SweepContour.js.map +1 -1
  426. package/lib/esm/topology/Graph.d.ts +29 -11
  427. package/lib/esm/topology/Graph.d.ts.map +1 -1
  428. package/lib/esm/topology/Graph.js +45 -26
  429. package/lib/esm/topology/Graph.js.map +1 -1
  430. package/lib/esm/topology/HalfEdgeMarkSet.d.ts +2 -2
  431. package/lib/esm/topology/HalfEdgeMarkSet.d.ts.map +1 -1
  432. package/lib/esm/topology/HalfEdgeMarkSet.js +2 -2
  433. package/lib/esm/topology/HalfEdgeMarkSet.js.map +1 -1
  434. package/lib/esm/topology/Merging.d.ts +3 -0
  435. package/lib/esm/topology/Merging.d.ts.map +1 -1
  436. package/lib/esm/topology/Merging.js +19 -5
  437. package/lib/esm/topology/Merging.js.map +1 -1
  438. package/lib/esm/topology/Triangulation.d.ts +15 -7
  439. package/lib/esm/topology/Triangulation.d.ts.map +1 -1
  440. package/lib/esm/topology/Triangulation.js +89 -47
  441. package/lib/esm/topology/Triangulation.js.map +1 -1
  442. package/package.json +4 -4
  443. package/lib/cjs/curve/CurveChain.d.ts +0 -17
  444. package/lib/cjs/curve/CurveChain.d.ts.map +0 -1
  445. package/lib/cjs/curve/CurveChain.js.map +0 -1
  446. package/lib/cjs/curve/CurveCurveCloseApproachXY.d.ts +0 -164
  447. package/lib/cjs/curve/CurveCurveCloseApproachXY.d.ts.map +0 -1
  448. package/lib/cjs/curve/CurveCurveCloseApproachXY.js.map +0 -1
  449. package/lib/cjs/curve/CurveCurveIntersectXY.d.ts.map +0 -1
  450. package/lib/cjs/curve/CurveCurveIntersectXY.js.map +0 -1
  451. package/lib/cjs/curve/CurveCurveIntersectXYZ.d.ts.map +0 -1
  452. package/lib/cjs/curve/CurveCurveIntersectXYZ.js.map +0 -1
  453. package/lib/esm/curve/CurveChain.d.ts +0 -17
  454. package/lib/esm/curve/CurveChain.d.ts.map +0 -1
  455. package/lib/esm/curve/CurveChain.js.map +0 -1
  456. package/lib/esm/curve/CurveCurveCloseApproachXY.d.ts +0 -164
  457. package/lib/esm/curve/CurveCurveCloseApproachXY.d.ts.map +0 -1
  458. package/lib/esm/curve/CurveCurveCloseApproachXY.js.map +0 -1
  459. package/lib/esm/curve/CurveCurveIntersectXY.d.ts.map +0 -1
  460. package/lib/esm/curve/CurveCurveIntersectXY.js.map +0 -1
  461. package/lib/esm/curve/CurveCurveIntersectXYZ.d.ts.map +0 -1
  462. package/lib/esm/curve/CurveCurveIntersectXYZ.js.map +0 -1
@@ -4,7 +4,7 @@
4
4
  * See LICENSE.md in the project root for license terms and full copyright notice.
5
5
  *--------------------------------------------------------------------------------------------*/
6
6
  Object.defineProperty(exports, "__esModule", { value: true });
7
- exports.ConsolidateAdjacentCurvePrimitivesOptions = exports.BagOfCurves = exports.CurveChain = exports.CurveCollection = void 0;
7
+ exports.BagOfCurves = exports.CurveChain = exports.CurveCollection = void 0;
8
8
  /** @packageDocumentation
9
9
  * @module Curve
10
10
  */
@@ -130,21 +130,38 @@ class CurveCollection extends GeometryQuery_1.GeometryQuery {
130
130
  * * `Loop`
131
131
  * * `ParityRegion`
132
132
  * * `UnionRegion`
133
+ * @see isAnyRegion
133
134
  */
134
135
  get isAnyRegionType() {
135
136
  return this.dgnBoundaryType() === 2 || this.dgnBoundaryType() === 4 || this.dgnBoundaryType() === 5;
136
137
  }
137
- /** Return true for a `Path`, i.e. a chain of curves joined head-to-tail */
138
+ /** Type guard for AnyRegion */
139
+ isAnyRegion() {
140
+ return this.isAnyRegionType;
141
+ }
142
+ /**
143
+ * Return true for a `Path`, i.e. a chain of curves joined head-to-tail
144
+ * @see isPath
145
+ */
138
146
  get isOpenPath() {
139
147
  return this.dgnBoundaryType() === 1;
140
148
  }
149
+ /** Type guard for Path */
150
+ isPath() {
151
+ return this.isOpenPath;
152
+ }
141
153
  /**
142
154
  * Return true for a single-loop planar region type, i.e. `Loop`.
143
155
  * * This is NOT a test for physical closure of a `Path`.
156
+ * @see isLoop
144
157
  */
145
158
  get isClosedPath() {
146
159
  return this.dgnBoundaryType() === 2;
147
160
  }
161
+ /** Type guard for Loop */
162
+ isLoop() {
163
+ return this.isClosedPath;
164
+ }
148
165
  /**
149
166
  * Extend (increase) the given range as needed to encompass all curves in the curve collection.
150
167
  * @param rangeToExtend the given range.
@@ -194,7 +211,7 @@ exports.CurveCollection = CurveCollection;
194
211
  /**
195
212
  * Shared base class for use by both open and closed paths.
196
213
  * * A `CurveChain` contains only CurvePrimitives. No other paths, loops, or regions allowed.
197
- * * The specific derived classes are `Path` and `Loop`
214
+ * * The specific derived classes are `Path` and `Loop`.
198
215
  * * `CurveChain` is an intermediate class. It is not instantiable on its own.
199
216
  * * The related class `CurveChainWithDistanceIndex` is a `CurvePrimitive` whose API presents well-defined mappings
200
217
  * from fraction to xyz over the entire chain, but in fact does all the calculations over multiple primitives.
@@ -209,8 +226,6 @@ class CurveChain extends CurveCollection {
209
226
  }
210
227
  /** Return the array of `CurvePrimitive` */
211
228
  get children() {
212
- if (this._curves === undefined)
213
- this._curves = [];
214
229
  return this._curves;
215
230
  }
216
231
  /**
@@ -285,7 +300,7 @@ class CurveChain extends CurveCollection {
285
300
  /**
286
301
  * Return the index where target is found in the array of children.
287
302
  * @param alsoSearchProxies whether to also check proxy curves of the children
288
- */
303
+ */
289
304
  childIndex(target, alsoSearchProxies) {
290
305
  for (let i = 0; i < this._curves.length; i++) {
291
306
  if (this._curves[i] === target)
@@ -390,21 +405,4 @@ class BagOfCurves extends CurveCollection {
390
405
  }
391
406
  }
392
407
  exports.BagOfCurves = BagOfCurves;
393
- /**
394
- * * Options to control method `RegionOps.consolidateAdjacentPrimitives`
395
- * @public
396
- */
397
- class ConsolidateAdjacentCurvePrimitivesOptions {
398
- constructor() {
399
- /** True to consolidated linear geometry (e.g. separate LineSegment3d and LineString3d) into LineString3d */
400
- this.consolidateLinearGeometry = true;
401
- /** True to consolidate contiguous arcs */
402
- this.consolidateCompatibleArcs = true;
403
- /** Tolerance for collapsing identical points */
404
- this.duplicatePointTolerance = Geometry_1.Geometry.smallMetricDistance;
405
- /** Tolerance for removing interior colinear points. */
406
- this.colinearPointTolerance = Geometry_1.Geometry.smallMetricDistance;
407
- }
408
- }
409
- exports.ConsolidateAdjacentCurvePrimitivesOptions = ConsolidateAdjacentCurvePrimitivesOptions;
410
408
  //# sourceMappingURL=CurveCollection.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"CurveCollection.js","sourceRoot":"","sources":["../../../src/curve/CurveCollection.ts"],"names":[],"mappings":";AAAA;;;+FAG+F;;;AAE/F;;GAEG;AACH,0CAAuC;AAQvC,+DAA4D;AAC5D,qDAAkD;AAElD,mDAAgD;AAChD,8EAA2E;AAC3E,kGAA+F;AAC/F,oGAAiG;AACjG,0EAAuE;AACvE,4FAAyF;AACzF,4EAAyE;AACzE,wFAAqF;AACrF,iDAA8C;AAC9C,6CAA0C;AAe1C;;;;;;;;;;;;;;GAcG;AACH,MAAsB,eAAgB,SAAQ,6BAAa;IAA3D;;QACE,wCAAwC;QACxB,qBAAgB,GAAG,iBAAiB,CAAC;QAGr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,uDAAuD;QAChD,2BAAsB,GAAG,mBAAQ,CAAC,mBAAmB,CAAC;IAC/D,CAAC;CAAA;AATD,8FASC","sourcesContent":["/*---------------------------------------------------------------------------------------------\r\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\r\n* See LICENSE.md in the project root for license terms and full copyright notice.\r\n*--------------------------------------------------------------------------------------------*/\r\n\r\n/** @packageDocumentation\r\n * @module Curve\r\n */\r\nimport { Geometry } from \"../Geometry\";\r\nimport { GeometryHandler } from \"../geometry3d/GeometryHandler\";\r\nimport { GrowableXYZArray } from \"../geometry3d/GrowableXYZArray\";\r\nimport { Point3d, Vector3d } from \"../geometry3d/Point3dVector3d\";\r\nimport { Range1d, Range3d } from \"../geometry3d/Range\";\r\nimport { Ray3d } from \"../geometry3d/Ray3d\";\r\nimport { Transform } from \"../geometry3d/Transform\";\r\nimport { AnyCurve } from \"./CurveChain\";\r\nimport { CurveLocationDetail } from \"./CurveLocationDetail\";\r\nimport { CurvePrimitive } from \"./CurvePrimitive\";\r\nimport { RecursiveCurveProcessor } from \"./CurveProcessor\";\r\nimport { GeometryQuery } from \"./GeometryQuery\";\r\nimport { CloneCurvesContext } from \"./internalContexts/CloneCurvesContext\";\r\nimport { CloneWithExpandedLineStrings } from \"./internalContexts/CloneWithExpandedLineStrings\";\r\nimport { CountLinearPartsSearchContext } from \"./internalContexts/CountLinearPartsSearchContext\";\r\nimport { GapSearchContext } from \"./internalContexts/GapSearchContext\";\r\nimport { PlaneAltitudeRangeContext } from \"./internalContexts/PlaneAltitudeRangeContext\";\r\nimport { SumLengthsContext } from \"./internalContexts/SumLengthsContext\";\r\nimport { TransformInPlaceContext } from \"./internalContexts/TransformInPlaceContext\";\r\nimport { LineString3d } from \"./LineString3d\";\r\nimport { ProxyCurve } from \"./ProxyCurve\";\r\nimport { StrokeOptions } from \"./StrokeOptions\";\r\n\r\n/**\r\n * Describes the concrete type of a [[CurveCollection]]. Each type name maps to a specific subclass and can be\r\n * used in conditional statements for type-switching.\r\n * - \"loop\" => [[Loop]]\r\n * - \"path\" => [[Path]]\r\n * - \"unionRegion\" => [[UnionRegion]]\r\n * - \"parityRegion\" => [[ParityRegion]]\r\n * - \"bagOfCurves\" => [[BagOfCurves]]\r\n * @public\r\n */\r\nexport type CurveCollectionType = \"loop\" | \"path\" | \"unionRegion\" | \"parityRegion\" | \"bagOfCurves\";\r\n\r\n/**\r\n * A `CurveCollection` is an abstract (non-instantiable) class for various sets of curves with particular structures:\r\n * - `CurveChain` is a (non-instantiable) intermediate class for a sequence of `CurvePrimitive` joining head-to-tail.\r\n * The two instantiable forms of `CurveChain` are\r\n * - `Path` - A chain not required to close and not enclosing a planar area (so curves do not have to be on the\r\n * same plane).\r\n * - `Loop` - A chain required to close from last to first so that a planar area is enclosed (so curves have to\r\n * be on the same plane).\r\n * - `ParityRegion` -- a collection of coplanar `Loop`, with \"in/out\" classification by parity rules.\r\n * - `UnionRegion` -- a collection of coplanar `Loop` and/or `ParityRegion`, with \"in/out\" classification by union rules.\r\n * - `BagOfCurves` -- a collection of `AnyCurve` with no implied structure.\r\n *\r\n * @see [Curve Collections]($docs/learning/geometry/CurveCollection.md) learning article.\r\n * @public\r\n */\r\nexport abstract class CurveCollection extends GeometryQuery {\r\n /** String name for schema properties */\r\n public readonly geometryCategory = \"curveCollection\";\r\n /** Type discriminator. */\r\n public abstract readonly curveCollectionType: CurveCollectionType;\r\n /* eslint-disable @typescript-eslint/naming-convention, no-empty */\r\n /** Flag for inner loop status. Only used by `Loop`. */\r\n public isInner: boolean = false;\r\n /** Return the sum of the lengths of all contained curves. */\r\n public sumLengths(): number {\r\n return SumLengthsContext.sumLengths(this);\r\n }\r\n /** Return the closest point on the contained curves */\r\n public closestPoint(spacePoint: Point3d): CurveLocationDetail | undefined {\r\n let detailA: CurveLocationDetail | undefined;\r\n if (this.children !== undefined) {\r\n for (const child of this.children) {\r\n if (child instanceof CurvePrimitive) {\r\n const detailB = child.closestPoint(spacePoint, false);\r\n detailA = CurveLocationDetail.chooseSmallerA(detailA, detailB);\r\n } else if (child instanceof CurveCollection) {\r\n const detailB = child.closestPoint(spacePoint);\r\n detailA = CurveLocationDetail.chooseSmallerA(detailA, detailB);\r\n }\r\n }\r\n }\r\n return detailA;\r\n }\r\n /**\r\n * Return the max gap between adjacent primitives in Path and Loop collections.\r\n * * In a Path, gaps are computed between consecutive primitives.\r\n * * In a Loop, gaps are computed between consecutive primitives and between last and first.\r\n * * Gaps are NOT computed between consecutive CurvePrimitives in \"unstructured\" collections. The type is\r\n * \"unstructured\" so gaps should not be semantically meaningful.\r\n */\r\n public maxGap(): number {\r\n return GapSearchContext.maxGap(this);\r\n }\r\n /** Return true if the curve collection has any primitives other than LineSegment3d and LineString3d */\r\n public checkForNonLinearPrimitives(): boolean {\r\n return CountLinearPartsSearchContext.hasNonLinearPrimitives(this);\r\n }\r\n /** Apply transform recursively to children */\r\n public tryTransformInPlace(transform: Transform): boolean {\r\n return TransformInPlaceContext.tryTransformInPlace(this, transform);\r\n }\r\n /** Return a deep copy. */\r\n public override clone(): CurveCollection {\r\n return CloneCurvesContext.clone(this) as CurveCollection;\r\n }\r\n /** Create a deep copy of transformed curves. */\r\n public override cloneTransformed(transform: Transform): CurveCollection | undefined {\r\n return CloneCurvesContext.clone(this, transform);\r\n }\r\n /** Create a deep copy with all linestrings broken down into multiple LineSegment3d. */\r\n public cloneWithExpandedLineStrings(): CurveCollection {\r\n return CloneWithExpandedLineStrings.clone(this);\r\n }\r\n /**\r\n * Push all CurvePrimitives contained in the instance onto the `results` array.\r\n * * This method is recursive. For example, if the CurveCollection contains a Loop, all CurvePrimitives\r\n * of the Loop are pushed onto `results`.\r\n */\r\n private collectCurvePrimitivesGo(\r\n results: CurvePrimitive[], smallestPossiblePrimitives: boolean, explodeLinestrings: boolean = false,\r\n ): void {\r\n if (this.children) {\r\n for (const child of this.children) {\r\n if (child instanceof CurvePrimitive)\r\n child.collectCurvePrimitivesGo(results, smallestPossiblePrimitives, explodeLinestrings);\r\n else if (child instanceof CurveCollection)\r\n child.collectCurvePrimitivesGo(results, smallestPossiblePrimitives, explodeLinestrings);\r\n }\r\n }\r\n }\r\n /**\r\n * Return an array containing all CurvePrimitives in the instance.\r\n * * This method is recursive. For example, if the CurveCollection contains a Loop, all CurvePrimitives of\r\n * the Loop are pushed onto the returned array.\r\n * @param collectorArray optional array to receive primitives. If present, new primitives are ADDED (without\r\n * clearing the array).\r\n * @param smallestPossiblePrimitives if false, CurvePrimitiveWithDistanceIndex returns only itself. If true,\r\n * it recurses to its (otherwise hidden) children.\r\n */\r\n public collectCurvePrimitives(\r\n collectorArray?: CurvePrimitive[], smallestPossiblePrimitives: boolean = false, explodeLineStrings: boolean = false,\r\n ): CurvePrimitive[] {\r\n const results: CurvePrimitive[] = collectorArray === undefined ? [] : collectorArray;\r\n this.collectCurvePrimitivesGo(results, smallestPossiblePrimitives, explodeLineStrings);\r\n return results;\r\n }\r\n /**\r\n * Return true for planar region types:\r\n * * `Loop`\r\n * * `ParityRegion`\r\n * * `UnionRegion`\r\n */\r\n public get isAnyRegionType(): boolean {\r\n return this.dgnBoundaryType() === 2 || this.dgnBoundaryType() === 4 || this.dgnBoundaryType() === 5;\r\n }\r\n /** Return true for a `Path`, i.e. a chain of curves joined head-to-tail */\r\n public get isOpenPath(): boolean {\r\n return this.dgnBoundaryType() === 1;\r\n }\r\n /**\r\n * Return true for a single-loop planar region type, i.e. `Loop`.\r\n * * This is NOT a test for physical closure of a `Path`.\r\n */\r\n public get isClosedPath(): boolean {\r\n return this.dgnBoundaryType() === 2;\r\n }\r\n /** Return a CurveCollection with the same structure but all curves replaced by strokes. */\r\n public abstract cloneStroked(options?: StrokeOptions): AnyCurve;\r\n /** Support method for ICurvePrimitive ... one line call to specific announce method . . */\r\n public abstract announceToCurveProcessor(processor: RecursiveCurveProcessor): void;\r\n /** Clone an empty collection. */\r\n public abstract cloneEmptyPeer(): CurveCollection;\r\n /**\r\n * Return the boundary type of a corresponding MicroStation CurveVector.\r\n * * Derived class must implement.\r\n */\r\n public abstract dgnBoundaryType(): number;\r\n /**\r\n * Try to add a child.\r\n * @param child child to add.\r\n * @return true if child is an acceptable type for this collection.\r\n */\r\n public abstract tryAddChild(child: AnyCurve | undefined): boolean;\r\n /** Return a child identified by by index */\r\n public abstract getChild(i: number): AnyCurve | undefined;\r\n /**\r\n * Extend (increase) the given range as needed to encompass all curves in the curve collection.\r\n * @param rangeToExtend the given range.\r\n * @param transform if supplied, the range is extended with transformed curves.\r\n */\r\n public extendRange(rangeToExtend: Range3d, transform?: Transform): void {\r\n const children = this.children;\r\n if (children) {\r\n for (const c of children) {\r\n c.extendRange(rangeToExtend, transform);\r\n }\r\n }\r\n }\r\n /**\r\n * Find any CurvePrimitive in the source and evaluate it at the given fraction.\r\n * * The first CurvePrimitive found is evaluated. Any other CurvePrimitives are ignored.\r\n * @param source containing `CurvePrimitive` or `CurveCollection`\r\n * @param fraction fraction to use in `curve.fractionToPoint(fraction)`\r\n */\r\n public static createCurveLocationDetailOnAnyCurvePrimitive(\r\n source: GeometryQuery | undefined, fraction: number = 0.5,\r\n ): CurveLocationDetail | undefined {\r\n if (!source)\r\n return undefined;\r\n if (source instanceof CurvePrimitive) {\r\n return CurveLocationDetail.createCurveEvaluatedFraction(source, fraction);\r\n } else if (source instanceof CurveCollection && source.children !== undefined)\r\n for (const child of source.children) {\r\n const detail = this.createCurveLocationDetailOnAnyCurvePrimitive(child, fraction);\r\n if (detail)\r\n return detail;\r\n }\r\n return undefined;\r\n }\r\n /**\r\n * Project instance geometry (via dispatch) onto the given ray, and return the extreme fractional parameters\r\n * of projection.\r\n * @param ray ray onto which the instance is projected. A `Vector3d` is treated as a `Ray3d` with zero origin.\r\n * @param lowHigh optional receiver for output\r\n * @returns range of fractional projection parameters onto the ray, where 0.0 is start of the ray and 1.0 is the\r\n * end of the ray.\r\n */\r\n public projectedParameterRange(ray: Vector3d | Ray3d, lowHigh?: Range1d): Range1d | undefined {\r\n return PlaneAltitudeRangeContext.findExtremeFractionsAlongDirection(this, ray, lowHigh);\r\n }\r\n}\r\n\r\n/**\r\n * Shared base class for use by both open and closed paths.\r\n * * A `CurveChain` contains only CurvePrimitives. No other paths, loops, or regions allowed.\r\n * * The specific derived classes are `Path` and `Loop`\r\n * * `CurveChain` is an intermediate class. It is not instantiable on its own.\r\n * * The related class `CurveChainWithDistanceIndex` is a `CurvePrimitive` whose API presents well-defined mappings\r\n * from fraction to xyz over the entire chain, but in fact does all the calculations over multiple primitives.\r\n * @see [Curve Collections]($docs/learning/geometry/CurveCollection.md) learning article.\r\n * @public\r\n */\r\nexport abstract class CurveChain extends CurveCollection {\r\n /** The curve primitives in the chain. */\r\n protected _curves: CurvePrimitive[];\r\n /** Constructor */\r\n protected constructor() {\r\n super();\r\n this._curves = [];\r\n }\r\n /** Return the array of `CurvePrimitive` */\r\n public override get children(): CurvePrimitive[] {\r\n if (this._curves === undefined)\r\n this._curves = [];\r\n return this._curves;\r\n }\r\n /**\r\n * Return the curve primitive at the given `index`, optionally using `modulo` to map `index` to the cyclic indexing.\r\n * * In particular, `-1` is the final curve.\r\n * @param index cyclic index\r\n */\r\n public cyclicCurvePrimitive(index: number, cyclic: boolean = true): CurvePrimitive | undefined {\r\n const n = this.children.length;\r\n if (n === 0)\r\n return undefined;\r\n if (index >= 0 && index < n) // try simplest non-cyclic access first\r\n return this.children[index];\r\n if (cyclic) {\r\n const index2 = Geometry.modulo(index, n);\r\n return this.children[index2];\r\n }\r\n return undefined;\r\n }\r\n /**\r\n * Stroke the chain into a simple xyz array.\r\n * @param options tolerance parameters controlling the stroking.\r\n */\r\n public getPackedStrokes(options?: StrokeOptions): GrowableXYZArray | undefined {\r\n /**\r\n * The object returned by \"cloneStroked\" has the same type (Loop or Path) but instead of a chain of\r\n * CurvePrimitives as children, it has a single LineString3d child. \"getPackedStrokes\" just returns\r\n * the points of that LineString3d using \"packedPoints\".\r\n */\r\n const tree = this.cloneStroked(options);\r\n if (tree instanceof CurveChain) {\r\n const children = tree.children;\r\n if (children.length === 1) {\r\n const ls = children[0];\r\n if (ls instanceof LineString3d)\r\n return ls.packedPoints;\r\n }\r\n }\r\n return undefined;\r\n }\r\n /** Return a structural clone, with CurvePrimitive objects stroked. */\r\n public abstract override cloneStroked(options?: StrokeOptions): AnyCurve;\r\n /**\r\n * Add a child curve.\r\n * * Returns false if the given child is not a CurvePrimitive.\r\n */\r\n public tryAddChild(child: AnyCurve | undefined): boolean {\r\n if (child && child instanceof CurvePrimitive) {\r\n this._curves.push(child);\r\n return true;\r\n }\r\n return false;\r\n }\r\n /** Return a child by index */\r\n public getChild(i: number): CurvePrimitive | undefined {\r\n if (i < this._curves.length) return this._curves[i];\r\n return undefined;\r\n }\r\n /** Invoke `curve.extendRange(range, transform)` for each child */\r\n public override extendRange(range: Range3d, transform?: Transform): void {\r\n for (const curve of this._curves)\r\n curve.extendRange(range, transform);\r\n }\r\n /**\r\n * Reverse each child curve (in place)\r\n * Reverse the order of the children in the CurveChain array.\r\n */\r\n public reverseChildrenInPlace(): void {\r\n for (const curve of this._curves)\r\n curve.reverseInPlace();\r\n this._curves.reverse();\r\n }\r\n /**\r\n * Return the index where target is found in the array of children.\r\n * @param alsoSearchProxies whether to also check proxy curves of the children\r\n */\r\n public childIndex(target: CurvePrimitive | undefined, alsoSearchProxies?: boolean): number | undefined {\r\n for (let i = 0; i < this._curves.length; i++) {\r\n if (this._curves[i] === target)\r\n return i;\r\n }\r\n if (alsoSearchProxies ?? false) {\r\n for (let i = 0; i < this._curves.length; i++) {\r\n const childCurve = this._curves[i];\r\n if (childCurve instanceof ProxyCurve) {\r\n if (childCurve.proxyCurve === target)\r\n return i;\r\n }\r\n }\r\n }\r\n return undefined;\r\n }\r\n /** Evaluate an indexed curve at a fraction. Return as a CurveLocationDetail that indicates the primitive. */\r\n public primitiveIndexAndFractionToCurveLocationDetailPointAndDerivative(\r\n index: number, fraction: number, cyclic: boolean = false, result?: CurveLocationDetail,\r\n ): CurveLocationDetail | undefined {\r\n const primitive = this.cyclicCurvePrimitive(index, cyclic);\r\n if (primitive) {\r\n return CurveLocationDetail.createCurveEvaluatedFractionPointAndDerivative(primitive, fraction, result);\r\n }\r\n return undefined;\r\n }\r\n}\r\n\r\n/**\r\n * * A `BagOfCurves` object is a collection of `AnyCurve` objects.\r\n * * A `BagOfCurves` has no implied properties such as being planar.\r\n * @public\r\n */\r\nexport class BagOfCurves extends CurveCollection {\r\n /** String name for schema properties */\r\n public readonly curveCollectionType = \"bagOfCurves\";\r\n /** Test if `other` is an instance of `BagOfCurves` */\r\n public isSameGeometryClass(other: GeometryQuery): boolean {\r\n return other instanceof BagOfCurves;\r\n }\r\n /**\r\n * Array of children.\r\n * * No restrictions on type.\r\n */\r\n protected _children: AnyCurve[];\r\n /** Construct an empty `BagOfCurves` */\r\n public constructor() {\r\n super();\r\n this._children = [];\r\n }\r\n /** Return the (reference to) array of children */\r\n public override get children(): AnyCurve[] {\r\n return this._children;\r\n }\r\n /** Create with given curves. */\r\n public static create(...data: AnyCurve[]): BagOfCurves {\r\n const result = new BagOfCurves();\r\n for (const child of data) {\r\n result.tryAddChild(child);\r\n }\r\n return result;\r\n }\r\n /** Return the boundary type (0) of a corresponding MicroStation CurveVector */\r\n public dgnBoundaryType(): number {\r\n return 0;\r\n }\r\n /** Invoke `processor.announceBagOfCurves(this, indexInParent);` */\r\n public announceToCurveProcessor(processor: RecursiveCurveProcessor, indexInParent: number = -1): void {\r\n return processor.announceBagOfCurves(this, indexInParent);\r\n }\r\n /** Clone all children in stroked form. */\r\n public cloneStroked(options?: StrokeOptions): BagOfCurves {\r\n const clone = new BagOfCurves();\r\n let child;\r\n for (child of this.children) {\r\n if (child instanceof CurvePrimitive) {\r\n const ls = LineString3d.create();\r\n child.emitStrokes(ls, options);\r\n if (ls)\r\n clone.children.push(ls);\r\n } else if (child instanceof CurveCollection) {\r\n const childStrokes = child.cloneStroked(options);\r\n if (childStrokes)\r\n clone.children.push(childStrokes);\r\n }\r\n }\r\n return clone;\r\n }\r\n /** Return an empty `BagOfCurves` */\r\n public cloneEmptyPeer(): BagOfCurves {\r\n return new BagOfCurves();\r\n }\r\n /** Add a child */\r\n public tryAddChild(child: AnyCurve | undefined): boolean {\r\n if (child)\r\n this._children.push(child);\r\n return true;\r\n }\r\n /** Get a child by index */\r\n public getChild(i: number): AnyCurve | undefined {\r\n if (i < this._children.length)\r\n return this._children[i];\r\n return undefined;\r\n }\r\n /** Second step of double dispatch: call `handler.handleBagOfCurves(this)` */\r\n public dispatchToGeometryHandler(handler: GeometryHandler): any {\r\n return handler.handleBagOfCurves(this);\r\n }\r\n}\r\n\r\n/**\r\n * * Options to control method `RegionOps.consolidateAdjacentPrimitives`\r\n * @public\r\n */\r\nexport class ConsolidateAdjacentCurvePrimitivesOptions {\r\n /** True to consolidated linear geometry (e.g. separate LineSegment3d and LineString3d) into LineString3d */\r\n public consolidateLinearGeometry: boolean = true;\r\n /** True to consolidate contiguous arcs */\r\n public consolidateCompatibleArcs: boolean = true;\r\n /** Tolerance for collapsing identical points */\r\n public duplicatePointTolerance = Geometry.smallMetricDistance;\r\n /** Tolerance for removing interior colinear points. */\r\n public colinearPointTolerance = Geometry.smallMetricDistance;\r\n}\r\n"]}
1
+ {"version":3,"file":"CurveCollection.js","sourceRoot":"","sources":["../../../src/curve/CurveCollection.ts"],"names":[],"mappings":";AAAA;;;+FAG+F;;;AAE/F;;GAEG;AACH,0CAAuC;AAOvC,+DAA4D;AAC5D,qDAAkD;AAGlD,mDAAgD;AAChD,8EAA2E;AAC3E,kGAA+F;AAC/F,oGAAiG;AACjG,0EAAuE;AACvE,4FAAyF;AACzF,4EAAyE;AACzE,wFAAqF;AACrF,iDAA8C;AAC9C,6CAA0C;AAoB1C;;;;;;;;;;;;;;GAcG;AACH,MAAsB,eAAgB,SAAQ,6BAAa;IAA3D;;QACE,wCAAwC;QACxB,qBAAgB,GAAG,iBAAiB,CAAC;QAGrD,mEAAmE;QACnE,uDAAuD;QAChD,YAAO,GAAY,KAAK,CAAC;IA0LlC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E,CAAC;QAChC,IAAI,KAAK,CAAC;QACV,KAAK,KAAK,IAAI,IAAI,CAAC,QAAQ,EAAE;YAC3B,IAAI,KAAK,YAAY,+BAAc,EAAE;gBACnC,MAAM,EAAE,GAAG,2BAAY,CAAC,MAAM,EAAE,CAAC;gBACjC,KAAK,CAAC,WAAW,CAAC,EAAE,EAAE,OAAO,CAAC,CAAC;gBAC/B,IAAI,EAAE;oBACJ,KAAK,CAAC,QAAQ,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;aAC3B;iBAAM,IAAI,KAAK,YAAY,eAAe,EAAE;gBAC3C,MAAM,YAAY,GAAG,KAAK,CAAC,YAAY,CAAC,OAAO,CAAC,CAAC;gBACjD,IAAI,YAAY;oBACd,KAAK,CAAC,QAAQ,CAAC,IAAI,CAAC,YAAY,CAAC,CAAC;aACrC;SACF;QACD,OAAO,KAAK,CAAC;IACf,CAAC;IACD,oCAAoC;IAC7B,cAAc;QACnB,OAAO,IAAI,WAAW,EAAE,CAAC;IAC3B,CAAC;IACD,mBAAmB;IACZ,WAAW,CAAC,KAA2B;QAC5C,IAAI,KAAK;YACP,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;QAC7B,OAAO,IAAI,CAAC;IACd,CAAC;IACD,2BAA2B;IACpB,QAAQ,CAAC,CAAS;QACvB,IAAI,CAAC,GAAG,IAAI,CAAC,SAAS,CAAC,MAAM;YAC3B,OAAO,IAAI,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC;QAC3B,OAAO,SAAS,CAAC;IACnB,CAAC;IACD,8EAA8E;IACvE,yBAAyB,CAAC,OAAwB;QACvD,OAAO,OAAO,CAAC,iBAAiB,CAAC,IAAI,CAAC,CAAC;IACzC,CAAC;CACF;AA3ED,kCA2EC","sourcesContent":["/*---------------------------------------------------------------------------------------------\r\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\r\n* See LICENSE.md in the project root for license terms and full copyright notice.\r\n*--------------------------------------------------------------------------------------------*/\r\n\r\n/** @packageDocumentation\r\n * @module Curve\r\n */\r\nimport { Geometry } from \"../Geometry\";\r\nimport { GeometryHandler } from \"../geometry3d/GeometryHandler\";\r\nimport { GrowableXYZArray } from \"../geometry3d/GrowableXYZArray\";\r\nimport { Point3d, Vector3d } from \"../geometry3d/Point3dVector3d\";\r\nimport { Range1d, Range3d } from \"../geometry3d/Range\";\r\nimport { Ray3d } from \"../geometry3d/Ray3d\";\r\nimport { Transform } from \"../geometry3d/Transform\";\r\nimport { CurveLocationDetail } from \"./CurveLocationDetail\";\r\nimport { CurvePrimitive } from \"./CurvePrimitive\";\r\nimport { RecursiveCurveProcessor } from \"./CurveProcessor\";\r\nimport { AnyCurve, type AnyRegion } from \"./CurveTypes\";\r\nimport { GeometryQuery } from \"./GeometryQuery\";\r\nimport { CloneCurvesContext } from \"./internalContexts/CloneCurvesContext\";\r\nimport { CloneWithExpandedLineStrings } from \"./internalContexts/CloneWithExpandedLineStrings\";\r\nimport { CountLinearPartsSearchContext } from \"./internalContexts/CountLinearPartsSearchContext\";\r\nimport { GapSearchContext } from \"./internalContexts/GapSearchContext\";\r\nimport { PlaneAltitudeRangeContext } from \"./internalContexts/PlaneAltitudeRangeContext\";\r\nimport { SumLengthsContext } from \"./internalContexts/SumLengthsContext\";\r\nimport { TransformInPlaceContext } from \"./internalContexts/TransformInPlaceContext\";\r\nimport { LineString3d } from \"./LineString3d\";\r\nimport { ProxyCurve } from \"./ProxyCurve\";\r\nimport { StrokeOptions } from \"./StrokeOptions\";\r\n\r\nimport type { Path } from \"./Path\";\r\nimport type { Loop } from \"./Loop\";\r\n\r\n/** Note: CurveChain and BagOfCurves classes are located in this file to prevent circular dependency. */\r\n\r\n/**\r\n * Describes the concrete type of a [[CurveCollection]]. Each type name maps to a specific subclass and can be\r\n * used in conditional statements for type-switching.\r\n * - \"loop\" => [[Loop]]\r\n * - \"path\" => [[Path]]\r\n * - \"unionRegion\" => [[UnionRegion]]\r\n * - \"parityRegion\" => [[ParityRegion]]\r\n * - \"bagOfCurves\" => [[BagOfCurves]]\r\n * @public\r\n */\r\nexport type CurveCollectionType = \"loop\" | \"path\" | \"unionRegion\" | \"parityRegion\" | \"bagOfCurves\";\r\n\r\n/**\r\n * A `CurveCollection` is an abstract (non-instantiable) class for various sets of curves with particular structures:\r\n * - `CurveChain` is a (non-instantiable) intermediate class for a sequence of `CurvePrimitive` joining head-to-tail.\r\n * The two instantiable forms of `CurveChain` are\r\n * - `Path` - A chain not required to close and not enclosing a planar area (so curves do not have to be on the\r\n * same plane).\r\n * - `Loop` - A chain required to close from last to first so that a planar area is enclosed (so curves have to\r\n * be on the same plane).\r\n * - `ParityRegion` -- a collection of coplanar `Loop`, with \"in/out\" classification by parity rules.\r\n * - `UnionRegion` -- a collection of coplanar `Loop` and/or `ParityRegion`, with \"in/out\" classification by union rules.\r\n * - `BagOfCurves` -- a collection of `AnyCurve` with no implied structure.\r\n *\r\n * @see [Curve Collections]($docs/learning/geometry/CurveCollection.md) learning article.\r\n * @public\r\n */\r\nexport abstract class CurveCollection extends GeometryQuery {\r\n /** String name for schema properties */\r\n public readonly geometryCategory = \"curveCollection\";\r\n /** Type discriminator. */\r\n public abstract readonly curveCollectionType: CurveCollectionType;\r\n /* eslint-disable @typescript-eslint/naming-convention, no-empty */\r\n /** Flag for inner loop status. Only used by `Loop`. */\r\n public isInner: boolean = false;\r\n /** Return the sum of the lengths of all contained curves. */\r\n public sumLengths(): number {\r\n return SumLengthsContext.sumLengths(this);\r\n }\r\n /** Return the closest point on the contained curves */\r\n public closestPoint(spacePoint: Point3d): CurveLocationDetail | undefined {\r\n let detailA: CurveLocationDetail | undefined;\r\n if (this.children !== undefined) {\r\n for (const child of this.children) {\r\n if (child instanceof CurvePrimitive) {\r\n const detailB = child.closestPoint(spacePoint, false);\r\n detailA = CurveLocationDetail.chooseSmallerA(detailA, detailB);\r\n } else if (child instanceof CurveCollection) {\r\n const detailB = child.closestPoint(spacePoint);\r\n detailA = CurveLocationDetail.chooseSmallerA(detailA, detailB);\r\n }\r\n }\r\n }\r\n return detailA;\r\n }\r\n /**\r\n * Return the max gap between adjacent primitives in Path and Loop collections.\r\n * * In a Path, gaps are computed between consecutive primitives.\r\n * * In a Loop, gaps are computed between consecutive primitives and between last and first.\r\n * * Gaps are NOT computed between consecutive CurvePrimitives in \"unstructured\" collections. The type is\r\n * \"unstructured\" so gaps should not be semantically meaningful.\r\n */\r\n public maxGap(): number {\r\n return GapSearchContext.maxGap(this);\r\n }\r\n /** Return true if the curve collection has any primitives other than LineSegment3d and LineString3d */\r\n public checkForNonLinearPrimitives(): boolean {\r\n return CountLinearPartsSearchContext.hasNonLinearPrimitives(this);\r\n }\r\n /** Apply transform recursively to children */\r\n public tryTransformInPlace(transform: Transform): boolean {\r\n return TransformInPlaceContext.tryTransformInPlace(this, transform);\r\n }\r\n /** Return a deep copy. */\r\n public override clone(): CurveCollection {\r\n return CloneCurvesContext.clone(this) as CurveCollection;\r\n }\r\n /** Create a deep copy of transformed curves. */\r\n public override cloneTransformed(transform: Transform): CurveCollection | undefined {\r\n return CloneCurvesContext.clone(this, transform);\r\n }\r\n /** Create a deep copy with all linestrings broken down into multiple LineSegment3d. */\r\n public cloneWithExpandedLineStrings(): CurveCollection {\r\n return CloneWithExpandedLineStrings.clone(this);\r\n }\r\n /**\r\n * Push all CurvePrimitives contained in the instance onto the `results` array.\r\n * * This method is recursive. For example, if the CurveCollection contains a Loop, all CurvePrimitives\r\n * of the Loop are pushed onto `results`.\r\n */\r\n private collectCurvePrimitivesGo(\r\n results: CurvePrimitive[], smallestPossiblePrimitives: boolean, explodeLinestrings: boolean = false,\r\n ): void {\r\n if (this.children) {\r\n for (const child of this.children) {\r\n if (child instanceof CurvePrimitive)\r\n child.collectCurvePrimitivesGo(results, smallestPossiblePrimitives, explodeLinestrings);\r\n else if (child instanceof CurveCollection)\r\n child.collectCurvePrimitivesGo(results, smallestPossiblePrimitives, explodeLinestrings);\r\n }\r\n }\r\n }\r\n /**\r\n * Return an array containing all CurvePrimitives in the instance.\r\n * * This method is recursive. For example, if the CurveCollection contains a Loop, all CurvePrimitives of\r\n * the Loop are pushed onto the returned array.\r\n * @param collectorArray optional array to receive primitives. If present, new primitives are ADDED (without\r\n * clearing the array).\r\n * @param smallestPossiblePrimitives if false, CurvePrimitiveWithDistanceIndex returns only itself. If true,\r\n * it recurses to its (otherwise hidden) children.\r\n */\r\n public collectCurvePrimitives(\r\n collectorArray?: CurvePrimitive[], smallestPossiblePrimitives: boolean = false, explodeLineStrings: boolean = false,\r\n ): CurvePrimitive[] {\r\n const results: CurvePrimitive[] = collectorArray === undefined ? [] : collectorArray;\r\n this.collectCurvePrimitivesGo(results, smallestPossiblePrimitives, explodeLineStrings);\r\n return results;\r\n }\r\n /**\r\n * Return true for planar region types:\r\n * * `Loop`\r\n * * `ParityRegion`\r\n * * `UnionRegion`\r\n * @see isAnyRegion\r\n */\r\n public get isAnyRegionType(): boolean {\r\n return this.dgnBoundaryType() === 2 || this.dgnBoundaryType() === 4 || this.dgnBoundaryType() === 5;\r\n }\r\n /** Type guard for AnyRegion */\r\n public isAnyRegion(): this is AnyRegion {\r\n return this.isAnyRegionType;\r\n }\r\n /**\r\n * Return true for a `Path`, i.e. a chain of curves joined head-to-tail\r\n * @see isPath\r\n */\r\n public get isOpenPath(): boolean {\r\n return this.dgnBoundaryType() === 1;\r\n }\r\n /** Type guard for Path */\r\n public isPath(): this is Path {\r\n return this.isOpenPath;\r\n }\r\n /**\r\n * Return true for a single-loop planar region type, i.e. `Loop`.\r\n * * This is NOT a test for physical closure of a `Path`.\r\n * @see isLoop\r\n */\r\n public get isClosedPath(): boolean {\r\n return this.dgnBoundaryType() === 2;\r\n }\r\n /** Type guard for Loop */\r\n public isLoop(): this is Loop {\r\n return this.isClosedPath;\r\n }\r\n\r\n /** Return a CurveCollection with the same structure but all curves replaced by strokes. */\r\n public abstract cloneStroked(options?: StrokeOptions): CurveCollection;\r\n /** Support method for ICurvePrimitive ... one line call to specific announce method . . */\r\n public abstract announceToCurveProcessor(processor: RecursiveCurveProcessor): void;\r\n /** Clone an empty collection. */\r\n public abstract cloneEmptyPeer(): CurveCollection;\r\n /**\r\n * Return the boundary type of a corresponding MicroStation CurveVector.\r\n * * Derived class must implement.\r\n */\r\n public abstract dgnBoundaryType(): number;\r\n /**\r\n * Try to add a child.\r\n * @param child child to add.\r\n * @return true if child is an acceptable type for this collection.\r\n */\r\n public abstract tryAddChild(child: AnyCurve | undefined): boolean;\r\n /** Return a child identified by by index */\r\n public abstract getChild(i: number): AnyCurve | undefined;\r\n /**\r\n * Extend (increase) the given range as needed to encompass all curves in the curve collection.\r\n * @param rangeToExtend the given range.\r\n * @param transform if supplied, the range is extended with transformed curves.\r\n */\r\n public extendRange(rangeToExtend: Range3d, transform?: Transform): void {\r\n const children = this.children;\r\n if (children) {\r\n for (const c of children) {\r\n c.extendRange(rangeToExtend, transform);\r\n }\r\n }\r\n }\r\n /**\r\n * Find any CurvePrimitive in the source and evaluate it at the given fraction.\r\n * * The first CurvePrimitive found is evaluated. Any other CurvePrimitives are ignored.\r\n * @param source containing `CurvePrimitive` or `CurveCollection`\r\n * @param fraction fraction to use in `curve.fractionToPoint(fraction)`\r\n */\r\n public static createCurveLocationDetailOnAnyCurvePrimitive(\r\n source: GeometryQuery | undefined, fraction: number = 0.5,\r\n ): CurveLocationDetail | undefined {\r\n if (!source)\r\n return undefined;\r\n if (source instanceof CurvePrimitive) {\r\n return CurveLocationDetail.createCurveEvaluatedFraction(source, fraction);\r\n } else if (source instanceof CurveCollection && source.children !== undefined)\r\n for (const child of source.children) {\r\n const detail = this.createCurveLocationDetailOnAnyCurvePrimitive(child, fraction);\r\n if (detail)\r\n return detail;\r\n }\r\n return undefined;\r\n }\r\n /**\r\n * Project instance geometry (via dispatch) onto the given ray, and return the extreme fractional parameters\r\n * of projection.\r\n * @param ray ray onto which the instance is projected. A `Vector3d` is treated as a `Ray3d` with zero origin.\r\n * @param lowHigh optional receiver for output\r\n * @returns range of fractional projection parameters onto the ray, where 0.0 is start of the ray and 1.0 is the\r\n * end of the ray.\r\n */\r\n public projectedParameterRange(ray: Vector3d | Ray3d, lowHigh?: Range1d): Range1d | undefined {\r\n return PlaneAltitudeRangeContext.findExtremeFractionsAlongDirection(this, ray, lowHigh);\r\n }\r\n}\r\n\r\n/**\r\n * Shared base class for use by both open and closed paths.\r\n * * A `CurveChain` contains only CurvePrimitives. No other paths, loops, or regions allowed.\r\n * * The specific derived classes are `Path` and `Loop`.\r\n * * `CurveChain` is an intermediate class. It is not instantiable on its own.\r\n * * The related class `CurveChainWithDistanceIndex` is a `CurvePrimitive` whose API presents well-defined mappings\r\n * from fraction to xyz over the entire chain, but in fact does all the calculations over multiple primitives.\r\n * @see [Curve Collections]($docs/learning/geometry/CurveCollection.md) learning article.\r\n * @public\r\n */\r\nexport abstract class CurveChain extends CurveCollection {\r\n /** The curve primitives in the chain. */\r\n protected _curves: CurvePrimitive[];\r\n /** Constructor */\r\n protected constructor() {\r\n super();\r\n this._curves = [];\r\n }\r\n /** Return the array of `CurvePrimitive` */\r\n public override get children(): CurvePrimitive[] {\r\n return this._curves;\r\n }\r\n /**\r\n * Return the curve primitive at the given `index`, optionally using `modulo` to map `index` to the cyclic indexing.\r\n * * In particular, `-1` is the final curve.\r\n * @param index cyclic index\r\n */\r\n public cyclicCurvePrimitive(index: number, cyclic: boolean = true): CurvePrimitive | undefined {\r\n const n = this.children.length;\r\n if (n === 0)\r\n return undefined;\r\n if (index >= 0 && index < n) // try simplest non-cyclic access first\r\n return this.children[index];\r\n if (cyclic) {\r\n const index2 = Geometry.modulo(index, n);\r\n return this.children[index2];\r\n }\r\n return undefined;\r\n }\r\n /**\r\n * Stroke the chain into a simple xyz array.\r\n * @param options tolerance parameters controlling the stroking.\r\n */\r\n public getPackedStrokes(options?: StrokeOptions): GrowableXYZArray | undefined {\r\n /**\r\n * The object returned by \"cloneStroked\" has the same type (Loop or Path) but instead of a chain of\r\n * CurvePrimitives as children, it has a single LineString3d child. \"getPackedStrokes\" just returns\r\n * the points of that LineString3d using \"packedPoints\".\r\n */\r\n const tree = this.cloneStroked(options);\r\n if (tree instanceof CurveChain) {\r\n const children = tree.children;\r\n if (children.length === 1) {\r\n const ls = children[0];\r\n if (ls instanceof LineString3d)\r\n return ls.packedPoints;\r\n }\r\n }\r\n return undefined;\r\n }\r\n /** Return a structural clone, with CurvePrimitive objects stroked. */\r\n public abstract override cloneStroked(options?: StrokeOptions): CurveChain;\r\n /**\r\n * Add a child curve.\r\n * * Returns false if the given child is not a CurvePrimitive.\r\n */\r\n public tryAddChild(child: AnyCurve | undefined): boolean {\r\n if (child && child instanceof CurvePrimitive) {\r\n this._curves.push(child);\r\n return true;\r\n }\r\n return false;\r\n }\r\n /** Return a child by index */\r\n public getChild(i: number): CurvePrimitive | undefined {\r\n if (i < this._curves.length) return this._curves[i];\r\n return undefined;\r\n }\r\n /** Invoke `curve.extendRange(range, transform)` for each child */\r\n public override extendRange(range: Range3d, transform?: Transform): void {\r\n for (const curve of this._curves)\r\n curve.extendRange(range, transform);\r\n }\r\n /**\r\n * Reverse each child curve (in place)\r\n * Reverse the order of the children in the CurveChain array.\r\n */\r\n public reverseChildrenInPlace(): void {\r\n for (const curve of this._curves)\r\n curve.reverseInPlace();\r\n this._curves.reverse();\r\n }\r\n /**\r\n * Return the index where target is found in the array of children.\r\n * @param alsoSearchProxies whether to also check proxy curves of the children\r\n */\r\n public childIndex(target: CurvePrimitive | undefined, alsoSearchProxies?: boolean): number | undefined {\r\n for (let i = 0; i < this._curves.length; i++) {\r\n if (this._curves[i] === target)\r\n return i;\r\n }\r\n if (alsoSearchProxies ?? false) {\r\n for (let i = 0; i < this._curves.length; i++) {\r\n const childCurve = this._curves[i];\r\n if (childCurve instanceof ProxyCurve) {\r\n if (childCurve.proxyCurve === target)\r\n return i;\r\n }\r\n }\r\n }\r\n return undefined;\r\n }\r\n /** Evaluate an indexed curve at a fraction. Return as a CurveLocationDetail that indicates the primitive. */\r\n public primitiveIndexAndFractionToCurveLocationDetailPointAndDerivative(\r\n index: number, fraction: number, cyclic: boolean = false, result?: CurveLocationDetail,\r\n ): CurveLocationDetail | undefined {\r\n const primitive = this.cyclicCurvePrimitive(index, cyclic);\r\n if (primitive) {\r\n return CurveLocationDetail.createCurveEvaluatedFractionPointAndDerivative(primitive, fraction, result);\r\n }\r\n return undefined;\r\n }\r\n}\r\n\r\n/**\r\n * * A `BagOfCurves` object is a collection of `AnyCurve` objects.\r\n * * A `BagOfCurves` has no implied properties such as being planar.\r\n * @public\r\n */\r\nexport class BagOfCurves extends CurveCollection {\r\n /** String name for schema properties */\r\n public readonly curveCollectionType = \"bagOfCurves\";\r\n /** Test if `other` is an instance of `BagOfCurves` */\r\n public isSameGeometryClass(other: GeometryQuery): boolean {\r\n return other instanceof BagOfCurves;\r\n }\r\n /**\r\n * Array of children.\r\n * * No restrictions on type.\r\n */\r\n protected _children: AnyCurve[];\r\n /** Construct an empty `BagOfCurves` */\r\n public constructor() {\r\n super();\r\n this._children = [];\r\n }\r\n /** Return the (reference to) array of children */\r\n public override get children(): AnyCurve[] {\r\n return this._children;\r\n }\r\n /** Create with given curves. */\r\n public static create(...data: AnyCurve[]): BagOfCurves {\r\n const result = new BagOfCurves();\r\n for (const child of data) {\r\n result.tryAddChild(child);\r\n }\r\n return result;\r\n }\r\n /** Return the boundary type (0) of a corresponding MicroStation CurveVector */\r\n public dgnBoundaryType(): number {\r\n return 0;\r\n }\r\n /** Invoke `processor.announceBagOfCurves(this, indexInParent);` */\r\n public announceToCurveProcessor(processor: RecursiveCurveProcessor, indexInParent: number = -1): void {\r\n return processor.announceBagOfCurves(this, indexInParent);\r\n }\r\n /** Clone all children in stroked form. */\r\n public cloneStroked(options?: StrokeOptions): BagOfCurves {\r\n const clone = new BagOfCurves();\r\n let child;\r\n for (child of this.children) {\r\n if (child instanceof CurvePrimitive) {\r\n const ls = LineString3d.create();\r\n child.emitStrokes(ls, options);\r\n if (ls)\r\n clone.children.push(ls);\r\n } else if (child instanceof CurveCollection) {\r\n const childStrokes = child.cloneStroked(options);\r\n if (childStrokes)\r\n clone.children.push(childStrokes);\r\n }\r\n }\r\n return clone;\r\n }\r\n /** Return an empty `BagOfCurves` */\r\n public cloneEmptyPeer(): BagOfCurves {\r\n return new BagOfCurves();\r\n }\r\n /** Add a child */\r\n public tryAddChild(child: AnyCurve | undefined): boolean {\r\n if (child)\r\n this._children.push(child);\r\n return true;\r\n }\r\n /** Get a child by index */\r\n public getChild(i: number): AnyCurve | undefined {\r\n if (i < this._children.length)\r\n return this._children[i];\r\n return undefined;\r\n }\r\n /** Second step of double dispatch: call `handler.handleBagOfCurves(this)` */\r\n public dispatchToGeometryHandler(handler: GeometryHandler): any {\r\n return handler.handleBagOfCurves(this);\r\n }\r\n}\r\n"]}
@@ -2,10 +2,9 @@
2
2
  * @module Curve
3
3
  */
4
4
  import { Matrix4d } from "../geometry4d/Matrix4d";
5
- import { CurveLocationDetailArrayPair } from "./CurveCurveIntersectXY";
6
- import { CurveLocationDetailPair } from "./CurveLocationDetail";
5
+ import { CurveLocationDetailArrayPair, CurveLocationDetailPair } from "./CurveLocationDetail";
7
6
  import { CurvePrimitive } from "./CurvePrimitive";
8
- import { GeometryQuery } from "./GeometryQuery";
7
+ import { AnyCurve } from "./CurveTypes";
9
8
  /**
10
9
  * `CurveCurve` has static method for various computations that work on a pair of curves or curve collections.
11
10
  * @public
@@ -13,36 +12,33 @@ import { GeometryQuery } from "./GeometryQuery";
13
12
  export declare class CurveCurve {
14
13
  /**
15
14
  * Return xy intersections of 2 curves.
16
- * * **NOTE:** GeometryQuery inputs should really be AnyCurve.
17
- * @param geometryA first geometry
18
- * @param extendA true to allow geometryA to extend
19
- * @param geometryB second geometry
20
- * @param extendB true to allow geometryB to extend
15
+ * @param curveA first curve
16
+ * @param extendA true to allow curveA to extend
17
+ * @param curveB second curve
18
+ * @param extendB true to allow curveB to extend
21
19
  * @param tolerance optional distance tolerance for coincidence
22
20
  */
23
- static intersectionXYPairs(geometryA: GeometryQuery, extendA: boolean, geometryB: GeometryQuery, extendB: boolean, tolerance?: number): CurveLocationDetailPair[];
21
+ static intersectionXYPairs(curveA: AnyCurve, extendA: boolean, curveB: AnyCurve, extendB: boolean, tolerance?: number): CurveLocationDetailPair[];
24
22
  /**
25
23
  * Return xy intersections of 2 projected curves.
26
- * * **NOTE:** GeometryQuery inputs should really be AnyCurve.
27
- * @param geometryA first geometry
28
- * @param extendA true to allow geometryA to extend
29
- * @param geometryB second geometry
30
- * @param extendB true to allow geometryB to extend
24
+ * @param curveA first curve
25
+ * @param extendA true to allow curveA to extend
26
+ * @param curveB second curve
27
+ * @param extendB true to allow curveB to extend
31
28
  * @param tolerance optional distance tolerance for coincidence
32
29
  */
33
- static intersectionProjectedXYPairs(worldToLocal: Matrix4d, geometryA: GeometryQuery, extendA: boolean, geometryB: GeometryQuery, extendB: boolean, tolerance?: number): CurveLocationDetailPair[];
30
+ static intersectionProjectedXYPairs(worldToLocal: Matrix4d, curveA: AnyCurve, extendA: boolean, curveB: AnyCurve, extendB: boolean, tolerance?: number): CurveLocationDetailPair[];
34
31
  /**
35
32
  * Return full 3d xyz intersections of 2 curves.
36
33
  * * Implemented for combinations of LineSegment3d, LineString3d, Arc3d.
37
34
  * * Not Implemented for bspline and bezier curves.
38
- * * **NOTE:** GeometryQuery inputs should really be AnyCurve.
39
35
  * @beta
40
- * @param geometryA first geometry
41
- * @param extendA true to allow geometryA to extend
42
- * @param geometryB second geometry
43
- * @param extendB true to allow geometryB to extend
36
+ * @param curveA first curve
37
+ * @param extendA true to allow curveA to extend
38
+ * @param curveB second curve
39
+ * @param extendB true to allow curveB to extend
44
40
  */
45
- static intersectionXYZ(geometryA: GeometryQuery, extendA: boolean, geometryB: GeometryQuery, extendB: boolean): CurveLocationDetailArrayPair;
41
+ static intersectionXYZ(curveA: AnyCurve, extendA: boolean, curveB: AnyCurve, extendB: boolean): CurveLocationDetailArrayPair;
46
42
  /**
47
43
  * Return xy intersections of input curves.
48
44
  * @param primitives input curves to intersect
@@ -50,11 +46,30 @@ export declare class CurveCurve {
50
46
  */
51
47
  static allIntersectionsAmongPrimitivesXY(primitives: CurvePrimitive[], tolerance?: number): CurveLocationDetailPair[];
52
48
  /**
53
- * Return xy close approaches of 2 projected curves.
54
- * * **NOTE:** GeometryQuery inputs should really be AnyCurve.
55
- * @param geometryA first geometry
56
- * @param geometryB second geometry
49
+ * Return at least one XY close approach between 2 curves.
50
+ * * Close approach xy-distances are measured without regard to z. This is equivalent to their separation distance
51
+ * as seen in the top view, or as measured between their projections onto the xy-plane.
52
+ * * If more than one approach is returned, one of them is the closest approach.
53
+ * * If an input curve is a `CurveCollection`, then close approaches are computed to each `CurvePrimitive` child.
54
+ * This can lead to many returned pairs, especially when both inputs are `CurveCollection`s. If an input curve is
55
+ * an `AnyRegion` then close approaches are computed only to the boundary curves, not to the interior.
56
+ * @param curveA first curve
57
+ * @param curveB second curve
58
+ * @param maxDistance maximum xy-distance to consider between the curves.
59
+ * Close approaches further than this xy-distance are not returned.
57
60
  */
58
- static closeApproachProjectedXYPairs(geometryA: GeometryQuery, geometryB: GeometryQuery, maxDistance: number): CurveLocationDetailPair[];
61
+ static closeApproachProjectedXYPairs(curveA: AnyCurve, curveB: AnyCurve, maxDistance: number): CurveLocationDetailPair[];
62
+ /**
63
+ * Convenience method that calls [[closeApproachProjectedXYPairs]] with a large `maxDistance`
64
+ * and returns a detail pair representing the closest xy-approach between the curves.
65
+ * * There may be many detail pairs that represent "closest" xy-approach, including coincident interval pairs,
66
+ * isolated intersections, or close approaches within tolerance of each other. This method makes no attempt to
67
+ * distinguish among them, and returns a pair whose `detail.point` values are separated by the smallest xy distance
68
+ * found among the pairs.
69
+ * @param curveA first curve
70
+ * @param curveB second curve
71
+ * @return detail pair of closest xy-approach, undefined if not found
72
+ */
73
+ static closestApproachProjectedXYPair(curveA: AnyCurve, curveB: AnyCurve): CurveLocationDetailPair | undefined;
59
74
  }
60
75
  //# sourceMappingURL=CurveCurve.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"CurveCurve.d.ts","sourceRoot":"","sources":["../../../src/curve/CurveCurve.ts"],"names":[],"mappings":"AAIA;;GAEG;AAGH,OAAO,EAAE,QAAQ,EAAE,MAAM,wBAAwB,CAAC;AAGlD,OAAO,EAAyB,4BAA4B,EAAE,MAAM,yBAAyB,CAAC;AAE9F,OAAO,EAAE,uBAAuB,EAAE,MAAM,uBAAuB,CAAC;AAChE,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAClD,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAEhD;;;GAGG;AACH,qBAAa,UAAU;IACrB;;;;;;;;OAQG;WACW,mBAAmB,CAC/B,SAAS,EAAE,aAAa,EAAE,OAAO,EAAE,OAAO,EAAE,SAAS,EAAE,aAAa,EAAE,OAAO,EAAE,OAAO,EACtF,SAAS,GAAE,MAAqC,GAC/C,uBAAuB,EAAE;IAa5B;;;;;;;;OAQG;WACW,4BAA4B,CACxC,YAAY,EAAE,QAAQ,EAAE,SAAS,EAAE,aAAa,EAAE,OAAO,EAAE,OAAO,EAAE,SAAS,EAAE,aAAa,EAAE,OAAO,EAAE,OAAO,EAC9G,SAAS,GAAE,MAAqC,GAC/C,uBAAuB,EAAE;IAK5B;;;;;;;;;;OAUG;WACW,eAAe,CAC3B,SAAS,EAAE,aAAa,EAAE,OAAO,EAAE,OAAO,EAAE,SAAS,EAAE,aAAa,EAAE,OAAO,EAAE,OAAO,GACrF,4BAA4B;IAK/B;;;;OAIG;WACW,iCAAiC,CAC7C,UAAU,EAAE,cAAc,EAAE,EAAE,SAAS,GAAE,MAAqC,GAC7E,uBAAuB,EAAE;IAW5B;;;;;OAKG;WACW,6BAA6B,CACzC,SAAS,EAAE,aAAa,EAAE,SAAS,EAAE,aAAa,EAAE,WAAW,EAAE,MAAM,GACtE,uBAAuB,EAAE;CAM7B"}
1
+ {"version":3,"file":"CurveCurve.d.ts","sourceRoot":"","sources":["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exports, "__esModule", { value: true });
10
10
  exports.CurveCurve = void 0;
11
11
  const Geometry_1 = require("../Geometry");
12
12
  const CurveCollection_1 = require("./CurveCollection");
13
- const CurveCurveCloseApproachXY_1 = require("./CurveCurveCloseApproachXY");
14
- const CurveCurveIntersectXY_1 = require("./CurveCurveIntersectXY");
15
- const CurveCurveIntersectXYZ_1 = require("./CurveCurveIntersectXYZ");
13
+ const CurveCurveCloseApproachXY_1 = require("./internalContexts/CurveCurveCloseApproachXY");
14
+ const CurveCurveIntersectXY_1 = require("./internalContexts/CurveCurveIntersectXY");
15
+ const CurveCurveIntersectXYZ_1 = require("./internalContexts/CurveCurveIntersectXYZ");
16
16
  const CurvePrimitive_1 = require("./CurvePrimitive");
17
17
  /**
18
18
  * `CurveCurve` has static method for various computations that work on a pair of curves or curve collections.
@@ -21,55 +21,52 @@ const CurvePrimitive_1 = require("./CurvePrimitive");
21
21
  class CurveCurve {
22
22
  /**
23
23
  * Return xy intersections of 2 curves.
24
- * * **NOTE:** GeometryQuery inputs should really be AnyCurve.
25
- * @param geometryA first geometry
26
- * @param extendA true to allow geometryA to extend
27
- * @param geometryB second geometry
28
- * @param extendB true to allow geometryB to extend
24
+ * @param curveA first curve
25
+ * @param extendA true to allow curveA to extend
26
+ * @param curveB second curve
27
+ * @param extendB true to allow curveB to extend
29
28
  * @param tolerance optional distance tolerance for coincidence
30
29
  */
31
- static intersectionXYPairs(geometryA, extendA, geometryB, extendB, tolerance = Geometry_1.Geometry.smallMetricDistance) {
32
- const handler = new CurveCurveIntersectXY_1.CurveCurveIntersectXY(undefined, extendA, geometryB, extendB, tolerance);
33
- if (geometryB instanceof CurvePrimitive_1.CurvePrimitive) {
34
- geometryA.dispatchToGeometryHandler(handler);
30
+ static intersectionXYPairs(curveA, extendA, curveB, extendB, tolerance = Geometry_1.Geometry.smallMetricDistance) {
31
+ const handler = new CurveCurveIntersectXY_1.CurveCurveIntersectXY(undefined, extendA, curveB, extendB, tolerance);
32
+ if (curveB instanceof CurvePrimitive_1.CurvePrimitive) {
33
+ curveA.dispatchToGeometryHandler(handler);
35
34
  }
36
- else if (geometryB instanceof CurveCollection_1.CurveCollection) {
37
- const allCurves = geometryB.collectCurvePrimitives();
35
+ else if (curveB instanceof CurveCollection_1.CurveCollection) {
36
+ const allCurves = curveB.collectCurvePrimitives();
38
37
  for (const child of allCurves) {
39
38
  handler.resetGeometry(false, child, false);
40
- geometryA.dispatchToGeometryHandler(handler);
39
+ curveA.dispatchToGeometryHandler(handler);
41
40
  }
42
41
  }
43
42
  return handler.grabPairedResults();
44
43
  }
45
44
  /**
46
45
  * Return xy intersections of 2 projected curves.
47
- * * **NOTE:** GeometryQuery inputs should really be AnyCurve.
48
- * @param geometryA first geometry
49
- * @param extendA true to allow geometryA to extend
50
- * @param geometryB second geometry
51
- * @param extendB true to allow geometryB to extend
46
+ * @param curveA first curve
47
+ * @param extendA true to allow curveA to extend
48
+ * @param curveB second curve
49
+ * @param extendB true to allow curveB to extend
52
50
  * @param tolerance optional distance tolerance for coincidence
53
51
  */
54
- static intersectionProjectedXYPairs(worldToLocal, geometryA, extendA, geometryB, extendB, tolerance = Geometry_1.Geometry.smallMetricDistance) {
55
- const handler = new CurveCurveIntersectXY_1.CurveCurveIntersectXY(worldToLocal, extendA, geometryB, extendB, tolerance);
56
- geometryA.dispatchToGeometryHandler(handler);
52
+ static intersectionProjectedXYPairs(worldToLocal, curveA, extendA, curveB, extendB, tolerance = Geometry_1.Geometry.smallMetricDistance) {
53
+ const handler = new CurveCurveIntersectXY_1.CurveCurveIntersectXY(worldToLocal, extendA, curveB, extendB, tolerance);
54
+ curveA.dispatchToGeometryHandler(handler);
57
55
  return handler.grabPairedResults();
58
56
  }
59
57
  /**
60
58
  * Return full 3d xyz intersections of 2 curves.
61
59
  * * Implemented for combinations of LineSegment3d, LineString3d, Arc3d.
62
60
  * * Not Implemented for bspline and bezier curves.
63
- * * **NOTE:** GeometryQuery inputs should really be AnyCurve.
64
61
  * @beta
65
- * @param geometryA first geometry
66
- * @param extendA true to allow geometryA to extend
67
- * @param geometryB second geometry
68
- * @param extendB true to allow geometryB to extend
62
+ * @param curveA first curve
63
+ * @param extendA true to allow curveA to extend
64
+ * @param curveB second curve
65
+ * @param extendB true to allow curveB to extend
69
66
  */
70
- static intersectionXYZ(geometryA, extendA, geometryB, extendB) {
71
- const handler = new CurveCurveIntersectXYZ_1.CurveCurveIntersectXYZ(extendA, geometryB, extendB);
72
- geometryA.dispatchToGeometryHandler(handler);
67
+ static intersectionXYZ(curveA, extendA, curveB, extendB) {
68
+ const handler = new CurveCurveIntersectXYZ_1.CurveCurveIntersectXYZ(extendA, curveB, extendB);
69
+ curveA.dispatchToGeometryHandler(handler);
73
70
  return handler.grabResults();
74
71
  }
75
72
  /**
@@ -80,26 +77,62 @@ class CurveCurve {
80
77
  static allIntersectionsAmongPrimitivesXY(primitives, tolerance = Geometry_1.Geometry.smallMetricDistance) {
81
78
  const handler = new CurveCurveIntersectXY_1.CurveCurveIntersectXY(undefined, false, undefined, false, tolerance);
82
79
  for (let i = 0; i < primitives.length; i++) {
83
- const geometryA = primitives[i];
80
+ const curveA = primitives[i];
84
81
  for (let j = i + 1; j < primitives.length; j++) {
85
82
  handler.resetGeometry(false, primitives[j], false);
86
- geometryA.dispatchToGeometryHandler(handler);
83
+ curveA.dispatchToGeometryHandler(handler);
87
84
  }
88
85
  }
89
86
  return handler.grabPairedResults();
90
87
  }
91
88
  /**
92
- * Return xy close approaches of 2 projected curves.
93
- * * **NOTE:** GeometryQuery inputs should really be AnyCurve.
94
- * @param geometryA first geometry
95
- * @param geometryB second geometry
89
+ * Return at least one XY close approach between 2 curves.
90
+ * * Close approach xy-distances are measured without regard to z. This is equivalent to their separation distance
91
+ * as seen in the top view, or as measured between their projections onto the xy-plane.
92
+ * * If more than one approach is returned, one of them is the closest approach.
93
+ * * If an input curve is a `CurveCollection`, then close approaches are computed to each `CurvePrimitive` child.
94
+ * This can lead to many returned pairs, especially when both inputs are `CurveCollection`s. If an input curve is
95
+ * an `AnyRegion` then close approaches are computed only to the boundary curves, not to the interior.
96
+ * @param curveA first curve
97
+ * @param curveB second curve
98
+ * @param maxDistance maximum xy-distance to consider between the curves.
99
+ * Close approaches further than this xy-distance are not returned.
96
100
  */
97
- static closeApproachProjectedXYPairs(geometryA, geometryB, maxDistance) {
98
- const handler = new CurveCurveCloseApproachXY_1.CurveCurveCloseApproachXY(geometryB);
101
+ static closeApproachProjectedXYPairs(curveA, curveB, maxDistance) {
102
+ const handler = new CurveCurveCloseApproachXY_1.CurveCurveCloseApproachXY(curveB);
99
103
  handler.maxDistanceToAccept = maxDistance;
100
- geometryA.dispatchToGeometryHandler(handler);
104
+ curveA.dispatchToGeometryHandler(handler);
101
105
  return handler.grabPairedResults();
102
106
  }
107
+ /**
108
+ * Convenience method that calls [[closeApproachProjectedXYPairs]] with a large `maxDistance`
109
+ * and returns a detail pair representing the closest xy-approach between the curves.
110
+ * * There may be many detail pairs that represent "closest" xy-approach, including coincident interval pairs,
111
+ * isolated intersections, or close approaches within tolerance of each other. This method makes no attempt to
112
+ * distinguish among them, and returns a pair whose `detail.point` values are separated by the smallest xy distance
113
+ * found among the pairs.
114
+ * @param curveA first curve
115
+ * @param curveB second curve
116
+ * @return detail pair of closest xy-approach, undefined if not found
117
+ */
118
+ static closestApproachProjectedXYPair(curveA, curveB) {
119
+ const range = curveA.range();
120
+ range.extendRange(curveB.range());
121
+ const maxDistance = range.low.distanceXY(range.high);
122
+ const closeApproaches = this.closeApproachProjectedXYPairs(curveA, curveB, maxDistance);
123
+ if (!closeApproaches.length)
124
+ return undefined;
125
+ let iMin = 0;
126
+ let minDistXY = 2 * maxDistance;
127
+ for (let i = 0; i < closeApproaches.length; ++i) {
128
+ const distXY = closeApproaches[i].detailA.point.distanceXY(closeApproaches[i].detailB.point);
129
+ if (distXY < minDistXY) {
130
+ iMin = i;
131
+ minDistXY = distXY;
132
+ }
133
+ }
134
+ return closeApproaches[iMin];
135
+ }
103
136
  }
104
137
  exports.CurveCurve = CurveCurve;
105
138
  //# sourceMappingURL=CurveCurve.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"CurveCurve.js","sourceRoot":"","sources":["../../../src/curve/CurveCurve.ts"],"names":[],"mappings":";AAAA;;;+FAG+F;AAC/F;;GAEG;;;AAEH,0CAAuC;AAEvC,uDAAoD;AACpD,2EAAwE;AACxE,mEAA8F;AAC9F,qEAAkE;AAElE,qDAAkD;AAGlD;;;GAGG;AACH,MAAa,UAAU;IACrB;;;;;;;;OAQG;IACI,MAAM,CAAC,mBAAmB,CAC/B,SAAwB,EAAE,OAAgB,EAAE,SAAwB,EAAE,OAAgB,EACtF,YAAoB,mBAAQ,CAAC,mBAAmB;QAEhD,MAAM,OAAO,GAAG,IAAI,6CAAqB,CAAC,SAAS,EAAE,OAAO,EAAE,SAAS,EAAE,OAAO,EAAE,SAAS,CAAC,CAAC;QAC7F,IAAI,SAAS,YAAY,+BAAc,EAAE;YACvC,SAAS,CAAC,yBAAyB,CAAC,OAAO,CAAC,CAAC;SAC9C;aAAM,IAAI,SAAS,YAAY,iCAAe,EAAE;YAC/C,MAAM,SAAS,GAAG,SAAS,CAAC,sBAAsB,EAAE,CAAC;YACrD,KAAK,MAAM,KAAK,IAAI,SAAS,EAAE;gBAC7B,OAAO,CAAC,aAAa,CAAC,KAAK,EAAE,KAAK,EAAE,KAAK,CAAC,CAAC;gBAC3C,SAAS,CAAC,yBAAyB,CAAC,OAAO,CAAC,CAAC;aAC9C;SACF;QACD,OAAO,OAAO,CAAC,iBAAiB,EAAE,CAAC;IACrC,CAAC;IACD;;;;;;;;OAQG;IACI,MAAM,CAAC,4BAA4B,CACxC,YAAsB,EAAE,SAAwB,EAAE,OAAgB,EAAE,SAAwB,EAAE,OAAgB,EAC9G,YAAoB,mBAAQ,CAAC,mBAAmB;QAEhD,MAAM,OAAO,GAAG,IAAI,6CAAqB,CAAC,YAAY,EAAE,OAAO,EAAE,SAAS,EAAE,OAAO,EAAE,SAAS,CAAC,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OAAO,CAAC,mBAAmB,GAAG,WAAW,CAAC;QAC1C,SAAS,CAAC,yBAAyB,CAAC,OAAO,CAAC,CAAC;QAC7C,OAAO,OAAO,CAAC,iBAAiB,EAAE,CAAC;IACrC,CAAC;CACF;AA7FD,gCA6FC","sourcesContent":["/*---------------------------------------------------------------------------------------------\r\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\r\n* See LICENSE.md in the project root for license terms and full copyright notice.\r\n*--------------------------------------------------------------------------------------------*/\r\n/** @packageDocumentation\r\n * @module Curve\r\n */\r\n\r\nimport { Geometry } from \"../Geometry\";\r\nimport { Matrix4d } from \"../geometry4d/Matrix4d\";\r\nimport { CurveCollection } from \"./CurveCollection\";\r\nimport { CurveCurveCloseApproachXY } from \"./CurveCurveCloseApproachXY\";\r\nimport { CurveCurveIntersectXY, CurveLocationDetailArrayPair } from \"./CurveCurveIntersectXY\";\r\nimport { CurveCurveIntersectXYZ } from \"./CurveCurveIntersectXYZ\";\r\nimport { CurveLocationDetailPair } from \"./CurveLocationDetail\";\r\nimport { CurvePrimitive } from \"./CurvePrimitive\";\r\nimport { GeometryQuery } from \"./GeometryQuery\";\r\n\r\n/**\r\n * `CurveCurve` has static method for various computations that work on a pair of curves or curve collections.\r\n * @public\r\n */\r\nexport class CurveCurve {\r\n /**\r\n * Return xy intersections of 2 curves.\r\n * * **NOTE:** GeometryQuery inputs should really be AnyCurve.\r\n * @param geometryA first geometry\r\n * @param extendA true to allow geometryA to extend\r\n * @param geometryB second geometry\r\n * @param extendB true to allow geometryB to extend\r\n * @param tolerance optional distance tolerance for coincidence\r\n */\r\n public static intersectionXYPairs(\r\n geometryA: GeometryQuery, extendA: boolean, geometryB: GeometryQuery, extendB: boolean,\r\n tolerance: number = Geometry.smallMetricDistance,\r\n ): CurveLocationDetailPair[] {\r\n const handler = new CurveCurveIntersectXY(undefined, extendA, geometryB, extendB, tolerance);\r\n if (geometryB instanceof CurvePrimitive) {\r\n geometryA.dispatchToGeometryHandler(handler);\r\n } else if (geometryB instanceof CurveCollection) {\r\n const allCurves = geometryB.collectCurvePrimitives();\r\n for (const child of allCurves) {\r\n handler.resetGeometry(false, child, false);\r\n geometryA.dispatchToGeometryHandler(handler);\r\n }\r\n }\r\n return handler.grabPairedResults();\r\n }\r\n /**\r\n * Return xy intersections of 2 projected curves.\r\n * * **NOTE:** GeometryQuery inputs should really be AnyCurve.\r\n * @param geometryA first geometry\r\n * @param extendA true to allow geometryA to extend\r\n * @param geometryB second geometry\r\n * @param extendB true to allow geometryB to extend\r\n * @param tolerance optional distance tolerance for coincidence\r\n */\r\n public static intersectionProjectedXYPairs(\r\n worldToLocal: Matrix4d, geometryA: GeometryQuery, extendA: boolean, geometryB: GeometryQuery, extendB: boolean,\r\n tolerance: number = Geometry.smallMetricDistance,\r\n ): CurveLocationDetailPair[] {\r\n const handler = new CurveCurveIntersectXY(worldToLocal, extendA, geometryB, extendB, tolerance);\r\n geometryA.dispatchToGeometryHandler(handler);\r\n return handler.grabPairedResults();\r\n }\r\n /**\r\n * Return full 3d xyz intersections of 2 curves.\r\n * * Implemented for combinations of LineSegment3d, LineString3d, Arc3d.\r\n * * Not Implemented for bspline and bezier curves.\r\n * * **NOTE:** GeometryQuery inputs should really be AnyCurve.\r\n * @beta\r\n * @param geometryA first geometry\r\n * @param extendA true to allow geometryA to extend\r\n * @param geometryB second geometry\r\n * @param extendB true to allow geometryB to extend\r\n */\r\n public static intersectionXYZ(\r\n geometryA: GeometryQuery, extendA: boolean, geometryB: GeometryQuery, extendB: boolean,\r\n ): CurveLocationDetailArrayPair {\r\n const handler = new CurveCurveIntersectXYZ(extendA, geometryB, extendB);\r\n geometryA.dispatchToGeometryHandler(handler);\r\n return handler.grabResults();\r\n }\r\n /**\r\n * Return xy intersections of input curves.\r\n * @param primitives input curves to intersect\r\n * @param tolerance optional distance tolerance for coincidence\r\n */\r\n public static allIntersectionsAmongPrimitivesXY(\r\n primitives: CurvePrimitive[], tolerance: number = Geometry.smallMetricDistance,\r\n ): CurveLocationDetailPair[] {\r\n const handler = new CurveCurveIntersectXY(undefined, false, undefined, false, tolerance);\r\n for (let i = 0; i < primitives.length; i++) {\r\n const geometryA = primitives[i];\r\n for (let j = i + 1; j < primitives.length; j++) {\r\n handler.resetGeometry(false, primitives[j], false);\r\n geometryA.dispatchToGeometryHandler(handler);\r\n }\r\n }\r\n return handler.grabPairedResults();\r\n }\r\n /**\r\n * Return xy close approaches of 2 projected curves.\r\n * * **NOTE:** GeometryQuery inputs should really be AnyCurve.\r\n * @param geometryA first geometry\r\n * @param geometryB second geometry\r\n */\r\n public static closeApproachProjectedXYPairs(\r\n geometryA: GeometryQuery, geometryB: GeometryQuery, maxDistance: number,\r\n ): CurveLocationDetailPair[] {\r\n const handler = new CurveCurveCloseApproachXY(geometryB);\r\n handler.maxDistanceToAccept = maxDistance;\r\n geometryA.dispatchToGeometryHandler(handler);\r\n return handler.grabPairedResults();\r\n }\r\n}\r\n"]}
1
+ {"version":3,"file":"CurveCurve.js","sourceRoot":"","sources":["../../../src/curve/CurveCurve.ts"],"names":[],"mappings":";AAAA;;;+FAG+F;AAC/F;;GAEG;;;AAEH,0CAAuC;AAEvC,uDAAoD;AACpD,4FAAyF;AACzF,oFAAiF;AACjF,sFAAmF;AAEnF,qDAAkD;AAGlD;;;GAGG;AACH,MAAa,UAAU;IACrB;;;;;;;OAOG;IACI,MAAM,CAAC,mBAAmB,CAC/B,MAAgB,EAChB,OAAgB,EAChB,MAAgB,EAChB,OAAgB,EAChB,YAAoB,mBAAQ,CAAC,mBAAmB;QAEhD,MAAM,OAAO,GAAG,IAAI,6CAAqB,CAAC,SAAS,EAAE,OAAO,EAAE,MAAM,EAAE,OAAO,EAAE,SAAS,CAAC,CAAC;QAC1F,IAAI,MAAM,YAAY,+BAAc,EAAE;YACpC,MAAM,CAAC,yBAAyB,CAAC,OAAO,CAAC,CAAC;SAC3C;aAAM,IAAI,MAAM,YAAY,iCAAe,EAAE;YAC5C,MAAM,SAAS,GAAG,MAAM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AAE,CAAC,GAAG,eAAe,CAAC,MAAM,EAAE,EAAE,CAAC,EAAE;YAC/C,MAAM,MAAM,GAAG,eAAe,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,KAAK,CAAC,UAAU,CAAC,eAAe,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC;YAC7F,IAAI,MAAM,GAAG,SAAS,EAAE;gBACtB,IAAI,GAAG,CAAC,CAAC;gBACT,SAAS,GAAG,MAAM,CAAC;aACpB;SACF;QACD,OAAO,eAAe,CAAC,IAAI,CAAC,CAAC;IAC/B,CAAC;CACF;AArID,gCAqIC","sourcesContent":["/*---------------------------------------------------------------------------------------------\r\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\r\n* See LICENSE.md in the project root for license terms and full copyright notice.\r\n*--------------------------------------------------------------------------------------------*/\r\n/** @packageDocumentation\r\n * @module Curve\r\n */\r\n\r\nimport { Geometry } from \"../Geometry\";\r\nimport { Matrix4d } from \"../geometry4d/Matrix4d\";\r\nimport { CurveCollection } from \"./CurveCollection\";\r\nimport { CurveCurveCloseApproachXY } from \"./internalContexts/CurveCurveCloseApproachXY\";\r\nimport { CurveCurveIntersectXY } from \"./internalContexts/CurveCurveIntersectXY\";\r\nimport { CurveCurveIntersectXYZ } from \"./internalContexts/CurveCurveIntersectXYZ\";\r\nimport { CurveLocationDetailArrayPair, CurveLocationDetailPair } from \"./CurveLocationDetail\";\r\nimport { CurvePrimitive } from \"./CurvePrimitive\";\r\nimport { AnyCurve } from \"./CurveTypes\";\r\n\r\n/**\r\n * `CurveCurve` has static method for various computations that work on a pair of curves or curve collections.\r\n * @public\r\n */\r\nexport class CurveCurve {\r\n /**\r\n * Return xy intersections of 2 curves.\r\n * @param curveA first curve\r\n * @param extendA true to allow curveA to extend\r\n * @param curveB second curve\r\n * @param extendB true to allow curveB to extend\r\n * @param tolerance optional distance tolerance for coincidence\r\n */\r\n public static intersectionXYPairs(\r\n curveA: AnyCurve,\r\n extendA: boolean,\r\n curveB: AnyCurve,\r\n extendB: boolean,\r\n tolerance: number = Geometry.smallMetricDistance,\r\n ): CurveLocationDetailPair[] {\r\n const handler = new CurveCurveIntersectXY(undefined, extendA, curveB, extendB, tolerance);\r\n if (curveB instanceof CurvePrimitive) {\r\n curveA.dispatchToGeometryHandler(handler);\r\n } else if (curveB instanceof CurveCollection) {\r\n const allCurves = curveB.collectCurvePrimitives();\r\n for (const child of allCurves) {\r\n handler.resetGeometry(false, child, false);\r\n curveA.dispatchToGeometryHandler(handler);\r\n }\r\n }\r\n return handler.grabPairedResults();\r\n }\r\n /**\r\n * Return xy intersections of 2 projected curves.\r\n * @param curveA first curve\r\n * @param extendA true to allow curveA to extend\r\n * @param curveB second curve\r\n * @param extendB true to allow curveB to extend\r\n * @param tolerance optional distance tolerance for coincidence\r\n */\r\n public static intersectionProjectedXYPairs(\r\n worldToLocal: Matrix4d,\r\n curveA: AnyCurve,\r\n extendA: boolean,\r\n curveB: AnyCurve,\r\n extendB: boolean,\r\n tolerance: number = Geometry.smallMetricDistance,\r\n ): CurveLocationDetailPair[] {\r\n const handler = new CurveCurveIntersectXY(worldToLocal, extendA, curveB, extendB, tolerance);\r\n curveA.dispatchToGeometryHandler(handler);\r\n return handler.grabPairedResults();\r\n }\r\n /**\r\n * Return full 3d xyz intersections of 2 curves.\r\n * * Implemented for combinations of LineSegment3d, LineString3d, Arc3d.\r\n * * Not Implemented for bspline and bezier curves.\r\n * @beta\r\n * @param curveA first curve\r\n * @param extendA true to allow curveA to extend\r\n * @param curveB second curve\r\n * @param extendB true to allow curveB to extend\r\n */\r\n public static intersectionXYZ(\r\n curveA: AnyCurve, extendA: boolean, curveB: AnyCurve, extendB: boolean,\r\n ): CurveLocationDetailArrayPair {\r\n const handler = new CurveCurveIntersectXYZ(extendA, curveB, extendB);\r\n curveA.dispatchToGeometryHandler(handler);\r\n return handler.grabResults();\r\n }\r\n /**\r\n * Return xy intersections of input curves.\r\n * @param primitives input curves to intersect\r\n * @param tolerance optional distance tolerance for coincidence\r\n */\r\n public static allIntersectionsAmongPrimitivesXY(\r\n primitives: CurvePrimitive[], tolerance: number = Geometry.smallMetricDistance,\r\n ): CurveLocationDetailPair[] {\r\n const handler = new CurveCurveIntersectXY(undefined, false, undefined, false, tolerance);\r\n for (let i = 0; i < primitives.length; i++) {\r\n const curveA = primitives[i];\r\n for (let j = i + 1; j < primitives.length; j++) {\r\n handler.resetGeometry(false, primitives[j], false);\r\n curveA.dispatchToGeometryHandler(handler);\r\n }\r\n }\r\n return handler.grabPairedResults();\r\n }\r\n /**\r\n * Return at least one XY close approach between 2 curves.\r\n * * Close approach xy-distances are measured without regard to z. This is equivalent to their separation distance\r\n * as seen in the top view, or as measured between their projections onto the xy-plane.\r\n * * If more than one approach is returned, one of them is the closest approach.\r\n * * If an input curve is a `CurveCollection`, then close approaches are computed to each `CurvePrimitive` child.\r\n * This can lead to many returned pairs, especially when both inputs are `CurveCollection`s. If an input curve is\r\n * an `AnyRegion` then close approaches are computed only to the boundary curves, not to the interior.\r\n * @param curveA first curve\r\n * @param curveB second curve\r\n * @param maxDistance maximum xy-distance to consider between the curves.\r\n * Close approaches further than this xy-distance are not returned.\r\n */\r\n public static closeApproachProjectedXYPairs(\r\n curveA: AnyCurve, curveB: AnyCurve, maxDistance: number,\r\n ): CurveLocationDetailPair[] {\r\n const handler = new CurveCurveCloseApproachXY(curveB);\r\n handler.maxDistanceToAccept = maxDistance;\r\n curveA.dispatchToGeometryHandler(handler);\r\n return handler.grabPairedResults();\r\n }\r\n /**\r\n * Convenience method that calls [[closeApproachProjectedXYPairs]] with a large `maxDistance`\r\n * and returns a detail pair representing the closest xy-approach between the curves.\r\n * * There may be many detail pairs that represent \"closest\" xy-approach, including coincident interval pairs,\r\n * isolated intersections, or close approaches within tolerance of each other. This method makes no attempt to\r\n * distinguish among them, and returns a pair whose `detail.point` values are separated by the smallest xy distance\r\n * found among the pairs.\r\n * @param curveA first curve\r\n * @param curveB second curve\r\n * @return detail pair of closest xy-approach, undefined if not found\r\n */\r\n public static closestApproachProjectedXYPair(curveA: AnyCurve, curveB: AnyCurve): CurveLocationDetailPair | undefined {\r\n const range = curveA.range();\r\n range.extendRange(curveB.range());\r\n const maxDistance = range.low.distanceXY(range.high);\r\n const closeApproaches = this.closeApproachProjectedXYPairs(curveA, curveB, maxDistance);\r\n if (!closeApproaches.length)\r\n return undefined;\r\n let iMin = 0;\r\n let minDistXY = 2 * maxDistance;\r\n for (let i = 0; i < closeApproaches.length; ++i) {\r\n const distXY = closeApproaches[i].detailA.point.distanceXY(closeApproaches[i].detailB.point);\r\n if (distXY < minDistXY) {\r\n iMin = i;\r\n minDistXY = distXY;\r\n }\r\n }\r\n return closeApproaches[iMin];\r\n }\r\n}\r\n"]}
@@ -13,7 +13,7 @@ import { XAndY } from "../geometry3d/XYZProps";
13
13
  import { IndexedPolyface } from "../polyface/Polyface";
14
14
  import { RuledSweep } from "../solid/RuledSweep";
15
15
  import { Arc3d } from "./Arc3d";
16
- import { AnyCurve } from "./CurveChain";
16
+ import { AnyCurve } from "./CurveTypes";
17
17
  import { CurveChain } from "./CurveCollection";
18
18
  import { CurvePrimitive } from "./CurvePrimitive";
19
19
  import { GeometryQuery } from "./GeometryQuery";