@itwin/core-geometry 3.5.0-dev.7 → 3.6.0-dev.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (342) hide show
  1. package/CHANGELOG.md +65 -1
  2. package/lib/cjs/Geometry.d.ts +26 -10
  3. package/lib/cjs/Geometry.d.ts.map +1 -1
  4. package/lib/cjs/Geometry.js +32 -17
  5. package/lib/cjs/Geometry.js.map +1 -1
  6. package/lib/cjs/bspline/BSplineCurve.d.ts +11 -5
  7. package/lib/cjs/bspline/BSplineCurve.d.ts.map +1 -1
  8. package/lib/cjs/bspline/BSplineCurve.js +47 -18
  9. package/lib/cjs/bspline/BSplineCurve.js.map +1 -1
  10. package/lib/cjs/bspline/BezierCurveBase.d.ts +10 -3
  11. package/lib/cjs/bspline/BezierCurveBase.d.ts.map +1 -1
  12. package/lib/cjs/bspline/BezierCurveBase.js +12 -4
  13. package/lib/cjs/bspline/BezierCurveBase.js.map +1 -1
  14. package/lib/cjs/bspline/InterpolationCurve3d.d.ts.map +1 -1
  15. package/lib/cjs/bspline/InterpolationCurve3d.js +4 -1
  16. package/lib/cjs/bspline/InterpolationCurve3d.js.map +1 -1
  17. package/lib/cjs/bspline/KnotVector.d.ts.map +1 -1
  18. package/lib/cjs/bspline/KnotVector.js +3 -0
  19. package/lib/cjs/bspline/KnotVector.js.map +1 -1
  20. package/lib/cjs/curve/Arc3d.d.ts +10 -4
  21. package/lib/cjs/curve/Arc3d.d.ts.map +1 -1
  22. package/lib/cjs/curve/Arc3d.js +17 -5
  23. package/lib/cjs/curve/Arc3d.js.map +1 -1
  24. package/lib/cjs/curve/CurveChainWithDistanceIndex.d.ts +15 -7
  25. package/lib/cjs/curve/CurveChainWithDistanceIndex.d.ts.map +1 -1
  26. package/lib/cjs/curve/CurveChainWithDistanceIndex.js +46 -29
  27. package/lib/cjs/curve/CurveChainWithDistanceIndex.js.map +1 -1
  28. package/lib/cjs/curve/CurveCollection.d.ts +13 -4
  29. package/lib/cjs/curve/CurveCollection.d.ts.map +1 -1
  30. package/lib/cjs/curve/CurveCollection.js +23 -2
  31. package/lib/cjs/curve/CurveCollection.js.map +1 -1
  32. package/lib/cjs/curve/CurveCurveIntersectXY.js +1 -1
  33. package/lib/cjs/curve/CurveCurveIntersectXY.js.map +1 -1
  34. package/lib/cjs/curve/CurveCurveIntersectXYZ.d.ts +4 -3
  35. package/lib/cjs/curve/CurveCurveIntersectXYZ.d.ts.map +1 -1
  36. package/lib/cjs/curve/CurveCurveIntersectXYZ.js +8 -6
  37. package/lib/cjs/curve/CurveCurveIntersectXYZ.js.map +1 -1
  38. package/lib/cjs/curve/CurvePrimitive.d.ts +20 -18
  39. package/lib/cjs/curve/CurvePrimitive.d.ts.map +1 -1
  40. package/lib/cjs/curve/CurvePrimitive.js +58 -339
  41. package/lib/cjs/curve/CurvePrimitive.js.map +1 -1
  42. package/lib/cjs/curve/LineSegment3d.d.ts +8 -2
  43. package/lib/cjs/curve/LineSegment3d.d.ts.map +1 -1
  44. package/lib/cjs/curve/LineSegment3d.js +9 -0
  45. package/lib/cjs/curve/LineSegment3d.js.map +1 -1
  46. package/lib/cjs/curve/LineString3d.d.ts +18 -2
  47. package/lib/cjs/curve/LineString3d.d.ts.map +1 -1
  48. package/lib/cjs/curve/LineString3d.js +39 -23
  49. package/lib/cjs/curve/LineString3d.js.map +1 -1
  50. package/lib/cjs/curve/ProxyCurve.d.ts +9 -7
  51. package/lib/cjs/curve/ProxyCurve.d.ts.map +1 -1
  52. package/lib/cjs/curve/ProxyCurve.js +4 -0
  53. package/lib/cjs/curve/ProxyCurve.js.map +1 -1
  54. package/lib/cjs/curve/Query/PlanarSubdivision.d.ts +2 -1
  55. package/lib/cjs/curve/Query/PlanarSubdivision.d.ts.map +1 -1
  56. package/lib/cjs/curve/Query/PlanarSubdivision.js +5 -4
  57. package/lib/cjs/curve/Query/PlanarSubdivision.js.map +1 -1
  58. package/lib/cjs/curve/RegionOps.d.ts +5 -0
  59. package/lib/cjs/curve/RegionOps.d.ts.map +1 -1
  60. package/lib/cjs/curve/RegionOps.js +17 -3
  61. package/lib/cjs/curve/RegionOps.js.map +1 -1
  62. package/lib/cjs/curve/RegionOpsClassificationSweeps.d.ts +9 -6
  63. package/lib/cjs/curve/RegionOpsClassificationSweeps.d.ts.map +1 -1
  64. package/lib/cjs/curve/RegionOpsClassificationSweeps.js +55 -47
  65. package/lib/cjs/curve/RegionOpsClassificationSweeps.js.map +1 -1
  66. package/lib/cjs/curve/internalContexts/AppendPlaneIntersectionStrokeHandler.d.ts +55 -0
  67. package/lib/cjs/curve/internalContexts/AppendPlaneIntersectionStrokeHandler.d.ts.map +1 -0
  68. package/lib/cjs/curve/internalContexts/AppendPlaneIntersectionStrokeHandler.js +143 -0
  69. package/lib/cjs/curve/internalContexts/AppendPlaneIntersectionStrokeHandler.js.map +1 -0
  70. package/lib/cjs/curve/internalContexts/ClosestPointStrokeHandler.d.ts +43 -0
  71. package/lib/cjs/curve/internalContexts/ClosestPointStrokeHandler.d.ts.map +1 -0
  72. package/lib/cjs/curve/internalContexts/ClosestPointStrokeHandler.js +146 -0
  73. package/lib/cjs/curve/internalContexts/ClosestPointStrokeHandler.js.map +1 -0
  74. package/lib/cjs/curve/internalContexts/CurveLengthContext.d.ts +33 -0
  75. package/lib/cjs/curve/internalContexts/CurveLengthContext.d.ts.map +1 -0
  76. package/lib/cjs/curve/internalContexts/CurveLengthContext.js +91 -0
  77. package/lib/cjs/curve/internalContexts/CurveLengthContext.js.map +1 -0
  78. package/lib/cjs/curve/internalContexts/NewtonRtoRStrokeHandler.d.ts +21 -0
  79. package/lib/cjs/curve/internalContexts/NewtonRtoRStrokeHandler.d.ts.map +1 -0
  80. package/lib/cjs/curve/internalContexts/NewtonRtoRStrokeHandler.js +34 -0
  81. package/lib/cjs/curve/internalContexts/NewtonRtoRStrokeHandler.js.map +1 -0
  82. package/lib/cjs/curve/internalContexts/PlaneAltitudeRangeContext.d.ts +31 -8
  83. package/lib/cjs/curve/internalContexts/PlaneAltitudeRangeContext.d.ts.map +1 -1
  84. package/lib/cjs/curve/internalContexts/PlaneAltitudeRangeContext.js +77 -12
  85. package/lib/cjs/curve/internalContexts/PlaneAltitudeRangeContext.js.map +1 -1
  86. package/lib/cjs/curve/spiral/DirectSpiral3d.d.ts +2 -2
  87. package/lib/cjs/curve/spiral/DirectSpiral3d.d.ts.map +1 -1
  88. package/lib/cjs/curve/spiral/DirectSpiral3d.js +15 -8
  89. package/lib/cjs/curve/spiral/DirectSpiral3d.js.map +1 -1
  90. package/lib/cjs/curve/spiral/TransitionSpiral3d.d.ts +12 -7
  91. package/lib/cjs/curve/spiral/TransitionSpiral3d.d.ts.map +1 -1
  92. package/lib/cjs/curve/spiral/TransitionSpiral3d.js +12 -3
  93. package/lib/cjs/curve/spiral/TransitionSpiral3d.js.map +1 -1
  94. package/lib/cjs/geometry3d/Angle.d.ts +66 -42
  95. package/lib/cjs/geometry3d/Angle.d.ts.map +1 -1
  96. package/lib/cjs/geometry3d/Angle.js +201 -99
  97. package/lib/cjs/geometry3d/Angle.js.map +1 -1
  98. package/lib/cjs/geometry3d/AngleSweep.d.ts +102 -60
  99. package/lib/cjs/geometry3d/AngleSweep.d.ts.map +1 -1
  100. package/lib/cjs/geometry3d/AngleSweep.js +191 -106
  101. package/lib/cjs/geometry3d/AngleSweep.js.map +1 -1
  102. package/lib/cjs/geometry3d/Matrix3d.d.ts +25 -8
  103. package/lib/cjs/geometry3d/Matrix3d.d.ts.map +1 -1
  104. package/lib/cjs/geometry3d/Matrix3d.js +67 -15
  105. package/lib/cjs/geometry3d/Matrix3d.js.map +1 -1
  106. package/lib/cjs/geometry3d/Point2dArrayCarrier.d.ts +1 -0
  107. package/lib/cjs/geometry3d/Point2dArrayCarrier.d.ts.map +1 -1
  108. package/lib/cjs/geometry3d/Point2dArrayCarrier.js +2 -1
  109. package/lib/cjs/geometry3d/Point2dArrayCarrier.js.map +1 -1
  110. package/lib/cjs/geometry3d/Point2dVector2d.d.ts +86 -25
  111. package/lib/cjs/geometry3d/Point2dVector2d.d.ts.map +1 -1
  112. package/lib/cjs/geometry3d/Point2dVector2d.js +230 -81
  113. package/lib/cjs/geometry3d/Point2dVector2d.js.map +1 -1
  114. package/lib/cjs/geometry3d/Point3dArrayCarrier.d.ts +14 -4
  115. package/lib/cjs/geometry3d/Point3dArrayCarrier.d.ts.map +1 -1
  116. package/lib/cjs/geometry3d/Point3dArrayCarrier.js +15 -5
  117. package/lib/cjs/geometry3d/Point3dArrayCarrier.js.map +1 -1
  118. package/lib/cjs/geometry3d/Point3dVector3d.d.ts +121 -67
  119. package/lib/cjs/geometry3d/Point3dVector3d.d.ts.map +1 -1
  120. package/lib/cjs/geometry3d/Point3dVector3d.js +318 -137
  121. package/lib/cjs/geometry3d/Point3dVector3d.js.map +1 -1
  122. package/lib/cjs/geometry3d/Range.d.ts +1 -2
  123. package/lib/cjs/geometry3d/Range.d.ts.map +1 -1
  124. package/lib/cjs/geometry3d/Range.js +1 -2
  125. package/lib/cjs/geometry3d/Range.js.map +1 -1
  126. package/lib/cjs/geometry3d/Ray3d.d.ts +5 -5
  127. package/lib/cjs/geometry3d/Ray3d.js +5 -5
  128. package/lib/cjs/geometry3d/Ray3d.js.map +1 -1
  129. package/lib/cjs/geometry3d/Transform.d.ts.map +1 -1
  130. package/lib/cjs/geometry3d/Transform.js.map +1 -1
  131. package/lib/cjs/numerics/Polynomials.d.ts.map +1 -1
  132. package/lib/cjs/numerics/Polynomials.js +0 -1
  133. package/lib/cjs/numerics/Polynomials.js.map +1 -1
  134. package/lib/cjs/polyface/IndexedEdgeMatcher.d.ts +4 -4
  135. package/lib/cjs/polyface/IndexedEdgeMatcher.d.ts.map +1 -1
  136. package/lib/cjs/polyface/IndexedEdgeMatcher.js +3 -3
  137. package/lib/cjs/polyface/IndexedEdgeMatcher.js.map +1 -1
  138. package/lib/cjs/polyface/IndexedPolyfaceVisitor.d.ts.map +1 -1
  139. package/lib/cjs/polyface/IndexedPolyfaceVisitor.js.map +1 -1
  140. package/lib/cjs/polyface/Polyface.d.ts +7 -2
  141. package/lib/cjs/polyface/Polyface.d.ts.map +1 -1
  142. package/lib/cjs/polyface/Polyface.js +8 -1
  143. package/lib/cjs/polyface/Polyface.js.map +1 -1
  144. package/lib/cjs/polyface/PolyfaceBuilder.d.ts.map +1 -1
  145. package/lib/cjs/polyface/PolyfaceBuilder.js.map +1 -1
  146. package/lib/cjs/polyface/PolyfaceQuery.d.ts +36 -8
  147. package/lib/cjs/polyface/PolyfaceQuery.d.ts.map +1 -1
  148. package/lib/cjs/polyface/PolyfaceQuery.js +112 -31
  149. package/lib/cjs/polyface/PolyfaceQuery.js.map +1 -1
  150. package/lib/cjs/serialization/GeometrySamples.d.ts.map +1 -1
  151. package/lib/cjs/serialization/GeometrySamples.js.map +1 -1
  152. package/lib/cjs/serialization/IModelJsonSchema.d.ts +1 -1
  153. package/lib/cjs/serialization/IModelJsonSchema.d.ts.map +1 -1
  154. package/lib/cjs/serialization/IModelJsonSchema.js +4 -3
  155. package/lib/cjs/serialization/IModelJsonSchema.js.map +1 -1
  156. package/lib/cjs/solid/Sphere.d.ts +1 -1
  157. package/lib/cjs/solid/Sphere.js +3 -3
  158. package/lib/cjs/solid/Sphere.js.map +1 -1
  159. package/lib/cjs/solid/TorusPipe.d.ts +17 -13
  160. package/lib/cjs/solid/TorusPipe.d.ts.map +1 -1
  161. package/lib/cjs/solid/TorusPipe.js +67 -38
  162. package/lib/cjs/solid/TorusPipe.js.map +1 -1
  163. package/lib/cjs/topology/Graph.d.ts +1 -1
  164. package/lib/cjs/topology/Graph.js +1 -1
  165. package/lib/cjs/topology/Graph.js.map +1 -1
  166. package/lib/cjs/topology/Merging.d.ts.map +1 -1
  167. package/lib/cjs/topology/Merging.js +9 -1
  168. package/lib/cjs/topology/Merging.js.map +1 -1
  169. package/lib/cjs/topology/Triangulation.d.ts +1 -1
  170. package/lib/cjs/topology/Triangulation.js +1 -1
  171. package/lib/cjs/topology/Triangulation.js.map +1 -1
  172. package/lib/esm/Geometry.d.ts +26 -10
  173. package/lib/esm/Geometry.d.ts.map +1 -1
  174. package/lib/esm/Geometry.js +32 -17
  175. package/lib/esm/Geometry.js.map +1 -1
  176. package/lib/esm/bspline/BSplineCurve.d.ts +11 -5
  177. package/lib/esm/bspline/BSplineCurve.d.ts.map +1 -1
  178. package/lib/esm/bspline/BSplineCurve.js +47 -18
  179. package/lib/esm/bspline/BSplineCurve.js.map +1 -1
  180. package/lib/esm/bspline/BezierCurveBase.d.ts +10 -3
  181. package/lib/esm/bspline/BezierCurveBase.d.ts.map +1 -1
  182. package/lib/esm/bspline/BezierCurveBase.js +12 -4
  183. package/lib/esm/bspline/BezierCurveBase.js.map +1 -1
  184. package/lib/esm/bspline/InterpolationCurve3d.d.ts.map +1 -1
  185. package/lib/esm/bspline/InterpolationCurve3d.js +4 -1
  186. package/lib/esm/bspline/InterpolationCurve3d.js.map +1 -1
  187. package/lib/esm/bspline/KnotVector.d.ts.map +1 -1
  188. package/lib/esm/bspline/KnotVector.js +3 -0
  189. package/lib/esm/bspline/KnotVector.js.map +1 -1
  190. package/lib/esm/curve/Arc3d.d.ts +10 -4
  191. package/lib/esm/curve/Arc3d.d.ts.map +1 -1
  192. package/lib/esm/curve/Arc3d.js +17 -5
  193. package/lib/esm/curve/Arc3d.js.map +1 -1
  194. package/lib/esm/curve/CurveChainWithDistanceIndex.d.ts +15 -7
  195. package/lib/esm/curve/CurveChainWithDistanceIndex.d.ts.map +1 -1
  196. package/lib/esm/curve/CurveChainWithDistanceIndex.js +46 -29
  197. package/lib/esm/curve/CurveChainWithDistanceIndex.js.map +1 -1
  198. package/lib/esm/curve/CurveCollection.d.ts +13 -4
  199. package/lib/esm/curve/CurveCollection.d.ts.map +1 -1
  200. package/lib/esm/curve/CurveCollection.js +23 -2
  201. package/lib/esm/curve/CurveCollection.js.map +1 -1
  202. package/lib/esm/curve/CurveCurveIntersectXY.js +1 -1
  203. package/lib/esm/curve/CurveCurveIntersectXY.js.map +1 -1
  204. package/lib/esm/curve/CurveCurveIntersectXYZ.d.ts +4 -3
  205. package/lib/esm/curve/CurveCurveIntersectXYZ.d.ts.map +1 -1
  206. package/lib/esm/curve/CurveCurveIntersectXYZ.js +8 -6
  207. package/lib/esm/curve/CurveCurveIntersectXYZ.js.map +1 -1
  208. package/lib/esm/curve/CurvePrimitive.d.ts +20 -18
  209. package/lib/esm/curve/CurvePrimitive.d.ts.map +1 -1
  210. package/lib/esm/curve/CurvePrimitive.js +52 -333
  211. package/lib/esm/curve/CurvePrimitive.js.map +1 -1
  212. package/lib/esm/curve/LineSegment3d.d.ts +8 -2
  213. package/lib/esm/curve/LineSegment3d.d.ts.map +1 -1
  214. package/lib/esm/curve/LineSegment3d.js +9 -0
  215. package/lib/esm/curve/LineSegment3d.js.map +1 -1
  216. package/lib/esm/curve/LineString3d.d.ts +18 -2
  217. package/lib/esm/curve/LineString3d.d.ts.map +1 -1
  218. package/lib/esm/curve/LineString3d.js +39 -23
  219. package/lib/esm/curve/LineString3d.js.map +1 -1
  220. package/lib/esm/curve/ProxyCurve.d.ts +9 -7
  221. package/lib/esm/curve/ProxyCurve.d.ts.map +1 -1
  222. package/lib/esm/curve/ProxyCurve.js +4 -0
  223. package/lib/esm/curve/ProxyCurve.js.map +1 -1
  224. package/lib/esm/curve/Query/PlanarSubdivision.d.ts +2 -1
  225. package/lib/esm/curve/Query/PlanarSubdivision.d.ts.map +1 -1
  226. package/lib/esm/curve/Query/PlanarSubdivision.js +5 -4
  227. package/lib/esm/curve/Query/PlanarSubdivision.js.map +1 -1
  228. package/lib/esm/curve/RegionOps.d.ts +5 -0
  229. package/lib/esm/curve/RegionOps.d.ts.map +1 -1
  230. package/lib/esm/curve/RegionOps.js +17 -3
  231. package/lib/esm/curve/RegionOps.js.map +1 -1
  232. package/lib/esm/curve/RegionOpsClassificationSweeps.d.ts +9 -6
  233. package/lib/esm/curve/RegionOpsClassificationSweeps.d.ts.map +1 -1
  234. package/lib/esm/curve/RegionOpsClassificationSweeps.js +56 -48
  235. package/lib/esm/curve/RegionOpsClassificationSweeps.js.map +1 -1
  236. package/lib/esm/curve/internalContexts/AppendPlaneIntersectionStrokeHandler.d.ts +55 -0
  237. package/lib/esm/curve/internalContexts/AppendPlaneIntersectionStrokeHandler.d.ts.map +1 -0
  238. package/lib/esm/curve/internalContexts/AppendPlaneIntersectionStrokeHandler.js +139 -0
  239. package/lib/esm/curve/internalContexts/AppendPlaneIntersectionStrokeHandler.js.map +1 -0
  240. package/lib/esm/curve/internalContexts/ClosestPointStrokeHandler.d.ts +43 -0
  241. package/lib/esm/curve/internalContexts/ClosestPointStrokeHandler.d.ts.map +1 -0
  242. package/lib/esm/curve/internalContexts/ClosestPointStrokeHandler.js +142 -0
  243. package/lib/esm/curve/internalContexts/ClosestPointStrokeHandler.js.map +1 -0
  244. package/lib/esm/curve/internalContexts/CurveLengthContext.d.ts +33 -0
  245. package/lib/esm/curve/internalContexts/CurveLengthContext.d.ts.map +1 -0
  246. package/lib/esm/curve/internalContexts/CurveLengthContext.js +87 -0
  247. package/lib/esm/curve/internalContexts/CurveLengthContext.js.map +1 -0
  248. package/lib/esm/curve/internalContexts/NewtonRtoRStrokeHandler.d.ts +21 -0
  249. package/lib/esm/curve/internalContexts/NewtonRtoRStrokeHandler.d.ts.map +1 -0
  250. package/lib/esm/curve/internalContexts/NewtonRtoRStrokeHandler.js +30 -0
  251. package/lib/esm/curve/internalContexts/NewtonRtoRStrokeHandler.js.map +1 -0
  252. package/lib/esm/curve/internalContexts/PlaneAltitudeRangeContext.d.ts +31 -8
  253. package/lib/esm/curve/internalContexts/PlaneAltitudeRangeContext.d.ts.map +1 -1
  254. package/lib/esm/curve/internalContexts/PlaneAltitudeRangeContext.js +77 -12
  255. package/lib/esm/curve/internalContexts/PlaneAltitudeRangeContext.js.map +1 -1
  256. package/lib/esm/curve/spiral/DirectSpiral3d.d.ts +2 -2
  257. package/lib/esm/curve/spiral/DirectSpiral3d.d.ts.map +1 -1
  258. package/lib/esm/curve/spiral/DirectSpiral3d.js +15 -8
  259. package/lib/esm/curve/spiral/DirectSpiral3d.js.map +1 -1
  260. package/lib/esm/curve/spiral/TransitionSpiral3d.d.ts +12 -7
  261. package/lib/esm/curve/spiral/TransitionSpiral3d.d.ts.map +1 -1
  262. package/lib/esm/curve/spiral/TransitionSpiral3d.js +12 -3
  263. package/lib/esm/curve/spiral/TransitionSpiral3d.js.map +1 -1
  264. package/lib/esm/geometry3d/Angle.d.ts +66 -42
  265. package/lib/esm/geometry3d/Angle.d.ts.map +1 -1
  266. package/lib/esm/geometry3d/Angle.js +201 -99
  267. package/lib/esm/geometry3d/Angle.js.map +1 -1
  268. package/lib/esm/geometry3d/AngleSweep.d.ts +102 -60
  269. package/lib/esm/geometry3d/AngleSweep.d.ts.map +1 -1
  270. package/lib/esm/geometry3d/AngleSweep.js +191 -106
  271. package/lib/esm/geometry3d/AngleSweep.js.map +1 -1
  272. package/lib/esm/geometry3d/Matrix3d.d.ts +25 -8
  273. package/lib/esm/geometry3d/Matrix3d.d.ts.map +1 -1
  274. package/lib/esm/geometry3d/Matrix3d.js +67 -15
  275. package/lib/esm/geometry3d/Matrix3d.js.map +1 -1
  276. package/lib/esm/geometry3d/Point2dArrayCarrier.d.ts +1 -0
  277. package/lib/esm/geometry3d/Point2dArrayCarrier.d.ts.map +1 -1
  278. package/lib/esm/geometry3d/Point2dArrayCarrier.js +2 -1
  279. package/lib/esm/geometry3d/Point2dArrayCarrier.js.map +1 -1
  280. package/lib/esm/geometry3d/Point2dVector2d.d.ts +86 -25
  281. package/lib/esm/geometry3d/Point2dVector2d.d.ts.map +1 -1
  282. package/lib/esm/geometry3d/Point2dVector2d.js +230 -81
  283. package/lib/esm/geometry3d/Point2dVector2d.js.map +1 -1
  284. package/lib/esm/geometry3d/Point3dArrayCarrier.d.ts +14 -4
  285. package/lib/esm/geometry3d/Point3dArrayCarrier.d.ts.map +1 -1
  286. package/lib/esm/geometry3d/Point3dArrayCarrier.js +15 -5
  287. package/lib/esm/geometry3d/Point3dArrayCarrier.js.map +1 -1
  288. package/lib/esm/geometry3d/Point3dVector3d.d.ts +121 -67
  289. package/lib/esm/geometry3d/Point3dVector3d.d.ts.map +1 -1
  290. package/lib/esm/geometry3d/Point3dVector3d.js +318 -137
  291. package/lib/esm/geometry3d/Point3dVector3d.js.map +1 -1
  292. package/lib/esm/geometry3d/Range.d.ts +1 -2
  293. package/lib/esm/geometry3d/Range.d.ts.map +1 -1
  294. package/lib/esm/geometry3d/Range.js +1 -2
  295. package/lib/esm/geometry3d/Range.js.map +1 -1
  296. package/lib/esm/geometry3d/Ray3d.d.ts +5 -5
  297. package/lib/esm/geometry3d/Ray3d.js +5 -5
  298. package/lib/esm/geometry3d/Ray3d.js.map +1 -1
  299. package/lib/esm/geometry3d/Transform.d.ts.map +1 -1
  300. package/lib/esm/geometry3d/Transform.js.map +1 -1
  301. package/lib/esm/numerics/Polynomials.d.ts.map +1 -1
  302. package/lib/esm/numerics/Polynomials.js +0 -1
  303. package/lib/esm/numerics/Polynomials.js.map +1 -1
  304. package/lib/esm/polyface/IndexedEdgeMatcher.d.ts +4 -4
  305. package/lib/esm/polyface/IndexedEdgeMatcher.d.ts.map +1 -1
  306. package/lib/esm/polyface/IndexedEdgeMatcher.js +3 -3
  307. package/lib/esm/polyface/IndexedEdgeMatcher.js.map +1 -1
  308. package/lib/esm/polyface/IndexedPolyfaceVisitor.d.ts.map +1 -1
  309. package/lib/esm/polyface/IndexedPolyfaceVisitor.js.map +1 -1
  310. package/lib/esm/polyface/Polyface.d.ts +7 -2
  311. package/lib/esm/polyface/Polyface.d.ts.map +1 -1
  312. package/lib/esm/polyface/Polyface.js +8 -1
  313. package/lib/esm/polyface/Polyface.js.map +1 -1
  314. package/lib/esm/polyface/PolyfaceBuilder.d.ts.map +1 -1
  315. package/lib/esm/polyface/PolyfaceBuilder.js.map +1 -1
  316. package/lib/esm/polyface/PolyfaceQuery.d.ts +36 -8
  317. package/lib/esm/polyface/PolyfaceQuery.d.ts.map +1 -1
  318. package/lib/esm/polyface/PolyfaceQuery.js +113 -32
  319. package/lib/esm/polyface/PolyfaceQuery.js.map +1 -1
  320. package/lib/esm/serialization/GeometrySamples.d.ts.map +1 -1
  321. package/lib/esm/serialization/GeometrySamples.js.map +1 -1
  322. package/lib/esm/serialization/IModelJsonSchema.d.ts +1 -1
  323. package/lib/esm/serialization/IModelJsonSchema.d.ts.map +1 -1
  324. package/lib/esm/serialization/IModelJsonSchema.js +4 -3
  325. package/lib/esm/serialization/IModelJsonSchema.js.map +1 -1
  326. package/lib/esm/solid/Sphere.d.ts +1 -1
  327. package/lib/esm/solid/Sphere.js +3 -3
  328. package/lib/esm/solid/Sphere.js.map +1 -1
  329. package/lib/esm/solid/TorusPipe.d.ts +17 -13
  330. package/lib/esm/solid/TorusPipe.d.ts.map +1 -1
  331. package/lib/esm/solid/TorusPipe.js +67 -38
  332. package/lib/esm/solid/TorusPipe.js.map +1 -1
  333. package/lib/esm/topology/Graph.d.ts +1 -1
  334. package/lib/esm/topology/Graph.js +1 -1
  335. package/lib/esm/topology/Graph.js.map +1 -1
  336. package/lib/esm/topology/Merging.d.ts.map +1 -1
  337. package/lib/esm/topology/Merging.js +9 -1
  338. package/lib/esm/topology/Merging.js.map +1 -1
  339. package/lib/esm/topology/Triangulation.d.ts +1 -1
  340. package/lib/esm/topology/Triangulation.js +1 -1
  341. package/lib/esm/topology/Triangulation.js.map +1 -1
  342. package/package.json +5 -5
@@ -1,19 +1,26 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.CurvePrimitive = void 0;
4
+ /*---------------------------------------------------------------------------------------------
5
+ * Copyright (c) Bentley Systems, Incorporated. All rights reserved.
6
+ * See LICENSE.md in the project root for license terms and full copyright notice.
7
+ *--------------------------------------------------------------------------------------------*/
8
+ /** @packageDocumentation
9
+ * @module Curve
10
+ */
11
+ const core_bentley_1 = require("@itwin/core-bentley");
4
12
  const StrokeCountMap_1 = require("../curve/Query/StrokeCountMap");
5
13
  const Geometry_1 = require("../Geometry");
6
14
  const Matrix3d_1 = require("../geometry3d/Matrix3d");
7
15
  const Point3dVector3d_1 = require("../geometry3d/Point3dVector3d");
16
+ const Range_1 = require("../geometry3d/Range");
8
17
  const Ray3d_1 = require("../geometry3d/Ray3d");
9
18
  const Transform_1 = require("../geometry3d/Transform");
10
- const BezierPolynomials_1 = require("../numerics/BezierPolynomials");
11
- const Newton_1 = require("../numerics/Newton");
12
- const Quadrature_1 = require("../numerics/Quadrature");
13
- const CurveExtendMode_1 = require("./CurveExtendMode");
14
19
  const CurveLocationDetail_1 = require("./CurveLocationDetail");
15
20
  const GeometryQuery_1 = require("./GeometryQuery");
16
- const Range_1 = require("../geometry3d/Range");
21
+ const AppendPlaneIntersectionStrokeHandler_1 = require("./internalContexts/AppendPlaneIntersectionStrokeHandler");
22
+ const ClosestPointStrokeHandler_1 = require("./internalContexts/ClosestPointStrokeHandler");
23
+ const CurveLengthContext_1 = require("./internalContexts/CurveLengthContext");
17
24
  /**
18
25
  * A curve primitive is bounded
19
26
  * A curve primitive maps fractions in 0..1 to points in space.
@@ -108,7 +115,7 @@ class CurvePrimitive extends GeometryQuery_1.GeometryQuery {
108
115
  * * Curve length is always positive.
109
116
  */
110
117
  curveLength() {
111
- const context = new CurveLengthContext();
118
+ const context = new CurveLengthContext_1.CurveLengthContext();
112
119
  this.emitStrokableParts(context);
113
120
  return context.getSum();
114
121
  }
@@ -128,7 +135,7 @@ class CurvePrimitive extends GeometryQuery_1.GeometryQuery {
128
135
  const totalLength = this.curveLength();
129
136
  return Math.abs((fraction1 - fraction0) * totalLength);
130
137
  }
131
- const context = new CurveLengthContext(fraction0, fraction1);
138
+ const context = new CurveLengthContext_1.CurveLengthContext(fraction0, fraction1);
132
139
  this.emitStrokableParts(context);
133
140
  return Math.abs(context.getSum());
134
141
  }
@@ -214,7 +221,7 @@ class CurvePrimitive extends GeometryQuery_1.GeometryQuery {
214
221
  fraction0 = fraction1;
215
222
  fraction1 = fSave;
216
223
  }
217
- const context = new CurveLengthContext(fraction0, fraction1, numGauss);
224
+ const context = new CurveLengthContext_1.CurveLengthContext(fraction0, fraction1, numGauss);
218
225
  context.announceIntervalForUniformStepStrokes(this, numInterval, fraction0, fraction1);
219
226
  return Math.abs(context.getSum());
220
227
  }
@@ -223,9 +230,8 @@ class CurvePrimitive extends GeometryQuery_1.GeometryQuery {
223
230
  * * (Attempt to) find a position on the curve at a signed distance from start fraction.
224
231
  * * Return the position as a CurveLocationDetail.
225
232
  * * In the `CurveLocationDetail`, record:
226
- * * `fractional` position
227
- * * `fraction` = coordinates of the point
228
- * * `search
233
+ * * `fraction` = fractional position
234
+ * * `point` = coordinates of the point
229
235
  * * `a` = (signed!) distance moved. If `allowExtension` is false and the move reached the start or end of the curve, this distance is smaller than the requested signedDistance.
230
236
  * * `curveSearchStatus` indicates one of:
231
237
  * * `error` (unusual) computation failed not supported for this curve.
@@ -280,13 +286,39 @@ class CurvePrimitive extends GeometryQuery_1.GeometryQuery {
280
286
  * @param result
281
287
  */
282
288
  moveSignedDistanceFromFractionGeneric(startFraction, signedDistance, allowExtension, result) {
283
- const limitFraction = signedDistance > 0.0 ? 1.0 : 0.0;
289
+ let limitFraction;
290
+ const slackFraction = 0.1; // slack to use when integration would otherwise have no room to work
291
+ if (signedDistance === 0.0)
292
+ return CurveLocationDetail_1.CurveLocationDetail.createCurveEvaluatedFraction(this, startFraction, result); // no movement, just evaluate at startFraction
293
+ if (signedDistance > 0.0) {
294
+ limitFraction = 1.0;
295
+ if (startFraction >= 1.0) {
296
+ const newStartFraction = 1.0 - slackFraction;
297
+ signedDistance += this.curveLengthBetweenFractions(newStartFraction, startFraction);
298
+ startFraction = newStartFraction;
299
+ }
300
+ }
301
+ else { // signedDistance < 0.0
302
+ limitFraction = 0.0;
303
+ if (startFraction <= 0.0) {
304
+ const newStartFraction = 0.0 + slackFraction;
305
+ signedDistance -= this.curveLengthBetweenFractions(startFraction, newStartFraction);
306
+ startFraction = newStartFraction;
307
+ }
308
+ }
309
+ const availableLength = this.curveLengthBetweenFractions(startFraction, limitFraction);
310
+ (0, core_bentley_1.assert)(availableLength > 0.0);
284
311
  const absDistance = Math.abs(signedDistance);
285
- const directionFactor = signedDistance < 0.0 ? -1.0 : 1.0;
286
- const availableLength = this.curveLengthBetweenFractions(startFraction, limitFraction); // that is always positive
287
312
  if (availableLength < absDistance && !allowExtension)
288
313
  return CurveLocationDetail_1.CurveLocationDetail.createConditionalMoveSignedDistance(allowExtension, this, startFraction, limitFraction, signedDistance, result);
289
- const fractionStep = absDistance / availableLength;
314
+ const fractionStep = Geometry_1.Geometry.conditionalDivideCoordinate(absDistance, availableLength);
315
+ if (undefined === fractionStep) {
316
+ // no available length!
317
+ result = CurveLocationDetail_1.CurveLocationDetail.createCurveEvaluatedFraction(this, startFraction, result);
318
+ result.curveSearchStatus = CurveLocationDetail_1.CurveSearchStatus.error;
319
+ return result;
320
+ }
321
+ const directionFactor = signedDistance < 0.0 ? -1.0 : 1.0;
290
322
  let fractionB = Geometry_1.Geometry.interpolate(startFraction, fractionStep, limitFraction);
291
323
  let fractionA = startFraction;
292
324
  let distanceA = 0.0;
@@ -321,9 +353,8 @@ class CurvePrimitive extends GeometryQuery_1.GeometryQuery {
321
353
  distanceA = distance0B;
322
354
  }
323
355
  if (numConverged > 1)
324
- return CurveLocationDetail_1.CurveLocationDetail.createConditionalMoveSignedDistance(false, this, startFraction, fractionB, signedDistance, result);
356
+ return CurveLocationDetail_1.CurveLocationDetail.createConditionalMoveSignedDistance(allowExtension, this, startFraction, fractionB, signedDistance, result);
325
357
  result = CurveLocationDetail_1.CurveLocationDetail.createCurveEvaluatedFraction(this, startFraction, result);
326
- result.a = 0.0;
327
358
  result.curveSearchStatus = CurveLocationDetail_1.CurveSearchStatus.error;
328
359
  return result;
329
360
  }
@@ -345,7 +376,7 @@ class CurvePrimitive extends GeometryQuery_1.GeometryQuery {
345
376
  * @returns Returns a CurveLocationDetail structure that holds the details of the close point.
346
377
  */
347
378
  closestPoint(spacePoint, extend) {
348
- const strokeHandler = new ClosestPointStrokeHandler(spacePoint, extend);
379
+ const strokeHandler = new ClosestPointStrokeHandler_1.ClosestPointStrokeHandler(spacePoint, extend);
349
380
  this.emitStrokableParts(strokeHandler);
350
381
  return strokeHandler.claimResult();
351
382
  }
@@ -367,7 +398,7 @@ class CurvePrimitive extends GeometryQuery_1.GeometryQuery {
367
398
  return undefined;
368
399
  }
369
400
  /**
370
- * * If the curve primitive has distance-along-curve strictly proportional to curve fraction, return true
401
+ * * If the curve primitive has distance-along-curve strictly proportional to curve fraction, return the scale factor.
371
402
  * * If distance-along-the-curve is not proportional, return undefined.
372
403
  * * When defined, the scale factor is always the length of the curve.
373
404
  * * This scale factor is typically available for these curve types:
@@ -392,7 +423,7 @@ class CurvePrimitive extends GeometryQuery_1.GeometryQuery {
392
423
  * @returns Return the number of CurveLocationDetail's added to the result array.
393
424
  */
394
425
  appendPlaneIntersectionPoints(plane, result) {
395
- const strokeHandler = new AppendPlaneIntersectionStrokeHandler(plane, result);
426
+ const strokeHandler = new AppendPlaneIntersectionStrokeHandler_1.AppendPlaneIntersectionStrokeHandler(plane, result);
396
427
  const n0 = result.length;
397
428
  this.emitStrokableParts(strokeHandler);
398
429
  return result.length - n0;
@@ -539,326 +570,14 @@ class CurvePrimitive extends GeometryQuery_1.GeometryQuery {
539
570
  this.collectCurvePrimitivesGo(results, smallestPossiblePrimitives, explodeLinestrings);
540
571
  return results;
541
572
  }
542
- }
543
- exports.CurvePrimitive = CurvePrimitive;
544
- /** Intermediate class for managing the parentCurve announcements from an IStrokeHandler */
545
- class NewtonRotRStrokeHandler extends Newton_1.NewtonEvaluatorRtoR {
546
- constructor() {
547
- super();
548
- this._parentCurvePrimitive = undefined;
549
- }
550
- /** retain the parentCurvePrimitive.
551
- * * Calling this method tells the handler that the parent curve is to be used for detail searches.
552
- * * Example: Transition spiral search is based on linestring first, then the exact spiral.
553
- * * Example: CurveChainWithDistanceIndex does NOT do this announcement -- the constituents act independently.
573
+ /** Project instance geometry (via dispatch) onto the given ray, and return the extreme fractional parameters of projection.
574
+ * @param ray ray onto which the instance is projected. A `Vector3d` is treated as a `Ray3d` with zero origin.
575
+ * @param lowHigh optional receiver for output
576
+ * @returns range of fractional projection parameters onto the ray, where 0.0 is start of the ray and 1.0 is the end of the ray.
554
577
  */
555
- startParentCurvePrimitive(curve) { this._parentCurvePrimitive = curve; }
556
- /** Forget the parentCurvePrimitive */
557
- endParentCurvePrimitive(_curve) { this._parentCurvePrimitive = undefined; }
558
- }
559
- class AppendPlaneIntersectionStrokeHandler extends NewtonRotRStrokeHandler {
560
- constructor(plane, intersections) {
561
- super();
562
- this._fractionA = 0;
563
- this._functionA = 0;
564
- // private derivativeA: number; <---- Not currently used
565
- this._functionB = 0;
566
- this._fractionB = 0;
567
- this._derivativeB = 0;
568
- this._numThisCurve = 0;
569
- this._plane = plane;
570
- this._intersections = intersections;
571
- this.startCurvePrimitive(undefined);
572
- this._ray = Ray3d_1.Ray3d.createZero();
573
- this._newtonSolver = new Newton_1.Newton1dUnboundedApproximateDerivative(this);
574
- }
575
- // Return the first defined curve among: this.parentCurvePrimitive, this.curve;
576
- effectiveCurve() {
577
- if (this._parentCurvePrimitive)
578
- return this._parentCurvePrimitive;
579
- return this._curve;
580
- }
581
- get getDerivativeB() { return this._derivativeB; } // <--- DerivativeB is not currently used anywhere. Provided getter to suppress lint error
582
- startCurvePrimitive(curve) {
583
- this._curve = curve;
584
- this._fractionA = 0.0;
585
- this._numThisCurve = 0;
586
- this._functionA = 0.0;
587
- // this.derivativeA = 0.0;
588
- }
589
- endCurvePrimitive() { }
590
- announceIntervalForUniformStepStrokes(cp, numStrokes, fraction0, fraction1) {
591
- this.startCurvePrimitive(cp);
592
- if (numStrokes < 1)
593
- numStrokes = 1;
594
- const df = 1.0 / numStrokes;
595
- for (let i = 0; i <= numStrokes; i++) {
596
- const fraction = Geometry_1.Geometry.interpolate(fraction0, i * df, fraction1);
597
- cp.fractionToPointAndDerivative(fraction, this._ray);
598
- this.announcePointTangent(this._ray.origin, fraction, this._ray.direction);
599
- }
600
- }
601
- announceSegmentInterval(_cp, point0, point1, _numStrokes, fraction0, fraction1) {
602
- const h0 = this._plane.altitude(point0);
603
- const h1 = this._plane.altitude(point1);
604
- if (h0 * h1 > 0.0)
605
- return;
606
- const fraction01 = BezierPolynomials_1.Order2Bezier.solveCoffs(h0, h1);
607
- // let numIntersection = 0;
608
- if (fraction01 !== undefined) {
609
- // numIntersection++;
610
- const fraction = Geometry_1.Geometry.interpolate(fraction0, fraction01, fraction1);
611
- this._newtonSolver.setX(fraction);
612
- if (this._newtonSolver.runIterations()) {
613
- this.announceSolutionFraction(this._newtonSolver.getX());
614
- }
615
- // this.intersections.push(CurveLocationDetail.createCurveFractionPoint(cp, fraction, cp.fractionToPoint(fraction)));
616
- }
617
- }
618
- announceSolutionFraction(fraction) {
619
- const curve = this.effectiveCurve();
620
- if (curve) {
621
- this._ray = curve.fractionToPointAndDerivative(fraction, this._ray);
622
- this._intersections.push(CurveLocationDetail_1.CurveLocationDetail.createCurveFractionPoint(curve, fraction, this._ray.origin));
623
- }
624
- }
625
- evaluate(fraction) {
626
- const curve = this.effectiveCurve();
627
- if (!curve)
628
- return false;
629
- this.currentF = this._plane.altitude(curve.fractionToPoint(fraction));
630
- return true;
631
- }
632
- /**
633
- * * ASSUME both the "A" and "B" evaluations (fraction, function, and derivative) are known.
634
- * * If function value changed sign between, interpolate an approximate root and improve it with
635
- * the newton solver.
636
- */
637
- searchInterval() {
638
- if (this._functionA * this._functionB > 0)
639
- return;
640
- if (this._functionA === 0)
641
- this.announceSolutionFraction(this._fractionA);
642
- if (this._functionB === 0)
643
- this.announceSolutionFraction(this._fractionB);
644
- if (this._functionA * this._functionB < 0) {
645
- const fraction = Geometry_1.Geometry.inverseInterpolate(this._fractionA, this._functionA, this._fractionB, this._functionB);
646
- if (fraction) {
647
- this._newtonSolver.setX(fraction);
648
- if (this._newtonSolver.runIterations())
649
- this.announceSolutionFraction(this._newtonSolver.getX());
650
- }
651
- }
652
- }
653
- /** Evaluate and save _functionB, _derivativeB, and _fractionB. */
654
- evaluateB(xyz, fraction, tangent) {
655
- this._functionB = this._plane.altitude(xyz);
656
- this._derivativeB = this._plane.velocity(tangent);
657
- this._fractionB = fraction;
658
- }
659
- /**
660
- * Announce point and tangent for evaluations.
661
- * * The function evaluation is saved as the "B" function point.
662
- * * The function point count is incremented
663
- * * If function point count is greater than 1, the current interval is searched.
664
- * * The just-evaluated point ("B") is saved as the "old" ("A") evaluation point.
665
- * @param xyz
666
- * @param fraction
667
- * @param tangent
668
- */
669
- announcePointTangent(xyz, fraction, tangent) {
670
- this.evaluateB(xyz, fraction, tangent);
671
- if (this._numThisCurve++ > 0)
672
- this.searchInterval();
673
- this._functionA = this._functionB;
674
- this._fractionA = this._fractionB;
675
- }
676
- }
677
- class CurveLengthContext {
678
- constructor(fraction0 = 0.0, fraction1 = 1.0, numGaussPoints = 5) {
679
- this.startCurvePrimitive(undefined);
680
- this._summedLength = 0.0;
681
- this._ray = Ray3d_1.Ray3d.createZero();
682
- if (fraction0 < fraction1) {
683
- this._fraction0 = fraction0;
684
- this._fraction1 = fraction1;
685
- }
686
- else {
687
- this._fraction0 = fraction1;
688
- this._fraction1 = fraction0;
689
- }
690
- this._gaussMapper = new Quadrature_1.GaussMapper(numGaussPoints);
691
- }
692
- tangentMagnitude(fraction) {
693
- this._ray = this._curve.fractionToPointAndDerivative(fraction, this._ray);
694
- return this._ray.direction.magnitude();
695
- }
696
- getSum() { return this._summedLength; }
697
- startCurvePrimitive(curve) {
698
- this._curve = curve;
699
- }
700
- startParentCurvePrimitive(_curve) { }
701
- endParentCurvePrimitive(_curve) { }
702
- endCurvePrimitive() { }
703
- announceIntervalForUniformStepStrokes(cp, numStrokes, fraction0, fraction1) {
704
- if (fraction0 < this._fraction0)
705
- fraction0 = this._fraction0;
706
- if (fraction1 > this._fraction1)
707
- fraction1 = this._fraction1;
708
- if (fraction1 > fraction0) {
709
- this.startCurvePrimitive(cp);
710
- if (numStrokes < 1)
711
- numStrokes = 1;
712
- const df = 1.0 / numStrokes;
713
- for (let i = 1; i <= numStrokes; i++) {
714
- const fractionA = Geometry_1.Geometry.interpolate(fraction0, (i - 1) * df, fraction1);
715
- const fractionB = i === numStrokes ? fraction1 : Geometry_1.Geometry.interpolate(fraction0, (i) * df, fraction1);
716
- const numGauss = this._gaussMapper.mapXAndW(fractionA, fractionB);
717
- for (let k = 0; k < numGauss; k++) {
718
- this._summedLength += this._gaussMapper.gaussW[k] * this.tangentMagnitude(this._gaussMapper.gaussX[k]);
719
- }
720
- }
721
- }
722
- }
723
- announceSegmentInterval(_cp, point0, point1, _numStrokes, fraction0, fraction1) {
724
- const segmentLength = point0.distance(point1);
725
- if (this._fraction0 <= fraction0 && fraction1 <= this._fraction1)
726
- this._summedLength += segmentLength;
727
- else {
728
- let g0 = fraction0;
729
- let g1 = fraction1;
730
- if (g0 < this._fraction0)
731
- g0 = this._fraction0;
732
- if (g1 > this._fraction1)
733
- g1 = this._fraction1;
734
- if (g1 > g0) {
735
- this._summedLength += segmentLength * (g1 - g0) / (fraction1 - fraction0);
736
- }
737
- }
738
- }
739
- announcePointTangent(_xyz, _fraction, _tangent) {
740
- // uh oh -- need to retain point for next interval
741
- }
742
- }
743
- // context for searching for closest point .. .
744
- class ClosestPointStrokeHandler extends NewtonRotRStrokeHandler {
745
- constructor(spacePoint, extend) {
746
- super();
747
- this._fractionA = 0;
748
- this._functionA = 0;
749
- this._functionB = 0;
750
- this._fractionB = 0;
751
- this._numThisCurve = 0;
752
- this._spacePoint = spacePoint;
753
- this._workPoint = Point3dVector3d_1.Point3d.create();
754
- this._workRay = Ray3d_1.Ray3d.createZero();
755
- this._closestPoint = undefined;
756
- this._extend = extend;
757
- this.startCurvePrimitive(undefined);
758
- this._newtonSolver = new Newton_1.Newton1dUnboundedApproximateDerivative(this);
759
- }
760
- claimResult() {
761
- if (this._closestPoint) {
762
- this._newtonSolver.setX(this._closestPoint.fraction);
763
- this._curve = this._closestPoint.curve;
764
- if (this._newtonSolver.runIterations()) {
765
- let fraction = this._newtonSolver.getX();
766
- fraction = CurveExtendMode_1.CurveExtendOptions.correctFraction(this._extend, fraction);
767
- this.announceSolutionFraction(fraction);
768
- }
769
- }
770
- return this._closestPoint;
771
- }
772
- needPrimaryGeometryForStrokes() { return true; }
773
- startCurvePrimitive(curve) {
774
- this._curve = curve;
775
- this._fractionA = 0.0;
776
- this._numThisCurve = 0;
777
- this._functionA = 0.0;
778
- }
779
- endCurvePrimitive() { }
780
- announceIntervalForUniformStepStrokes(cp, numStrokes, fraction0, fraction1) {
781
- this.startCurvePrimitive(cp);
782
- this.announceSolutionFraction(0.0); // test start point as closest
783
- this.announceSolutionFraction(1.0); // test end point as closest
784
- if (numStrokes < 1)
785
- numStrokes = 1;
786
- const df = 1.0 / numStrokes;
787
- for (let i = 0; i <= numStrokes; i++) {
788
- const fraction = Geometry_1.Geometry.interpolate(fraction0, i * df, fraction1);
789
- cp.fractionToPointAndDerivative(fraction, this._workRay);
790
- this.announceRay(fraction, this._workRay);
791
- }
792
- }
793
- announceCandidate(cp, fraction, point) {
794
- const distance = this._spacePoint.distance(point);
795
- if (this._closestPoint && distance > this._closestPoint.a)
796
- return;
797
- this._closestPoint = CurveLocationDetail_1.CurveLocationDetail.createCurveFractionPoint(cp, fraction, point, this._closestPoint);
798
- this._closestPoint.a = distance;
799
- if (this._parentCurvePrimitive !== undefined)
800
- this._closestPoint.curve = this._parentCurvePrimitive;
801
- }
802
- announceSegmentInterval(cp, point0, point1, _numStrokes, fraction0, fraction1) {
803
- let localFraction = this._spacePoint.fractionOfProjectionToLine(point0, point1, 0.0);
804
- // only consider extending the segment if the immediate caller says we are at endpoints ...
805
- if (!this._extend)
806
- localFraction = Geometry_1.Geometry.clampToStartEnd(localFraction, 0.0, 1.0);
807
- else {
808
- if (fraction0 !== 0.0)
809
- localFraction = Math.max(localFraction, 0.0);
810
- if (fraction1 !== 1.0)
811
- localFraction = Math.min(localFraction, 1.0);
812
- }
813
- this._workPoint = point0.interpolate(localFraction, point1);
814
- const globalFraction = Geometry_1.Geometry.interpolate(fraction0, localFraction, fraction1);
815
- this.announceCandidate(cp, globalFraction, this._workPoint);
816
- }
817
- searchInterval() {
818
- if (this._functionA * this._functionB > 0)
819
- return;
820
- if (this._functionA === 0)
821
- this.announceSolutionFraction(this._fractionA);
822
- if (this._functionB === 0)
823
- this.announceSolutionFraction(this._fractionB);
824
- if (this._functionA * this._functionB < 0) {
825
- const fraction = Geometry_1.Geometry.inverseInterpolate(this._fractionA, this._functionA, this._fractionB, this._functionB);
826
- if (fraction) {
827
- this._newtonSolver.setX(fraction);
828
- if (this._newtonSolver.runIterations())
829
- this.announceSolutionFraction(this._newtonSolver.getX());
830
- }
831
- }
832
- }
833
- evaluateB(fractionB, dataB) {
834
- this._functionB = dataB.dotProductToPoint(this._spacePoint);
835
- this._fractionB = fractionB;
836
- }
837
- announceSolutionFraction(fraction) {
838
- if (this._curve)
839
- this.announceCandidate(this._curve, fraction, this._curve.fractionToPoint(fraction));
840
- }
841
- evaluate(fraction) {
842
- let curve = this._curve;
843
- if (this._parentCurvePrimitive)
844
- curve = this._parentCurvePrimitive;
845
- if (curve) {
846
- this._workRay = curve.fractionToPointAndDerivative(fraction, this._workRay);
847
- this.currentF = this._workRay.dotProductToPoint(this._spacePoint);
848
- return true;
849
- }
850
- return false;
851
- }
852
- announceRay(fraction, data) {
853
- this.evaluateB(fraction, data);
854
- if (this._numThisCurve++ > 0)
855
- this.searchInterval();
856
- this._functionA = this._functionB;
857
- this._fractionA = this._fractionB;
858
- }
859
- announcePointTangent(point, fraction, tangent) {
860
- this._workRay.set(point, tangent);
861
- this.announceRay(fraction, this._workRay);
578
+ projectedParameterRange(_ray, _lowHigh) {
579
+ return undefined; // common implementation delegated to subclasses to avoid circular dependency
862
580
  }
863
581
  }
582
+ exports.CurvePrimitive = CurvePrimitive;
864
583
  //# sourceMappingURL=CurvePrimitive.js.map