@itwin/core-geometry 5.9.0-dev.1 → 5.9.0-dev.10

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 (246) hide show
  1. package/CHANGELOG.md +18 -1
  2. package/lib/cjs/Geometry.d.ts +10 -7
  3. package/lib/cjs/Geometry.d.ts.map +1 -1
  4. package/lib/cjs/Geometry.js +8 -6
  5. package/lib/cjs/Geometry.js.map +1 -1
  6. package/lib/cjs/curve/Arc3d.d.ts +7 -0
  7. package/lib/cjs/curve/Arc3d.d.ts.map +1 -1
  8. package/lib/cjs/curve/Arc3d.js +18 -6
  9. package/lib/cjs/curve/Arc3d.js.map +1 -1
  10. package/lib/cjs/curve/CurveChainWithDistanceIndex.d.ts +11 -2
  11. package/lib/cjs/curve/CurveChainWithDistanceIndex.d.ts.map +1 -1
  12. package/lib/cjs/curve/CurveChainWithDistanceIndex.js +25 -15
  13. package/lib/cjs/curve/CurveChainWithDistanceIndex.js.map +1 -1
  14. package/lib/cjs/curve/CurveCollection.d.ts +15 -6
  15. package/lib/cjs/curve/CurveCollection.d.ts.map +1 -1
  16. package/lib/cjs/curve/CurveCollection.js +15 -6
  17. package/lib/cjs/curve/CurveCollection.js.map +1 -1
  18. package/lib/cjs/curve/CurveCurve.d.ts +1 -1
  19. package/lib/cjs/curve/CurveCurve.d.ts.map +1 -1
  20. package/lib/cjs/curve/CurveCurve.js +2 -1
  21. package/lib/cjs/curve/CurveCurve.js.map +1 -1
  22. package/lib/cjs/curve/CurveFactory.d.ts +73 -1
  23. package/lib/cjs/curve/CurveFactory.d.ts.map +1 -1
  24. package/lib/cjs/curve/CurveFactory.js +228 -1
  25. package/lib/cjs/curve/CurveFactory.js.map +1 -1
  26. package/lib/cjs/curve/CurveLocationDetail.d.ts +21 -0
  27. package/lib/cjs/curve/CurveLocationDetail.d.ts.map +1 -1
  28. package/lib/cjs/curve/CurveLocationDetail.js +59 -0
  29. package/lib/cjs/curve/CurveLocationDetail.js.map +1 -1
  30. package/lib/cjs/curve/CurvePrimitive.d.ts +13 -12
  31. package/lib/cjs/curve/CurvePrimitive.d.ts.map +1 -1
  32. package/lib/cjs/curve/CurvePrimitive.js +12 -11
  33. package/lib/cjs/curve/CurvePrimitive.js.map +1 -1
  34. package/lib/cjs/curve/RegionOps.d.ts +17 -4
  35. package/lib/cjs/curve/RegionOps.d.ts.map +1 -1
  36. package/lib/cjs/curve/RegionOps.js +114 -18
  37. package/lib/cjs/curve/RegionOps.js.map +1 -1
  38. package/lib/cjs/curve/RegionOpsClassificationSweeps.d.ts +3 -11
  39. package/lib/cjs/curve/RegionOpsClassificationSweeps.d.ts.map +1 -1
  40. package/lib/cjs/curve/RegionOpsClassificationSweeps.js +1 -91
  41. package/lib/cjs/curve/RegionOpsClassificationSweeps.js.map +1 -1
  42. package/lib/cjs/curve/StrokeOptions.d.ts +13 -6
  43. package/lib/cjs/curve/StrokeOptions.d.ts.map +1 -1
  44. package/lib/cjs/curve/StrokeOptions.js +13 -6
  45. package/lib/cjs/curve/StrokeOptions.js.map +1 -1
  46. package/lib/cjs/curve/internalContexts/AnnounceTangentStrokeHandler.d.ts +1 -1
  47. package/lib/cjs/curve/internalContexts/AnnounceTangentStrokeHandler.d.ts.map +1 -1
  48. package/lib/cjs/curve/internalContexts/AnnounceTangentStrokeHandler.js +1 -2
  49. package/lib/cjs/curve/internalContexts/AnnounceTangentStrokeHandler.js.map +1 -1
  50. package/lib/cjs/curve/internalContexts/AppendPlaneIntersectionStrokeHandler.d.ts +1 -1
  51. package/lib/cjs/curve/internalContexts/AppendPlaneIntersectionStrokeHandler.d.ts.map +1 -1
  52. package/lib/cjs/curve/internalContexts/AppendPlaneIntersectionStrokeHandler.js +1 -2
  53. package/lib/cjs/curve/internalContexts/AppendPlaneIntersectionStrokeHandler.js.map +1 -1
  54. package/lib/cjs/curve/internalContexts/ClosestPointStrokeHandler.d.ts +1 -1
  55. package/lib/cjs/curve/internalContexts/ClosestPointStrokeHandler.d.ts.map +1 -1
  56. package/lib/cjs/curve/internalContexts/ClosestPointStrokeHandler.js +1 -2
  57. package/lib/cjs/curve/internalContexts/ClosestPointStrokeHandler.js.map +1 -1
  58. package/lib/cjs/curve/internalContexts/CurveCurveCloseApproachXY.d.ts +113 -103
  59. package/lib/cjs/curve/internalContexts/CurveCurveCloseApproachXY.d.ts.map +1 -1
  60. package/lib/cjs/curve/internalContexts/CurveCurveCloseApproachXY.js +368 -337
  61. package/lib/cjs/curve/internalContexts/CurveCurveCloseApproachXY.js.map +1 -1
  62. package/lib/cjs/curve/internalContexts/CurveCurveIntersectXY.d.ts +2 -3
  63. package/lib/cjs/curve/internalContexts/CurveCurveIntersectXY.d.ts.map +1 -1
  64. package/lib/cjs/curve/internalContexts/CurveCurveIntersectXY.js +20 -32
  65. package/lib/cjs/curve/internalContexts/CurveCurveIntersectXY.js.map +1 -1
  66. package/lib/cjs/curve/spiral/DirectSpiral3d.d.ts +1 -2
  67. package/lib/cjs/curve/spiral/DirectSpiral3d.d.ts.map +1 -1
  68. package/lib/cjs/curve/spiral/DirectSpiral3d.js +9 -3
  69. package/lib/cjs/curve/spiral/DirectSpiral3d.js.map +1 -1
  70. package/lib/cjs/curve/spiral/IntegratedSpiral3d.d.ts +1 -2
  71. package/lib/cjs/curve/spiral/IntegratedSpiral3d.d.ts.map +1 -1
  72. package/lib/cjs/curve/spiral/IntegratedSpiral3d.js +10 -4
  73. package/lib/cjs/curve/spiral/IntegratedSpiral3d.js.map +1 -1
  74. package/lib/cjs/geometry3d/AngleSweep.d.ts +3 -1
  75. package/lib/cjs/geometry3d/AngleSweep.d.ts.map +1 -1
  76. package/lib/cjs/geometry3d/AngleSweep.js +6 -2
  77. package/lib/cjs/geometry3d/AngleSweep.js.map +1 -1
  78. package/lib/cjs/geometry3d/GeometryHandler.d.ts +33 -4
  79. package/lib/cjs/geometry3d/GeometryHandler.d.ts.map +1 -1
  80. package/lib/cjs/geometry3d/GeometryHandler.js +79 -1
  81. package/lib/cjs/geometry3d/GeometryHandler.js.map +1 -1
  82. package/lib/cjs/geometry3d/GrowableXYArray.d.ts +9 -6
  83. package/lib/cjs/geometry3d/GrowableXYArray.d.ts.map +1 -1
  84. package/lib/cjs/geometry3d/GrowableXYArray.js +20 -10
  85. package/lib/cjs/geometry3d/GrowableXYArray.js.map +1 -1
  86. package/lib/cjs/geometry3d/GrowableXYZArray.d.ts +9 -6
  87. package/lib/cjs/geometry3d/GrowableXYZArray.d.ts.map +1 -1
  88. package/lib/cjs/geometry3d/GrowableXYZArray.js +20 -10
  89. package/lib/cjs/geometry3d/GrowableXYZArray.js.map +1 -1
  90. package/lib/cjs/geometry3d/Matrix3d.d.ts +4 -4
  91. package/lib/cjs/geometry3d/Matrix3d.d.ts.map +1 -1
  92. package/lib/cjs/geometry3d/Matrix3d.js +5 -4
  93. package/lib/cjs/geometry3d/Matrix3d.js.map +1 -1
  94. package/lib/cjs/geometry3d/Point3dVector3d.js +1 -1
  95. package/lib/cjs/geometry3d/Point3dVector3d.js.map +1 -1
  96. package/lib/cjs/numerics/BezierPolynomials.d.ts.map +1 -1
  97. package/lib/cjs/numerics/BezierPolynomials.js +1 -1
  98. package/lib/cjs/numerics/BezierPolynomials.js.map +1 -1
  99. package/lib/cjs/numerics/Newton.d.ts +44 -13
  100. package/lib/cjs/numerics/Newton.d.ts.map +1 -1
  101. package/lib/cjs/numerics/Newton.js +73 -23
  102. package/lib/cjs/numerics/Newton.js.map +1 -1
  103. package/lib/cjs/numerics/Polynomials.d.ts +1 -1
  104. package/lib/cjs/numerics/Polynomials.d.ts.map +1 -1
  105. package/lib/cjs/numerics/Polynomials.js +21 -9
  106. package/lib/cjs/numerics/Polynomials.js.map +1 -1
  107. package/lib/cjs/polyface/PolyfaceQuery.d.ts +14 -14
  108. package/lib/cjs/polyface/PolyfaceQuery.d.ts.map +1 -1
  109. package/lib/cjs/polyface/PolyfaceQuery.js +14 -14
  110. package/lib/cjs/polyface/PolyfaceQuery.js.map +1 -1
  111. package/lib/cjs/serialization/BGFBReader.js +2 -2
  112. package/lib/cjs/serialization/BGFBReader.js.map +1 -1
  113. package/lib/cjs/topology/Graph.d.ts +15 -15
  114. package/lib/cjs/topology/Graph.d.ts.map +1 -1
  115. package/lib/cjs/topology/Graph.js +1 -1
  116. package/lib/cjs/topology/Graph.js.map +1 -1
  117. package/lib/cjs/topology/HalfEdgeGraphSearch.d.ts +3 -3
  118. package/lib/cjs/topology/HalfEdgeGraphSearch.d.ts.map +1 -1
  119. package/lib/cjs/topology/HalfEdgeGraphSearch.js.map +1 -1
  120. package/lib/esm/Geometry.d.ts +10 -7
  121. package/lib/esm/Geometry.d.ts.map +1 -1
  122. package/lib/esm/Geometry.js +8 -6
  123. package/lib/esm/Geometry.js.map +1 -1
  124. package/lib/esm/curve/Arc3d.d.ts +7 -0
  125. package/lib/esm/curve/Arc3d.d.ts.map +1 -1
  126. package/lib/esm/curve/Arc3d.js +18 -6
  127. package/lib/esm/curve/Arc3d.js.map +1 -1
  128. package/lib/esm/curve/CurveChainWithDistanceIndex.d.ts +11 -2
  129. package/lib/esm/curve/CurveChainWithDistanceIndex.d.ts.map +1 -1
  130. package/lib/esm/curve/CurveChainWithDistanceIndex.js +25 -15
  131. package/lib/esm/curve/CurveChainWithDistanceIndex.js.map +1 -1
  132. package/lib/esm/curve/CurveCollection.d.ts +15 -6
  133. package/lib/esm/curve/CurveCollection.d.ts.map +1 -1
  134. package/lib/esm/curve/CurveCollection.js +15 -6
  135. package/lib/esm/curve/CurveCollection.js.map +1 -1
  136. package/lib/esm/curve/CurveCurve.d.ts +1 -1
  137. package/lib/esm/curve/CurveCurve.d.ts.map +1 -1
  138. package/lib/esm/curve/CurveCurve.js +2 -1
  139. package/lib/esm/curve/CurveCurve.js.map +1 -1
  140. package/lib/esm/curve/CurveFactory.d.ts +73 -1
  141. package/lib/esm/curve/CurveFactory.d.ts.map +1 -1
  142. package/lib/esm/curve/CurveFactory.js +228 -1
  143. package/lib/esm/curve/CurveFactory.js.map +1 -1
  144. package/lib/esm/curve/CurveLocationDetail.d.ts +21 -0
  145. package/lib/esm/curve/CurveLocationDetail.d.ts.map +1 -1
  146. package/lib/esm/curve/CurveLocationDetail.js +59 -0
  147. package/lib/esm/curve/CurveLocationDetail.js.map +1 -1
  148. package/lib/esm/curve/CurvePrimitive.d.ts +13 -12
  149. package/lib/esm/curve/CurvePrimitive.d.ts.map +1 -1
  150. package/lib/esm/curve/CurvePrimitive.js +12 -11
  151. package/lib/esm/curve/CurvePrimitive.js.map +1 -1
  152. package/lib/esm/curve/RegionOps.d.ts +17 -4
  153. package/lib/esm/curve/RegionOps.d.ts.map +1 -1
  154. package/lib/esm/curve/RegionOps.js +116 -20
  155. package/lib/esm/curve/RegionOps.js.map +1 -1
  156. package/lib/esm/curve/RegionOpsClassificationSweeps.d.ts +3 -11
  157. package/lib/esm/curve/RegionOpsClassificationSweeps.d.ts.map +1 -1
  158. package/lib/esm/curve/RegionOpsClassificationSweeps.js +2 -92
  159. package/lib/esm/curve/RegionOpsClassificationSweeps.js.map +1 -1
  160. package/lib/esm/curve/StrokeOptions.d.ts +13 -6
  161. package/lib/esm/curve/StrokeOptions.d.ts.map +1 -1
  162. package/lib/esm/curve/StrokeOptions.js +13 -6
  163. package/lib/esm/curve/StrokeOptions.js.map +1 -1
  164. package/lib/esm/curve/internalContexts/AnnounceTangentStrokeHandler.d.ts +1 -1
  165. package/lib/esm/curve/internalContexts/AnnounceTangentStrokeHandler.d.ts.map +1 -1
  166. package/lib/esm/curve/internalContexts/AnnounceTangentStrokeHandler.js +1 -2
  167. package/lib/esm/curve/internalContexts/AnnounceTangentStrokeHandler.js.map +1 -1
  168. package/lib/esm/curve/internalContexts/AppendPlaneIntersectionStrokeHandler.d.ts +1 -1
  169. package/lib/esm/curve/internalContexts/AppendPlaneIntersectionStrokeHandler.d.ts.map +1 -1
  170. package/lib/esm/curve/internalContexts/AppendPlaneIntersectionStrokeHandler.js +1 -2
  171. package/lib/esm/curve/internalContexts/AppendPlaneIntersectionStrokeHandler.js.map +1 -1
  172. package/lib/esm/curve/internalContexts/ClosestPointStrokeHandler.d.ts +1 -1
  173. package/lib/esm/curve/internalContexts/ClosestPointStrokeHandler.d.ts.map +1 -1
  174. package/lib/esm/curve/internalContexts/ClosestPointStrokeHandler.js +1 -2
  175. package/lib/esm/curve/internalContexts/ClosestPointStrokeHandler.js.map +1 -1
  176. package/lib/esm/curve/internalContexts/CurveCurveCloseApproachXY.d.ts +113 -103
  177. package/lib/esm/curve/internalContexts/CurveCurveCloseApproachXY.d.ts.map +1 -1
  178. package/lib/esm/curve/internalContexts/CurveCurveCloseApproachXY.js +370 -339
  179. package/lib/esm/curve/internalContexts/CurveCurveCloseApproachXY.js.map +1 -1
  180. package/lib/esm/curve/internalContexts/CurveCurveIntersectXY.d.ts +2 -3
  181. package/lib/esm/curve/internalContexts/CurveCurveIntersectXY.d.ts.map +1 -1
  182. package/lib/esm/curve/internalContexts/CurveCurveIntersectXY.js +20 -32
  183. package/lib/esm/curve/internalContexts/CurveCurveIntersectXY.js.map +1 -1
  184. package/lib/esm/curve/spiral/DirectSpiral3d.d.ts +1 -2
  185. package/lib/esm/curve/spiral/DirectSpiral3d.d.ts.map +1 -1
  186. package/lib/esm/curve/spiral/DirectSpiral3d.js +9 -3
  187. package/lib/esm/curve/spiral/DirectSpiral3d.js.map +1 -1
  188. package/lib/esm/curve/spiral/IntegratedSpiral3d.d.ts +1 -2
  189. package/lib/esm/curve/spiral/IntegratedSpiral3d.d.ts.map +1 -1
  190. package/lib/esm/curve/spiral/IntegratedSpiral3d.js +10 -4
  191. package/lib/esm/curve/spiral/IntegratedSpiral3d.js.map +1 -1
  192. package/lib/esm/geometry3d/AngleSweep.d.ts +3 -1
  193. package/lib/esm/geometry3d/AngleSweep.d.ts.map +1 -1
  194. package/lib/esm/geometry3d/AngleSweep.js +6 -2
  195. package/lib/esm/geometry3d/AngleSweep.js.map +1 -1
  196. package/lib/esm/geometry3d/GeometryHandler.d.ts +33 -4
  197. package/lib/esm/geometry3d/GeometryHandler.d.ts.map +1 -1
  198. package/lib/esm/geometry3d/GeometryHandler.js +77 -0
  199. package/lib/esm/geometry3d/GeometryHandler.js.map +1 -1
  200. package/lib/esm/geometry3d/GrowableXYArray.d.ts +9 -6
  201. package/lib/esm/geometry3d/GrowableXYArray.d.ts.map +1 -1
  202. package/lib/esm/geometry3d/GrowableXYArray.js +20 -10
  203. package/lib/esm/geometry3d/GrowableXYArray.js.map +1 -1
  204. package/lib/esm/geometry3d/GrowableXYZArray.d.ts +9 -6
  205. package/lib/esm/geometry3d/GrowableXYZArray.d.ts.map +1 -1
  206. package/lib/esm/geometry3d/GrowableXYZArray.js +20 -10
  207. package/lib/esm/geometry3d/GrowableXYZArray.js.map +1 -1
  208. package/lib/esm/geometry3d/Matrix3d.d.ts +4 -4
  209. package/lib/esm/geometry3d/Matrix3d.d.ts.map +1 -1
  210. package/lib/esm/geometry3d/Matrix3d.js +5 -4
  211. package/lib/esm/geometry3d/Matrix3d.js.map +1 -1
  212. package/lib/esm/geometry3d/Point3dVector3d.js +1 -1
  213. package/lib/esm/geometry3d/Point3dVector3d.js.map +1 -1
  214. package/lib/esm/numerics/BezierPolynomials.d.ts.map +1 -1
  215. package/lib/esm/numerics/BezierPolynomials.js +1 -1
  216. package/lib/esm/numerics/BezierPolynomials.js.map +1 -1
  217. package/lib/esm/numerics/Newton.d.ts +44 -13
  218. package/lib/esm/numerics/Newton.d.ts.map +1 -1
  219. package/lib/esm/numerics/Newton.js +71 -22
  220. package/lib/esm/numerics/Newton.js.map +1 -1
  221. package/lib/esm/numerics/Polynomials.d.ts +1 -1
  222. package/lib/esm/numerics/Polynomials.d.ts.map +1 -1
  223. package/lib/esm/numerics/Polynomials.js +21 -9
  224. package/lib/esm/numerics/Polynomials.js.map +1 -1
  225. package/lib/esm/polyface/PolyfaceQuery.d.ts +14 -14
  226. package/lib/esm/polyface/PolyfaceQuery.d.ts.map +1 -1
  227. package/lib/esm/polyface/PolyfaceQuery.js +14 -14
  228. package/lib/esm/polyface/PolyfaceQuery.js.map +1 -1
  229. package/lib/esm/serialization/BGFBReader.js +2 -2
  230. package/lib/esm/serialization/BGFBReader.js.map +1 -1
  231. package/lib/esm/topology/Graph.d.ts +15 -15
  232. package/lib/esm/topology/Graph.d.ts.map +1 -1
  233. package/lib/esm/topology/Graph.js +1 -1
  234. package/lib/esm/topology/Graph.js.map +1 -1
  235. package/lib/esm/topology/HalfEdgeGraphSearch.d.ts +3 -3
  236. package/lib/esm/topology/HalfEdgeGraphSearch.d.ts.map +1 -1
  237. package/lib/esm/topology/HalfEdgeGraphSearch.js.map +1 -1
  238. package/package.json +3 -3
  239. package/lib/cjs/curve/internalContexts/NewtonRtoRStrokeHandler.d.ts +0 -23
  240. package/lib/cjs/curve/internalContexts/NewtonRtoRStrokeHandler.d.ts.map +0 -1
  241. package/lib/cjs/curve/internalContexts/NewtonRtoRStrokeHandler.js +0 -37
  242. package/lib/cjs/curve/internalContexts/NewtonRtoRStrokeHandler.js.map +0 -1
  243. package/lib/esm/curve/internalContexts/NewtonRtoRStrokeHandler.d.ts +0 -23
  244. package/lib/esm/curve/internalContexts/NewtonRtoRStrokeHandler.d.ts.map +0 -1
  245. package/lib/esm/curve/internalContexts/NewtonRtoRStrokeHandler.js +0 -33
  246. package/lib/esm/curve/internalContexts/NewtonRtoRStrokeHandler.js.map +0 -1
@@ -13,12 +13,11 @@ const Ray3d_1 = require("../../geometry3d/Ray3d");
13
13
  const BezierPolynomials_1 = require("../../numerics/BezierPolynomials");
14
14
  const Newton_1 = require("../../numerics/Newton");
15
15
  const CurveLocationDetail_1 = require("../CurveLocationDetail");
16
- const NewtonRtoRStrokeHandler_1 = require("./NewtonRtoRStrokeHandler");
17
16
  /**
18
17
  * Context for computing intersections of a CurvePrimitive with a plane.
19
18
  * @internal
20
19
  */
21
- class AppendPlaneIntersectionStrokeHandler extends NewtonRtoRStrokeHandler_1.NewtonRtoRStrokeHandler {
20
+ class AppendPlaneIntersectionStrokeHandler extends Newton_1.NewtonRtoRStrokeHandler {
22
21
  _curve;
23
22
  _plane;
24
23
  _intersections;
@@ -1 +1 @@
1
- {"version":3,"file":"AppendPlaneIntersectionStrokeHandler.js","sourceRoot":"","sources":["../../../../src/curve/internalContexts/AppendPlaneIntersectionStrokeHandler.ts"],"names":[],"mappings":";AAAA;;;+FAG+F;AAC/F;;GAEG;;;AAEH,6CAAkE;AAGlE,kDAA+C;AAC/C,wEAAgE;AAChE,kDAA+E;AAC/E,gEAA6D;AAE7D,uEAAoE;AAEpE;;;GAGG;AACH,MAAa,oCAAqC,SAAQ,iDAAuB;IACvE,MAAM,CAA6B;IACnC,MAAM,CAAyB;IAC/B,cAAc,CAAwB;IACtC,UAAU,GAAW,CAAC,CAAC;IACvB,UAAU,GAAW,CAAC,CAAC;IAC/B,0DAA0D;IAClD,UAAU,GAAW,CAAC,CAAC;IACvB,UAAU,GAAW,CAAC,CAAC;IACvB,YAAY,GAAW,CAAC,CAAC;IACzB,aAAa,GAAW,CAAC,CAAC;IAClC,uCAAuC;IAC/B,IAAI,CAAQ;IACZ,aAAa,CAAyC;IAE9D,+EAA+E;IACxE,cAAc;QACnB,IAAI,IAAI,CAAC,qBAAqB;YAC5B,OAAO,IAAI,CAAC,qBAAqB,CAAC;QACpC,OAAO,IAAI,CAAC,MAAM,CAAC;IACrB,CAAC;IAED,IAAW,cAAc;QACvB,OAAO,IAAI,CAAC,YAAY,CAAC,CAAI,2FAA2F;IAC1H,CAAC;IAED,YAAmB,KAA6B,EAAE,aAAoC;QACpF,KAAK,EAAE,CAAC;QACR,IAAI,CAAC,MAAM,GAAG,KAAK,CAAC;QACpB,IAAI,CAAC,cAAc,GAAG,aAAa,CAAC;QACpC,IAAI,CAAC,mBAAmB,CAAC,SAAS,CAAC,CAAC;QACpC,IAAI,CAAC,IAAI,GAAG,aAAK,CAAC,UAAU,EAAE,CAAC;QAC/B,IAAI,CAAC,aAAa,GAAG,IAAI,+CAAsC,CAAC,IAAI,CAAC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cAAc,EAAE,CAAC;QACpD,IAAI,CAAC,UAAU,GAAG,IAAI,CAAC,UAAU,CAAC;QAClC,IAAI,CAAC,UAAU,GAAG,IAAI,CAAC,UAAU,CAAC;IACpC,CAAC;CACF;AA/ID,oFA+IC","sourcesContent":["/*---------------------------------------------------------------------------------------------\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n* See LICENSE.md in the project root for license terms and full copyright notice.\n*--------------------------------------------------------------------------------------------*/\n/** @packageDocumentation\n * @module Curve\n */\n\nimport { Geometry, PlaneAltitudeEvaluator } from \"../../Geometry\";\nimport { IStrokeHandler } from \"../../geometry3d/GeometryHandler\";\nimport { Point3d, Vector3d } from \"../../geometry3d/Point3dVector3d\";\nimport { Ray3d } from \"../../geometry3d/Ray3d\";\nimport { Order2Bezier } from \"../../numerics/BezierPolynomials\";\nimport { Newton1dUnboundedApproximateDerivative } from \"../../numerics/Newton\";\nimport { CurveLocationDetail } from \"../CurveLocationDetail\";\nimport { CurvePrimitive } from \"../CurvePrimitive\";\nimport { NewtonRtoRStrokeHandler } from \"./NewtonRtoRStrokeHandler\";\n\n/**\n * Context for computing intersections of a CurvePrimitive with a plane.\n * @internal\n */\nexport class AppendPlaneIntersectionStrokeHandler extends NewtonRtoRStrokeHandler implements IStrokeHandler {\n private _curve: CurvePrimitive | undefined;\n private _plane: PlaneAltitudeEvaluator;\n private _intersections: CurveLocationDetail[];\n private _fractionA: number = 0;\n private _functionA: number = 0;\n // private derivativeA: number; <---- Not currently used\n private _functionB: number = 0;\n private _fractionB: number = 0;\n private _derivativeB: number = 0;\n private _numThisCurve: number = 0;\n // scratch vars for use within methods.\n private _ray: Ray3d;\n private _newtonSolver: Newton1dUnboundedApproximateDerivative;\n\n // Return the first defined curve among: this.parentCurvePrimitive, this.curve;\n public effectiveCurve(): CurvePrimitive | undefined {\n if (this._parentCurvePrimitive)\n return this._parentCurvePrimitive;\n return this._curve;\n }\n\n public get getDerivativeB() {\n return this._derivativeB; // <--- _derivativeB is not currently used anywhere. Provided getter to suppress lint error\n }\n\n public constructor(plane: PlaneAltitudeEvaluator, intersections: CurveLocationDetail[]) {\n super();\n this._plane = plane;\n this._intersections = intersections;\n this.startCurvePrimitive(undefined);\n this._ray = Ray3d.createZero();\n this._newtonSolver = new Newton1dUnboundedApproximateDerivative(this);\n }\n\n public startCurvePrimitive(curve: CurvePrimitive | undefined) {\n this._curve = curve;\n this._fractionA = 0.0;\n this._numThisCurve = 0;\n this._functionA = 0.0;\n // this.derivativeA = 0.0;\n }\n\n public endCurvePrimitive() {\n }\n\n public announceIntervalForUniformStepStrokes(\n cp: CurvePrimitive,\n numStrokes: number,\n fraction0: number,\n fraction1: number): void {\n this.startCurvePrimitive(cp);\n if (numStrokes < 1) numStrokes = 1;\n const df = 1.0 / numStrokes;\n for (let i = 0; i <= numStrokes; i++) {\n const fraction = Geometry.interpolate(fraction0, i * df, fraction1);\n cp.fractionToPointAndDerivative(fraction, this._ray);\n this.announcePointTangent(this._ray.origin, fraction, this._ray.direction);\n }\n }\n\n public announceSegmentInterval(\n _cp: CurvePrimitive,\n point0: Point3d,\n point1: Point3d,\n _numStrokes: number,\n fraction0: number,\n fraction1: number): void {\n const h0 = this._plane.altitude(point0);\n const h1 = this._plane.altitude(point1);\n if (h0 * h1 > 0.0)\n return;\n const fraction01 = Order2Bezier.solveCoffs(h0, h1);\n // let numIntersection = 0;\n if (fraction01 !== undefined) {\n // numIntersection++;\n const fraction = Geometry.interpolate(fraction0, fraction01, fraction1);\n this._newtonSolver.setX(fraction);\n if (this._newtonSolver.runIterations()) {\n this.announceSolutionFraction(this._newtonSolver.getX());\n }\n // this.intersections.push(CurveLocationDetail.createCurveFractionPoint(cp, fraction, cp.fractionToPoint(fraction)));\n }\n }\n\n private announceSolutionFraction(fraction: number) {\n const curve = this.effectiveCurve();\n if (curve) {\n this._ray = curve.fractionToPointAndDerivative(fraction, this._ray);\n this._intersections.push(CurveLocationDetail.createCurveFractionPoint(curve, fraction, this._ray.origin));\n }\n }\n\n public evaluate(fraction: number): boolean {\n const curve = this.effectiveCurve();\n if (!curve)\n return false;\n this.currentF = this._plane.altitude(curve.fractionToPoint(fraction));\n return true;\n }\n\n /**\n * * ASSUME both the \"A\" and \"B\" evaluations (fraction, function, and derivative) are known.\n * * If function value changed sign between, interpolate an approximate root and improve it with\n * the newton solver.\n */\n private searchInterval() {\n if (this._functionA * this._functionB > 0) return;\n if (this._functionA === 0) this.announceSolutionFraction(this._fractionA);\n if (this._functionB === 0) this.announceSolutionFraction(this._fractionB);\n if (this._functionA * this._functionB < 0) {\n const fraction = Geometry.inverseInterpolate(this._fractionA, this._functionA, this._fractionB, this._functionB);\n if (fraction) {\n this._newtonSolver.setX(fraction);\n if (this._newtonSolver.runIterations())\n this.announceSolutionFraction(this._newtonSolver.getX());\n }\n }\n }\n\n /** Evaluate and save _functionB, _derivativeB, and _fractionB. */\n private evaluateB(xyz: Point3d, fraction: number, tangent: Vector3d) {\n this._functionB = this._plane.altitude(xyz);\n this._derivativeB = this._plane.velocity(tangent);\n this._fractionB = fraction;\n }\n\n /**\n * Announce point and tangent for evaluations.\n * * The function evaluation is saved as the \"B\" function point.\n * * The function point count is incremented\n * * If function point count is greater than 1, the current interval is searched.\n * * The just-evaluated point (\"B\") is saved as the \"old\" (\"A\") evaluation point.\n * @param xyz\n * @param fraction\n * @param tangent\n */\n public announcePointTangent(xyz: Point3d, fraction: number, tangent: Vector3d): void {\n this.evaluateB(xyz, fraction, tangent);\n if (this._numThisCurve++ > 0) this.searchInterval();\n this._functionA = this._functionB;\n this._fractionA = this._fractionB;\n }\n}\n"]}
1
+ {"version":3,"file":"AppendPlaneIntersectionStrokeHandler.js","sourceRoot":"","sources":["../../../../src/curve/internalContexts/AppendPlaneIntersectionStrokeHandler.ts"],"names":[],"mappings":";AAAA;;;+FAG+F;AAC/F;;GAEG;;;AAEH,6CAAkE;AAGlE,kDAA+C;AAC/C,wEAAgE;AAChE,kDAAwG;AACxG,gEAA6D;AAG7D;;;GAGG;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AAC,kBAAkB,CAAC,IAAI,CAAC,UAAU,EAAE,IAAI,CAAC,UAAU,EAAE,IAAI,CAAC,UAAU,EAAE,IAAI,CAAC,UAAU,CAAC,CAAC;YACjH,IAAI,QAAQ,EAAE,CAAC;gBACb,IAAI,CAAC,aAAa,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;gBAClC,IAAI,IAAI,CAAC,aAAa,CAAC,aAAa,EAAE;oBACpC,IAAI,CAAC,wBAAwB,CAAC,IAAI,CAAC,aAAa,CAAC,IAAI,EAAE,CAAC,CAAC;YAC7D,CAAC;QACH,CAAC;IACH,CAAC;IAED,kEAAkE;IAC1D,SAAS,CAAC,GAAY,EAAE,QAAgB,EAAE,OAAiB;QACjE,IAAI,CAAC,UAAU,GAAG,IAAI,CAAC,MAAM,CAAC,QAAQ,CAAC,GAAG,CAAC,CAAC;QAC5C,IAAI,CAAC,YAAY,GAAG,IAAI,CAAC,MAAM,CAAC,QAAQ,CAAC,OAAO,CAAC,CAAC;QAClD,IAAI,CAAC,UAAU,GAAG,QAAQ,CAAC;IAC7B,CAAC;IAED;;;;;;;;;OASG;IACI,oBAAoB,CAAC,GAAY,EAAE,QAAgB,EAAE,OAAiB;QAC3E,IAAI,CAAC,SAAS,CAAC,GAAG,EAAE,QAAQ,EAAE,OAAO,CAAC,CAAC;QACvC,IAAI,IAAI,CAAC,aAAa,EAAE,GAAG,CAAC;YAAE,IAAI,CAAC,cAAc,EAAE,CAAC;QACpD,IAAI,CAAC,UAAU,GAAG,IAAI,CAAC,UAAU,CAAC;QAClC,IAAI,CAAC,UAAU,GAAG,IAAI,CAAC,UAAU,CAAC;IACpC,CAAC;CACF;AA/ID,oFA+IC","sourcesContent":["/*---------------------------------------------------------------------------------------------\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n* See LICENSE.md in the project root for license terms and full copyright notice.\n*--------------------------------------------------------------------------------------------*/\n/** @packageDocumentation\n * @module Curve\n */\n\nimport { Geometry, PlaneAltitudeEvaluator } from \"../../Geometry\";\nimport { IStrokeHandler } from \"../../geometry3d/GeometryHandler\";\nimport { Point3d, Vector3d } from \"../../geometry3d/Point3dVector3d\";\nimport { Ray3d } from \"../../geometry3d/Ray3d\";\nimport { Order2Bezier } from \"../../numerics/BezierPolynomials\";\nimport { Newton1dUnboundedApproximateDerivative, NewtonRtoRStrokeHandler } from \"../../numerics/Newton\";\nimport { CurveLocationDetail } from \"../CurveLocationDetail\";\nimport { CurvePrimitive } from \"../CurvePrimitive\";\n\n/**\n * Context for computing intersections of a CurvePrimitive with a plane.\n * @internal\n */\nexport class AppendPlaneIntersectionStrokeHandler extends NewtonRtoRStrokeHandler implements IStrokeHandler {\n private _curve: CurvePrimitive | undefined;\n private _plane: PlaneAltitudeEvaluator;\n private _intersections: CurveLocationDetail[];\n private _fractionA: number = 0;\n private _functionA: number = 0;\n // private derivativeA: number; <---- Not currently used\n private _functionB: number = 0;\n private _fractionB: number = 0;\n private _derivativeB: number = 0;\n private _numThisCurve: number = 0;\n // scratch vars for use within methods.\n private _ray: Ray3d;\n private _newtonSolver: Newton1dUnboundedApproximateDerivative;\n\n // Return the first defined curve among: this.parentCurvePrimitive, this.curve;\n public effectiveCurve(): CurvePrimitive | undefined {\n if (this._parentCurvePrimitive)\n return this._parentCurvePrimitive;\n return this._curve;\n }\n\n public get getDerivativeB() {\n return this._derivativeB; // <--- _derivativeB is not currently used anywhere. Provided getter to suppress lint error\n }\n\n public constructor(plane: PlaneAltitudeEvaluator, intersections: CurveLocationDetail[]) {\n super();\n this._plane = plane;\n this._intersections = intersections;\n this.startCurvePrimitive(undefined);\n this._ray = Ray3d.createZero();\n this._newtonSolver = new Newton1dUnboundedApproximateDerivative(this);\n }\n\n public startCurvePrimitive(curve: CurvePrimitive | undefined) {\n this._curve = curve;\n this._fractionA = 0.0;\n this._numThisCurve = 0;\n this._functionA = 0.0;\n // this.derivativeA = 0.0;\n }\n\n public endCurvePrimitive() {\n }\n\n public announceIntervalForUniformStepStrokes(\n cp: CurvePrimitive,\n numStrokes: number,\n fraction0: number,\n fraction1: number): void {\n this.startCurvePrimitive(cp);\n if (numStrokes < 1) numStrokes = 1;\n const df = 1.0 / numStrokes;\n for (let i = 0; i <= numStrokes; i++) {\n const fraction = Geometry.interpolate(fraction0, i * df, fraction1);\n cp.fractionToPointAndDerivative(fraction, this._ray);\n this.announcePointTangent(this._ray.origin, fraction, this._ray.direction);\n }\n }\n\n public announceSegmentInterval(\n _cp: CurvePrimitive,\n point0: Point3d,\n point1: Point3d,\n _numStrokes: number,\n fraction0: number,\n fraction1: number): void {\n const h0 = this._plane.altitude(point0);\n const h1 = this._plane.altitude(point1);\n if (h0 * h1 > 0.0)\n return;\n const fraction01 = Order2Bezier.solveCoffs(h0, h1);\n // let numIntersection = 0;\n if (fraction01 !== undefined) {\n // numIntersection++;\n const fraction = Geometry.interpolate(fraction0, fraction01, fraction1);\n this._newtonSolver.setX(fraction);\n if (this._newtonSolver.runIterations()) {\n this.announceSolutionFraction(this._newtonSolver.getX());\n }\n // this.intersections.push(CurveLocationDetail.createCurveFractionPoint(cp, fraction, cp.fractionToPoint(fraction)));\n }\n }\n\n private announceSolutionFraction(fraction: number) {\n const curve = this.effectiveCurve();\n if (curve) {\n this._ray = curve.fractionToPointAndDerivative(fraction, this._ray);\n this._intersections.push(CurveLocationDetail.createCurveFractionPoint(curve, fraction, this._ray.origin));\n }\n }\n\n public evaluate(fraction: number): boolean {\n const curve = this.effectiveCurve();\n if (!curve)\n return false;\n this.currentF = this._plane.altitude(curve.fractionToPoint(fraction));\n return true;\n }\n\n /**\n * * ASSUME both the \"A\" and \"B\" evaluations (fraction, function, and derivative) are known.\n * * If function value changed sign between, interpolate an approximate root and improve it with\n * the newton solver.\n */\n private searchInterval() {\n if (this._functionA * this._functionB > 0) return;\n if (this._functionA === 0) this.announceSolutionFraction(this._fractionA);\n if (this._functionB === 0) this.announceSolutionFraction(this._fractionB);\n if (this._functionA * this._functionB < 0) {\n const fraction = Geometry.inverseInterpolate(this._fractionA, this._functionA, this._fractionB, this._functionB);\n if (fraction) {\n this._newtonSolver.setX(fraction);\n if (this._newtonSolver.runIterations())\n this.announceSolutionFraction(this._newtonSolver.getX());\n }\n }\n }\n\n /** Evaluate and save _functionB, _derivativeB, and _fractionB. */\n private evaluateB(xyz: Point3d, fraction: number, tangent: Vector3d) {\n this._functionB = this._plane.altitude(xyz);\n this._derivativeB = this._plane.velocity(tangent);\n this._fractionB = fraction;\n }\n\n /**\n * Announce point and tangent for evaluations.\n * * The function evaluation is saved as the \"B\" function point.\n * * The function point count is incremented\n * * If function point count is greater than 1, the current interval is searched.\n * * The just-evaluated point (\"B\") is saved as the \"old\" (\"A\") evaluation point.\n * @param xyz\n * @param fraction\n * @param tangent\n */\n public announcePointTangent(xyz: Point3d, fraction: number, tangent: Vector3d): void {\n this.evaluateB(xyz, fraction, tangent);\n if (this._numThisCurve++ > 0) this.searchInterval();\n this._functionA = this._functionB;\n this._fractionA = this._fractionB;\n }\n}\n"]}
@@ -3,10 +3,10 @@
3
3
  */
4
4
  import { IStrokeHandler } from "../../geometry3d/GeometryHandler";
5
5
  import { Point3d, Vector3d } from "../../geometry3d/Point3dVector3d";
6
+ import { NewtonRtoRStrokeHandler } from "../../numerics/Newton";
6
7
  import { VariantCurveExtendParameter } from "../CurveExtendMode";
7
8
  import { CurveLocationDetail } from "../CurveLocationDetail";
8
9
  import { CurvePrimitive } from "../CurvePrimitive";
9
- import { NewtonRtoRStrokeHandler } from "./NewtonRtoRStrokeHandler";
10
10
  /**
11
11
  * Context for searching for the closest point to a CurvePrimitive.
12
12
  * @internal
@@ -1 +1 @@
1
- {"version":3,"file":"ClosestPointStrokeHandler.d.ts","sourceRoot":"","sources":["../../../../src/curve/internalContexts/ClosestPointStrokeHandler.ts"],"names":[],"mappings":"AAIA;;GAEG;AAIH,OAAO,EAAE,cAAc,EAAE,MAAM,kCAAkC,CAAC;AAClE,OAAO,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,kCAAkC,CAA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AAO,CAAC,aAAa,CAAyC;IAC9D,kBAAkB;gBACC,UAAU,EAAE,OAAO,EAAE,MAAM,CAAC,EAAE,2BAA2B,EAAE,MAAM,CAAC,EAAE,mBAAmB,EAAE,MAAM,CAAC,EAAE,OAAO;IAarH,WAAW,IAAI,mBAAmB,GAAG,SAAS;IAY9C,6BAA6B;IAG7B,mBAAmB,CAAC,KAAK,EAAE,cAAc,GAAG,SAAS;IAMrD,iBAAiB;IAEjB,qCAAqC,CAC1C,EAAE,EAAE,cAAc,EAAE,UAAU,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,GAC3E,IAAI;IAaP,OAAO,CAAC,iBAAiB;IASlB,uBAAuB,CAC5B,EAAE,EAAE,cAAc,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,EAAE,OAAO,EAAE,WAAW,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,GAC9G,IAAI;IAcP;;;;;;;OAOG;IACH,OAAO,CAAC,cAAc;IAiBtB,OAAO,CAAC,wBAAwB;IAIhC;;;;;;;OAOG;IACH,OAAO,CAAC,gBAAgB;IAYjB,QAAQ,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO;IAU1C,OAAO,CAAC,WAAW;IAUZ,oBAAoB,CAAC,KAAK,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,EAAE,OAAO,EAAE,QAAQ;CAIhF"}
@@ -16,12 +16,11 @@ const Newton_1 = require("../../numerics/Newton");
16
16
  const SmallSystem_1 = require("../../numerics/SmallSystem");
17
17
  const CurveExtendMode_1 = require("../CurveExtendMode");
18
18
  const CurveLocationDetail_1 = require("../CurveLocationDetail");
19
- const NewtonRtoRStrokeHandler_1 = require("./NewtonRtoRStrokeHandler");
20
19
  /**
21
20
  * Context for searching for the closest point to a CurvePrimitive.
22
21
  * @internal
23
22
  */
24
- class ClosestPointStrokeHandler extends NewtonRtoRStrokeHandler_1.NewtonRtoRStrokeHandler {
23
+ class ClosestPointStrokeHandler extends Newton_1.NewtonRtoRStrokeHandler {
25
24
  _curve;
26
25
  _closestPoint;
27
26
  _spacePoint;
@@ -1 +1 @@
1
- {"version":3,"file":"ClosestPointStrokeHandler.js","sourceRoot":"","sources":["../../../../src/curve/internalContexts/ClosestPointStrokeHandler.ts"],"names":[],"mappings":";AAAA;;;+FAG+F;AAC/F;;GAEG;;;AAEH,sDAA6C;AAC7C,6CAA0C;AAE1C,sEAAqE;AACrE,kDAA+C;AAC/C,kDAA+E;AAC/E,4DAAyD;AACzD,wDAAsG;AACtG,gEAA6D;AAE7D,uEAAoE;AAEpE;;;GAGG;AACH,MAAa,yBAA0B,SAAQ,iDAAuB;IAC5D,MAAM,CAA6B;IACnC,aAAa,CAAkC;IAC/C,WAAW,CAAU;IACrB,OAAO,CAA8B;IACrC,OAAO,CAAU;IACzB,iFAAiF;IACzE,UAAU,GAAW,CAAC,CAAC;IACvB,UAAU,GAAW,CAAC,CAAC;IAC/B,uFAAuF;IAC/E,UAAU,GAAW,CAAC,CAAC;IACvB,UAAU,GAAW,CAAC,CAAC;IACvB,aAAa,GAAW,CAAC,CAAC;IAClC,qCAAqC;IAC7B,UAAU,CAAU;IACpB,QAAQ,CAAQ;IAChB,aAAa,CAAyC;IAC9D,kBAAkB;IAClB,YAAmB,UAAmB,EAAE,MAAoC,EAAE,MAA4B,EAAE,MAAgB;QAC1H,KAAK,EAAE,CAAC;QACR,IAAI,CAAC,WAAW,GAAG,UAAU,CAAC;QAC9B,IAAI,CAAC,UAAU,GAAG,yBAAO,CAAC,MAAM,EAAE,CAAC;QACnC,IAAI,CAAC,QAAQ,GAAG,aAAK,CAAC,UAAU,EAAE,CAAC;QACnC,IAAI,CAAC,aAAa,GAAG,MAAM,CAAC;QAC5B,IAAI,IAAI,CAAC,aAAa;YACpB,IAAI,CAAC,aAAa,CAAC,CAAC,GAAG,mBAAQ,CAAC,qBAAqB,CAAA;QACvD,IAAI,CAAC,OAAO,GAAG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Q,CAAC,CAAC;IAC5C,CAAC;CACF;AAvKD,8DAuKC","sourcesContent":["/*---------------------------------------------------------------------------------------------\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n* See LICENSE.md in the project root for license terms and full copyright notice.\n*--------------------------------------------------------------------------------------------*/\n/** @packageDocumentation\n * @module Curve\n */\n\nimport { assert } from \"@itwin/core-bentley\";\nimport { Geometry } from \"../../Geometry\";\nimport { IStrokeHandler } from \"../../geometry3d/GeometryHandler\";\nimport { Point3d, Vector3d } from \"../../geometry3d/Point3dVector3d\";\nimport { Ray3d } from \"../../geometry3d/Ray3d\";\nimport { Newton1dUnboundedApproximateDerivative } from \"../../numerics/Newton\";\nimport { SmallSystem } from \"../../numerics/SmallSystem\";\nimport { CurveExtendMode, CurveExtendOptions, VariantCurveExtendParameter } from \"../CurveExtendMode\";\nimport { CurveLocationDetail } from \"../CurveLocationDetail\";\nimport { CurvePrimitive } from \"../CurvePrimitive\";\nimport { NewtonRtoRStrokeHandler } from \"./NewtonRtoRStrokeHandler\";\n\n/**\n * Context for searching for the closest point to a CurvePrimitive.\n * @internal\n */\nexport class ClosestPointStrokeHandler extends NewtonRtoRStrokeHandler implements IStrokeHandler {\n private _curve: CurvePrimitive | undefined;\n private _closestPoint: CurveLocationDetail | undefined;\n private _spacePoint: Point3d;\n private _extend: VariantCurveExtendParameter;\n private _xyOnly: boolean;\n // fraction and function value on one side of an interval that may bracket a root\n private _fractionA: number = 0;\n private _functionA: number = 0;\n // fraction and function value on the other side of an interval that may bracket a root\n private _fractionB: number = 0;\n private _functionB: number = 0;\n private _numThisCurve: number = 0;\n // scratch vars to use within methods\n private _workPoint: Point3d;\n private _workRay: Ray3d;\n private _newtonSolver: Newton1dUnboundedApproximateDerivative;\n /** Constructor */\n public constructor(spacePoint: Point3d, extend?: VariantCurveExtendParameter, result?: CurveLocationDetail, xyOnly?: boolean) {\n super();\n this._spacePoint = spacePoint;\n this._workPoint = Point3d.create();\n this._workRay = Ray3d.createZero();\n this._closestPoint = result;\n if (this._closestPoint)\n this._closestPoint.a = Geometry.largeCoordinateResult\n this._extend = extend ?? false;\n this._xyOnly = xyOnly ?? false;\n this.startCurvePrimitive(undefined);\n this._newtonSolver = new Newton1dUnboundedApproximateDerivative(this);\n }\n public claimResult(): CurveLocationDetail | undefined {\n if (this._closestPoint) {\n this._newtonSolver.setX(this._closestPoint.fraction);\n this._curve = this._closestPoint.curve;\n if (this._newtonSolver.runIterations()) {\n let fraction = this._newtonSolver.getX();\n fraction = CurveExtendOptions.correctFraction(this._extend, fraction);\n this.announceSolutionFraction(fraction);\n }\n }\n return this._closestPoint;\n }\n public needPrimaryGeometryForStrokes() {\n return true;\n }\n public startCurvePrimitive(curve: CurvePrimitive | undefined) {\n this._curve = curve;\n this._fractionA = 0.0;\n this._numThisCurve = 0;\n this._functionA = 0.0;\n }\n public endCurvePrimitive() {\n }\n public announceIntervalForUniformStepStrokes(\n cp: CurvePrimitive, numStrokes: number, fraction0: number, fraction1: number,\n ): void {\n this.startCurvePrimitive(cp);\n this.announceSolutionFraction(0.0); // test start point as closest\n this.announceSolutionFraction(1.0); // test end point as closest\n if (numStrokes < 1)\n numStrokes = 1;\n const df = 1.0 / numStrokes;\n for (let i = 0; i <= numStrokes; i++) {\n const fraction = Geometry.interpolate(fraction0, i * df, fraction1);\n cp.fractionToPointAndDerivative(fraction, this._workRay);\n this.announceRay(fraction, this._workRay);\n }\n }\n private announceCandidate(cp: CurvePrimitive, fraction: number, point: Point3d) {\n const distance = this._xyOnly ? this._spacePoint.distanceXY(point) : this._spacePoint.distance(point);\n if (this._closestPoint && distance > this._closestPoint.a)\n return;\n this._closestPoint = CurveLocationDetail.createCurveFractionPoint(cp, fraction, point, this._closestPoint);\n this._closestPoint.a = distance;\n if (this._parentCurvePrimitive !== undefined)\n this._closestPoint.curve = this._parentCurvePrimitive;\n }\n public announceSegmentInterval(\n cp: CurvePrimitive, point0: Point3d, point1: Point3d, _numStrokes: number, fraction0: number, fraction1: number,\n ): void {\n let localFraction = 0;\n if (this._xyOnly)\n localFraction = SmallSystem.lineSegment3dXYClosestPointUnbounded(point0, point1, this._spacePoint) ?? 0;\n else\n localFraction = this._spacePoint.fractionOfProjectionToLine(point0, point1, 0.0);\n // only consider segment extension at a parent curve endpoint, i.e. when fraction0 is 0 or fraction1 is 1\n const extend0 = (fraction0 === 0) ? CurveExtendOptions.resolveVariantCurveExtendParameterToCurveExtendMode(this._extend, 0) : CurveExtendMode.None;\n const extend1 = (fraction1 === 1) ? CurveExtendOptions.resolveVariantCurveExtendParameterToCurveExtendMode(this._extend, 1) : CurveExtendMode.None;\n localFraction = CurveExtendOptions.correctFraction([extend0, extend1], localFraction);\n this._workPoint = point0.interpolate(localFraction, point1);\n const globalFraction = Geometry.interpolate(fraction0, localFraction, fraction1);\n this.announceCandidate(cp, globalFraction, this._workPoint);\n }\n /**\n * Given a function `f` and (unordered) fractions `a` and `b`, search for and announce a root of `f` in this\n * fractional interval.\n * * This method searches for a root of `f` if and only if the stroke segment defined by `(a, f(a))` and\n * `(b, f(b))` has a root. This is a HEURISTIC: given continuous `f` between `a` and `b`, a root of the stroke\n * segment implies a root of `f`, but not vice-versa. Therefore, if the strokes are not sufficiently dense,\n * this method can miss a root of `f`.\n */\n private searchInterval() {\n if (this._functionA * this._functionB > 0)\n return; // stroke segment has no root; ASSUME the function has no root either\n if (this._functionA === 0)\n this.announceSolutionFraction(this._fractionA);\n if (this._functionB === 0)\n this.announceSolutionFraction(this._fractionB);\n // by the Intermediate Value Theorem, a root lies between fractionA and fractionB; use Newton to find it.\n if (this._functionA * this._functionB < 0) {\n const fraction = Geometry.inverseInterpolate(this._fractionA, this._functionA, this._fractionB, this._functionB);\n if (fraction) {\n this._newtonSolver.setX(fraction);\n if (this._newtonSolver.runIterations())\n this.announceSolutionFraction(this._newtonSolver.getX());\n }\n }\n }\n private announceSolutionFraction(fraction: number) {\n if (this._curve)\n this.announceCandidate(this._curve, fraction, this._curve.fractionToPoint(fraction));\n }\n /**\n * Evaluate the univariate real-valued function for which we are finding roots.\n * * For finding the closest point to curve X from point Q, this function is `f(t) := Q-X(t) dot X'(t)`.\n * * Either `pointAndDerivative` must be defined, or both `fraction` and `curve`.\n * @param pointAndDerivative pre-evaluated curve\n * @param fraction fraction at which to evaluate `curve`\n * @param curve curve to evaluate at `fraction`\n */\n private evaluateFunction(pointAndDerivative?: Ray3d, fraction?: number, curve?: CurvePrimitive): number | undefined {\n if (pointAndDerivative)\n this._workRay.setFrom(pointAndDerivative);\n else if (fraction !== undefined && curve)\n this._workRay = curve.fractionToPointAndDerivative(fraction, this._workRay);\n else\n return undefined;\n if (this._xyOnly)\n return this._workRay.dotProductToPointXY(this._spacePoint);\n else\n return this._workRay.dotProductToPoint(this._spacePoint);\n }\n public evaluate(fraction: number): boolean {\n let curve = this._curve;\n if (this._parentCurvePrimitive)\n curve = this._parentCurvePrimitive;\n const value = this.evaluateFunction(undefined, fraction, curve);\n if (value === undefined)\n return false;\n this.currentF = value;\n return true;\n }\n private announceRay(fraction: number, data: Ray3d): void {\n const value = this.evaluateFunction(data);\n assert(value !== undefined, \"expect defined because evaluateFunction never returns undefined for input Ray3d\");\n this._functionB = value;\n this._fractionB = fraction;\n if (this._numThisCurve++ > 0) // after the first stroke point, a stroke segment is defined, so we have an interval\n this.searchInterval();\n this._functionA = this._functionB;\n this._fractionA = this._fractionB;\n }\n public announcePointTangent(point: Point3d, fraction: number, tangent: Vector3d) {\n this._workRay.set(point, tangent);\n this.announceRay(fraction, this._workRay);\n }\n}\n"]}
1
+ {"version":3,"file":"ClosestPointStrokeHandler.js","sourceRoot":"","sources":["../../../../src/curve/internalContexts/ClosestPointStrokeHandler.ts"],"names":[],"mappings":";AAAA;;;+FAG+F;AAC/F;;GAEG;;;AAEH,sDAA6C;AAC7C,6CAA0C;AAE1C,sEAAqE;AACrE,kDAA+C;AAC/C,kDAAwG;AACxG,4DAAyD;AACzD,wDAAsG;AACtG,gEAA6D;AAG7D;;;GAGG;AACH,MAAa,y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,CAAC,CAAC;QAChE,IAAI,KAAK,KAAK,SAAS;YACrB,OAAO,KAAK,CAAC;QACf,IAAI,CAAC,QAAQ,GAAG,KAAK,CAAC;QACtB,OAAO,IAAI,CAAC;IACd,CAAC;IACO,WAAW,CAAC,QAAgB,EAAE,IAAW;QAC/C,MAAM,KAAK,GAAG,IAAI,CAAC,gBAAgB,CAAC,IAAI,CAAC,CAAC;QAC1C,IAAA,qBAAM,EAAC,KAAK,KAAK,SAAS,EAAE,iFAAiF,CAAC,CAAC;QAC/G,IAAI,CAAC,UAAU,GAAG,KAAK,CAAC;QACxB,IAAI,CAAC,UAAU,GAAG,QAAQ,CAAC;QAC3B,IAAI,IAAI,CAAC,aAAa,EAAE,GAAG,CAAC,EAAE,oFAAoF;YAChH,IAAI,CAAC,cAAc,EAAE,CAAC;QACxB,IAAI,CAAC,UAAU,GAAG,IAAI,CAAC,UAAU,CAAC;QAClC,IAAI,CAAC,UAAU,GAAG,IAAI,CAAC,UAAU,CAAC;IACpC,CAAC;IACM,oBAAoB,CAAC,KAAc,EAAE,QAAgB,EAAE,OAAiB;QAC7E,IAAI,CAAC,QAAQ,CAAC,GAAG,CAAC,KAAK,EAAE,OAAO,CAAC,CAAC;QAClC,IAAI,CAAC,WAAW,CAAC,QAAQ,EAAE,IAAI,CAAC,QAAQ,CAAC,CAAC;IAC5C,CAAC;CACF;AAvKD,8DAuKC","sourcesContent":["/*---------------------------------------------------------------------------------------------\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n* See LICENSE.md in the project root for license terms and full copyright notice.\n*--------------------------------------------------------------------------------------------*/\n/** @packageDocumentation\n * @module Curve\n */\n\nimport { assert } from \"@itwin/core-bentley\";\nimport { Geometry } from \"../../Geometry\";\nimport { IStrokeHandler } from \"../../geometry3d/GeometryHandler\";\nimport { Point3d, Vector3d } from \"../../geometry3d/Point3dVector3d\";\nimport { Ray3d } from \"../../geometry3d/Ray3d\";\nimport { Newton1dUnboundedApproximateDerivative, NewtonRtoRStrokeHandler } from \"../../numerics/Newton\";\nimport { SmallSystem } from \"../../numerics/SmallSystem\";\nimport { CurveExtendMode, CurveExtendOptions, VariantCurveExtendParameter } from \"../CurveExtendMode\";\nimport { CurveLocationDetail } from \"../CurveLocationDetail\";\nimport { CurvePrimitive } from \"../CurvePrimitive\";\n\n/**\n * Context for searching for the closest point to a CurvePrimitive.\n * @internal\n */\nexport class ClosestPointStrokeHandler extends NewtonRtoRStrokeHandler implements IStrokeHandler {\n private _curve: CurvePrimitive | undefined;\n private _closestPoint: CurveLocationDetail | undefined;\n private _spacePoint: Point3d;\n private _extend: VariantCurveExtendParameter;\n private _xyOnly: boolean;\n // fraction and function value on one side of an interval that may bracket a root\n private _fractionA: number = 0;\n private _functionA: number = 0;\n // fraction and function value on the other side of an interval that may bracket a root\n private _fractionB: number = 0;\n private _functionB: number = 0;\n private _numThisCurve: number = 0;\n // scratch vars to use within methods\n private _workPoint: Point3d;\n private _workRay: Ray3d;\n private _newtonSolver: Newton1dUnboundedApproximateDerivative;\n /** Constructor */\n public constructor(spacePoint: Point3d, extend?: VariantCurveExtendParameter, result?: CurveLocationDetail, xyOnly?: boolean) {\n super();\n this._spacePoint = spacePoint;\n this._workPoint = Point3d.create();\n this._workRay = Ray3d.createZero();\n this._closestPoint = result;\n if (this._closestPoint)\n this._closestPoint.a = Geometry.largeCoordinateResult\n this._extend = extend ?? false;\n this._xyOnly = xyOnly ?? false;\n this.startCurvePrimitive(undefined);\n this._newtonSolver = new Newton1dUnboundedApproximateDerivative(this);\n }\n public claimResult(): CurveLocationDetail | undefined {\n if (this._closestPoint) {\n this._newtonSolver.setX(this._closestPoint.fraction);\n this._curve = this._closestPoint.curve;\n if (this._newtonSolver.runIterations()) {\n let fraction = this._newtonSolver.getX();\n fraction = CurveExtendOptions.correctFraction(this._extend, fraction);\n this.announceSolutionFraction(fraction);\n }\n }\n return this._closestPoint;\n }\n public needPrimaryGeometryForStrokes() {\n return true;\n }\n public startCurvePrimitive(curve: CurvePrimitive | undefined) {\n this._curve = curve;\n this._fractionA = 0.0;\n this._numThisCurve = 0;\n this._functionA = 0.0;\n }\n public endCurvePrimitive() {\n }\n public announceIntervalForUniformStepStrokes(\n cp: CurvePrimitive, numStrokes: number, fraction0: number, fraction1: number,\n ): void {\n this.startCurvePrimitive(cp);\n this.announceSolutionFraction(0.0); // test start point as closest\n this.announceSolutionFraction(1.0); // test end point as closest\n if (numStrokes < 1)\n numStrokes = 1;\n const df = 1.0 / numStrokes;\n for (let i = 0; i <= numStrokes; i++) {\n const fraction = Geometry.interpolate(fraction0, i * df, fraction1);\n cp.fractionToPointAndDerivative(fraction, this._workRay);\n this.announceRay(fraction, this._workRay);\n }\n }\n private announceCandidate(cp: CurvePrimitive, fraction: number, point: Point3d) {\n const distance = this._xyOnly ? this._spacePoint.distanceXY(point) : this._spacePoint.distance(point);\n if (this._closestPoint && distance > this._closestPoint.a)\n return;\n this._closestPoint = CurveLocationDetail.createCurveFractionPoint(cp, fraction, point, this._closestPoint);\n this._closestPoint.a = distance;\n if (this._parentCurvePrimitive !== undefined)\n this._closestPoint.curve = this._parentCurvePrimitive;\n }\n public announceSegmentInterval(\n cp: CurvePrimitive, point0: Point3d, point1: Point3d, _numStrokes: number, fraction0: number, fraction1: number,\n ): void {\n let localFraction = 0;\n if (this._xyOnly)\n localFraction = SmallSystem.lineSegment3dXYClosestPointUnbounded(point0, point1, this._spacePoint) ?? 0;\n else\n localFraction = this._spacePoint.fractionOfProjectionToLine(point0, point1, 0.0);\n // only consider segment extension at a parent curve endpoint, i.e. when fraction0 is 0 or fraction1 is 1\n const extend0 = (fraction0 === 0) ? CurveExtendOptions.resolveVariantCurveExtendParameterToCurveExtendMode(this._extend, 0) : CurveExtendMode.None;\n const extend1 = (fraction1 === 1) ? CurveExtendOptions.resolveVariantCurveExtendParameterToCurveExtendMode(this._extend, 1) : CurveExtendMode.None;\n localFraction = CurveExtendOptions.correctFraction([extend0, extend1], localFraction);\n this._workPoint = point0.interpolate(localFraction, point1);\n const globalFraction = Geometry.interpolate(fraction0, localFraction, fraction1);\n this.announceCandidate(cp, globalFraction, this._workPoint);\n }\n /**\n * Given a function `f` and (unordered) fractions `a` and `b`, search for and announce a root of `f` in this\n * fractional interval.\n * * This method searches for a root of `f` if and only if the stroke segment defined by `(a, f(a))` and\n * `(b, f(b))` has a root. This is a HEURISTIC: given continuous `f` between `a` and `b`, a root of the stroke\n * segment implies a root of `f`, but not vice-versa. Therefore, if the strokes are not sufficiently dense,\n * this method can miss a root of `f`.\n */\n private searchInterval() {\n if (this._functionA * this._functionB > 0)\n return; // stroke segment has no root; ASSUME the function has no root either\n if (this._functionA === 0)\n this.announceSolutionFraction(this._fractionA);\n if (this._functionB === 0)\n this.announceSolutionFraction(this._fractionB);\n // by the Intermediate Value Theorem, a root lies between fractionA and fractionB; use Newton to find it.\n if (this._functionA * this._functionB < 0) {\n const fraction = Geometry.inverseInterpolate(this._fractionA, this._functionA, this._fractionB, this._functionB);\n if (fraction) {\n this._newtonSolver.setX(fraction);\n if (this._newtonSolver.runIterations())\n this.announceSolutionFraction(this._newtonSolver.getX());\n }\n }\n }\n private announceSolutionFraction(fraction: number) {\n if (this._curve)\n this.announceCandidate(this._curve, fraction, this._curve.fractionToPoint(fraction));\n }\n /**\n * Evaluate the univariate real-valued function for which we are finding roots.\n * * For finding the closest point to curve X from point Q, this function is `f(t) := Q-X(t) dot X'(t)`.\n * * Either `pointAndDerivative` must be defined, or both `fraction` and `curve`.\n * @param pointAndDerivative pre-evaluated curve\n * @param fraction fraction at which to evaluate `curve`\n * @param curve curve to evaluate at `fraction`\n */\n private evaluateFunction(pointAndDerivative?: Ray3d, fraction?: number, curve?: CurvePrimitive): number | undefined {\n if (pointAndDerivative)\n this._workRay.setFrom(pointAndDerivative);\n else if (fraction !== undefined && curve)\n this._workRay = curve.fractionToPointAndDerivative(fraction, this._workRay);\n else\n return undefined;\n if (this._xyOnly)\n return this._workRay.dotProductToPointXY(this._spacePoint);\n else\n return this._workRay.dotProductToPoint(this._spacePoint);\n }\n public evaluate(fraction: number): boolean {\n let curve = this._curve;\n if (this._parentCurvePrimitive)\n curve = this._parentCurvePrimitive;\n const value = this.evaluateFunction(undefined, fraction, curve);\n if (value === undefined)\n return false;\n this.currentF = value;\n return true;\n }\n private announceRay(fraction: number, data: Ray3d): void {\n const value = this.evaluateFunction(data);\n assert(value !== undefined, \"expect defined because evaluateFunction never returns undefined for input Ray3d\");\n this._functionB = value;\n this._fractionB = fraction;\n if (this._numThisCurve++ > 0) // after the first stroke point, a stroke segment is defined, so we have an interval\n this.searchInterval();\n this._functionA = this._functionB;\n this._fractionA = this._fractionB;\n }\n public announcePointTangent(point: Point3d, fraction: number, tangent: Vector3d) {\n this._workRay.set(point, tangent);\n this.announceRay(fraction, this._workRay);\n }\n}\n"]}
@@ -1,14 +1,13 @@
1
1
  import { BSplineCurve3d } from "../../bspline/BSplineCurve";
2
2
  import { BSplineCurve3dH } from "../../bspline/BSplineCurve3dH";
3
3
  import { RecurseToCurvesGeometryHandler } from "../../geometry3d/GeometryHandler";
4
- import { Point3d } from "../../geometry3d/Point3dVector3d";
5
4
  import { Arc3d } from "../Arc3d";
6
5
  import { CurveChainWithDistanceIndex } from "../CurveChainWithDistanceIndex";
7
6
  import { CurveLocationDetailPair } from "../CurveLocationDetail";
8
- import { CurvePrimitive } from "../CurvePrimitive";
9
7
  import { AnyCurve } from "../CurveTypes";
10
8
  import { LineSegment3d } from "../LineSegment3d";
11
9
  import { LineString3d } from "../LineString3d";
10
+ import { TransitionSpiral3d } from "../spiral/TransitionSpiral3d";
12
11
  /**
13
12
  * Handler class for XY close approach between _geometryB and another geometry.
14
13
  * * Approach means the XY distance (z is ignored) between _geometryB and another geometry.
@@ -25,7 +24,6 @@ import { LineString3d } from "../LineString3d";
25
24
  */
26
25
  export declare class CurveCurveCloseApproachXY extends RecurseToCurvesGeometryHandler {
27
26
  private _geometryB;
28
- private setGeometryB;
29
27
  /**
30
28
  * Maximum XY distance (z is ignored). Approach larger than this is not interesting.
31
29
  * This is caller defined and can be undefined.
@@ -33,6 +31,8 @@ export declare class CurveCurveCloseApproachXY extends RecurseToCurvesGeometryHa
33
31
  private _maxDistanceToAccept;
34
32
  /** Squared max distance. Default is [[Geometry.smallMetricDistanceSquared]]. */
35
33
  private _maxDistanceSquared;
34
+ private _xyTolerance;
35
+ private _newtonTolerance;
36
36
  /**
37
37
  * Start and end points of line segments that meet closest approach criteria, i.e., they are perpendicular to
38
38
  * both curves and their length is smaller than _maxDistanceToAccept.
@@ -46,55 +46,64 @@ export declare class CurveCurveCloseApproachXY extends RecurseToCurvesGeometryHa
46
46
  /**
47
47
  * Constructor.
48
48
  * @param geometryB second curve for intersection. Saved for reference by specific handler methods.
49
+ * @param xyTolerance optional tolerance for comparing xy points (default [[Geometry.smallMetricDistance]]).
50
+ * @param newtonTolerance optional relative fraction tolerance for Newton iteration (default [[Geometry.smallNewtonStep]]).
49
51
  */
50
- constructor(geometryB?: AnyCurve);
52
+ constructor(geometryB?: AnyCurve, xyTolerance?: number, newtonTolerance?: number);
51
53
  /** Set the (possibly undefined) max XY distance (z is ignored) to accept. */
52
54
  set maxDistanceToAccept(value: number | undefined);
53
55
  /** Access the (possibly undefined) max XY distance (z is ignored) to accept. */
54
56
  get maxDistanceToAccept(): number | undefined;
55
57
  /** Ask if the maxDistanceToAccept value is defined and positive */
56
58
  get isMaxDistanceSet(): boolean;
57
- /** Reset the geometry and flags, leaving all other parts unchanged (and preserving accumulated intersections) */
58
- resetGeometry(geometryB: AnyCurve): void;
59
- /** returns true if `fraction` is in [0,1] within tolerance */
60
- private acceptFraction;
61
59
  /**
62
- * Return the results structure for the intersection calculation, structured as an array of CurveLocationDetailPair.
63
- * @param reinitialize if true, a new results structure is created for use by later calls.
60
+ * Reset the geometry.
61
+ * * Undefined inputs are ignored.
62
+ * * All other instance data is unchanged, including accumulated intersections.
64
63
  */
65
- grabPairedResults(reinitialize?: boolean): CurveLocationDetailPair[];
66
- /**
67
- * If distance between pointA and pointB is less than maxDistance, record CurveLocationDetailPair which is
68
- * the approach from pointA to pointB.
64
+ resetGeometry(geometryB?: AnyCurve): void;
65
+ /** returns true if `fraction` is in [0,1] within tolerance */
66
+ private acceptFraction;
67
+ /** Extract (and clear) the results, structured as an array of CurveLocationDetailPair. */
68
+ grabPairedResults(): CurveLocationDetailPair[];
69
+ /**
70
+ * Create and record a close-approach pair from raw curve/fraction/point data.
71
+ * * If points are undefined, they are computed from the fractions via `fractionToPoint`.
72
+ * * Fractions are global (i.e., relative to the full curve, not a sub-segment).
73
+ * * The pair is recorded only if the XY distance is within `_maxDistanceSquared`.
74
+ * @param cpA first curve
75
+ * @param fA global fraction on cpA
76
+ * @param pointA point on cpA at fA, or undefined to compute from fA
77
+ * @param cpB second curve
78
+ * @param fB global fraction on cpB
79
+ * @param pointB point on cpB at fB, or undefined to compute from fB
80
+ * @param reversed if true, swap detailA and detailB before recording
69
81
  */
70
- private testAndRecordPointPairApproach;
82
+ private testAndRecordPointPair;
71
83
  /**
72
- * Create a close approach pair if XY distance is within maxDistance.
73
- * @param localFractionA a fraction on first curve
74
- * @param cpA the first curve
75
- * @param fractionA0 start of the first curve
76
- * @param fractionA1 end of the first curve
77
- * @param localFractionB a fraction on second curve
78
- * @param cpB the second curve
79
- * @param fractionB0 start of the second curve
80
- * @param fractionB1 end of the second curve
81
- * @param reversed whether to reverse the details in the pair (e.g., so that detailB refers to geometryB).
84
+ * Record a pre-built close-approach pair with global fractions already set.
85
+ * * Computes and stores the XY distance on both details.
86
+ * * The pair is recorded only if the XY distance is within `_maxDistanceSquared`.
87
+ * @param pair details with global fractions and points already set; modified in place
88
+ * @param reversed if true, swap detailA and detailB before recording
82
89
  */
83
- private recordPointWithLocalFractions;
84
- /**
85
- * Capture a close approach pair that has point and local fraction but not curve.
86
- * * Record the pair, each detail modified with global fraction and input curve.
87
- * * Pair is neither modified nor recorded if it would be a duplicate of the last recorded pair.
88
- * @param pair details computed with local fractions
89
- * @param cpA curveA
90
- * @param fractionA0 global start fraction on curveA
91
- * @param fractionA1 global end fraction on curveA
92
- * @param cpB curveB
93
- * @param fractionB0 global start fraction on curveB
94
- * @param fractionB1 global end fraction on curveB
95
- * @param reversed whether to reverse the details in the pair (e.g., so that detailB refers to geometryB).
90
+ private testAndRecordPair;
91
+ /**
92
+ * Convert a close-approach pair from local (sub-segment) fractions to global fractions, then record it.
93
+ * * Local fractions in the pair are interpolated into the global fraction ranges.
94
+ * * Points are recomputed from the parent curves at the global fractions.
95
+ * * The pair is recorded only if the XY distance is within `_maxDistanceSquared`.
96
+ * @param pair local details (curve unspecified); modified in place with global fractions, curves, and points
97
+ * @param cpA parent curve A
98
+ * @param fractionA0 global fraction corresponding to local fraction 0 on curve A
99
+ * @param fractionA1 global fraction corresponding to local fraction 1 on curve A
100
+ * @param cpB parent curve B
101
+ * @param fractionB0 global fraction corresponding to local fraction 0 on curve B
102
+ * @param fractionB1 global fraction corresponding to local fraction 1 on curve B
103
+ * @param reversed if true, swap detailA and detailB before recording
96
104
  */
97
- private capturePairWithLocalFractions;
105
+ private testAndRecordLocalPair;
106
+ /** Modify the current closest approach if the inputs are closer. */
98
107
  private static updatePointToSegmentDistance;
99
108
  /**
100
109
  * Return fractions of close approach within maxDistance between two line segments (a0,a1) and (b0,b1).
@@ -104,38 +113,20 @@ export declare class CurveCurveCloseApproachXY extends RecurseToCurvesGeometryHa
104
113
  * @param b0 start point of line b
105
114
  * @param b1 end point of line b
106
115
  * @param maxDistanceSquared maximum distance squared (assumed to be positive)
107
- * @returns the fractional (not xy) coordinates in result.x and result.y. result.x is fraction on line a.
108
- * result.y is fraction on line b.
116
+ * @returns a pair of details for the closest approach, or `undefined` if no approach is within `maxDistanceSquared`.
117
+ * `detailA.fraction` is the fraction on segment a; `detailB.fraction` is the fraction on segment b. Returned
118
+ * details store the *squared* distance in the `a` property.
109
119
  */
110
120
  private static segmentSegmentBoundedApproach;
111
121
  /**
112
- * Check different combination of fractions on curveA and curveB. If distance between points at 2 fractions
113
- * is less than maxDistance, record CurveLocationDetailPair which is the approach between the 2 points.
114
- * Optionally, record close approaches of one curve's points if they fall between the other curve's points.
115
- * * If an input curve is a LineString3d, then the corresponding fractions must define a segment of the line string.
122
+ * Compute closest approaches from the endpoints of each curve (if open) to the other curve.
123
+ * Record a [[CurveLocationDetailPair]] if such a distance is less than [[maxDistance]].
116
124
  * @param cpA curveA
117
- * @param fA0 fraction0 on curveA
118
- * @param fA1 fraction1 on curveA
119
- * @param testProjectionOnA whether to record projections of the given curveB points onto curveA
120
125
  * @param cpB curveB
121
- * @param fB0 fraction0 on curveB
122
- * @param fB1 fraction0 on curveB
123
- * @param testProjectionOnB whether to record projections of the given curveA points onto curveB
124
- * @param reversed whether to reverse the details in the pair (e.g., so that detailB refers to geometryB).
126
+ * @param reversed whether to reverse the details in the pair (e.g., so that detailB refers to curveA).
125
127
  */
126
- private testAndRecordFractionalPairApproach;
127
- /**
128
- * Return XY closest approach between a curve primitive and a point.
129
- * Currently, this function only supports Arc3d and LineSegment.
130
- * Note that this function doesn't handle endpoints.
131
- */
132
- private getPointCurveClosestApproachXYNewton;
133
- /**
134
- * Find the closest xy approach between `pointA` and `cpB`. Add the approach if it's within `fB0` and `fB1`.
135
- * * Does not test the endpoints of `cpB`.
136
- * * The only types supported for `cpB` are Arc3d, LineSegment3d, and LineString3d.
137
- * * If `cpB` is a LineString3d, then the interval `[fB0, fB1]` must correspond to a segment of the line string.
138
- */
128
+ private testAndRecordEndPointApproaches;
129
+ /** Find the closest xy approach between `pointA` and `cpB`. */
139
130
  private testAndRecordProjection;
140
131
  /**
141
132
  * Compute closest xy approach of two line segments.
@@ -143,46 +134,37 @@ export declare class CurveCurveCloseApproachXY extends RecurseToCurvesGeometryHa
143
134
  * Record with fraction mapping.
144
135
  * * The fraction mappings allow portions of a linestring to be passed here.
145
136
  */
146
- private computeSegmentSegment3D;
147
- /** Low level dispatch of segment with segment. */
148
- private dispatchSegmentSegment;
137
+ private computeSegmentSegment;
149
138
  /**
150
139
  * Compute the perpendiculars between a line segment and an arc, without extending either curve.
151
140
  * * One or two perpendiculars will be found.
152
141
  * * Each perpendicular segment starts or ends on the arc where the arc tangent is parallel to the line tangent.
153
- * * Perpendiculars from an endpoint are not explicitly computed.
154
- * @param cpA line segment or line string; if it is a line string, then the fractions must specify a segment
155
- * @param pointA0 start point of the segment
156
- * @param fractionA0 fraction of the start of the segment
157
- * @param pointA1 end point of the segment
158
- * @param fractionA1 fraction of the end of the segment
159
- * @param arc the arc
160
- * @param reversed swap the details in the recorded pair (default: false)
142
+ * @param startA line segment start point
143
+ * @param endA line segment end point
144
+ * @param arcB the arc
145
+ * @param announce callback to receive line and arc fractions and optional points of each perpendicular segment computed.
161
146
  */
162
- allPerpendicularsSegmentArcBounded(cpA: CurvePrimitive, pointA0: Point3d, fractionA0: number, pointA1: Point3d, fractionA1: number, arc: Arc3d, reversed?: boolean): void;
147
+ private announceAllPerpendicularsSegmentArcBounded;
163
148
  /**
164
- * Low level dispatch of line segment with arc.
165
- * Find close approaches within maxDistance between a line segments (pointA0, pointA1) and an arc.
149
+ * Find close approaches within maxDistance between a line segment and an arc.
166
150
  * To consider:
167
151
  * 1) intersection between arc and segment.
168
- * 2) endpoints to endpoints or endpoints projection to the other curve.
169
- * 3) arc tangent parallel to line segment (or line string).
170
- * @param cpA curve A (line segment or line string; if it is a line string, then the fractions must specify a segment)
171
- * @param pointA0 start point of the segment
172
- * @param fractionA0 fraction of the start of the segment
173
- * @param pointA1 end point of the segment
174
- * @param fractionA1 fraction of the end of the segment
175
- * @param arc the arc
176
- * @param reversed whether to reverse the details in the pair (e.g., so that detailB refers to geometryB).
177
- */
178
- private dispatchSegmentArc;
152
+ * 2) endpoints to endpoints, or endpoints projection to the other curve.
153
+ * 3) arc tangent parallel to line segment
154
+ * @param lineA the line segment
155
+ * @param arcB the arc
156
+ * @param reversed whether to reverse the details in the pair (e.g., so that detailB refers to arcA).
157
+ */
158
+ private computeSegmentArc;
179
159
  /**
180
160
  * Compute segments perpendicular to two elliptical arcs, without extending either curve.
181
161
  * * Perpendiculars from an endpoint are not explicitly computed.
182
162
  * * Intersections are also found by this search: they are reported as zero-length segments.
163
+ * @param arcA first arc
164
+ * @param arcB second arc
183
165
  * @param reversed swap the details in the recorded pair (default: false)
184
166
  */
185
- allPerpendicularsArcArcBounded(arc0: Arc3d, arc1: Arc3d, reversed?: boolean): void;
167
+ allPerpendicularsArcArcBounded(arcA: Arc3d, arcB: Arc3d, reversed?: boolean): void;
186
168
  /** Low level dispatch of arc with Arc3d. */
187
169
  private dispatchArcArc;
188
170
  /** Low level dispatch of arc with (beziers of) a bspline curve */
@@ -190,19 +172,13 @@ export declare class CurveCurveCloseApproachXY extends RecurseToCurvesGeometryHa
190
172
  /** Low level dispatch of (beziers of) a bspline curve with (beziers of) a bspline curve */
191
173
  private dispatchBSplineCurve3dBSplineCurve3d;
192
174
  /** Low level dispatch of linestring with (beziers of) a bspline curve */
193
- dispatchLineStringBSplineCurve(lsA: LineString3d, curveB: BSplineCurve3d, reversed: boolean): void;
175
+ private dispatchLineStringBSplineCurve;
194
176
  /** Low level dispatch of segment with (beziers of) a bspline curve */
195
- dispatchSegmentBsplineCurve(segA: LineSegment3d, curveB: BSplineCurve3d, reversed: boolean): void;
177
+ private dispatchSegmentBsplineCurve;
196
178
  /** Detail computation for segment approaching linestring. */
197
- computeSegmentLineString(segA: LineSegment3d, lsB: LineString3d, reversed: boolean): void;
179
+ private computeSegmentLineString;
198
180
  /** Detail computation for arc approaching linestring. */
199
- computeArcLineString(arcA: Arc3d, lsB: LineString3d, reversed: boolean): void;
200
- /** Low level dispatch of curve collection. */
201
- private dispatchCurveCollection;
202
- /** Low level dispatch to geomA given a CurveChainWithDistanceIndex in geometryB. */
203
- private dispatchCurveChainWithDistanceIndex;
204
- /** Double dispatch handler for strongly typed segment. */
205
- handleLineSegment3d(segmentA: LineSegment3d): any;
181
+ private computeArcLineString;
206
182
  /**
207
183
  * Set bits for comparison to range xy
208
184
  * * bit 0x01 => x smaller than range.low.x
@@ -222,12 +198,46 @@ export declare class CurveCurveCloseApproachXY extends RecurseToCurvesGeometryHa
222
198
  private classifyBitsPointRangeXY;
223
199
  /** Low level dispatch of line string with line string. */
224
200
  private computeLineStringLineString;
201
+ /** Low level dispatch of curve collection. */
202
+ private dispatchCurveCollection;
203
+ /** Low level dispatch to geomA given a CurveChainWithDistanceIndex in geometryB. */
204
+ private dispatchCurveChainWithDistanceIndex;
205
+ /** Double dispatch handler for strongly typed segment. */
206
+ handleLineSegment3d(segmentA: LineSegment3d): any;
225
207
  /** Double dispatch handler for strongly typed linestring. */
226
208
  handleLineString3d(lsA: LineString3d): any;
227
209
  /** Double dispatch handler for strongly typed arc. */
228
- handleArc3d(arc0: Arc3d): any;
210
+ handleArc3d(arcA: Arc3d): any;
229
211
  /** Double dispatch handler for strongly typed bspline curve. */
230
- handleBSplineCurve3d(curve: BSplineCurve3d): any;
212
+ handleBSplineCurve3d(curveA: BSplineCurve3d): any;
213
+ /**
214
+ * Process seeds for xy close approach between the curve and spiral.
215
+ * * Refine each result via Newton iteration. If it doesn't converge, remove it.
216
+ * @param seeds The initial seed results to refine.
217
+ * @param curveA The other curve primitive. May also be a transition spiral.
218
+ * @param spiralB The transition spiral.
219
+ * @param reversed whether `spiralB` data is in `detailA` of each recorded pair, and `curveA` data in `detailB`.
220
+ */
221
+ private refineSpiralResultsByNewton;
222
+ /**
223
+ * Append stroke points and return the line string.
224
+ * * This is a convenient wrapper for [[CurvePrimitive.emitStrokes]] but the analogous instance method cannot be added
225
+ * to that class due to the ensuing recursion with subclass [[LineString3d]].
226
+ * @param options options for stroking the instance curve.
227
+ * @param result object to receive appended stroke points; if omitted, a new object is created, populated, and returned.
228
+ */
229
+ private strokeCurve;
230
+ /** Find and return the close approaches between curveA and the discretization of curveB. */
231
+ private computeDiscreteCloseApproachResults;
232
+ /**
233
+ * Compute the XY close approach of a curve and a spiral.
234
+ * @param curveA curve to find its close approach with spiralB. May also be a transition spiral.
235
+ * @param spiralB transition spiral to find its close approach with curveA.
236
+ * @param reversed whether `spiralB` data will be recorded in `detailA` of each result, and `curveA` data in `detailB`.
237
+ */
238
+ private dispatchCurveSpiral;
239
+ /** Double dispatch handler for strongly typed spiral curve. */
240
+ handleTransitionSpiral(spiral: TransitionSpiral3d): any;
231
241
  /** Double dispatch handler for strongly typed CurveChainWithDistanceIndex. */
232
242
  handleCurveChainWithDistanceIndex(chain: CurveChainWithDistanceIndex): any;
233
243
  /** Double dispatch handler for strongly typed homogeneous bspline curve .. */
@@ -1 +1 @@
1
- {"version":3,"file":"CurveCurveCloseApproachXY.d.ts","sourceRoot":"","sources":["../../../../src/curve/internalContexts/CurveCurveCloseApproachXY.ts"],"names":[],"mappings":"AAUA,OAAO,EAAE,cAAc,EAAsB,MAAM,4BAA4B,CAAC;AAChF,OAAO,EAAE,eAAe,EAAE,MAAM,+BAA+B,CAAC;AAEhE,OAAO,EAAE,8BAA8B,EAAE,MAAM,kCAAkC,CAAC;AAElF,OAAO,EAAE,OAAO,EAAE,MAAM,kCAAkC,CAAC;AAO3D,OAAO,EAAE,KAAK,EAAE,MAAM,UAAU,CAAC;AACjC,OAAO,EAAE,2BAA2B,EAAE,MAAM,gCAAgC,CAAC;AAE7E,OAAO,EAA0C,uBAAuB,EAAE,MAAM,wBAAwB,CAAC;AACzG,OAAO,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAC;AACnD,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AACzC,OAAO,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC;AACjD,OAAO,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAI/C;;;;;;;;;;;;;GAaG;AACH,qBAAa,yBAA0B,SAAQ,8BAA8B;IAC3E,OAAO,CAAC,UAAU,CAAuB;IACzC,OAAO,CAAC,YAAY;IAGpB;;;OAGG;IACH,OAAO,CAAC,oBAAoB,CAAqB;IACjD,gFAAgF;IAChF,OAAO,CAAC,mBAAmB,CAAS;I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