@itwin/core-geometry 5.9.0-dev.8 → 5.9.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (646) hide show
  1. package/CHANGELOG.md +27 -1
  2. package/lib/cjs/Constant.js.map +1 -1
  3. package/lib/cjs/Geometry.d.ts +8 -6
  4. package/lib/cjs/Geometry.d.ts.map +1 -1
  5. package/lib/cjs/Geometry.js +8 -6
  6. package/lib/cjs/Geometry.js.map +1 -1
  7. package/lib/cjs/bspline/AkimaCurve3d.js.map +1 -1
  8. package/lib/cjs/bspline/BSpline1dNd.js.map +1 -1
  9. package/lib/cjs/bspline/BSplineCurve.js.map +1 -1
  10. package/lib/cjs/bspline/BSplineCurve3dH.js.map +1 -1
  11. package/lib/cjs/bspline/BSplineCurveOps.js.map +1 -1
  12. package/lib/cjs/bspline/BSplineSurface.js.map +1 -1
  13. package/lib/cjs/bspline/Bezier1dNd.js.map +1 -1
  14. package/lib/cjs/bspline/BezierCurve3d.js.map +1 -1
  15. package/lib/cjs/bspline/BezierCurve3dH.js.map +1 -1
  16. package/lib/cjs/bspline/BezierCurveBase.js.map +1 -1
  17. package/lib/cjs/bspline/InterpolationCurve3d.js.map +1 -1
  18. package/lib/cjs/bspline/KnotVector.js.map +1 -1
  19. package/lib/cjs/bspline/SurfaceLocationDetail.js.map +1 -1
  20. package/lib/cjs/clipping/AlternatingConvexClipTree.js.map +1 -1
  21. package/lib/cjs/clipping/BooleanClipFactory.js.map +1 -1
  22. package/lib/cjs/clipping/BooleanClipNode.js.map +1 -1
  23. package/lib/cjs/clipping/ClipPlane.js.map +1 -1
  24. package/lib/cjs/clipping/ClipPrimitive.js.map +1 -1
  25. package/lib/cjs/clipping/ClipUtils.js.map +1 -1
  26. package/lib/cjs/clipping/ClipVector.js.map +1 -1
  27. package/lib/cjs/clipping/ConvexClipPlaneSet.js.map +1 -1
  28. package/lib/cjs/clipping/UnionOfConvexClipPlaneSets.js.map +1 -1
  29. package/lib/cjs/clipping/internalContexts/LineStringOffsetClipperContext.js.map +1 -1
  30. package/lib/cjs/core-geometry.js.map +1 -1
  31. package/lib/cjs/curve/Arc3d.d.ts +7 -0
  32. package/lib/cjs/curve/Arc3d.d.ts.map +1 -1
  33. package/lib/cjs/curve/Arc3d.js +11 -0
  34. package/lib/cjs/curve/Arc3d.js.map +1 -1
  35. package/lib/cjs/curve/ConstrainedCurve2d.js.map +1 -1
  36. package/lib/cjs/curve/ConstructCurveBetweenCurves.js.map +1 -1
  37. package/lib/cjs/curve/CoordinateXYZ.js.map +1 -1
  38. package/lib/cjs/curve/CurveChainWithDistanceIndex.d.ts +11 -2
  39. package/lib/cjs/curve/CurveChainWithDistanceIndex.d.ts.map +1 -1
  40. package/lib/cjs/curve/CurveChainWithDistanceIndex.js +25 -15
  41. package/lib/cjs/curve/CurveChainWithDistanceIndex.js.map +1 -1
  42. package/lib/cjs/curve/CurveCollection.d.ts +15 -6
  43. package/lib/cjs/curve/CurveCollection.d.ts.map +1 -1
  44. package/lib/cjs/curve/CurveCollection.js +15 -6
  45. package/lib/cjs/curve/CurveCollection.js.map +1 -1
  46. package/lib/cjs/curve/CurveCurve.d.ts +1 -1
  47. package/lib/cjs/curve/CurveCurve.d.ts.map +1 -1
  48. package/lib/cjs/curve/CurveCurve.js +2 -1
  49. package/lib/cjs/curve/CurveCurve.js.map +1 -1
  50. package/lib/cjs/curve/CurveExtendMode.js.map +1 -1
  51. package/lib/cjs/curve/CurveFactory.js.map +1 -1
  52. package/lib/cjs/curve/CurveLocationDetail.d.ts +21 -0
  53. package/lib/cjs/curve/CurveLocationDetail.d.ts.map +1 -1
  54. package/lib/cjs/curve/CurveLocationDetail.js +59 -0
  55. package/lib/cjs/curve/CurveLocationDetail.js.map +1 -1
  56. package/lib/cjs/curve/CurveOps.js.map +1 -1
  57. package/lib/cjs/curve/CurvePrimitive.d.ts +13 -12
  58. package/lib/cjs/curve/CurvePrimitive.d.ts.map +1 -1
  59. package/lib/cjs/curve/CurvePrimitive.js +12 -11
  60. package/lib/cjs/curve/CurvePrimitive.js.map +1 -1
  61. package/lib/cjs/curve/CurveProcessor.js.map +1 -1
  62. package/lib/cjs/curve/CurveTypes.js.map +1 -1
  63. package/lib/cjs/curve/CurveWireMomentsXYZ.js.map +1 -1
  64. package/lib/cjs/curve/GeometryQuery.js.map +1 -1
  65. package/lib/cjs/curve/LineSegment3d.js.map +1 -1
  66. package/lib/cjs/curve/LineString3d.js.map +1 -1
  67. package/lib/cjs/curve/Loop.d.ts.map +1 -1
  68. package/lib/cjs/curve/Loop.js +3 -1
  69. package/lib/cjs/curve/Loop.js.map +1 -1
  70. package/lib/cjs/curve/OffsetOptions.js.map +1 -1
  71. package/lib/cjs/curve/ParityRegion.js.map +1 -1
  72. package/lib/cjs/curve/Path.js.map +1 -1
  73. package/lib/cjs/curve/PointString3d.js.map +1 -1
  74. package/lib/cjs/curve/ProxyCurve.js.map +1 -1
  75. package/lib/cjs/curve/Query/ConsolidateAdjacentPrimitivesContext.js.map +1 -1
  76. package/lib/cjs/curve/Query/CurveSplitContext.js.map +1 -1
  77. package/lib/cjs/curve/Query/CylindricalRange.js.map +1 -1
  78. package/lib/cjs/curve/Query/InOutTests.js.map +1 -1
  79. package/lib/cjs/curve/Query/PlanarSubdivision.js.map +1 -1
  80. package/lib/cjs/curve/Query/StrokeCountChain.js.map +1 -1
  81. package/lib/cjs/curve/Query/StrokeCountMap.js.map +1 -1
  82. package/lib/cjs/curve/RegionMomentsXY.js.map +1 -1
  83. package/lib/cjs/curve/RegionOps.d.ts +17 -4
  84. package/lib/cjs/curve/RegionOps.d.ts.map +1 -1
  85. package/lib/cjs/curve/RegionOps.js +114 -18
  86. package/lib/cjs/curve/RegionOps.js.map +1 -1
  87. package/lib/cjs/curve/RegionOpsClassificationSweeps.d.ts +3 -11
  88. package/lib/cjs/curve/RegionOpsClassificationSweeps.d.ts.map +1 -1
  89. package/lib/cjs/curve/RegionOpsClassificationSweeps.js +1 -91
  90. package/lib/cjs/curve/RegionOpsClassificationSweeps.js.map +1 -1
  91. package/lib/cjs/curve/StrokeOptions.d.ts +13 -6
  92. package/lib/cjs/curve/StrokeOptions.d.ts.map +1 -1
  93. package/lib/cjs/curve/StrokeOptions.js +13 -6
  94. package/lib/cjs/curve/StrokeOptions.js.map +1 -1
  95. package/lib/cjs/curve/UnionRegion.js.map +1 -1
  96. package/lib/cjs/curve/internalContexts/AnnounceTangentStrokeHandler.d.ts +1 -1
  97. package/lib/cjs/curve/internalContexts/AnnounceTangentStrokeHandler.d.ts.map +1 -1
  98. package/lib/cjs/curve/internalContexts/AnnounceTangentStrokeHandler.js +1 -2
  99. package/lib/cjs/curve/internalContexts/AnnounceTangentStrokeHandler.js.map +1 -1
  100. package/lib/cjs/curve/internalContexts/AppendPlaneIntersectionStrokeHandler.d.ts +1 -1
  101. package/lib/cjs/curve/internalContexts/AppendPlaneIntersectionStrokeHandler.d.ts.map +1 -1
  102. package/lib/cjs/curve/internalContexts/AppendPlaneIntersectionStrokeHandler.js +1 -2
  103. package/lib/cjs/curve/internalContexts/AppendPlaneIntersectionStrokeHandler.js.map +1 -1
  104. package/lib/cjs/curve/internalContexts/ChainCollectorContext.js.map +1 -1
  105. package/lib/cjs/curve/internalContexts/CloneCurvesContext.js.map +1 -1
  106. package/lib/cjs/curve/internalContexts/CloneWithExpandedLineStrings.js.map +1 -1
  107. package/lib/cjs/curve/internalContexts/ClosestPointStrokeHandler.d.ts +1 -1
  108. package/lib/cjs/curve/internalContexts/ClosestPointStrokeHandler.d.ts.map +1 -1
  109. package/lib/cjs/curve/internalContexts/ClosestPointStrokeHandler.js +1 -2
  110. package/lib/cjs/curve/internalContexts/ClosestPointStrokeHandler.js.map +1 -1
  111. package/lib/cjs/curve/internalContexts/CountLinearPartsSearchContext.js.map +1 -1
  112. package/lib/cjs/curve/internalContexts/CurveCurveCloseApproachXY.d.ts +113 -109
  113. package/lib/cjs/curve/internalContexts/CurveCurveCloseApproachXY.d.ts.map +1 -1
  114. package/lib/cjs/curve/internalContexts/CurveCurveCloseApproachXY.js +361 -385
  115. package/lib/cjs/curve/internalContexts/CurveCurveCloseApproachXY.js.map +1 -1
  116. package/lib/cjs/curve/internalContexts/CurveCurveIntersectXY.d.ts +17 -17
  117. package/lib/cjs/curve/internalContexts/CurveCurveIntersectXY.d.ts.map +1 -1
  118. package/lib/cjs/curve/internalContexts/CurveCurveIntersectXY.js +153 -184
  119. package/lib/cjs/curve/internalContexts/CurveCurveIntersectXY.js.map +1 -1
  120. package/lib/cjs/curve/internalContexts/CurveCurveIntersectXYZ.js.map +1 -1
  121. package/lib/cjs/curve/internalContexts/CurveLengthContext.js.map +1 -1
  122. package/lib/cjs/curve/internalContexts/CurveOffsetXYHandler.js.map +1 -1
  123. package/lib/cjs/curve/internalContexts/EllipticalArcApproximationContext.js.map +1 -1
  124. package/lib/cjs/curve/internalContexts/GapSearchContext.js.map +1 -1
  125. package/lib/cjs/curve/internalContexts/MultiChainCollector.js.map +1 -1
  126. package/lib/cjs/curve/internalContexts/PlaneAltitudeRangeContext.js.map +1 -1
  127. package/lib/cjs/curve/internalContexts/PointToCurveTangentHandler.js.map +1 -1
  128. package/lib/cjs/curve/internalContexts/PolygonOffsetContext.js.map +1 -1
  129. package/lib/cjs/curve/internalContexts/SumLengthsContext.js.map +1 -1
  130. package/lib/cjs/curve/internalContexts/TransferWithSplitArcs.js.map +1 -1
  131. package/lib/cjs/curve/internalContexts/TransformInPlaceContext.js.map +1 -1
  132. package/lib/cjs/curve/internalContexts/geometry2d/ConstrainedImplicitCurve2d.js.map +1 -1
  133. package/lib/cjs/curve/internalContexts/geometry2d/ConstraintSet.js.map +1 -1
  134. package/lib/cjs/curve/internalContexts/geometry2d/ImplicitCurve2d.js.map +1 -1
  135. package/lib/cjs/curve/internalContexts/geometry2d/ImplicitCurve2dConverter.js.map +1 -1
  136. package/lib/cjs/curve/internalContexts/geometry2d/UnboundedCircle2d.js.map +1 -1
  137. package/lib/cjs/curve/internalContexts/geometry2d/UnboundedEllipse2d.js.map +1 -1
  138. package/lib/cjs/curve/internalContexts/geometry2d/UnboundedHyperbola2d.js.map +1 -1
  139. package/lib/cjs/curve/internalContexts/geometry2d/UnboundedLine2d.js.map +1 -1
  140. package/lib/cjs/curve/internalContexts/geometry2d/UnboundedParabola2d.js.map +1 -1
  141. package/lib/cjs/curve/spiral/AustralianRailCorpXYEvaluator.js.map +1 -1
  142. package/lib/cjs/curve/spiral/ClothoidSeries.js.map +1 -1
  143. package/lib/cjs/curve/spiral/CubicEvaluator.js.map +1 -1
  144. package/lib/cjs/curve/spiral/CzechSpiralEvaluator.js.map +1 -1
  145. package/lib/cjs/curve/spiral/DirectHalfCosineSpiralEvaluator.js.map +1 -1
  146. package/lib/cjs/curve/spiral/DirectSpiral3d.d.ts +1 -2
  147. package/lib/cjs/curve/spiral/DirectSpiral3d.d.ts.map +1 -1
  148. package/lib/cjs/curve/spiral/DirectSpiral3d.js +9 -3
  149. package/lib/cjs/curve/spiral/DirectSpiral3d.js.map +1 -1
  150. package/lib/cjs/curve/spiral/IntegratedSpiral3d.d.ts +1 -2
  151. package/lib/cjs/curve/spiral/IntegratedSpiral3d.d.ts.map +1 -1
  152. package/lib/cjs/curve/spiral/IntegratedSpiral3d.js +10 -4
  153. package/lib/cjs/curve/spiral/IntegratedSpiral3d.js.map +1 -1
  154. package/lib/cjs/curve/spiral/MXCubicAlongArcSpiralEvaluator.js.map +1 -1
  155. package/lib/cjs/curve/spiral/NormalizedTransition.js.map +1 -1
  156. package/lib/cjs/curve/spiral/PolishCubicSpiralEvaluator.js.map +1 -1
  157. package/lib/cjs/curve/spiral/TransitionConditionalProperties.js.map +1 -1
  158. package/lib/cjs/curve/spiral/TransitionSpiral3d.js.map +1 -1
  159. package/lib/cjs/curve/spiral/XYCurveEvaluator.js.map +1 -1
  160. package/lib/cjs/geometry3d/Angle.js.map +1 -1
  161. package/lib/cjs/geometry3d/AngleSweep.d.ts +3 -1
  162. package/lib/cjs/geometry3d/AngleSweep.d.ts.map +1 -1
  163. package/lib/cjs/geometry3d/AngleSweep.js +6 -2
  164. package/lib/cjs/geometry3d/AngleSweep.js.map +1 -1
  165. package/lib/cjs/geometry3d/BarycentricTriangle.js.map +1 -1
  166. package/lib/cjs/geometry3d/BilinearPatch.js.map +1 -1
  167. package/lib/cjs/geometry3d/CoincidentGeometryOps.js.map +1 -1
  168. package/lib/cjs/geometry3d/Ellipsoid.js.map +1 -1
  169. package/lib/cjs/geometry3d/FrameBuilder.js.map +1 -1
  170. package/lib/cjs/geometry3d/FrustumAnimation.js.map +1 -1
  171. package/lib/cjs/geometry3d/GeometryHandler.d.ts +33 -4
  172. package/lib/cjs/geometry3d/GeometryHandler.d.ts.map +1 -1
  173. package/lib/cjs/geometry3d/GeometryHandler.js +79 -1
  174. package/lib/cjs/geometry3d/GeometryHandler.js.map +1 -1
  175. package/lib/cjs/geometry3d/GrowableBlockedArray.js.map +1 -1
  176. package/lib/cjs/geometry3d/GrowableFloat64Array.js.map +1 -1
  177. package/lib/cjs/geometry3d/GrowableXYArray.d.ts +9 -6
  178. package/lib/cjs/geometry3d/GrowableXYArray.d.ts.map +1 -1
  179. package/lib/cjs/geometry3d/GrowableXYArray.js +20 -10
  180. package/lib/cjs/geometry3d/GrowableXYArray.js.map +1 -1
  181. package/lib/cjs/geometry3d/GrowableXYZArray.d.ts +9 -6
  182. package/lib/cjs/geometry3d/GrowableXYZArray.d.ts.map +1 -1
  183. package/lib/cjs/geometry3d/GrowableXYZArray.js +20 -10
  184. package/lib/cjs/geometry3d/GrowableXYZArray.js.map +1 -1
  185. package/lib/cjs/geometry3d/IndexedCollectionInterval.js.map +1 -1
  186. package/lib/cjs/geometry3d/IndexedXYCollection.js.map +1 -1
  187. package/lib/cjs/geometry3d/IndexedXYZCollection.js.map +1 -1
  188. package/lib/cjs/geometry3d/LongitudeLatitudeAltitude.js.map +1 -1
  189. package/lib/cjs/geometry3d/Matrix3d.d.ts +4 -4
  190. package/lib/cjs/geometry3d/Matrix3d.d.ts.map +1 -1
  191. package/lib/cjs/geometry3d/Matrix3d.js +5 -4
  192. package/lib/cjs/geometry3d/Matrix3d.js.map +1 -1
  193. package/lib/cjs/geometry3d/OrderedRotationAngles.js.map +1 -1
  194. package/lib/cjs/geometry3d/Plane3d.js.map +1 -1
  195. package/lib/cjs/geometry3d/Plane3dByOriginAndUnitNormal.js.map +1 -1
  196. package/lib/cjs/geometry3d/Plane3dByOriginAndVectors.js.map +1 -1
  197. package/lib/cjs/geometry3d/Point2dArrayCarrier.js.map +1 -1
  198. package/lib/cjs/geometry3d/Point2dVector2d.js.map +1 -1
  199. package/lib/cjs/geometry3d/Point3dArrayCarrier.js.map +1 -1
  200. package/lib/cjs/geometry3d/Point3dVector3d.js.map +1 -1
  201. package/lib/cjs/geometry3d/PointHelpers.d.ts.map +1 -1
  202. package/lib/cjs/geometry3d/PointHelpers.js +6 -7
  203. package/lib/cjs/geometry3d/PointHelpers.js.map +1 -1
  204. package/lib/cjs/geometry3d/PointStreaming.js.map +1 -1
  205. package/lib/cjs/geometry3d/PolygonOps.js.map +1 -1
  206. package/lib/cjs/geometry3d/PolylineCompressionByEdgeOffset.js.map +1 -1
  207. package/lib/cjs/geometry3d/PolylineOps.js.map +1 -1
  208. package/lib/cjs/geometry3d/Range.js.map +1 -1
  209. package/lib/cjs/geometry3d/Ray2d.js.map +1 -1
  210. package/lib/cjs/geometry3d/Ray3d.js.map +1 -1
  211. package/lib/cjs/geometry3d/ReusableObjectCache.js.map +1 -1
  212. package/lib/cjs/geometry3d/Segment1d.js.map +1 -1
  213. package/lib/cjs/geometry3d/SortablePolygon.js.map +1 -1
  214. package/lib/cjs/geometry3d/Transform.js.map +1 -1
  215. package/lib/cjs/geometry3d/UVSurfaceOps.js.map +1 -1
  216. package/lib/cjs/geometry3d/XYZProps.js.map +1 -1
  217. package/lib/cjs/geometry3d/YawPitchRollAngles.js.map +1 -1
  218. package/lib/cjs/geometry4d/Map4d.js.map +1 -1
  219. package/lib/cjs/geometry4d/Matrix4d.js.map +1 -1
  220. package/lib/cjs/geometry4d/MomentData.js.map +1 -1
  221. package/lib/cjs/geometry4d/PlaneByOriginAndVectors4d.js.map +1 -1
  222. package/lib/cjs/geometry4d/Point4d.js.map +1 -1
  223. package/lib/cjs/numerics/BandedSystem.js.map +1 -1
  224. package/lib/cjs/numerics/BezierPolynomials.d.ts.map +1 -1
  225. package/lib/cjs/numerics/BezierPolynomials.js +1 -1
  226. package/lib/cjs/numerics/BezierPolynomials.js.map +1 -1
  227. package/lib/cjs/numerics/ClusterableArray.js.map +1 -1
  228. package/lib/cjs/numerics/Complex.js.map +1 -1
  229. package/lib/cjs/numerics/ConvexPolygon2d.js.map +1 -1
  230. package/lib/cjs/numerics/Newton.d.ts +52 -13
  231. package/lib/cjs/numerics/Newton.d.ts.map +1 -1
  232. package/lib/cjs/numerics/Newton.js +73 -23
  233. package/lib/cjs/numerics/Newton.js.map +1 -1
  234. package/lib/cjs/numerics/PascalCoefficients.js.map +1 -1
  235. package/lib/cjs/numerics/PolarData.js.map +1 -1
  236. package/lib/cjs/numerics/Polynomials.js.map +1 -1
  237. package/lib/cjs/numerics/Quadrature.js.map +1 -1
  238. package/lib/cjs/numerics/Range1dArray.js.map +1 -1
  239. package/lib/cjs/numerics/SmallSystem.js.map +1 -1
  240. package/lib/cjs/numerics/TriDiagonalSystem.js.map +1 -1
  241. package/lib/cjs/numerics/UnionFind.js.map +1 -1
  242. package/lib/cjs/numerics/UsageSums.js.map +1 -1
  243. package/lib/cjs/polyface/AuxData.js.map +1 -1
  244. package/lib/cjs/polyface/BoxTopology.js.map +1 -1
  245. package/lib/cjs/polyface/FacetFaceData.js.map +1 -1
  246. package/lib/cjs/polyface/FacetLocationDetail.js.map +1 -1
  247. package/lib/cjs/polyface/FacetOrientation.js.map +1 -1
  248. package/lib/cjs/polyface/GreedyTriangulationBetweenLineStrings.js.map +1 -1
  249. package/lib/cjs/polyface/IndexedEdgeMatcher.js.map +1 -1
  250. package/lib/cjs/polyface/IndexedPolyfaceVisitor.js.map +1 -1
  251. package/lib/cjs/polyface/IndexedPolyfaceWalker.js.map +1 -1
  252. package/lib/cjs/polyface/Polyface.js.map +1 -1
  253. package/lib/cjs/polyface/PolyfaceBuilder.js.map +1 -1
  254. package/lib/cjs/polyface/PolyfaceClip.js.map +1 -1
  255. package/lib/cjs/polyface/PolyfaceData.js.map +1 -1
  256. package/lib/cjs/polyface/PolyfaceQuery.d.ts +14 -14
  257. package/lib/cjs/polyface/PolyfaceQuery.d.ts.map +1 -1
  258. package/lib/cjs/polyface/PolyfaceQuery.js +14 -14
  259. package/lib/cjs/polyface/PolyfaceQuery.js.map +1 -1
  260. package/lib/cjs/polyface/RangeLengthData.js.map +1 -1
  261. package/lib/cjs/polyface/RangeTree/LineString3dRangeTreeContext.js.map +1 -1
  262. package/lib/cjs/polyface/RangeTree/MinimumValueTester.js.map +1 -1
  263. package/lib/cjs/polyface/RangeTree/Point3dArrayRangeTreeContext.js.map +1 -1
  264. package/lib/cjs/polyface/RangeTree/PolyfaceRangeTreeContext.js.map +1 -1
  265. package/lib/cjs/polyface/RangeTree/RangeTreeNode.js.map +1 -1
  266. package/lib/cjs/polyface/RangeTree/RangeTreeSearchHandlers.js.map +1 -1
  267. package/lib/cjs/polyface/TaggedNumericData.js.map +1 -1
  268. package/lib/cjs/polyface/TriangleCandidate.js.map +1 -1
  269. package/lib/cjs/polyface/multiclip/BuildAverageNormalsContext.js.map +1 -1
  270. package/lib/cjs/polyface/multiclip/GriddedRaggedRange2dSet.js.map +1 -1
  271. package/lib/cjs/polyface/multiclip/GriddedRaggedRange2dSetWithOverflow.js.map +1 -1
  272. package/lib/cjs/polyface/multiclip/LinearSearchRange2dArray.js.map +1 -1
  273. package/lib/cjs/polyface/multiclip/OffsetMeshContext.js.map +1 -1
  274. package/lib/cjs/polyface/multiclip/Range2dSearchInterface.js.map +1 -1
  275. package/lib/cjs/polyface/multiclip/RangeSearch.js.map +1 -1
  276. package/lib/cjs/polyface/multiclip/SweepLineStringToFacetContext.js.map +1 -1
  277. package/lib/cjs/polyface/multiclip/XYPointBuckets.js.map +1 -1
  278. package/lib/cjs/serialization/BGFBAccessors.js.map +1 -1
  279. package/lib/cjs/serialization/BGFBReader.js +2 -2
  280. package/lib/cjs/serialization/BGFBReader.js.map +1 -1
  281. package/lib/cjs/serialization/BGFBWriter.js.map +1 -1
  282. package/lib/cjs/serialization/BentleyGeometryFlatBuffer.js.map +1 -1
  283. package/lib/cjs/serialization/DeepCompare.js.map +1 -1
  284. package/lib/cjs/serialization/IModelJsonSchema.js.map +1 -1
  285. package/lib/cjs/serialization/SerializationHelpers.js.map +1 -1
  286. package/lib/cjs/solid/Box.js.map +1 -1
  287. package/lib/cjs/solid/Cone.js.map +1 -1
  288. package/lib/cjs/solid/LinearSweep.js.map +1 -1
  289. package/lib/cjs/solid/RotationalSweep.js.map +1 -1
  290. package/lib/cjs/solid/RuledSweep.js.map +1 -1
  291. package/lib/cjs/solid/SolidPrimitive.js.map +1 -1
  292. package/lib/cjs/solid/Sphere.js.map +1 -1
  293. package/lib/cjs/solid/SweepContour.js.map +1 -1
  294. package/lib/cjs/solid/TorusPipe.js.map +1 -1
  295. package/lib/cjs/topology/ChainMerge.js.map +1 -1
  296. package/lib/cjs/topology/Graph.d.ts +15 -15
  297. package/lib/cjs/topology/Graph.d.ts.map +1 -1
  298. package/lib/cjs/topology/Graph.js +1 -1
  299. package/lib/cjs/topology/Graph.js.map +1 -1
  300. package/lib/cjs/topology/HalfEdgeGraphFromIndexedLoopsContext.js.map +1 -1
  301. package/lib/cjs/topology/HalfEdgeGraphSearch.d.ts +3 -3
  302. package/lib/cjs/topology/HalfEdgeGraphSearch.d.ts.map +1 -1
  303. package/lib/cjs/topology/HalfEdgeGraphSearch.js.map +1 -1
  304. package/lib/cjs/topology/HalfEdgeGraphSpineContext.js.map +1 -1
  305. package/lib/cjs/topology/HalfEdgeGraphValidation.js.map +1 -1
  306. package/lib/cjs/topology/HalfEdgeMarkSet.js.map +1 -1
  307. package/lib/cjs/topology/HalfEdgeNodeXYZUV.js.map +1 -1
  308. package/lib/cjs/topology/HalfEdgePointInGraphSearch.js.map +1 -1
  309. package/lib/cjs/topology/HalfEdgePositionDetail.js.map +1 -1
  310. package/lib/cjs/topology/HalfEdgePriorityQueue.js.map +1 -1
  311. package/lib/cjs/topology/InsertAndRetriangulateContext.js.map +1 -1
  312. package/lib/cjs/topology/MaskManager.js.map +1 -1
  313. package/lib/cjs/topology/Merging.js.map +1 -1
  314. package/lib/cjs/topology/RegularizeFace.js.map +1 -1
  315. package/lib/cjs/topology/SignedDataSummary.js.map +1 -1
  316. package/lib/cjs/topology/SpaceTriangulation.js.map +1 -1
  317. package/lib/cjs/topology/Triangulation.js.map +1 -1
  318. package/lib/cjs/topology/Voronoi.js.map +1 -1
  319. package/lib/cjs/topology/XYParitySearchContext.js.map +1 -1
  320. package/lib/esm/Constant.js.map +1 -1
  321. package/lib/esm/Geometry.d.ts +8 -6
  322. package/lib/esm/Geometry.d.ts.map +1 -1
  323. package/lib/esm/Geometry.js +8 -6
  324. package/lib/esm/Geometry.js.map +1 -1
  325. package/lib/esm/bspline/AkimaCurve3d.js.map +1 -1
  326. package/lib/esm/bspline/BSpline1dNd.js.map +1 -1
  327. package/lib/esm/bspline/BSplineCurve.js.map +1 -1
  328. package/lib/esm/bspline/BSplineCurve3dH.js.map +1 -1
  329. package/lib/esm/bspline/BSplineCurveOps.js.map +1 -1
  330. package/lib/esm/bspline/BSplineSurface.js.map +1 -1
  331. package/lib/esm/bspline/Bezier1dNd.js.map +1 -1
  332. package/lib/esm/bspline/BezierCurve3d.js.map +1 -1
  333. package/lib/esm/bspline/BezierCurve3dH.js.map +1 -1
  334. package/lib/esm/bspline/BezierCurveBase.js.map +1 -1
  335. package/lib/esm/bspline/InterpolationCurve3d.js.map +1 -1
  336. package/lib/esm/bspline/KnotVector.js.map +1 -1
  337. package/lib/esm/bspline/SurfaceLocationDetail.js.map +1 -1
  338. package/lib/esm/clipping/AlternatingConvexClipTree.js.map +1 -1
  339. package/lib/esm/clipping/BooleanClipFactory.js.map +1 -1
  340. package/lib/esm/clipping/BooleanClipNode.js.map +1 -1
  341. package/lib/esm/clipping/ClipPlane.js.map +1 -1
  342. package/lib/esm/clipping/ClipPrimitive.js.map +1 -1
  343. package/lib/esm/clipping/ClipUtils.js.map +1 -1
  344. package/lib/esm/clipping/ClipVector.js.map +1 -1
  345. package/lib/esm/clipping/ConvexClipPlaneSet.js.map +1 -1
  346. package/lib/esm/clipping/UnionOfConvexClipPlaneSets.js.map +1 -1
  347. package/lib/esm/clipping/internalContexts/LineStringOffsetClipperContext.js.map +1 -1
  348. package/lib/esm/core-geometry.js.map +1 -1
  349. package/lib/esm/curve/Arc3d.d.ts +7 -0
  350. package/lib/esm/curve/Arc3d.d.ts.map +1 -1
  351. package/lib/esm/curve/Arc3d.js +11 -0
  352. package/lib/esm/curve/Arc3d.js.map +1 -1
  353. package/lib/esm/curve/ConstrainedCurve2d.js.map +1 -1
  354. package/lib/esm/curve/ConstructCurveBetweenCurves.js.map +1 -1
  355. package/lib/esm/curve/CoordinateXYZ.js.map +1 -1
  356. package/lib/esm/curve/CurveChainWithDistanceIndex.d.ts +11 -2
  357. package/lib/esm/curve/CurveChainWithDistanceIndex.d.ts.map +1 -1
  358. package/lib/esm/curve/CurveChainWithDistanceIndex.js +25 -15
  359. package/lib/esm/curve/CurveChainWithDistanceIndex.js.map +1 -1
  360. package/lib/esm/curve/CurveCollection.d.ts +15 -6
  361. package/lib/esm/curve/CurveCollection.d.ts.map +1 -1
  362. package/lib/esm/curve/CurveCollection.js +15 -6
  363. package/lib/esm/curve/CurveCollection.js.map +1 -1
  364. package/lib/esm/curve/CurveCurve.d.ts +1 -1
  365. package/lib/esm/curve/CurveCurve.d.ts.map +1 -1
  366. package/lib/esm/curve/CurveCurve.js +2 -1
  367. package/lib/esm/curve/CurveCurve.js.map +1 -1
  368. package/lib/esm/curve/CurveExtendMode.js.map +1 -1
  369. package/lib/esm/curve/CurveFactory.js.map +1 -1
  370. package/lib/esm/curve/CurveLocationDetail.d.ts +21 -0
  371. package/lib/esm/curve/CurveLocationDetail.d.ts.map +1 -1
  372. package/lib/esm/curve/CurveLocationDetail.js +59 -0
  373. package/lib/esm/curve/CurveLocationDetail.js.map +1 -1
  374. package/lib/esm/curve/CurveOps.js.map +1 -1
  375. package/lib/esm/curve/CurvePrimitive.d.ts +13 -12
  376. package/lib/esm/curve/CurvePrimitive.d.ts.map +1 -1
  377. package/lib/esm/curve/CurvePrimitive.js +12 -11
  378. package/lib/esm/curve/CurvePrimitive.js.map +1 -1
  379. package/lib/esm/curve/CurveProcessor.js.map +1 -1
  380. package/lib/esm/curve/CurveTypes.js.map +1 -1
  381. package/lib/esm/curve/CurveWireMomentsXYZ.js.map +1 -1
  382. package/lib/esm/curve/GeometryQuery.js.map +1 -1
  383. package/lib/esm/curve/LineSegment3d.js.map +1 -1
  384. package/lib/esm/curve/LineString3d.js.map +1 -1
  385. package/lib/esm/curve/Loop.d.ts.map +1 -1
  386. package/lib/esm/curve/Loop.js +3 -1
  387. package/lib/esm/curve/Loop.js.map +1 -1
  388. package/lib/esm/curve/OffsetOptions.js.map +1 -1
  389. package/lib/esm/curve/ParityRegion.js.map +1 -1
  390. package/lib/esm/curve/Path.js.map +1 -1
  391. package/lib/esm/curve/PointString3d.js.map +1 -1
  392. package/lib/esm/curve/ProxyCurve.js.map +1 -1
  393. package/lib/esm/curve/Query/ConsolidateAdjacentPrimitivesContext.js.map +1 -1
  394. package/lib/esm/curve/Query/CurveSplitContext.js.map +1 -1
  395. package/lib/esm/curve/Query/CylindricalRange.js.map +1 -1
  396. package/lib/esm/curve/Query/InOutTests.js.map +1 -1
  397. package/lib/esm/curve/Query/PlanarSubdivision.js.map +1 -1
  398. package/lib/esm/curve/Query/StrokeCountChain.js.map +1 -1
  399. package/lib/esm/curve/Query/StrokeCountMap.js.map +1 -1
  400. package/lib/esm/curve/RegionMomentsXY.js.map +1 -1
  401. package/lib/esm/curve/RegionOps.d.ts +17 -4
  402. package/lib/esm/curve/RegionOps.d.ts.map +1 -1
  403. package/lib/esm/curve/RegionOps.js +116 -20
  404. package/lib/esm/curve/RegionOps.js.map +1 -1
  405. package/lib/esm/curve/RegionOpsClassificationSweeps.d.ts +3 -11
  406. package/lib/esm/curve/RegionOpsClassificationSweeps.d.ts.map +1 -1
  407. package/lib/esm/curve/RegionOpsClassificationSweeps.js +2 -92
  408. package/lib/esm/curve/RegionOpsClassificationSweeps.js.map +1 -1
  409. package/lib/esm/curve/StrokeOptions.d.ts +13 -6
  410. package/lib/esm/curve/StrokeOptions.d.ts.map +1 -1
  411. package/lib/esm/curve/StrokeOptions.js +13 -6
  412. package/lib/esm/curve/StrokeOptions.js.map +1 -1
  413. package/lib/esm/curve/UnionRegion.js.map +1 -1
  414. package/lib/esm/curve/internalContexts/AnnounceTangentStrokeHandler.d.ts +1 -1
  415. package/lib/esm/curve/internalContexts/AnnounceTangentStrokeHandler.d.ts.map +1 -1
  416. package/lib/esm/curve/internalContexts/AnnounceTangentStrokeHandler.js +1 -2
  417. package/lib/esm/curve/internalContexts/AnnounceTangentStrokeHandler.js.map +1 -1
  418. package/lib/esm/curve/internalContexts/AppendPlaneIntersectionStrokeHandler.d.ts +1 -1
  419. package/lib/esm/curve/internalContexts/AppendPlaneIntersectionStrokeHandler.d.ts.map +1 -1
  420. package/lib/esm/curve/internalContexts/AppendPlaneIntersectionStrokeHandler.js +1 -2
  421. package/lib/esm/curve/internalContexts/AppendPlaneIntersectionStrokeHandler.js.map +1 -1
  422. package/lib/esm/curve/internalContexts/ChainCollectorContext.js.map +1 -1
  423. package/lib/esm/curve/internalContexts/CloneCurvesContext.js.map +1 -1
  424. package/lib/esm/curve/internalContexts/CloneWithExpandedLineStrings.js.map +1 -1
  425. package/lib/esm/curve/internalContexts/ClosestPointStrokeHandler.d.ts +1 -1
  426. package/lib/esm/curve/internalContexts/ClosestPointStrokeHandler.d.ts.map +1 -1
  427. package/lib/esm/curve/internalContexts/ClosestPointStrokeHandler.js +1 -2
  428. package/lib/esm/curve/internalContexts/ClosestPointStrokeHandler.js.map +1 -1
  429. package/lib/esm/curve/internalContexts/CountLinearPartsSearchContext.js.map +1 -1
  430. package/lib/esm/curve/internalContexts/CurveCurveCloseApproachXY.d.ts +113 -109
  431. package/lib/esm/curve/internalContexts/CurveCurveCloseApproachXY.d.ts.map +1 -1
  432. package/lib/esm/curve/internalContexts/CurveCurveCloseApproachXY.js +364 -388
  433. package/lib/esm/curve/internalContexts/CurveCurveCloseApproachXY.js.map +1 -1
  434. package/lib/esm/curve/internalContexts/CurveCurveIntersectXY.d.ts +17 -17
  435. package/lib/esm/curve/internalContexts/CurveCurveIntersectXY.d.ts.map +1 -1
  436. package/lib/esm/curve/internalContexts/CurveCurveIntersectXY.js +153 -184
  437. package/lib/esm/curve/internalContexts/CurveCurveIntersectXY.js.map +1 -1
  438. package/lib/esm/curve/internalContexts/CurveCurveIntersectXYZ.js.map +1 -1
  439. package/lib/esm/curve/internalContexts/CurveLengthContext.js.map +1 -1
  440. package/lib/esm/curve/internalContexts/CurveOffsetXYHandler.js.map +1 -1
  441. package/lib/esm/curve/internalContexts/EllipticalArcApproximationContext.js.map +1 -1
  442. package/lib/esm/curve/internalContexts/GapSearchContext.js.map +1 -1
  443. package/lib/esm/curve/internalContexts/MultiChainCollector.js.map +1 -1
  444. package/lib/esm/curve/internalContexts/PlaneAltitudeRangeContext.js.map +1 -1
  445. package/lib/esm/curve/internalContexts/PointToCurveTangentHandler.js.map +1 -1
  446. package/lib/esm/curve/internalContexts/PolygonOffsetContext.js.map +1 -1
  447. package/lib/esm/curve/internalContexts/SumLengthsContext.js.map +1 -1
  448. package/lib/esm/curve/internalContexts/TransferWithSplitArcs.js.map +1 -1
  449. package/lib/esm/curve/internalContexts/TransformInPlaceContext.js.map +1 -1
  450. package/lib/esm/curve/internalContexts/geometry2d/ConstrainedImplicitCurve2d.js.map +1 -1
  451. package/lib/esm/curve/internalContexts/geometry2d/ConstraintSet.js.map +1 -1
  452. package/lib/esm/curve/internalContexts/geometry2d/ImplicitCurve2d.js.map +1 -1
  453. package/lib/esm/curve/internalContexts/geometry2d/ImplicitCurve2dConverter.js.map +1 -1
  454. package/lib/esm/curve/internalContexts/geometry2d/UnboundedCircle2d.js.map +1 -1
  455. package/lib/esm/curve/internalContexts/geometry2d/UnboundedEllipse2d.js.map +1 -1
  456. package/lib/esm/curve/internalContexts/geometry2d/UnboundedHyperbola2d.js.map +1 -1
  457. package/lib/esm/curve/internalContexts/geometry2d/UnboundedLine2d.js.map +1 -1
  458. package/lib/esm/curve/internalContexts/geometry2d/UnboundedParabola2d.js.map +1 -1
  459. package/lib/esm/curve/spiral/AustralianRailCorpXYEvaluator.js.map +1 -1
  460. package/lib/esm/curve/spiral/ClothoidSeries.js.map +1 -1
  461. package/lib/esm/curve/spiral/CubicEvaluator.js.map +1 -1
  462. package/lib/esm/curve/spiral/CzechSpiralEvaluator.js.map +1 -1
  463. package/lib/esm/curve/spiral/DirectHalfCosineSpiralEvaluator.js.map +1 -1
  464. package/lib/esm/curve/spiral/DirectSpiral3d.d.ts +1 -2
  465. package/lib/esm/curve/spiral/DirectSpiral3d.d.ts.map +1 -1
  466. package/lib/esm/curve/spiral/DirectSpiral3d.js +9 -3
  467. package/lib/esm/curve/spiral/DirectSpiral3d.js.map +1 -1
  468. package/lib/esm/curve/spiral/IntegratedSpiral3d.d.ts +1 -2
  469. package/lib/esm/curve/spiral/IntegratedSpiral3d.d.ts.map +1 -1
  470. package/lib/esm/curve/spiral/IntegratedSpiral3d.js +10 -4
  471. package/lib/esm/curve/spiral/IntegratedSpiral3d.js.map +1 -1
  472. package/lib/esm/curve/spiral/MXCubicAlongArcSpiralEvaluator.js.map +1 -1
  473. package/lib/esm/curve/spiral/NormalizedTransition.js.map +1 -1
  474. package/lib/esm/curve/spiral/PolishCubicSpiralEvaluator.js.map +1 -1
  475. package/lib/esm/curve/spiral/TransitionConditionalProperties.js.map +1 -1
  476. package/lib/esm/curve/spiral/TransitionSpiral3d.js.map +1 -1
  477. package/lib/esm/curve/spiral/XYCurveEvaluator.js.map +1 -1
  478. package/lib/esm/geometry3d/Angle.js.map +1 -1
  479. package/lib/esm/geometry3d/AngleSweep.d.ts +3 -1
  480. package/lib/esm/geometry3d/AngleSweep.d.ts.map +1 -1
  481. package/lib/esm/geometry3d/AngleSweep.js +6 -2
  482. package/lib/esm/geometry3d/AngleSweep.js.map +1 -1
  483. package/lib/esm/geometry3d/BarycentricTriangle.js.map +1 -1
  484. package/lib/esm/geometry3d/BilinearPatch.js.map +1 -1
  485. package/lib/esm/geometry3d/CoincidentGeometryOps.js.map +1 -1
  486. package/lib/esm/geometry3d/Ellipsoid.js.map +1 -1
  487. package/lib/esm/geometry3d/FrameBuilder.js.map +1 -1
  488. package/lib/esm/geometry3d/FrustumAnimation.js.map +1 -1
  489. package/lib/esm/geometry3d/GeometryHandler.d.ts +33 -4
  490. package/lib/esm/geometry3d/GeometryHandler.d.ts.map +1 -1
  491. package/lib/esm/geometry3d/GeometryHandler.js +77 -0
  492. package/lib/esm/geometry3d/GeometryHandler.js.map +1 -1
  493. package/lib/esm/geometry3d/GrowableBlockedArray.js.map +1 -1
  494. package/lib/esm/geometry3d/GrowableFloat64Array.js.map +1 -1
  495. package/lib/esm/geometry3d/GrowableXYArray.d.ts +9 -6
  496. package/lib/esm/geometry3d/GrowableXYArray.d.ts.map +1 -1
  497. package/lib/esm/geometry3d/GrowableXYArray.js +20 -10
  498. package/lib/esm/geometry3d/GrowableXYArray.js.map +1 -1
  499. package/lib/esm/geometry3d/GrowableXYZArray.d.ts +9 -6
  500. package/lib/esm/geometry3d/GrowableXYZArray.d.ts.map +1 -1
  501. package/lib/esm/geometry3d/GrowableXYZArray.js +20 -10
  502. package/lib/esm/geometry3d/GrowableXYZArray.js.map +1 -1
  503. package/lib/esm/geometry3d/IndexedCollectionInterval.js.map +1 -1
  504. package/lib/esm/geometry3d/IndexedXYCollection.js.map +1 -1
  505. package/lib/esm/geometry3d/IndexedXYZCollection.js.map +1 -1
  506. package/lib/esm/geometry3d/LongitudeLatitudeAltitude.js.map +1 -1
  507. package/lib/esm/geometry3d/Matrix3d.d.ts +4 -4
  508. package/lib/esm/geometry3d/Matrix3d.d.ts.map +1 -1
  509. package/lib/esm/geometry3d/Matrix3d.js +5 -4
  510. package/lib/esm/geometry3d/Matrix3d.js.map +1 -1
  511. package/lib/esm/geometry3d/OrderedRotationAngles.js.map +1 -1
  512. package/lib/esm/geometry3d/Plane3d.js.map +1 -1
  513. package/lib/esm/geometry3d/Plane3dByOriginAndUnitNormal.js.map +1 -1
  514. package/lib/esm/geometry3d/Plane3dByOriginAndVectors.js.map +1 -1
  515. package/lib/esm/geometry3d/Point2dArrayCarrier.js.map +1 -1
  516. package/lib/esm/geometry3d/Point2dVector2d.js.map +1 -1
  517. package/lib/esm/geometry3d/Point3dArrayCarrier.js.map +1 -1
  518. package/lib/esm/geometry3d/Point3dVector3d.js.map +1 -1
  519. package/lib/esm/geometry3d/PointHelpers.d.ts.map +1 -1
  520. package/lib/esm/geometry3d/PointHelpers.js +6 -7
  521. package/lib/esm/geometry3d/PointHelpers.js.map +1 -1
  522. package/lib/esm/geometry3d/PointStreaming.js.map +1 -1
  523. package/lib/esm/geometry3d/PolygonOps.js.map +1 -1
  524. package/lib/esm/geometry3d/PolylineCompressionByEdgeOffset.js.map +1 -1
  525. package/lib/esm/geometry3d/PolylineOps.js.map +1 -1
  526. package/lib/esm/geometry3d/Range.js.map +1 -1
  527. package/lib/esm/geometry3d/Ray2d.js.map +1 -1
  528. package/lib/esm/geometry3d/Ray3d.js.map +1 -1
  529. package/lib/esm/geometry3d/ReusableObjectCache.js.map +1 -1
  530. package/lib/esm/geometry3d/Segment1d.js.map +1 -1
  531. package/lib/esm/geometry3d/SortablePolygon.js.map +1 -1
  532. package/lib/esm/geometry3d/Transform.js.map +1 -1
  533. package/lib/esm/geometry3d/UVSurfaceOps.js.map +1 -1
  534. package/lib/esm/geometry3d/XYZProps.js.map +1 -1
  535. package/lib/esm/geometry3d/YawPitchRollAngles.js.map +1 -1
  536. package/lib/esm/geometry4d/Map4d.js.map +1 -1
  537. package/lib/esm/geometry4d/Matrix4d.js.map +1 -1
  538. package/lib/esm/geometry4d/MomentData.js.map +1 -1
  539. package/lib/esm/geometry4d/PlaneByOriginAndVectors4d.js.map +1 -1
  540. package/lib/esm/geometry4d/Point4d.js.map +1 -1
  541. package/lib/esm/numerics/BandedSystem.js.map +1 -1
  542. package/lib/esm/numerics/BezierPolynomials.d.ts.map +1 -1
  543. package/lib/esm/numerics/BezierPolynomials.js +1 -1
  544. package/lib/esm/numerics/BezierPolynomials.js.map +1 -1
  545. package/lib/esm/numerics/ClusterableArray.js.map +1 -1
  546. package/lib/esm/numerics/Complex.js.map +1 -1
  547. package/lib/esm/numerics/ConvexPolygon2d.js.map +1 -1
  548. package/lib/esm/numerics/Newton.d.ts +52 -13
  549. package/lib/esm/numerics/Newton.d.ts.map +1 -1
  550. package/lib/esm/numerics/Newton.js +71 -22
  551. package/lib/esm/numerics/Newton.js.map +1 -1
  552. package/lib/esm/numerics/PascalCoefficients.js.map +1 -1
  553. package/lib/esm/numerics/PolarData.js.map +1 -1
  554. package/lib/esm/numerics/Polynomials.js.map +1 -1
  555. package/lib/esm/numerics/Quadrature.js.map +1 -1
  556. package/lib/esm/numerics/Range1dArray.js.map +1 -1
  557. package/lib/esm/numerics/SmallSystem.js.map +1 -1
  558. package/lib/esm/numerics/TriDiagonalSystem.js.map +1 -1
  559. package/lib/esm/numerics/UnionFind.js.map +1 -1
  560. package/lib/esm/numerics/UsageSums.js.map +1 -1
  561. package/lib/esm/polyface/AuxData.js.map +1 -1
  562. package/lib/esm/polyface/BoxTopology.js.map +1 -1
  563. package/lib/esm/polyface/FacetFaceData.js.map +1 -1
  564. package/lib/esm/polyface/FacetLocationDetail.js.map +1 -1
  565. package/lib/esm/polyface/FacetOrientation.js.map +1 -1
  566. package/lib/esm/polyface/GreedyTriangulationBetweenLineStrings.js.map +1 -1
  567. package/lib/esm/polyface/IndexedEdgeMatcher.js.map +1 -1
  568. package/lib/esm/polyface/IndexedPolyfaceVisitor.js.map +1 -1
  569. package/lib/esm/polyface/IndexedPolyfaceWalker.js.map +1 -1
  570. package/lib/esm/polyface/Polyface.js.map +1 -1
  571. package/lib/esm/polyface/PolyfaceBuilder.js.map +1 -1
  572. package/lib/esm/polyface/PolyfaceClip.js.map +1 -1
  573. package/lib/esm/polyface/PolyfaceData.js.map +1 -1
  574. package/lib/esm/polyface/PolyfaceQuery.d.ts +14 -14
  575. package/lib/esm/polyface/PolyfaceQuery.d.ts.map +1 -1
  576. package/lib/esm/polyface/PolyfaceQuery.js +14 -14
  577. package/lib/esm/polyface/PolyfaceQuery.js.map +1 -1
  578. package/lib/esm/polyface/RangeLengthData.js.map +1 -1
  579. package/lib/esm/polyface/RangeTree/LineString3dRangeTreeContext.js.map +1 -1
  580. package/lib/esm/polyface/RangeTree/MinimumValueTester.js.map +1 -1
  581. package/lib/esm/polyface/RangeTree/Point3dArrayRangeTreeContext.js.map +1 -1
  582. package/lib/esm/polyface/RangeTree/PolyfaceRangeTreeContext.js.map +1 -1
  583. package/lib/esm/polyface/RangeTree/RangeTreeNode.js.map +1 -1
  584. package/lib/esm/polyface/RangeTree/RangeTreeSearchHandlers.js.map +1 -1
  585. package/lib/esm/polyface/TaggedNumericData.js.map +1 -1
  586. package/lib/esm/polyface/TriangleCandidate.js.map +1 -1
  587. package/lib/esm/polyface/multiclip/BuildAverageNormalsContext.js.map +1 -1
  588. package/lib/esm/polyface/multiclip/GriddedRaggedRange2dSet.js.map +1 -1
  589. package/lib/esm/polyface/multiclip/GriddedRaggedRange2dSetWithOverflow.js.map +1 -1
  590. package/lib/esm/polyface/multiclip/LinearSearchRange2dArray.js.map +1 -1
  591. package/lib/esm/polyface/multiclip/OffsetMeshContext.js.map +1 -1
  592. package/lib/esm/polyface/multiclip/Range2dSearchInterface.js.map +1 -1
  593. package/lib/esm/polyface/multiclip/RangeSearch.js.map +1 -1
  594. package/lib/esm/polyface/multiclip/SweepLineStringToFacetContext.js.map +1 -1
  595. package/lib/esm/polyface/multiclip/XYPointBuckets.js.map +1 -1
  596. package/lib/esm/serialization/BGFBAccessors.js.map +1 -1
  597. package/lib/esm/serialization/BGFBReader.js +2 -2
  598. package/lib/esm/serialization/BGFBReader.js.map +1 -1
  599. package/lib/esm/serialization/BGFBWriter.js.map +1 -1
  600. package/lib/esm/serialization/BentleyGeometryFlatBuffer.js.map +1 -1
  601. package/lib/esm/serialization/DeepCompare.js.map +1 -1
  602. package/lib/esm/serialization/IModelJsonSchema.js.map +1 -1
  603. package/lib/esm/serialization/SerializationHelpers.js.map +1 -1
  604. package/lib/esm/solid/Box.js.map +1 -1
  605. package/lib/esm/solid/Cone.js.map +1 -1
  606. package/lib/esm/solid/LinearSweep.js.map +1 -1
  607. package/lib/esm/solid/RotationalSweep.js.map +1 -1
  608. package/lib/esm/solid/RuledSweep.js.map +1 -1
  609. package/lib/esm/solid/SolidPrimitive.js.map +1 -1
  610. package/lib/esm/solid/Sphere.js.map +1 -1
  611. package/lib/esm/solid/SweepContour.js.map +1 -1
  612. package/lib/esm/solid/TorusPipe.js.map +1 -1
  613. package/lib/esm/topology/ChainMerge.js.map +1 -1
  614. package/lib/esm/topology/Graph.d.ts +15 -15
  615. package/lib/esm/topology/Graph.d.ts.map +1 -1
  616. package/lib/esm/topology/Graph.js +1 -1
  617. package/lib/esm/topology/Graph.js.map +1 -1
  618. package/lib/esm/topology/HalfEdgeGraphFromIndexedLoopsContext.js.map +1 -1
  619. package/lib/esm/topology/HalfEdgeGraphSearch.d.ts +3 -3
  620. package/lib/esm/topology/HalfEdgeGraphSearch.d.ts.map +1 -1
  621. package/lib/esm/topology/HalfEdgeGraphSearch.js.map +1 -1
  622. package/lib/esm/topology/HalfEdgeGraphSpineContext.js.map +1 -1
  623. package/lib/esm/topology/HalfEdgeGraphValidation.js.map +1 -1
  624. package/lib/esm/topology/HalfEdgeMarkSet.js.map +1 -1
  625. package/lib/esm/topology/HalfEdgeNodeXYZUV.js.map +1 -1
  626. package/lib/esm/topology/HalfEdgePointInGraphSearch.js.map +1 -1
  627. package/lib/esm/topology/HalfEdgePositionDetail.js.map +1 -1
  628. package/lib/esm/topology/HalfEdgePriorityQueue.js.map +1 -1
  629. package/lib/esm/topology/InsertAndRetriangulateContext.js.map +1 -1
  630. package/lib/esm/topology/MaskManager.js.map +1 -1
  631. package/lib/esm/topology/Merging.js.map +1 -1
  632. package/lib/esm/topology/RegularizeFace.js.map +1 -1
  633. package/lib/esm/topology/SignedDataSummary.js.map +1 -1
  634. package/lib/esm/topology/SpaceTriangulation.js.map +1 -1
  635. package/lib/esm/topology/Triangulation.js.map +1 -1
  636. package/lib/esm/topology/Voronoi.js.map +1 -1
  637. package/lib/esm/topology/XYParitySearchContext.js.map +1 -1
  638. package/package.json +3 -3
  639. package/lib/cjs/curve/internalContexts/NewtonRtoRStrokeHandler.d.ts +0 -23
  640. package/lib/cjs/curve/internalContexts/NewtonRtoRStrokeHandler.d.ts.map +0 -1
  641. package/lib/cjs/curve/internalContexts/NewtonRtoRStrokeHandler.js +0 -37
  642. package/lib/cjs/curve/internalContexts/NewtonRtoRStrokeHandler.js.map +0 -1
  643. package/lib/esm/curve/internalContexts/NewtonRtoRStrokeHandler.d.ts +0 -23
  644. package/lib/esm/curve/internalContexts/NewtonRtoRStrokeHandler.d.ts.map +0 -1
  645. package/lib/esm/curve/internalContexts/NewtonRtoRStrokeHandler.js +0 -33
  646. package/lib/esm/curve/internalContexts/NewtonRtoRStrokeHandler.js.map +0 -1
@@ -5,22 +5,26 @@
5
5
  /** @packageDocumentation
6
6
  * @module Curve
7
7
  */
8
- import { assert } from "@itwin/core-bentley";
9
- import { BSplineCurve3d, BSplineCurve3dBase } from "../../bspline/BSplineCurve";
8
+ import { assert, DuplicatePolicy, SortedArray } from "@itwin/core-bentley";
9
+ import { BSplineCurve3dBase } from "../../bspline/BSplineCurve";
10
10
  import { Geometry } from "../../Geometry";
11
11
  import { RecurseToCurvesGeometryHandler } from "../../geometry3d/GeometryHandler";
12
12
  import { GrowableFloat64Array } from "../../geometry3d/GrowableFloat64Array";
13
13
  import { Point3d } from "../../geometry3d/Point3dVector3d";
14
14
  import { Range3d } from "../../geometry3d/Range";
15
- import { CurveCurveCloseApproachXYRRtoRRD, CurvePointCloseApproachXYRtoRD, Newton1dUnbounded, Newton2dUnboundedWithDerivative, } from "../../numerics/Newton";
15
+ import { CurveCurveCloseApproachXYRRtoRRD, Newton2dUnboundedWithDerivative } from "../../numerics/Newton";
16
16
  import { AnalyticRoots } from "../../numerics/Polynomials";
17
17
  import { SmallSystem } from "../../numerics/SmallSystem";
18
18
  import { Arc3d } from "../Arc3d";
19
19
  import { CurveChainWithDistanceIndex } from "../CurveChainWithDistanceIndex";
20
20
  import { CurveCollection } from "../CurveCollection";
21
+ import { CurveCurve } from "../CurveCurve";
21
22
  import { CurveIntervalRole, CurveLocationDetail, CurveLocationDetailPair } from "../CurveLocationDetail";
23
+ import { CurvePrimitive } from "../CurvePrimitive";
22
24
  import { LineSegment3d } from "../LineSegment3d";
23
25
  import { LineString3d } from "../LineString3d";
26
+ import { ProxyCurve } from "../ProxyCurve";
27
+ import { TransitionSpiral3d } from "../spiral/TransitionSpiral3d";
24
28
  // cspell:word XYRR currentdFdX
25
29
  /**
26
30
  * Handler class for XY close approach between _geometryB and another geometry.
@@ -38,9 +42,6 @@ import { LineString3d } from "../LineString3d";
38
42
  */
39
43
  export class CurveCurveCloseApproachXY extends RecurseToCurvesGeometryHandler {
40
44
  _geometryB;
41
- setGeometryB(geometryB) {
42
- this._geometryB = geometryB;
43
- }
44
45
  /**
45
46
  * Maximum XY distance (z is ignored). Approach larger than this is not interesting.
46
47
  * This is caller defined and can be undefined.
@@ -48,6 +49,8 @@ export class CurveCurveCloseApproachXY extends RecurseToCurvesGeometryHandler {
48
49
  _maxDistanceToAccept;
49
50
  /** Squared max distance. Default is [[Geometry.smallMetricDistanceSquared]]. */
50
51
  _maxDistanceSquared;
52
+ _xyTolerance;
53
+ _newtonTolerance;
51
54
  /**
52
55
  * Start and end points of line segments that meet closest approach criteria, i.e., they are perpendicular to
53
56
  * both curves and their length is smaller than _maxDistanceToAccept.
@@ -61,18 +64,28 @@ export class CurveCurveCloseApproachXY extends RecurseToCurvesGeometryHandler {
61
64
  /**
62
65
  * Constructor.
63
66
  * @param geometryB second curve for intersection. Saved for reference by specific handler methods.
67
+ * @param xyTolerance optional tolerance for comparing xy points (default [[Geometry.smallMetricDistance]]).
68
+ * @param newtonTolerance optional relative fraction tolerance for Newton iteration (default [[Geometry.smallNewtonStep]]).
64
69
  */
65
- constructor(geometryB) {
70
+ constructor(geometryB, xyTolerance = Geometry.smallMetricDistance, newtonTolerance = Geometry.smallNewtonStep) {
66
71
  super();
67
- this.setGeometryB(geometryB);
72
+ this._geometryB = geometryB instanceof ProxyCurve ? geometryB.proxyCurve : geometryB;
68
73
  this._maxDistanceSquared = Geometry.smallMetricDistanceSquared;
69
- this._results = [];
74
+ this._xyTolerance = xyTolerance;
75
+ this._newtonTolerance = newtonTolerance;
76
+ const compare = CurveLocationDetailPair.comparePairsByPoints(xyTolerance, true);
77
+ this._results = new SortedArray(compare, DuplicatePolicy.Retain);
70
78
  }
71
79
  /** Set the (possibly undefined) max XY distance (z is ignored) to accept. */
72
80
  set maxDistanceToAccept(value) {
73
- this._maxDistanceToAccept = value;
74
- if (this._maxDistanceToAccept !== undefined && this._maxDistanceToAccept > 0)
75
- this._maxDistanceSquared = this._maxDistanceToAccept * this._maxDistanceToAccept;
81
+ if (value === undefined) {
82
+ this._maxDistanceToAccept = undefined;
83
+ this._maxDistanceSquared = Geometry.smallMetricDistanceSquared;
84
+ }
85
+ else {
86
+ this._maxDistanceToAccept = Math.abs(value);
87
+ this._maxDistanceSquared = value * value;
88
+ }
76
89
  }
77
90
  /** Access the (possibly undefined) max XY distance (z is ignored) to accept. */
78
91
  get maxDistanceToAccept() {
@@ -82,9 +95,14 @@ export class CurveCurveCloseApproachXY extends RecurseToCurvesGeometryHandler {
82
95
  get isMaxDistanceSet() {
83
96
  return this._maxDistanceToAccept !== undefined && this._maxDistanceToAccept > 0;
84
97
  }
85
- /** Reset the geometry and flags, leaving all other parts unchanged (and preserving accumulated intersections) */
98
+ /**
99
+ * Reset the geometry.
100
+ * * Undefined inputs are ignored.
101
+ * * All other instance data is unchanged, including accumulated intersections.
102
+ */
86
103
  resetGeometry(geometryB) {
87
- this.setGeometryB(geometryB);
104
+ if (geometryB)
105
+ this._geometryB = geometryB;
88
106
  }
89
107
  /** returns true if `fraction` is in [0,1] within tolerance */
90
108
  acceptFraction(fraction, fractionTol = 1.0e-12) {
@@ -94,131 +112,103 @@ export class CurveCurveCloseApproachXY extends RecurseToCurvesGeometryHandler {
94
112
  return false;
95
113
  return true;
96
114
  }
97
- /**
98
- * Return the results structure for the intersection calculation, structured as an array of CurveLocationDetailPair.
99
- * @param reinitialize if true, a new results structure is created for use by later calls.
100
- */
101
- grabPairedResults(reinitialize = false) {
102
- const result = this._results;
103
- if (reinitialize)
104
- this._results = [];
105
- return result;
115
+ /** Extract (and clear) the results, structured as an array of CurveLocationDetailPair. */
116
+ grabPairedResults() {
117
+ return this._results.extractArray();
106
118
  }
107
119
  /**
108
- * If distance between pointA and pointB is less than maxDistance, record CurveLocationDetailPair which is
109
- * the approach from pointA to pointB.
120
+ * Create and record a close-approach pair from raw curve/fraction/point data.
121
+ * * If points are undefined, they are computed from the fractions via `fractionToPoint`.
122
+ * * Fractions are global (i.e., relative to the full curve, not a sub-segment).
123
+ * * The pair is recorded only if the XY distance is within `_maxDistanceSquared`.
124
+ * @param cpA first curve
125
+ * @param fA global fraction on cpA
126
+ * @param pointA point on cpA at fA, or undefined to compute from fA
127
+ * @param cpB second curve
128
+ * @param fB global fraction on cpB
129
+ * @param pointB point on cpB at fB, or undefined to compute from fB
130
+ * @param reversed if true, swap detailA and detailB before recording
110
131
  */
111
- testAndRecordPointPairApproach(cpA, fA, pointA, cpB, fB, pointB, reversed) {
132
+ testAndRecordPointPair(cpA, fA, pointA, cpB, fB, pointB, reversed) {
133
+ if (!pointA)
134
+ pointA = cpA.fractionToPoint(fA);
135
+ if (!pointB)
136
+ pointB = cpB.fractionToPoint(fB);
112
137
  const d2 = pointA.distanceSquaredXY(pointB);
113
- if (d2 < this._maxDistanceSquared) {
138
+ if (d2 <= this._maxDistanceSquared) {
114
139
  const d = Math.sqrt(d2);
115
140
  const detailA = CurveLocationDetail.createCurveFractionPointDistance(cpA, fA, pointA, d);
116
141
  const detailB = CurveLocationDetail.createCurveFractionPointDistance(cpB, fB, pointB, d);
142
+ detailA.setIntervalRole(CurveIntervalRole.isolated);
143
+ detailB.setIntervalRole(CurveIntervalRole.isolated);
117
144
  const pair = CurveLocationDetailPair.createCapture(detailA, detailB);
118
145
  if (reversed)
119
146
  pair.swapDetails();
120
- this._results.push(pair);
147
+ this._results.insert(pair);
121
148
  }
122
149
  }
123
150
  /**
124
- * Create a close approach pair if XY distance is within maxDistance.
125
- * @param localFractionA a fraction on first curve
126
- * @param cpA the first curve
127
- * @param fractionA0 start of the first curve
128
- * @param fractionA1 end of the first curve
129
- * @param localFractionB a fraction on second curve
130
- * @param cpB the second curve
131
- * @param fractionB0 start of the second curve
132
- * @param fractionB1 end of the second curve
133
- * @param reversed whether to reverse the details in the pair (e.g., so that detailB refers to geometryB).
151
+ * Record a pre-built close-approach pair with global fractions already set.
152
+ * * Computes and stores the XY distance on both details.
153
+ * * The pair is recorded only if the XY distance is within `_maxDistanceSquared`.
154
+ * @param pair details with global fractions and points already set; modified in place
155
+ * @param reversed if true, swap detailA and detailB before recording
134
156
  */
135
- recordPointWithLocalFractions(localFractionA, cpA, fractionA0, fractionA1, localFractionB, cpB, fractionB0, fractionB1, reversed) {
136
- const globalFractionA = Geometry.interpolate(fractionA0, localFractionA, fractionA1);
137
- const globalFractionB = Geometry.interpolate(fractionB0, localFractionB, fractionB1);
138
- // ignore duplicate of most recent approach
139
- const numPrevious = this._results.length;
140
- if (numPrevious > 0) {
141
- const oldDetailA = this._results[numPrevious - 1].detailA;
142
- const oldDetailB = this._results[numPrevious - 1].detailB;
143
- if (reversed) {
144
- if (oldDetailB.isSameCurveAndFraction({ curve: cpA, fraction: globalFractionA }) &&
145
- oldDetailA.isSameCurveAndFraction({ curve: cpB, fraction: globalFractionB }))
146
- return;
147
- }
148
- else {
149
- if (oldDetailA.isSameCurveAndFraction({ curve: cpA, fraction: globalFractionA }) &&
150
- oldDetailB.isSameCurveAndFraction({ curve: cpB, fraction: globalFractionB }))
151
- return;
152
- }
153
- }
154
- const pointA = cpA.fractionToPoint(globalFractionA);
155
- const pointB = cpB.fractionToPoint(globalFractionB);
156
- const d2 = pointA.distanceSquaredXY(pointB);
157
+ testAndRecordPair(pair, reversed) {
158
+ const d2 = pair.detailA.point.distanceSquaredXY(pair.detailB.point);
157
159
  if (d2 > this._maxDistanceSquared)
158
160
  return;
159
161
  const d = Math.sqrt(d2);
160
- const detailA = CurveLocationDetail.createCurveFractionPointDistance(cpA, globalFractionA, pointA, d);
161
- const detailB = CurveLocationDetail.createCurveFractionPointDistance(cpB, globalFractionB, pointB, d);
162
- detailA.setIntervalRole(CurveIntervalRole.isolated);
163
- detailB.setIntervalRole(CurveIntervalRole.isolated);
162
+ pair.detailA.a = pair.detailB.a = d;
163
+ pair.detailA.setIntervalRole(CurveIntervalRole.isolated);
164
+ pair.detailB.setIntervalRole(CurveIntervalRole.isolated);
164
165
  if (reversed)
165
- this._results.push(new CurveLocationDetailPair(detailB, detailA));
166
- else
167
- this._results.push(new CurveLocationDetailPair(detailA, detailB));
166
+ pair.swapDetails();
167
+ this._results.insert(pair);
168
168
  }
169
169
  /**
170
- * Capture a close approach pair that has point and local fraction but not curve.
171
- * * Record the pair, each detail modified with global fraction and input curve.
172
- * * Pair is neither modified nor recorded if it would be a duplicate of the last recorded pair.
173
- * @param pair details computed with local fractions
174
- * @param cpA curveA
175
- * @param fractionA0 global start fraction on curveA
176
- * @param fractionA1 global end fraction on curveA
177
- * @param cpB curveB
178
- * @param fractionB0 global start fraction on curveB
179
- * @param fractionB1 global end fraction on curveB
180
- * @param reversed whether to reverse the details in the pair (e.g., so that detailB refers to geometryB).
170
+ * Convert a close-approach pair from local (sub-segment) fractions to global fractions, then record it.
171
+ * * Local fractions in the pair are interpolated into the global fraction ranges.
172
+ * * Points are recomputed from the parent curves at the global fractions.
173
+ * * The pair is recorded only if the XY distance is within `_maxDistanceSquared`.
174
+ * @param pair local details (curve unspecified); modified in place with global fractions, curves, and points
175
+ * @param cpA parent curve A
176
+ * @param fractionA0 global fraction corresponding to local fraction 0 on curve A
177
+ * @param fractionA1 global fraction corresponding to local fraction 1 on curve A
178
+ * @param cpB parent curve B
179
+ * @param fractionB0 global fraction corresponding to local fraction 0 on curve B
180
+ * @param fractionB1 global fraction corresponding to local fraction 1 on curve B
181
+ * @param reversed if true, swap detailA and detailB before recording
181
182
  */
182
- capturePairWithLocalFractions(pair, cpA, fractionA0, fractionA1, cpB, fractionB0, fractionB1, reversed) {
183
+ testAndRecordLocalPair(pair, cpA, fractionA0, fractionA1, cpB, fractionB0, fractionB1, reversed) {
183
184
  const globalFractionA = Geometry.interpolate(fractionA0, pair.detailA.fraction, fractionA1);
184
185
  const globalFractionB = Geometry.interpolate(fractionB0, pair.detailB.fraction, fractionB1);
185
- // ignore duplicate of most recent pair
186
- const numPrevious = this._results.length;
187
- if (numPrevious > 0) {
188
- const oldDetailA = this._results[numPrevious - 1].detailA;
189
- const oldDetailB = this._results[numPrevious - 1].detailB;
190
- if (reversed) {
191
- if (oldDetailB.isSameCurveAndFraction({ curve: cpA, fraction: globalFractionA }) &&
192
- oldDetailA.isSameCurveAndFraction({ curve: cpB, fraction: globalFractionB }))
193
- return;
194
- }
195
- else {
196
- if (oldDetailA.isSameCurveAndFraction({ curve: cpA, fraction: globalFractionA }) &&
197
- oldDetailB.isSameCurveAndFraction({ curve: cpB, fraction: globalFractionB }))
198
- return;
199
- }
200
- }
201
- // recompute the points just in case
202
- CurveLocationDetail.createCurveEvaluatedFraction(cpA, globalFractionA, pair.detailA);
203
- CurveLocationDetail.createCurveEvaluatedFraction(cpB, globalFractionB, pair.detailB);
204
- pair.detailA.a = pair.detailB.a = pair.detailA.point.distanceXY(pair.detailB.point);
186
+ const pointA = cpA.fractionToPoint(globalFractionA);
187
+ const pointB = cpB.fractionToPoint(globalFractionB);
188
+ const d2 = pointA.distanceSquaredXY(pointB);
189
+ if (d2 > this._maxDistanceSquared)
190
+ return;
191
+ const d = Math.sqrt(d2);
192
+ CurveLocationDetail.createCurveFractionPointDistance(cpA, globalFractionA, pointA, d, pair.detailA);
193
+ CurveLocationDetail.createCurveFractionPointDistance(cpB, globalFractionB, pointB, d, pair.detailB);
205
194
  pair.detailA.setIntervalRole(CurveIntervalRole.isolated);
206
195
  pair.detailB.setIntervalRole(CurveIntervalRole.isolated);
207
196
  if (reversed)
208
197
  pair.swapDetails();
209
- this._results.push(pair);
198
+ this._results.insert(pair);
210
199
  }
211
- static updatePointToSegmentDistance(fractionA, pointA, pointB0, pointB1, fractionB, maxDistanceSquared, closestApproach) {
200
+ /** Modify the current closest approach if the inputs are closer. */
201
+ static updatePointToSegmentDistance(closestApproach, fractionA, pointA, fractionB, pointB0, pointB1, maxDistanceSquared) {
212
202
  let updated = false;
213
203
  if (fractionB < 0)
214
204
  fractionB = 0;
215
205
  else if (fractionB > 1)
216
206
  fractionB = 1;
217
- this._workPointB = pointB0.interpolate(fractionB, pointB1, this._workPointB);
218
- const distanceSquared = this._workPointB.distanceSquaredXY(pointA);
207
+ const pointB = pointB0.interpolate(fractionB, pointB1, this._workPointB);
208
+ const distanceSquared = pointB.distanceSquaredXY(pointA);
219
209
  if (distanceSquared <= Math.min(maxDistanceSquared, closestApproach.detailA.a)) {
220
210
  closestApproach.detailA.setFP(fractionA, pointA, undefined, distanceSquared);
221
- closestApproach.detailB.setFP(fractionB, this._workPointB, undefined, distanceSquared);
211
+ closestApproach.detailB.setFP(fractionB, pointB, undefined, distanceSquared);
222
212
  updated = true;
223
213
  }
224
214
  return updated;
@@ -231,8 +221,9 @@ export class CurveCurveCloseApproachXY extends RecurseToCurvesGeometryHandler {
231
221
  * @param b0 start point of line b
232
222
  * @param b1 end point of line b
233
223
  * @param maxDistanceSquared maximum distance squared (assumed to be positive)
234
- * @returns the fractional (not xy) coordinates in result.x and result.y. result.x is fraction on line a.
235
- * result.y is fraction on line b.
224
+ * @returns a pair of details for the closest approach, or `undefined` if no approach is within `maxDistanceSquared`.
225
+ * `detailA.fraction` is the fraction on segment a; `detailB.fraction` is the fraction on segment b. Returned
226
+ * details store the *squared* distance in the `a` property.
236
227
  */
237
228
  static segmentSegmentBoundedApproach(a0, a1, b0, b1, maxDistanceSquared) {
238
229
  const ux = a1.x - a0.x;
@@ -261,23 +252,23 @@ export class CurveCurveCloseApproachXY extends RecurseToCurvesGeometryHandler {
261
252
  const uu = Geometry.hypotenuseSquaredXY(ux, uy);
262
253
  if (hab0 * hab0 <= maxDistanceSquared * uu) { // test distance of b0 to u
263
254
  const fractionA = Geometry.safeDivideFraction(Geometry.dotProductXYXY(ux, uy, e00x, e00y), uu, 0.0);
264
- if (this.updatePointToSegmentDistance(0, b0, a0, a1, fractionA, maxDistanceSquared, closestApproach))
255
+ if (this.updatePointToSegmentDistance(closestApproach, 0, b0, fractionA, a0, a1, maxDistanceSquared))
265
256
  reversed = true;
266
257
  }
267
258
  if (hab1 * hab1 <= maxDistanceSquared * uu) { // test distance of b1 to u
268
259
  const fractionA = Geometry.safeDivideFraction(Geometry.dotProductXYXY(ux, uy, e01x, e01y), uu, 0.0);
269
- if (this.updatePointToSegmentDistance(1, b1, a0, a1, fractionA, maxDistanceSquared, closestApproach))
260
+ if (this.updatePointToSegmentDistance(closestApproach, 1, b1, fractionA, a0, a1, maxDistanceSquared))
270
261
  reversed = true;
271
262
  }
272
263
  const vv = Geometry.hypotenuseSquaredXY(vx, vy);
273
264
  if (hba0 * hba0 <= maxDistanceSquared * vv) { // test distance of a0 to v
274
265
  const fractionB = Geometry.safeDivideFraction(-Geometry.dotProductXYXY(vx, vy, e00x, e00y), vv, 0.0);
275
- if (this.updatePointToSegmentDistance(0, a0, b0, b1, fractionB, maxDistanceSquared, closestApproach))
266
+ if (this.updatePointToSegmentDistance(closestApproach, 0, a0, fractionB, b0, b1, maxDistanceSquared))
276
267
  reversed = false;
277
268
  }
278
269
  if (hba1 * hba1 <= maxDistanceSquared * vv) { // test distance of a1 to v
279
270
  const fractionB = Geometry.safeDivideFraction(-Geometry.dotProductXYXY(vx, vy, e10x, e10y), vv, 0.0);
280
- if (this.updatePointToSegmentDistance(1, a1, b0, b1, fractionB, maxDistanceSquared, closestApproach))
271
+ if (this.updatePointToSegmentDistance(closestApproach, 1, a1, fractionB, b0, b1, maxDistanceSquared))
281
272
  reversed = false;
282
273
  }
283
274
  if (closestApproach.detailA.a > maxDistanceSquared)
@@ -287,96 +278,30 @@ export class CurveCurveCloseApproachXY extends RecurseToCurvesGeometryHandler {
287
278
  return closestApproach;
288
279
  }
289
280
  /**
290
- * Check different combination of fractions on curveA and curveB. If distance between points at 2 fractions
291
- * is less than maxDistance, record CurveLocationDetailPair which is the approach between the 2 points.
292
- * Optionally, record close approaches of one curve's points if they fall between the other curve's points.
293
- * * If an input curve is a LineString3d, then the corresponding fractions must define a segment of the line string.
281
+ * Compute closest approaches from the endpoints of each curve (if open) to the other curve.
282
+ * Record a [[CurveLocationDetailPair]] if such a distance is less than [[maxDistance]].
294
283
  * @param cpA curveA
295
- * @param fA0 fraction0 on curveA
296
- * @param fA1 fraction1 on curveA
297
- * @param testProjectionOnA whether to record projections of the given curveB points onto curveA
298
284
  * @param cpB curveB
299
- * @param fB0 fraction0 on curveB
300
- * @param fB1 fraction0 on curveB
301
- * @param testProjectionOnB whether to record projections of the given curveA points onto curveB
302
- * @param reversed whether to reverse the details in the pair (e.g., so that detailB refers to geometryB).
285
+ * @param reversed whether to reverse the details in the pair (e.g., so that detailB refers to curveA).
303
286
  */
304
- testAndRecordFractionalPairApproach(cpA, fA0, fA1, testProjectionOnA, cpB, fB0, fB1, testProjectionOnB, reversed) {
305
- const pointA0 = cpA.fractionToPoint(fA0);
306
- const pointA1 = cpA.fractionToPoint(fA1);
307
- const pointB0 = cpB.fractionToPoint(fB0);
308
- const pointB1 = cpB.fractionToPoint(fB1);
309
- this.testAndRecordPointPairApproach(cpA, fA0, pointA0, cpB, fB0, pointB0, reversed);
310
- this.testAndRecordPointPairApproach(cpA, fA1, pointA1, cpB, fB0, pointB0, reversed);
311
- this.testAndRecordPointPairApproach(cpA, fA0, pointA0, cpB, fB1, pointB1, reversed);
312
- this.testAndRecordPointPairApproach(cpA, fA1, pointA1, cpB, fB1, pointB1, reversed);
313
- if (testProjectionOnB) {
314
- this.testAndRecordProjection(cpA, fA0, pointA0, cpB, fB0, fB1, reversed);
315
- this.testAndRecordProjection(cpA, fA1, pointA1, cpB, fB0, fB1, reversed);
316
- }
317
- if (testProjectionOnA) {
318
- this.testAndRecordProjection(cpB, fB0, pointB0, cpA, fA0, fA1, !reversed);
319
- this.testAndRecordProjection(cpB, fB1, pointB1, cpA, fA0, fA1, !reversed);
287
+ testAndRecordEndPointApproaches(cpA, cpB, reversed) {
288
+ const pt = CurveCurveCloseApproachXY._workPointB;
289
+ // in closest approach context, endpoints of full sweep arcs are artificial locations, and thus ignored
290
+ const isClosedArc = (curve) => curve instanceof Arc3d && curve.sweep.isFullCircle;
291
+ if (!isClosedArc(cpA)) {
292
+ this.testAndRecordProjection(cpA, 0, cpA.startPoint(pt), cpB, reversed);
293
+ this.testAndRecordProjection(cpA, 1, cpA.endPoint(pt), cpB, reversed);
320
294
  }
321
- }
322
- /**
323
- * Return XY closest approach between a curve primitive and a point.
324
- * Currently, this function only supports Arc3d and LineSegment.
325
- * Note that this function doesn't handle endpoints.
326
- */
327
- getPointCurveClosestApproachXYNewton(curveP, pointQ) {
328
- if (!(curveP instanceof Arc3d) && !(curveP instanceof LineSegment3d)) {
329
- assert(false, "getPointCurveClosestApproachXYNewton only supports Arc3d and LineSegment");
330
- }
331
- const seeds = [0.2, 0.4, 0.6, 0.8]; // HEURISTIC: arcs have up to 4 perpendiculars; lines have only 1
332
- const newtonEvaluator = new CurvePointCloseApproachXYRtoRD(curveP, pointQ);
333
- const newtonSearcher = new Newton1dUnbounded(newtonEvaluator, 100); // observed convergence to 1.0e-11 in 66 iters
334
- let minCloseApproachLength = Geometry.largeCoordinateResult;
335
- let minCurvePFraction;
336
- let minPointP;
337
- for (const seed of seeds) {
338
- newtonSearcher.setX(seed);
339
- if (newtonSearcher.runIterations()) {
340
- const curvePFraction = newtonSearcher.getX();
341
- if (this.acceptFraction(curvePFraction)) {
342
- const pointP = curveP.fractionToPoint(curvePFraction);
343
- const closeApproachLength = pointP.distanceSquaredXY(pointQ);
344
- if (closeApproachLength < minCloseApproachLength) {
345
- minCloseApproachLength = closeApproachLength;
346
- minCurvePFraction = curvePFraction;
347
- minPointP = pointP;
348
- }
349
- }
350
- }
295
+ if (!isClosedArc(cpB)) {
296
+ this.testAndRecordProjection(cpB, 0, cpB.startPoint(pt), cpA, !reversed);
297
+ this.testAndRecordProjection(cpB, 1, cpB.endPoint(pt), cpA, !reversed);
351
298
  }
352
- if (minCurvePFraction && minPointP)
353
- return CurveLocationDetail.createCurveFractionPoint(curveP, minCurvePFraction, minPointP);
354
- return undefined;
355
299
  }
356
- /**
357
- * Find the closest xy approach between `pointA` and `cpB`. Add the approach if it's within `fB0` and `fB1`.
358
- * * Does not test the endpoints of `cpB`.
359
- * * The only types supported for `cpB` are Arc3d, LineSegment3d, and LineString3d.
360
- * * If `cpB` is a LineString3d, then the interval `[fB0, fB1]` must correspond to a segment of the line string.
361
- */
362
- testAndRecordProjection(cpA, fA, pointA, cpB, fB0, fB1, reversed) {
363
- let detail;
364
- if (cpB instanceof LineString3d) {
365
- const segParamsB = cpB.globalFractionToSegmentIndexAndLocalFraction(fB0 <= fB1 ? fB0 : fB1);
366
- const segIndexB = (segParamsB.fraction < 0.999999) ? segParamsB.index : segParamsB.index + 1;
367
- const segmentB = cpB.getIndexedSegment(segIndexB);
368
- if (segmentB && (detail = this.getPointCurveClosestApproachXYNewton(segmentB, pointA)))
369
- LineString3d.convertLocalToGlobalDetail(detail, segIndexB, cpB.numEdges(), cpB);
370
- }
371
- else {
372
- detail = this.getPointCurveClosestApproachXYNewton(cpB, pointA);
373
- }
374
- if (detail) {
375
- const fB = Geometry.restrictToInterval(detail.fraction, fB0, fB1);
376
- if (fB === detail.fraction) { // if fraction is within fB0 and fB1
377
- this.testAndRecordPointPairApproach(cpA, fA, pointA, cpB, detail.fraction, detail.point, reversed);
378
- }
379
- }
300
+ /** Find the closest xy approach between `pointA` and `cpB`. */
301
+ testAndRecordProjection(cpA, fA, pointA, cpB, reversed) {
302
+ const detail = cpB.closestPointXY(pointA);
303
+ if (detail)
304
+ this.testAndRecordPointPair(cpA, fA, pointA, cpB, detail.fraction, detail.point, reversed);
380
305
  }
381
306
  /**
382
307
  * Compute closest xy approach of two line segments.
@@ -384,63 +309,50 @@ export class CurveCurveCloseApproachXY extends RecurseToCurvesGeometryHandler {
384
309
  * Record with fraction mapping.
385
310
  * * The fraction mappings allow portions of a linestring to be passed here.
386
311
  */
387
- computeSegmentSegment3D(cpA, pointA0, fractionA0, pointA1, fractionA1, cpB, pointB0, fractionB0, pointB1, fractionB1, reversed) {
312
+ computeSegmentSegment(cpA, pointA0, fractionA0, pointA1, fractionA1, cpB, pointB0, fractionB0, pointB1, fractionB1, reversed) {
388
313
  // compute a pair with fractions local to segments
389
314
  const approach = CurveCurveCloseApproachXY.segmentSegmentBoundedApproach(pointA0, pointA1, pointB0, pointB1, this._maxDistanceSquared);
390
315
  // adjust the pair to refer to input curves and global fractions, then record it if new
391
316
  if (approach) {
392
317
  approach.detailA.setCurve(cpA);
393
318
  approach.detailB.setCurve(cpB);
394
- this.capturePairWithLocalFractions(approach, cpA, fractionA0, fractionA1, cpB, fractionB0, fractionB1, reversed);
319
+ this.testAndRecordLocalPair(approach, cpA, fractionA0, fractionA1, cpB, fractionB0, fractionB1, reversed);
395
320
  }
396
321
  }
397
- /** Low level dispatch of segment with segment. */
398
- dispatchSegmentSegment(cpA, pointA0, fractionA0, pointA1, fractionA1, cpB, pointB0, fractionB0, pointB1, fractionB1, reversed) {
399
- this.computeSegmentSegment3D(cpA, pointA0, fractionA0, pointA1, fractionA1, cpB, pointB0, fractionB0, pointB1, fractionB1, reversed);
400
- }
401
322
  /**
402
323
  * Compute the perpendiculars between a line segment and an arc, without extending either curve.
403
324
  * * One or two perpendiculars will be found.
404
325
  * * Each perpendicular segment starts or ends on the arc where the arc tangent is parallel to the line tangent.
405
- * * Perpendiculars from an endpoint are not explicitly computed.
406
- * @param cpA line segment or line string; if it is a line string, then the fractions must specify a segment
407
- * @param pointA0 start point of the segment
408
- * @param fractionA0 fraction of the start of the segment
409
- * @param pointA1 end point of the segment
410
- * @param fractionA1 fraction of the end of the segment
411
- * @param arc the arc
412
- * @param reversed swap the details in the recorded pair (default: false)
326
+ * @param startA line segment start point
327
+ * @param endA line segment end point
328
+ * @param arcB the arc
329
+ * @param announce callback to receive line and arc fractions and optional points of each perpendicular segment computed.
413
330
  */
414
- allPerpendicularsSegmentArcBounded(cpA, pointA0, fractionA0, pointA1, fractionA1, arc, reversed = false) {
415
- const dotUT = arc.vector0.crossProductStartEndXY(pointA0, pointA1);
416
- const dotVT = arc.vector90.crossProductStartEndXY(pointA0, pointA1);
331
+ announceAllPerpendicularsSegmentArcBounded(startA, endA, arcB, announce) {
332
+ const dotUT = arcB.vector0.crossProductStartEndXY(startA, endA);
333
+ const dotVT = arcB.vector90.crossProductStartEndXY(startA, endA);
417
334
  const parallelRadians = Math.atan2(dotVT, dotUT);
418
335
  for (const radians1 of [parallelRadians, parallelRadians + Math.PI]) {
419
- const arcPoint = arc.radiansToPoint(radians1);
420
- const fArc = arc.sweep.radiansToSignedPeriodicFraction(radians1);
421
- if (this.acceptFraction(fArc)) { // reject solution outside arc sweep
422
- const fLine = SmallSystem.lineSegment3dXYClosestPointUnbounded(pointA0, pointA1, arcPoint);
423
- if (fLine !== undefined && this.acceptFraction(fLine))
424
- this.recordPointWithLocalFractions(fLine, cpA, fractionA0, fractionA1, fArc, arc, 0, 1, reversed);
336
+ const arcPoint = arcB.radiansToPoint(radians1);
337
+ const arcFraction = arcB.sweep.radiansToSignedPeriodicFraction(radians1);
338
+ if (this.acceptFraction(arcFraction)) { // reject solution outside arc sweep
339
+ const lineFraction = SmallSystem.lineSegment3dXYClosestPointUnbounded(startA, endA, arcPoint);
340
+ if (lineFraction !== undefined && this.acceptFraction(lineFraction))
341
+ announce(lineFraction, undefined, arcFraction, arcPoint);
425
342
  }
426
343
  }
427
344
  }
428
345
  /**
429
- * Low level dispatch of line segment with arc.
430
- * Find close approaches within maxDistance between a line segments (pointA0, pointA1) and an arc.
346
+ * Find close approaches within maxDistance between a line segment and an arc.
431
347
  * To consider:
432
348
  * 1) intersection between arc and segment.
433
- * 2) endpoints to endpoints or endpoints projection to the other curve.
434
- * 3) arc tangent parallel to line segment (or line string).
435
- * @param cpA curve A (line segment or line string; if it is a line string, then the fractions must specify a segment)
436
- * @param pointA0 start point of the segment
437
- * @param fractionA0 fraction of the start of the segment
438
- * @param pointA1 end point of the segment
439
- * @param fractionA1 fraction of the end of the segment
440
- * @param arc the arc
441
- * @param reversed whether to reverse the details in the pair (e.g., so that detailB refers to geometryB).
349
+ * 2) endpoints to endpoints, or endpoints projection to the other curve.
350
+ * 3) arc tangent parallel to line segment
351
+ * @param lineA the line segment
352
+ * @param arcB the arc
353
+ * @param reversed whether to reverse the details in the pair (e.g., so that detailB refers to arcA).
442
354
  */
443
- dispatchSegmentArc(cpA, pointA0, fractionA0, pointA1, fractionA1, arc, reversed) {
355
+ computeSegmentArc(lineA, arcB, reversed) {
444
356
  // 1) intersection between arc and line segment (or string).
445
357
  // Suppose:
446
358
  // Arc: X = C + cU + sV where c = cos(theta) and s = sin(theta)
@@ -451,45 +363,45 @@ export class CurveCurveCloseApproachXY extends RecurseToCurvesGeometryHandler {
451
363
  // evaluate points.
452
364
  // project back to line.
453
365
  let intersectionFound = false;
454
- const data = arc.toTransformedVectors();
455
- const pointA0Local = pointA0;
456
- const pointA1Local = pointA1;
457
- const alpha = Geometry.tripleProductXYW(pointA0Local, 1, pointA1Local, 1, data.center, 1); // det(A0, A1, C)
458
- const beta = Geometry.tripleProductXYW(pointA0Local, 1, pointA1Local, 1, data.vector0, 0); // det(A0, A1, U)
459
- const gamma = Geometry.tripleProductXYW(pointA0Local, 1, pointA1Local, 1, data.vector90, 0); // det(A0, A1, V)
366
+ const data = arcB.toTransformedVectors();
367
+ const alpha = Geometry.tripleProductXYW(lineA.point0Ref, 1, lineA.point1Ref, 1, data.center, 1); // det(A0, A1, C)
368
+ const beta = Geometry.tripleProductXYW(lineA.point0Ref, 1, lineA.point1Ref, 1, data.vector0, 0); // det(A0, A1, U)
369
+ const gamma = Geometry.tripleProductXYW(lineA.point0Ref, 1, lineA.point1Ref, 1, data.vector90, 0); // det(A0, A1, V)
460
370
  const cosines = new GrowableFloat64Array(2);
461
371
  const sines = new GrowableFloat64Array(2);
462
372
  const radians = new GrowableFloat64Array(2);
463
- const numRoots = AnalyticRoots.appendImplicitLineUnitCircleIntersections(// solve the equation
464
- alpha, beta, gamma, cosines, sines, radians);
373
+ const numRoots = AnalyticRoots.appendImplicitLineUnitCircleIntersections(alpha, beta, gamma, cosines, sines, radians);
465
374
  for (let i = 0; i < numRoots; i++) {
466
375
  const arcPoint = data.center.plus2Scaled(data.vector0, cosines.atUncheckedIndex(i), data.vector90, sines.atUncheckedIndex(i));
467
376
  const arcFraction = data.sweep.radiansToSignedPeriodicFraction(radians.atUncheckedIndex(i));
468
- const lineFraction = SmallSystem.lineSegment3dXYClosestPointUnbounded(pointA0Local, pointA1Local, arcPoint);
469
- // only add if the point is within the start and end fractions of both line segment and arc
470
- if (lineFraction !== undefined && this.acceptFraction(lineFraction) && this.acceptFraction(arcFraction)) {
471
- this.recordPointWithLocalFractions(lineFraction, cpA, fractionA0, fractionA1, arcFraction, arc, 0, 1, reversed);
472
- intersectionFound = true;
377
+ if (this.acceptFraction(arcFraction)) { // reject solution outside arc sweep
378
+ const lineFraction = SmallSystem.lineSegment3dXYClosestPointUnbounded(lineA.point0Ref, lineA.point1Ref, arcPoint);
379
+ if (lineFraction !== undefined && this.acceptFraction(lineFraction)) {
380
+ this.testAndRecordPointPair(lineA, lineFraction, undefined, arcB, arcFraction, arcPoint, reversed);
381
+ intersectionFound = true;
382
+ }
473
383
  }
474
384
  }
475
385
  if (intersectionFound)
476
386
  return;
477
- // 2) endpoints to endpoints or endpoints projection to the other curve.
478
- this.testAndRecordFractionalPairApproach(cpA, fractionA0, fractionA1, true, arc, 0, 1, true, reversed);
479
- // 3) arc tangent parallel to line segment (or string).
387
+ // 2) endpoints to endpoints, or endpoints projection to the other curve.
388
+ this.testAndRecordEndPointApproaches(lineA, arcB, reversed);
389
+ // 3) arc tangent parallel to line segment.
480
390
  // If line does not intersect the arc, then the closest (and/or the furthest) point on arc to the line is a
481
391
  // point where the tangent line on arc at that point is parallel to the line.
482
- this.allPerpendicularsSegmentArcBounded(cpA, pointA0, fractionA0, pointA1, fractionA1, arc, reversed);
392
+ this.announceAllPerpendicularsSegmentArcBounded(lineA.point0Ref, lineA.point1Ref, arcB, (lineFraction, linePoint, arcFraction, arcPoint) => this.testAndRecordPointPair(lineA, lineFraction, linePoint, arcB, arcFraction, arcPoint, reversed));
483
393
  }
484
394
  /**
485
395
  * Compute segments perpendicular to two elliptical arcs, without extending either curve.
486
396
  * * Perpendiculars from an endpoint are not explicitly computed.
487
397
  * * Intersections are also found by this search: they are reported as zero-length segments.
398
+ * @param arcA first arc
399
+ * @param arcB second arc
488
400
  * @param reversed swap the details in the recorded pair (default: false)
489
401
  */
490
- allPerpendicularsArcArcBounded(arc0, arc1, reversed = false) {
491
- const newtonEvaluator = new CurveCurveCloseApproachXYRRtoRRD(arc0, arc1);
492
- // HEURISTIC: 2 ellipses have up to 8 perpendiculars and up to 4 intersections
402
+ allPerpendicularsArcArcBounded(arcA, arcB, reversed = false) {
403
+ const newtonEvaluator = new CurveCurveCloseApproachXYRRtoRRD(arcA, arcB);
404
+ // HEURISTIC: 2 ellipses have up to 8 perpendiculars
493
405
  const seedDelta = 1 / 10; // denominator 9 fails the unit test
494
406
  const seedStart = seedDelta / 2;
495
407
  const newtonSearcher = new Newton2dUnboundedWithDerivative(newtonEvaluator, 100); // observed convergence to 1.0e-11 in 49 iters
@@ -497,10 +409,10 @@ export class CurveCurveCloseApproachXY extends RecurseToCurvesGeometryHandler {
497
409
  for (let seedV = seedStart; seedV < 1; seedV += seedDelta) {
498
410
  newtonSearcher.setUV(seedU, seedV);
499
411
  if (newtonSearcher.runIterations()) {
500
- const frac0 = newtonSearcher.getU();
501
- const frac1 = newtonSearcher.getV();
502
- if (this.acceptFraction(frac0) && this.acceptFraction(frac1)) {
503
- this.recordPointWithLocalFractions(frac0, arc0, 0, 1, frac1, arc1, 0, 1, reversed);
412
+ const fractionA = newtonSearcher.getU();
413
+ const fractionB = newtonSearcher.getV();
414
+ if (this.acceptFraction(fractionA) && this.acceptFraction(fractionB)) {
415
+ this.testAndRecordPointPair(arcA, fractionA, undefined, arcB, fractionB, undefined, reversed);
504
416
  }
505
417
  }
506
418
  }
@@ -515,36 +427,10 @@ export class CurveCurveCloseApproachXY extends RecurseToCurvesGeometryHandler {
515
427
  if (!rangeB.intersectsRangeXY(rangeA))
516
428
  return;
517
429
  // 1) endpoints to endpoints or endpoints projection to the other curve
518
- this.testAndRecordFractionalPairApproach(cpA, 0, 1, true, cpB, 0, 1, true, reversed);
430
+ this.testAndRecordEndPointApproaches(cpA, cpB, reversed);
519
431
  // 2) perpendicular line between 2 arcs (includes intersections)
520
432
  this.allPerpendicularsArcArcBounded(cpA, cpB, reversed);
521
433
  }
522
- /** Low level dispatch of arc with (beziers of) a bspline curve */
523
- dispatchArcBsplineCurve3d(cpA, cpB, reversed) {
524
- const ls = LineString3d.create();
525
- cpB.emitStrokes(ls);
526
- this.computeArcLineString(cpA, ls, reversed);
527
- }
528
- /** Low level dispatch of (beziers of) a bspline curve with (beziers of) a bspline curve */
529
- dispatchBSplineCurve3dBSplineCurve3d(bcurveA, bcurveB, reversed) {
530
- const lsA = LineString3d.create();
531
- bcurveA.emitStrokes(lsA);
532
- const lsB = LineString3d.create();
533
- bcurveB.emitStrokes(lsB);
534
- this.computeLineStringLineString(lsA, lsB, reversed);
535
- }
536
- /** Low level dispatch of linestring with (beziers of) a bspline curve */
537
- dispatchLineStringBSplineCurve(lsA, curveB, reversed) {
538
- const lsB = LineString3d.create();
539
- curveB.emitStrokes(lsB);
540
- this.computeLineStringLineString(lsA, lsB, reversed);
541
- }
542
- /** Low level dispatch of segment with (beziers of) a bspline curve */
543
- dispatchSegmentBsplineCurve(segA, curveB, reversed) {
544
- const lsB = LineString3d.create();
545
- curveB.emitStrokes(lsB);
546
- this.computeSegmentLineString(segA, lsB, reversed);
547
- }
548
434
  /** Detail computation for segment approaching linestring. */
549
435
  computeSegmentLineString(segA, lsB, reversed) {
550
436
  const numB = lsB.numPoints();
@@ -558,7 +444,7 @@ export class CurveCurveCloseApproachXY extends RecurseToCurvesGeometryHandler {
558
444
  const fB1 = (i + 1 === numB - 1) ? 1.0 : (i + 1) * deltaFracB; // make sure we nail the end fraction
559
445
  lsB.packedPoints.getPoint3dAtUncheckedPointIndex(i, pointB0);
560
446
  lsB.packedPoints.getPoint3dAtUncheckedPointIndex(i + 1, pointB1);
561
- this.dispatchSegmentSegment(segA, pointA0, 0.0, pointA1, 1.0, lsB, pointB0, fB0, pointB1, fB1, reversed);
447
+ this.computeSegmentSegment(segA, pointA0, 0.0, pointA1, 1.0, lsB, pointB0, fB0, pointB1, fB1, reversed);
562
448
  }
563
449
  }
564
450
  /** Detail computation for arc approaching linestring. */
@@ -569,72 +455,28 @@ export class CurveCurveCloseApproachXY extends RecurseToCurvesGeometryHandler {
569
455
  rangeA.expandInPlace(this._maxDistanceToAccept);
570
456
  if (!rangeB.intersectsRangeXY(rangeA))
571
457
  return;
572
- const pointB0 = CurveCurveCloseApproachXY._workPointBB0;
573
- const pointB1 = CurveCurveCloseApproachXY._workPointBB1;
574
- const numB = lsB.numPoints();
575
- if (numB > 1) {
576
- const dfB = 1.0 / (numB - 1);
577
- let fB0;
578
- let fB1;
579
- fB0 = 0.0;
580
- lsB.pointAt(0, pointB0);
581
- for (let ib = 1; ib < numB; ib++, pointB0.setFrom(pointB1), fB0 = fB1) {
582
- lsB.pointAt(ib, pointB1);
583
- fB1 = ib * dfB;
584
- this.dispatchSegmentArc(lsB, pointB0, fB0, pointB1, fB1, arcA, !reversed);
585
- }
458
+ const v0 = CurveCurveCloseApproachXY._workPointBB0;
459
+ const v1 = CurveCurveCloseApproachXY._workPointBB1;
460
+ // 1. record intersections
461
+ const intersections = CurveCurve.intersectionXYPairs(arcA, false, lsB, false, this._xyTolerance);
462
+ for (const intersection of intersections)
463
+ this.testAndRecordPair(intersection, reversed);
464
+ // 2. record linestring interior vertex projections onto arc
465
+ const fStep = Geometry.safeDivideFraction(1.0, lsB.numEdges(), 0);
466
+ for (let i = 1; i < lsB.numEdges(); ++i)
467
+ this.testAndRecordProjection(lsB, i * fStep, lsB.pointAtUnchecked(i, v0), arcA, !reversed);
468
+ // 3. record arc/linestring endpoint projections onto linestring/arc
469
+ this.testAndRecordEndPointApproaches(arcA, lsB, reversed);
470
+ // 4. record perpendiculars from within a segment to the arc
471
+ lsB.startPoint(v0);
472
+ for (let iSeg = 0; iSeg < lsB.numEdges(); ++iSeg, v0.setFrom(v1)) {
473
+ lsB.pointAtUnchecked(iSeg + 1, v1);
474
+ this.announceAllPerpendicularsSegmentArcBounded(v0, v1, arcA, (lineFraction, linePoint, arcFraction, arcPoint) => {
475
+ const fLineString = lsB.segmentIndexAndLocalFractionToGlobalFraction(iSeg, lineFraction);
476
+ this.testAndRecordPointPair(arcA, arcFraction, arcPoint, lsB, fLineString, linePoint, reversed);
477
+ });
586
478
  }
587
479
  }
588
- /** Low level dispatch of curve collection. */
589
- dispatchCurveCollection(geomA, geomAHandler) {
590
- const geomB = this._geometryB; // save
591
- if (!geomB || !geomB.children || !(geomB instanceof CurveCollection))
592
- return;
593
- for (const child of geomB.children) {
594
- this.resetGeometry(child);
595
- geomAHandler(geomA);
596
- }
597
- this._geometryB = geomB; // restore
598
- }
599
- /** Low level dispatch to geomA given a CurveChainWithDistanceIndex in geometryB. */
600
- dispatchCurveChainWithDistanceIndex(geomA, geomAHandler) {
601
- if (!this._geometryB || !(this._geometryB instanceof CurveChainWithDistanceIndex))
602
- return;
603
- if (geomA instanceof CurveChainWithDistanceIndex) {
604
- assert(false, "call handleCurveChainWithDistanceIndex(geomA) instead");
605
- }
606
- const index0 = this._results.length;
607
- const geomB = this._geometryB; // save
608
- for (const child of geomB.path.children) {
609
- this.resetGeometry(child);
610
- geomAHandler(geomA);
611
- }
612
- this.resetGeometry(geomB); // restore
613
- this._results = CurveChainWithDistanceIndex.convertChildDetailToChainDetail(this._results, index0, undefined, geomB, true);
614
- }
615
- /** Double dispatch handler for strongly typed segment. */
616
- handleLineSegment3d(segmentA) {
617
- if (this._geometryB instanceof LineSegment3d) {
618
- const segmentB = this._geometryB;
619
- this.dispatchSegmentSegment(segmentA, segmentA.point0Ref, 0.0, segmentA.point1Ref, 1.0, segmentB, segmentB.point0Ref, 0.0, segmentB.point1Ref, 1.0, false);
620
- }
621
- else if (this._geometryB instanceof LineString3d) {
622
- this.computeSegmentLineString(segmentA, this._geometryB, false);
623
- }
624
- else if (this._geometryB instanceof Arc3d) {
625
- this.dispatchSegmentArc(segmentA, segmentA.point0Ref, 0.0, segmentA.point1Ref, 1.0, this._geometryB, false);
626
- }
627
- else if (this._geometryB instanceof BSplineCurve3d) {
628
- this.dispatchSegmentBsplineCurve(segmentA, this._geometryB, false);
629
- }
630
- else if (this._geometryB instanceof CurveCollection) {
631
- this.dispatchCurveCollection(segmentA, this.handleLineSegment3d.bind(this));
632
- }
633
- else if (this._geometryB instanceof CurveChainWithDistanceIndex) {
634
- this.dispatchCurveChainWithDistanceIndex(segmentA, this.handleLineSegment3d.bind(this));
635
- }
636
- return undefined;
637
- }
638
480
  /**
639
481
  * Set bits for comparison to range xy
640
482
  * * bit 0x01 => x smaller than range.low.x
@@ -707,26 +549,164 @@ export class CurveCurveCloseApproachXY extends RecurseToCurvesGeometryHandler {
707
549
  // DO NOT study the segment in detail if both bitB bits are on for any of the 4 planes
708
550
  // (i.e., no intersection between rangeA1 and the range around line segment [B0,B1])
709
551
  if ((bitB0 & bitB1) === 0)
710
- this.dispatchSegmentSegment(lsA, pointA0, fA0, pointA1, fA1, lsB, pointB0, fB0, pointB1, fB1, reversed);
552
+ this.computeSegmentSegment(lsA, pointA0, fA0, pointA1, fA1, lsB, pointB0, fB0, pointB1, fB1, reversed);
711
553
  }
712
554
  }
713
555
  }
714
556
  }
715
557
  }
558
+ /** Low level dispatch of curve collection. */
559
+ dispatchCurveCollection(geomA, geomAHandler) {
560
+ const geomB = this._geometryB; // save
561
+ if (!geomB || !geomB.children || !(geomB instanceof CurveCollection))
562
+ return;
563
+ for (const child of geomB.children) {
564
+ this.resetGeometry(child);
565
+ geomAHandler(geomA);
566
+ }
567
+ this._geometryB = geomB; // restore
568
+ }
569
+ /** Low level dispatch to geomA given a CurveChainWithDistanceIndex in geometryB. */
570
+ dispatchCurveChainWithDistanceIndex(geomA, geomAHandler) {
571
+ if (!this._geometryB || !(this._geometryB instanceof CurveChainWithDistanceIndex))
572
+ return;
573
+ if (geomA instanceof CurveChainWithDistanceIndex)
574
+ assert(false, "call handleCurveChainWithDistanceIndex(geomA) instead");
575
+ const saveResults = this.grabPairedResults();
576
+ const geomB = this._geometryB;
577
+ for (const child of geomB.path.children) {
578
+ this.resetGeometry(child);
579
+ geomAHandler(geomA);
580
+ }
581
+ this.resetGeometry(geomB);
582
+ const childResults = this._results.extractArray();
583
+ childResults.forEach((pair) => {
584
+ CurveChainWithDistanceIndex.convertChildDetailToChainDetailSingle(pair, undefined, geomB);
585
+ this._results.insert(pair);
586
+ });
587
+ saveResults.forEach((pair) => this._results.insert(pair));
588
+ }
589
+ /** Specifies whether the curve needs to be stroked for close approach computation. */
590
+ needsStroking(curve) {
591
+ return curve instanceof BSplineCurve3dBase || curve instanceof TransitionSpiral3d;
592
+ }
593
+ /**
594
+ * Process seeds for xy close approach between one curve and another curve to be stroked.
595
+ * * Refine each result via Newton iteration. If it doesn't converge, remove it.
596
+ * @param seeds the initial seed results to refine.
597
+ * @param curveA curve to find its XY close approach with curveB.
598
+ * @param curveB the other curve to be stroked.
599
+ * @param reversed whether `curveB` data is in `detailA` of each recorded pair, and `curveA` data in `detailB`.
600
+ */
601
+ refineStrokedResultsByNewton(seeds, curveA, curveB, reversed = false) {
602
+ const xyMatchingFunction = new CurveCurveCloseApproachXYRRtoRRD(curveA, curveB);
603
+ const newtonSearcher = new Newton2dUnboundedWithDerivative(xyMatchingFunction, 50, this._newtonTolerance); // seen: 47
604
+ for (const seed of seeds) {
605
+ const detailA = reversed ? seed.detailB : seed.detailA;
606
+ const detailB = reversed ? seed.detailA : seed.detailB;
607
+ assert(detailB.curve instanceof LineString3d, "Caller has discretized the curve");
608
+ newtonSearcher.setUV(detailA.fraction, detailB.fraction); // use the linestring fraction as initial curveB fraction (ASSUME it's close enough)
609
+ if (newtonSearcher.runIterations()) {
610
+ const fractionA = newtonSearcher.getU();
611
+ const fractionB = newtonSearcher.getV();
612
+ if (this.acceptFraction(fractionA) && this.acceptFraction(fractionB))
613
+ this.testAndRecordPointPair(curveA, fractionA, undefined, curveB, fractionB, undefined, reversed);
614
+ } // ignore failure to converge
615
+ }
616
+ }
617
+ /**
618
+ * Append stroke points and return the line string.
619
+ * * This is a convenient wrapper for [[CurvePrimitive.emitStrokes]] but the analogous instance method cannot be added
620
+ * to that class due to the ensuing recursion with subclass [[LineString3d]].
621
+ * @param options options for stroking the instance curve.
622
+ * @param result object to receive appended stroke points; if omitted, a new object is created, populated, and returned.
623
+ */
624
+ strokeCurve(curve, options, result) {
625
+ const ls = result ? result : LineString3d.create();
626
+ curve.emitStrokes(ls, options);
627
+ return ls;
628
+ }
629
+ /** Find and return the close approaches between curveA and the discretization of curveB. */
630
+ computeDiscreteCloseApproachResults(curveA, lsB, reversed) {
631
+ const maxDist = this.maxDistanceToAccept;
632
+ const saveResults = this.grabPairedResults(); // save current results
633
+ const geomB = this._geometryB;
634
+ this.maxDistanceToAccept = maxDist ? maxDist * 1.2 : undefined; // HEURISTIC: allow slack for Newton seeds
635
+ this.resetGeometry(curveA);
636
+ this.handleLineString3d(lsB); // populate empty results with discrete solutions
637
+ if (!reversed) {
638
+ // handleLineString3d put lsB data into detailA, so if we aren't reversing, we need to swap
639
+ for (const result of this._results)
640
+ result.swapDetails();
641
+ }
642
+ this.resetGeometry(geomB);
643
+ this.maxDistanceToAccept = maxDist;
644
+ const discreteResults = this._results.extractArray();
645
+ saveResults.forEach((pair) => this._results.insert(pair)); // restore current results
646
+ return discreteResults;
647
+ }
648
+ /**
649
+ * Compute the XY close approach of a curve and another curve to be stroked.
650
+ * @param curveA curve to find its XY close approach with curveB.
651
+ * @param curveB the other curve to be stroked.
652
+ * @param reversed whether `curveB` data will be recorded in `detailA` of each result, and `curveA` data in `detailB`.
653
+ */
654
+ dispatchCurveStrokedCurve(curveA, curveB, reversed) {
655
+ // explicit search for intersections (Newton converges too slowly on DirectSpiral3d tangent intersections)
656
+ const intersections = CurveCurve.intersectionXYPairs(curveA, false, curveB, false, this._xyTolerance);
657
+ for (const intersection of intersections)
658
+ this.testAndRecordPair(intersection, reversed);
659
+ // append seeds computed by solving the discretized spiral close approach problem, then refine the seeds via Newton
660
+ let cpA = curveA;
661
+ if (this.needsStroking(curveA))
662
+ cpA = this.strokeCurve(curveA);
663
+ const cpB = this.strokeCurve(curveB);
664
+ const seeds = this.computeDiscreteCloseApproachResults(cpA, cpB, reversed);
665
+ this.refineStrokedResultsByNewton(seeds, curveA, curveB, reversed);
666
+ if (curveA instanceof LineString3d) { // explicitly test corners (where Newton converges too slowly)
667
+ const fStep = Geometry.safeDivideFraction(1.0, curveA.numEdges(), 0);
668
+ const v0 = CurveCurveCloseApproachXY._workPointBB0;
669
+ for (let i = 1; i < curveA.numEdges(); ++i)
670
+ this.testAndRecordProjection(curveA, i * fStep, curveA.pointAtUnchecked(i, v0), curveB, reversed);
671
+ }
672
+ this.testAndRecordEndPointApproaches(curveA, curveB, reversed);
673
+ }
674
+ /** Double dispatch handler for strongly typed segment. */
675
+ handleLineSegment3d(segmentA) {
676
+ if (this._geometryB instanceof LineSegment3d) {
677
+ const segmentB = this._geometryB;
678
+ this.computeSegmentSegment(segmentA, segmentA.point0Ref, 0.0, segmentA.point1Ref, 1.0, segmentB, segmentB.point0Ref, 0.0, segmentB.point1Ref, 1.0, false);
679
+ }
680
+ else if (this._geometryB instanceof LineString3d) {
681
+ this.computeSegmentLineString(segmentA, this._geometryB, false);
682
+ }
683
+ else if (this._geometryB instanceof Arc3d) {
684
+ this.computeSegmentArc(segmentA, this._geometryB, false);
685
+ }
686
+ else if (this.needsStroking(this._geometryB)) {
687
+ this.dispatchCurveStrokedCurve(segmentA, this._geometryB, false);
688
+ }
689
+ else if (this._geometryB instanceof CurveCollection) {
690
+ this.dispatchCurveCollection(segmentA, this.handleLineSegment3d.bind(this));
691
+ }
692
+ else if (this._geometryB instanceof CurveChainWithDistanceIndex) {
693
+ this.dispatchCurveChainWithDistanceIndex(segmentA, this.handleLineSegment3d.bind(this));
694
+ }
695
+ return undefined;
696
+ }
716
697
  /** Double dispatch handler for strongly typed linestring. */
717
698
  handleLineString3d(lsA) {
718
- if (this._geometryB instanceof LineString3d) {
719
- const lsB = this._geometryB;
720
- this.computeLineStringLineString(lsA, lsB, false);
721
- }
722
- else if (this._geometryB instanceof LineSegment3d) {
699
+ if (this._geometryB instanceof LineSegment3d) {
723
700
  this.computeSegmentLineString(this._geometryB, lsA, true);
724
701
  }
702
+ else if (this._geometryB instanceof LineString3d) {
703
+ this.computeLineStringLineString(lsA, this._geometryB, false);
704
+ }
725
705
  else if (this._geometryB instanceof Arc3d) {
726
706
  this.computeArcLineString(this._geometryB, lsA, true);
727
707
  }
728
- else if (this._geometryB instanceof BSplineCurve3d) {
729
- this.dispatchLineStringBSplineCurve(lsA, this._geometryB, false);
708
+ else if (this.needsStroking(this._geometryB)) {
709
+ this.dispatchCurveStrokedCurve(lsA, this._geometryB, false);
730
710
  }
731
711
  else if (this._geometryB instanceof CurveCollection) {
732
712
  this.dispatchCurveCollection(lsA, this.handleLineString3d.bind(this));
@@ -737,46 +717,50 @@ export class CurveCurveCloseApproachXY extends RecurseToCurvesGeometryHandler {
737
717
  return undefined;
738
718
  }
739
719
  /** Double dispatch handler for strongly typed arc. */
740
- handleArc3d(arc0) {
720
+ handleArc3d(arcA) {
741
721
  if (this._geometryB instanceof LineSegment3d) {
742
- this.dispatchSegmentArc(this._geometryB, this._geometryB.point0Ref, 0.0, this._geometryB.point1Ref, 1.0, arc0, true);
722
+ this.computeSegmentArc(this._geometryB, arcA, true);
743
723
  }
744
724
  else if (this._geometryB instanceof LineString3d) {
745
- this.computeArcLineString(arc0, this._geometryB, false);
725
+ this.computeArcLineString(arcA, this._geometryB, false);
746
726
  }
747
727
  else if (this._geometryB instanceof Arc3d) {
748
- this.dispatchArcArc(arc0, this._geometryB, false);
728
+ this.dispatchArcArc(arcA, this._geometryB, false);
749
729
  }
750
- else if (this._geometryB instanceof BSplineCurve3d) {
751
- this.dispatchArcBsplineCurve3d(arc0, this._geometryB, false);
730
+ else if (this.needsStroking(this._geometryB)) {
731
+ this.dispatchCurveStrokedCurve(arcA, this._geometryB, false);
752
732
  }
753
733
  else if (this._geometryB instanceof CurveCollection) {
754
- this.dispatchCurveCollection(arc0, this.handleArc3d.bind(this));
734
+ this.dispatchCurveCollection(arcA, this.handleArc3d.bind(this));
755
735
  }
756
736
  else if (this._geometryB instanceof CurveChainWithDistanceIndex) {
757
- this.dispatchCurveChainWithDistanceIndex(arc0, this.handleArc3d.bind(this));
737
+ this.dispatchCurveChainWithDistanceIndex(arcA, this.handleArc3d.bind(this));
758
738
  }
759
739
  return undefined;
760
740
  }
761
741
  /** Double dispatch handler for strongly typed bspline curve. */
762
- handleBSplineCurve3d(curve) {
763
- if (this._geometryB instanceof LineSegment3d) {
764
- this.dispatchSegmentBsplineCurve(this._geometryB, curve, true);
742
+ handleBSplineCurve3d(curveA) {
743
+ if (this._geometryB instanceof CurveChainWithDistanceIndex) {
744
+ this.dispatchCurveChainWithDistanceIndex(curveA, this.handleBSplineCurve3d.bind(this));
765
745
  }
766
- else if (this._geometryB instanceof LineString3d) {
767
- this.dispatchLineStringBSplineCurve(this._geometryB, curve, true);
746
+ else if (this._geometryB instanceof CurvePrimitive) {
747
+ this.dispatchCurveStrokedCurve(this._geometryB, curveA, true);
768
748
  }
769
- else if (this._geometryB instanceof Arc3d) {
770
- this.dispatchArcBsplineCurve3d(this._geometryB, curve, true);
749
+ else if (this._geometryB instanceof CurveCollection) {
750
+ this.dispatchCurveCollection(curveA, this.handleBSplineCurve3d.bind(this));
751
+ }
752
+ return undefined;
753
+ }
754
+ /** Double dispatch handler for strongly typed spiral curve. */
755
+ handleTransitionSpiral(spiral) {
756
+ if (this._geometryB instanceof CurveChainWithDistanceIndex) {
757
+ this.dispatchCurveChainWithDistanceIndex(spiral, this.handleTransitionSpiral.bind(this));
771
758
  }
772
- else if (this._geometryB instanceof BSplineCurve3dBase) {
773
- this.dispatchBSplineCurve3dBSplineCurve3d(curve, this._geometryB, false);
759
+ else if (this._geometryB instanceof CurvePrimitive) {
760
+ this.dispatchCurveStrokedCurve(this._geometryB, spiral, true);
774
761
  }
775
762
  else if (this._geometryB instanceof CurveCollection) {
776
- this.dispatchCurveCollection(curve, this.handleBSplineCurve3d.bind(this));
777
- }
778
- else if (this._geometryB instanceof CurveChainWithDistanceIndex) {
779
- this.dispatchCurveChainWithDistanceIndex(curve, this.handleBSplineCurve3d.bind(this));
763
+ this.dispatchCurveCollection(spiral, this.handleTransitionSpiral.bind(this));
780
764
  }
781
765
  return undefined;
782
766
  }
@@ -784,23 +768,15 @@ export class CurveCurveCloseApproachXY extends RecurseToCurvesGeometryHandler {
784
768
  handleCurveChainWithDistanceIndex(chain) {
785
769
  super.handleCurveChainWithDistanceIndex(chain);
786
770
  // if _geometryB is also a CurveChainWithDistanceIndex, it will already have been converted by dispatchCurveChainWithDistanceIndex
787
- this._results = CurveChainWithDistanceIndex.convertChildDetailToChainDetail(this._results, 0, chain, undefined, true);
771
+ const childResults = this._results.extractArray();
772
+ childResults.forEach((pair) => {
773
+ CurveChainWithDistanceIndex.convertChildDetailToChainDetailSingle(pair, chain, undefined);
774
+ this._results.insert(pair);
775
+ });
788
776
  }
789
777
  /** Double dispatch handler for strongly typed homogeneous bspline curve .. */
790
778
  handleBSplineCurve3dH(_curve) {
791
- /*
792
- //NEEDS WORK -- make "dispatch" methods tolerant of both 3d and 3dH.
793
- // "easy" if both present BezierCurve3dH span loaders
794
- if (this._geometryB instanceof LineSegment3d) {
795
- this.dispatchSegmentBsplineCurve(
796
- this._geometryB, this._extendB, this._geometryB.point0Ref, 0.0, this._geometryB.point1Ref, 1.0, this._extendB,
797
- curve, this._extendA, true);
798
- } else if (this._geometryB instanceof LineString3d) {
799
- this.dispatchLineStringBSplineCurve(this._geometryB, this._extendB, curve, this._extendA, true);
800
- } else if (this._geometryB instanceof Arc3d) {
801
- this.dispatchArcBsplineCurve3d(this._geometryB, this._extendB, curve, this._extendA, true);
802
- }
803
- */
779
+ // NEEDS WORK -- make "dispatch" methods tolerant of both 3d and 3dH
804
780
  return undefined;
805
781
  }
806
782
  }