@itwin/core-geometry 3.0.0-extension.0 → 3.1.0-dev.11

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 (213) hide show
  1. package/CHANGELOG.md +80 -1
  2. package/LICENSE.md +1 -1
  3. package/lib/cjs/Geometry.d.ts +6 -0
  4. package/lib/cjs/Geometry.d.ts.map +1 -1
  5. package/lib/cjs/Geometry.js.map +1 -1
  6. package/lib/cjs/bspline/BSplineCurve.d.ts +4 -0
  7. package/lib/cjs/bspline/BSplineCurve.d.ts.map +1 -1
  8. package/lib/cjs/bspline/BSplineCurve.js +39 -0
  9. package/lib/cjs/bspline/BSplineCurve.js.map +1 -1
  10. package/lib/cjs/bspline/BSplineCurveOps.d.ts +7 -0
  11. package/lib/cjs/bspline/BSplineCurveOps.d.ts.map +1 -1
  12. package/lib/cjs/bspline/BSplineCurveOps.js +21 -6
  13. package/lib/cjs/bspline/BSplineCurveOps.js.map +1 -1
  14. package/lib/cjs/bspline/BezierCurve3dH.d.ts.map +1 -1
  15. package/lib/cjs/bspline/BezierCurve3dH.js +7 -3
  16. package/lib/cjs/bspline/BezierCurve3dH.js.map +1 -1
  17. package/lib/cjs/bspline/InterpolationCurve3d.d.ts.map +1 -1
  18. package/lib/cjs/bspline/InterpolationCurve3d.js +12 -5
  19. package/lib/cjs/bspline/InterpolationCurve3d.js.map +1 -1
  20. package/lib/cjs/bspline/KnotVector.d.ts +2 -2
  21. package/lib/cjs/bspline/KnotVector.d.ts.map +1 -1
  22. package/lib/cjs/bspline/KnotVector.js +2 -2
  23. package/lib/cjs/bspline/KnotVector.js.map +1 -1
  24. package/lib/cjs/clipping/BooleanClipNode.d.ts +10 -5
  25. package/lib/cjs/clipping/BooleanClipNode.d.ts.map +1 -1
  26. package/lib/cjs/clipping/BooleanClipNode.js +13 -3
  27. package/lib/cjs/clipping/BooleanClipNode.js.map +1 -1
  28. package/lib/cjs/clipping/ClipPlane.d.ts +12 -0
  29. package/lib/cjs/clipping/ClipPlane.d.ts.map +1 -1
  30. package/lib/cjs/clipping/ClipPlane.js +12 -0
  31. package/lib/cjs/clipping/ClipPlane.js.map +1 -1
  32. package/lib/cjs/clipping/ClipUtils.d.ts +57 -9
  33. package/lib/cjs/clipping/ClipUtils.d.ts.map +1 -1
  34. package/lib/cjs/clipping/ClipUtils.js +191 -2
  35. package/lib/cjs/clipping/ClipUtils.js.map +1 -1
  36. package/lib/cjs/clipping/ClipVector.d.ts +7 -3
  37. package/lib/cjs/clipping/ClipVector.d.ts.map +1 -1
  38. package/lib/cjs/clipping/ClipVector.js +9 -4
  39. package/lib/cjs/clipping/ClipVector.js.map +1 -1
  40. package/lib/cjs/clipping/ConvexClipPlaneSet.d.ts +1 -1
  41. package/lib/cjs/clipping/ConvexClipPlaneSet.d.ts.map +1 -1
  42. package/lib/cjs/clipping/ConvexClipPlaneSet.js +4 -3
  43. package/lib/cjs/clipping/ConvexClipPlaneSet.js.map +1 -1
  44. package/lib/cjs/curve/CurveChainWithDistanceIndex.d.ts +1 -1
  45. package/lib/cjs/curve/CurveChainWithDistanceIndex.d.ts.map +1 -1
  46. package/lib/cjs/curve/CurveChainWithDistanceIndex.js +2 -3
  47. package/lib/cjs/curve/CurveChainWithDistanceIndex.js.map +1 -1
  48. package/lib/cjs/curve/CurveFactory.d.ts +12 -0
  49. package/lib/cjs/curve/CurveFactory.d.ts.map +1 -1
  50. package/lib/cjs/curve/CurveFactory.js +25 -0
  51. package/lib/cjs/curve/CurveFactory.js.map +1 -1
  52. package/lib/cjs/curve/CurvePrimitive.js +3 -0
  53. package/lib/cjs/curve/CurvePrimitive.js.map +1 -1
  54. package/lib/cjs/curve/spiral/DirectSpiral3d.js +2 -2
  55. package/lib/cjs/curve/spiral/DirectSpiral3d.js.map +1 -1
  56. package/lib/cjs/curve/spiral/NormalizedTransition.d.ts +0 -1
  57. package/lib/cjs/curve/spiral/NormalizedTransition.d.ts.map +1 -1
  58. package/lib/cjs/curve/spiral/NormalizedTransition.js +0 -1
  59. package/lib/cjs/curve/spiral/NormalizedTransition.js.map +1 -1
  60. package/lib/cjs/geometry3d/FrameBuilder.d.ts.map +1 -1
  61. package/lib/cjs/geometry3d/FrameBuilder.js +20 -1
  62. package/lib/cjs/geometry3d/FrameBuilder.js.map +1 -1
  63. package/lib/cjs/geometry3d/Plane3dByOriginAndUnitNormal.d.ts +12 -0
  64. package/lib/cjs/geometry3d/Plane3dByOriginAndUnitNormal.d.ts.map +1 -1
  65. package/lib/cjs/geometry3d/Plane3dByOriginAndUnitNormal.js +12 -0
  66. package/lib/cjs/geometry3d/Plane3dByOriginAndUnitNormal.js.map +1 -1
  67. package/lib/cjs/geometry3d/Point3dVector3d.d.ts +1 -11
  68. package/lib/cjs/geometry3d/Point3dVector3d.d.ts.map +1 -1
  69. package/lib/cjs/geometry3d/Point3dVector3d.js +5 -25
  70. package/lib/cjs/geometry3d/Point3dVector3d.js.map +1 -1
  71. package/lib/cjs/geometry3d/PolygonOps.d.ts +2 -0
  72. package/lib/cjs/geometry3d/PolygonOps.d.ts.map +1 -1
  73. package/lib/cjs/geometry3d/PolygonOps.js +7 -0
  74. package/lib/cjs/geometry3d/PolygonOps.js.map +1 -1
  75. package/lib/cjs/geometry3d/PolylineOps.d.ts +5 -0
  76. package/lib/cjs/geometry3d/PolylineOps.d.ts.map +1 -1
  77. package/lib/cjs/geometry3d/PolylineOps.js +21 -0
  78. package/lib/cjs/geometry3d/PolylineOps.js.map +1 -1
  79. package/lib/cjs/geometry3d/Ray3d.d.ts +10 -0
  80. package/lib/cjs/geometry3d/Ray3d.d.ts.map +1 -1
  81. package/lib/cjs/geometry3d/Ray3d.js +23 -0
  82. package/lib/cjs/geometry3d/Ray3d.js.map +1 -1
  83. package/lib/cjs/geometry3d/Transform.d.ts +5 -0
  84. package/lib/cjs/geometry3d/Transform.d.ts.map +1 -1
  85. package/lib/cjs/geometry3d/Transform.js +7 -0
  86. package/lib/cjs/geometry3d/Transform.js.map +1 -1
  87. package/lib/cjs/geometry4d/Point4d.d.ts +12 -0
  88. package/lib/cjs/geometry4d/Point4d.d.ts.map +1 -1
  89. package/lib/cjs/geometry4d/Point4d.js +12 -0
  90. package/lib/cjs/geometry4d/Point4d.js.map +1 -1
  91. package/lib/cjs/serialization/GeometrySamples.d.ts +7 -0
  92. package/lib/cjs/serialization/GeometrySamples.d.ts.map +1 -1
  93. package/lib/cjs/serialization/GeometrySamples.js +27 -0
  94. package/lib/cjs/serialization/GeometrySamples.js.map +1 -1
  95. package/lib/cjs/topology/HalfEdgeNodeXYZUV.d.ts +2 -0
  96. package/lib/cjs/topology/HalfEdgeNodeXYZUV.d.ts.map +1 -1
  97. package/lib/cjs/topology/HalfEdgeNodeXYZUV.js +4 -0
  98. package/lib/cjs/topology/HalfEdgeNodeXYZUV.js.map +1 -1
  99. package/lib/cjs/topology/HalfEdgePointInGraphSearch.js +1 -0
  100. package/lib/cjs/topology/HalfEdgePointInGraphSearch.js.map +1 -1
  101. package/lib/cjs/topology/HalfEdgePositionDetail.d.ts +17 -4
  102. package/lib/cjs/topology/HalfEdgePositionDetail.d.ts.map +1 -1
  103. package/lib/cjs/topology/HalfEdgePositionDetail.js +26 -5
  104. package/lib/cjs/topology/HalfEdgePositionDetail.js.map +1 -1
  105. package/lib/cjs/topology/InsertAndRetriangulateContext.d.ts.map +1 -1
  106. package/lib/cjs/topology/InsertAndRetriangulateContext.js +28 -2
  107. package/lib/cjs/topology/InsertAndRetriangulateContext.js.map +1 -1
  108. package/lib/esm/Geometry.d.ts +6 -0
  109. package/lib/esm/Geometry.d.ts.map +1 -1
  110. package/lib/esm/Geometry.js.map +1 -1
  111. package/lib/esm/bspline/BSplineCurve.d.ts +4 -0
  112. package/lib/esm/bspline/BSplineCurve.d.ts.map +1 -1
  113. package/lib/esm/bspline/BSplineCurve.js +39 -0
  114. package/lib/esm/bspline/BSplineCurve.js.map +1 -1
  115. package/lib/esm/bspline/BSplineCurveOps.d.ts +7 -0
  116. package/lib/esm/bspline/BSplineCurveOps.d.ts.map +1 -1
  117. package/lib/esm/bspline/BSplineCurveOps.js +21 -6
  118. package/lib/esm/bspline/BSplineCurveOps.js.map +1 -1
  119. package/lib/esm/bspline/BezierCurve3dH.d.ts.map +1 -1
  120. package/lib/esm/bspline/BezierCurve3dH.js +7 -3
  121. package/lib/esm/bspline/BezierCurve3dH.js.map +1 -1
  122. package/lib/esm/bspline/InterpolationCurve3d.d.ts.map +1 -1
  123. package/lib/esm/bspline/InterpolationCurve3d.js +12 -5
  124. package/lib/esm/bspline/InterpolationCurve3d.js.map +1 -1
  125. package/lib/esm/bspline/KnotVector.d.ts +2 -2
  126. package/lib/esm/bspline/KnotVector.d.ts.map +1 -1
  127. package/lib/esm/bspline/KnotVector.js +2 -2
  128. package/lib/esm/bspline/KnotVector.js.map +1 -1
  129. package/lib/esm/clipping/BooleanClipNode.d.ts +10 -5
  130. package/lib/esm/clipping/BooleanClipNode.d.ts.map +1 -1
  131. package/lib/esm/clipping/BooleanClipNode.js +13 -3
  132. package/lib/esm/clipping/BooleanClipNode.js.map +1 -1
  133. package/lib/esm/clipping/ClipPlane.d.ts +12 -0
  134. package/lib/esm/clipping/ClipPlane.d.ts.map +1 -1
  135. package/lib/esm/clipping/ClipPlane.js +12 -0
  136. package/lib/esm/clipping/ClipPlane.js.map +1 -1
  137. package/lib/esm/clipping/ClipUtils.d.ts +57 -9
  138. package/lib/esm/clipping/ClipUtils.d.ts.map +1 -1
  139. package/lib/esm/clipping/ClipUtils.js +191 -2
  140. package/lib/esm/clipping/ClipUtils.js.map +1 -1
  141. package/lib/esm/clipping/ClipVector.d.ts +7 -3
  142. package/lib/esm/clipping/ClipVector.d.ts.map +1 -1
  143. package/lib/esm/clipping/ClipVector.js +9 -4
  144. package/lib/esm/clipping/ClipVector.js.map +1 -1
  145. package/lib/esm/clipping/ConvexClipPlaneSet.d.ts +1 -1
  146. package/lib/esm/clipping/ConvexClipPlaneSet.d.ts.map +1 -1
  147. package/lib/esm/clipping/ConvexClipPlaneSet.js +4 -3
  148. package/lib/esm/clipping/ConvexClipPlaneSet.js.map +1 -1
  149. package/lib/esm/curve/CurveChainWithDistanceIndex.d.ts +1 -1
  150. package/lib/esm/curve/CurveChainWithDistanceIndex.d.ts.map +1 -1
  151. package/lib/esm/curve/CurveChainWithDistanceIndex.js +2 -3
  152. package/lib/esm/curve/CurveChainWithDistanceIndex.js.map +1 -1
  153. package/lib/esm/curve/CurveFactory.d.ts +12 -0
  154. package/lib/esm/curve/CurveFactory.d.ts.map +1 -1
  155. package/lib/esm/curve/CurveFactory.js +25 -0
  156. package/lib/esm/curve/CurveFactory.js.map +1 -1
  157. package/lib/esm/curve/CurvePrimitive.js +3 -0
  158. package/lib/esm/curve/CurvePrimitive.js.map +1 -1
  159. package/lib/esm/curve/spiral/DirectSpiral3d.js +2 -2
  160. package/lib/esm/curve/spiral/DirectSpiral3d.js.map +1 -1
  161. package/lib/esm/curve/spiral/NormalizedTransition.d.ts +0 -1
  162. package/lib/esm/curve/spiral/NormalizedTransition.d.ts.map +1 -1
  163. package/lib/esm/curve/spiral/NormalizedTransition.js +0 -1
  164. package/lib/esm/curve/spiral/NormalizedTransition.js.map +1 -1
  165. package/lib/esm/geometry3d/FrameBuilder.d.ts.map +1 -1
  166. package/lib/esm/geometry3d/FrameBuilder.js +20 -1
  167. package/lib/esm/geometry3d/FrameBuilder.js.map +1 -1
  168. package/lib/esm/geometry3d/Plane3dByOriginAndUnitNormal.d.ts +12 -0
  169. package/lib/esm/geometry3d/Plane3dByOriginAndUnitNormal.d.ts.map +1 -1
  170. package/lib/esm/geometry3d/Plane3dByOriginAndUnitNormal.js +12 -0
  171. package/lib/esm/geometry3d/Plane3dByOriginAndUnitNormal.js.map +1 -1
  172. package/lib/esm/geometry3d/Point3dVector3d.d.ts +1 -11
  173. package/lib/esm/geometry3d/Point3dVector3d.d.ts.map +1 -1
  174. package/lib/esm/geometry3d/Point3dVector3d.js +5 -25
  175. package/lib/esm/geometry3d/Point3dVector3d.js.map +1 -1
  176. package/lib/esm/geometry3d/PolygonOps.d.ts +2 -0
  177. package/lib/esm/geometry3d/PolygonOps.d.ts.map +1 -1
  178. package/lib/esm/geometry3d/PolygonOps.js +7 -0
  179. package/lib/esm/geometry3d/PolygonOps.js.map +1 -1
  180. package/lib/esm/geometry3d/PolylineOps.d.ts +5 -0
  181. package/lib/esm/geometry3d/PolylineOps.d.ts.map +1 -1
  182. package/lib/esm/geometry3d/PolylineOps.js +21 -0
  183. package/lib/esm/geometry3d/PolylineOps.js.map +1 -1
  184. package/lib/esm/geometry3d/Ray3d.d.ts +10 -0
  185. package/lib/esm/geometry3d/Ray3d.d.ts.map +1 -1
  186. package/lib/esm/geometry3d/Ray3d.js +23 -0
  187. package/lib/esm/geometry3d/Ray3d.js.map +1 -1
  188. package/lib/esm/geometry3d/Transform.d.ts +5 -0
  189. package/lib/esm/geometry3d/Transform.d.ts.map +1 -1
  190. package/lib/esm/geometry3d/Transform.js +7 -0
  191. package/lib/esm/geometry3d/Transform.js.map +1 -1
  192. package/lib/esm/geometry4d/Point4d.d.ts +12 -0
  193. package/lib/esm/geometry4d/Point4d.d.ts.map +1 -1
  194. package/lib/esm/geometry4d/Point4d.js +12 -0
  195. package/lib/esm/geometry4d/Point4d.js.map +1 -1
  196. package/lib/esm/serialization/GeometrySamples.d.ts +7 -0
  197. package/lib/esm/serialization/GeometrySamples.d.ts.map +1 -1
  198. package/lib/esm/serialization/GeometrySamples.js +27 -0
  199. package/lib/esm/serialization/GeometrySamples.js.map +1 -1
  200. package/lib/esm/topology/HalfEdgeNodeXYZUV.d.ts +2 -0
  201. package/lib/esm/topology/HalfEdgeNodeXYZUV.d.ts.map +1 -1
  202. package/lib/esm/topology/HalfEdgeNodeXYZUV.js +4 -0
  203. package/lib/esm/topology/HalfEdgeNodeXYZUV.js.map +1 -1
  204. package/lib/esm/topology/HalfEdgePointInGraphSearch.js +1 -0
  205. package/lib/esm/topology/HalfEdgePointInGraphSearch.js.map +1 -1
  206. package/lib/esm/topology/HalfEdgePositionDetail.d.ts +17 -4
  207. package/lib/esm/topology/HalfEdgePositionDetail.d.ts.map +1 -1
  208. package/lib/esm/topology/HalfEdgePositionDetail.js +26 -5
  209. package/lib/esm/topology/HalfEdgePositionDetail.js.map +1 -1
  210. package/lib/esm/topology/InsertAndRetriangulateContext.d.ts.map +1 -1
  211. package/lib/esm/topology/InsertAndRetriangulateContext.js +28 -2
  212. package/lib/esm/topology/InsertAndRetriangulateContext.js.map +1 -1
  213. package/package.json +8 -9
@@ -1 +1 @@
1
- {"version":3,"file":"CurvePrimitive.js","sourceRoot":"","sources":["../../../src/curve/CurvePrimitive.ts"],"names":[],"mappings":"AASA,OAAO,EAAE,cAAc,EAAE,MAAM,+BAA+B,CAAC;AAC/D,OAAO,EAAE,SAAS,EAAE,QAAQ,EAA0B,MAAM,aAAa,CAAC;AAQ1E,OAAO,EAAE,QAAQ,EAAE,MAAM,wBAAwB,CAAC;AAGlD,OAAO,EAAE,OAAO,EAAY,MAAM,+BAA+B,CAAC;AAClE,OAAO,EAAE,KAAK,EAAE,MAAM,qBAAqB,CAAC;AAC5C,OAAO,EAAE,SAAS,EAAE,MAAM,yBAAyB,CAAC;AACpD,OAAO,EAAE,YAAY,EAAE,MAAM,+BAA+B,CAAC;AAC7D,OAAO,EAAE,sCAAsC,EAAE,mBAAmB,EAAE,MAAM,oBAAoB,CAAC;AACjG,OAAO,EAAE,WAAW,EAAE,MAAM,wBAAwB,CAAC;AAErD,OAAO,EAAE,kBAAkB,EAA+B,MAAM,mBAAmB,CAAC;AACpF,OAAO,EAAE,iBAAiB,EAAE,mBAAmB,EAAE,iBAAiB,EAAE,MAAM,uBAAuB,CAAC;AAClG,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAoChD;;;;;;;;;;;;;GAaG;AACH,MAAM,OAAgB,cAAe,SAAQ,aAAa;IAMxD;QAA0B,KAAK,EAAE,CAAC;QALlC,wCAAwC;QACxB,qBAAgB,GAAG,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AwB,CAAC,QAAgB;QAC/C,IAAI,IAAI,CAAC,MAAM;YACb,IAAI,CAAC,iBAAiB,CAAC,IAAI,CAAC,MAAM,EAAE,QAAQ,EAAE,IAAI,CAAC,MAAM,CAAC,eAAe,CAAC,QAAQ,CAAC,CAAC,CAAC;IACzF,CAAC;IACM,QAAQ,CAAC,QAAgB;QAC9B,IAAI,KAAK,GAAG,IAAI,CAAC,MAAM,CAAC;QACxB,IAAI,IAAI,CAAC,qBAAqB;YAC5B,KAAK,GAAG,IAAI,CAAC,qBAAqB,CAAC;QACrC,IAAI,KAAK,EAAE;YACT,IAAI,CAAC,QAAQ,GAAG,KAAK,CAAC,4BAA4B,CAAC,QAAQ,EAAE,IAAI,CAAC,QAAQ,CAAC,CAAC;YAC5E,IAAI,CAAC,QAAQ,GAAG,IAAI,CAAC,QAAQ,CAAC,iBAAiB,CAAC,IAAI,CAAC,WAAW,CAAC,CAAC;YAClE,OAAO,IAAI,CAAC;SACb;QACD,OAAO,KAAK,CAAC;IACf,CAAC;IACM,WAAW,CAAC,QAAgB,EAAE,IAAW;QAC9C,IAAI,CAAC,SAAS,CAAC,QAAQ,EAAE,IAAI,CAAC,CAAC;QAC/B,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;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","sourcesContent":["/*---------------------------------------------------------------------------------------------\r\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\r\n* See LICENSE.md in the project root for license terms and full copyright notice.\r\n*--------------------------------------------------------------------------------------------*/\r\n/** @packageDocumentation\r\n * @module Curve\r\n */\r\nimport { InterpolationCurve3d } from \"../bspline/InterpolationCurve3d\";\r\nimport { Clipper } from \"../clipping/ClipUtils\";\r\nimport { StrokeCountMap } from \"../curve/Query/StrokeCountMap\";\r\nimport { AxisOrder, Geometry, PlaneAltitudeEvaluator } from \"../Geometry\";\r\nimport { AkimaCurve3d } from \"../bspline/AkimaCurve3d\";\r\nimport { BSplineCurve3d } from \"../bspline/BSplineCurve\";\r\nimport { BezierCurve3d } from \"../bspline/BezierCurve3d\";\r\nimport { CurveChainWithDistanceIndex } from \"./CurveChainWithDistanceIndex\";\r\nimport { DirectSpiral3d } from \"./spiral/DirectSpiral3d\";\r\nimport { IntegratedSpiral3d } from \"./spiral/IntegratedSpiral3d\";\r\nimport { IStrokeHandler } from \"../geometry3d/GeometryHandler\";\r\nimport { Matrix3d } from \"../geometry3d/Matrix3d\";\r\nimport { Plane3dByOriginAndUnitNormal } from \"../geometry3d/Plane3dByOriginAndUnitNormal\";\r\nimport { Plane3dByOriginAndVectors } from \"../geometry3d/Plane3dByOriginAndVectors\";\r\nimport { Point3d, Vector3d } from \"../geometry3d/Point3dVector3d\";\r\nimport { Ray3d } from \"../geometry3d/Ray3d\";\r\nimport { Transform } from \"../geometry3d/Transform\";\r\nimport { Order2Bezier } from \"../numerics/BezierPolynomials\";\r\nimport { Newton1dUnboundedApproximateDerivative, NewtonEvaluatorRtoR } from \"../numerics/Newton\";\r\nimport { GaussMapper } from \"../numerics/Quadrature\";\r\nimport { Arc3d } from \"./Arc3d\";\r\nimport { CurveExtendOptions, VariantCurveExtendParameter } from \"./CurveExtendMode\";\r\nimport { CurveIntervalRole, CurveLocationDetail, CurveSearchStatus } from \"./CurveLocationDetail\";\r\nimport { GeometryQuery } from \"./GeometryQuery\";\r\nimport { LineSegment3d } from \"./LineSegment3d\";\r\nimport { LineString3d } from \"./LineString3d\";\r\nimport { StrokeOptions } from \"./StrokeOptions\";\r\n\r\n/** Describes the concrete type of a [[CurvePrimitive]]. Each type name maps to a specific subclass and can be used for type-switching in conditional statements.\r\n * - \"arc\" => [[Arc3d]]\r\n * - \"lineSegment\" => [[LineSegment3d]]\r\n * - \"lineString\" => [[LineString3d]]\r\n * - \"bsplineCurve\" => [[BSplineCurve3dBase]] which is an intermediate class implemented by [[BSplineCurve3d]] and [[BSplineCurve3dH]]\r\n * - \"bezierCurve\" => [[BezierCurveBase]] which is an intermediate class implemented by [[BezierCurve3d]] and [[BezierCurve3dH]]\r\n * - \"transitionSpiral\" => [[TransitionSpiral3d]]\r\n * - \"curveChainWithDistanceIndex\" => [[CurveChainWithDistanceIndex]]\r\n * @see [[AnyCurvePrimitive]] for a union type that supports compile-time type narrowing.\r\n * @public\r\n */\r\nexport type CurvePrimitiveType = \"arc\" | \"lineSegment\" | \"lineString\" | \"bsplineCurve\" | \"bezierCurve\" | \"transitionSpiral\" | \"curveChainWithDistanceIndex\" | \"interpolationCurve\" | \"akimaCurve\";\r\n\r\n/** Union type for subclasses of [[CurvePrimitive]]. Specific subclasses can be discriminated at compile- or run-time using [[CurvePrimitive.curvePrimitiveType]].\r\n * @public\r\n */\r\nexport type AnyCurvePrimitive = Arc3d | LineSegment3d | LineString3d | BSplineCurve3d | BezierCurve3d | DirectSpiral3d | IntegratedSpiral3d | CurveChainWithDistanceIndex | InterpolationCurve3d | AkimaCurve3d;\r\n\r\n/** function signature for callback which announces a pair of numbers, such as a fractional interval, along with a containing CurvePrimitive.\r\n * @public\r\n */\r\nexport type AnnounceNumberNumberCurvePrimitive = (a0: number, a1: number, cp: CurvePrimitive) => void;\r\n/** Function signature for a callback which announces a pair of numbers\r\n * @public\r\n */\r\n\r\nexport type AnnounceNumberNumber = (a0: number, a1: number) => void;\r\n/** Function signature for a callback which announces a curve primitive\r\n * @public\r\n */\r\nexport type AnnounceCurvePrimitive = (cp: CurvePrimitive) => void;\r\n/**\r\n * A curve primitive is bounded\r\n * A curve primitive maps fractions in 0..1 to points in space.\r\n * As the fraction proceeds from 0 towards 1, the point moves \"forward\" along the curve.\r\n * True distance along the curve is not always strictly proportional to fraction.\r\n * * LineSegment3d always has proportional fraction and distance\r\n * * an Arc3d which is true circular has proportional fraction and distance\r\n * * A LineString3d is not proportional (except for special case of all segments of equal length)\r\n * * A Spiral3d is proportional\r\n * * A BsplineCurve3d is only proportional for special cases.\r\n *\r\n * For fractions outside 0..1, the curve primitive class may either (a) return the near endpoint or (b) evaluate an extended curve.\r\n * @public\r\n */\r\nexport abstract class CurvePrimitive extends GeometryQuery {\r\n /** String name for schema properties */\r\n public readonly geometryCategory = \"curvePrimitive\";\r\n /** String name for schema properties */\r\n public abstract readonly curvePrimitiveType: CurvePrimitiveType;\r\n\r\n protected constructor() { super(); }\r\n /**\r\n * data attached during stroking for facets.\r\n */\r\n public strokeData?: StrokeCountMap;\r\n /**\r\n * data attached in curve cutting.\r\n * @internal\r\n */\r\n public startCut?: CurveLocationDetail;\r\n /**\r\n * data attached in curve cutting.\r\n * @internal\r\n */\r\n public endCut?: CurveLocationDetail;\r\n /**\r\n * data attached by various algorithms (e.g. Region booleans)\r\n */\r\n public parent?: any;\r\n\r\n /** Return the point (x,y,z) on the curve at fractional position.\r\n * @param fraction fractional position along the geometry.\r\n * @returns Returns a point on the curve.\r\n */\r\n public abstract fractionToPoint(fraction: number, result?: Point3d): Point3d;\r\n /** Return the point (x,y,z) and derivative on the curve at fractional position.\r\n *\r\n * * Note that this derivative is \"derivative of xyz with respect to fraction.\"\r\n * * this derivative shows the speed of the \"fractional point\" moving along the curve.\r\n * * this is not generally a unit vector. use fractionToPointAndUnitTangent for a unit vector.\r\n * @param fraction fractional position along the geometry.\r\n * @returns Returns a ray whose origin is the curve point and direction is the derivative with respect to the fraction.\r\n */\r\n public abstract fractionToPointAndDerivative(fraction: number, result?: Ray3d): Ray3d;\r\n /**\r\n * Returns a ray whose origin is the curve point and direction is the unit tangent.\r\n * @param fraction fractional position on the curve\r\n * @param result optional preallocated ray.\r\n */\r\n public fractionToPointAndUnitTangent(fraction: number, result?: Ray3d): Ray3d {\r\n const ray = this.fractionToPointAndDerivative(fraction, result);\r\n ray.trySetDirectionMagnitudeInPlace(1.0);\r\n return ray;\r\n }\r\n /**\r\n * Returns the (absolute) curvature magnitude.\r\n * * Base implementation in CurvePrimitive computes curvature from the first and second derivative vectors.\r\n * @param fraction fractional position on the curve\r\n */\r\n public fractionToCurvature(fraction: number): number | undefined {\r\n const data = this.fractionToPointAnd2Derivatives(fraction)!;\r\n const cross = data.vectorU.crossProduct(data.vectorV);\r\n const a = cross.magnitude();\r\n const b = data.vectorU.magnitude();\r\n return Geometry.conditionalDivideFraction(a, b * b * b);\r\n }\r\n\r\n /** Return a plane with\r\n *\r\n * * origin at fractional position along the curve\r\n * * vectorU is the first derivative, i.e. tangent vector with length equal to the rate of change with respect to the fraction.\r\n * * vectorV is the second derivative, i.e.derivative of vectorU.\r\n */\r\n public abstract fractionToPointAnd2Derivatives(fraction: number, result?: Plane3dByOriginAndVectors): Plane3dByOriginAndVectors | undefined;\r\n\r\n /** Construct a frenet frame:\r\n * * origin at the point on the curve\r\n * * x axis is unit vector along the curve (tangent)\r\n * * y axis is perpendicular and in the plane of the osculating circle.\r\n * * z axis perpendicular to those.\r\n */\r\n public fractionToFrenetFrame(fraction: number, result?: Transform): Transform | undefined {\r\n const plane = this.fractionToPointAnd2Derivatives(fraction);\r\n if (!plane) return undefined;\r\n let axes = Matrix3d.createRigidFromColumns(plane.vectorU, plane.vectorV, AxisOrder.XYZ);\r\n if (axes)\r\n return Transform.createRefs(plane.origin, axes, result);\r\n // 2nd derivative not distinct -- do arbitrary headsUP ...\r\n const perpVector = Matrix3d.createPerpendicularVectorFavorXYPlane(plane.vectorU, plane.vectorV);\r\n axes = Matrix3d.createRigidFromColumns(plane.vectorU, perpVector, AxisOrder.XYZ);\r\n if (axes)\r\n return Transform.createRefs(plane.origin, axes, result);\r\n return undefined;\r\n }\r\n\r\n /**\r\n * Construct a point extrapolated along tangent at fraction.\r\n * @param fraction fractional position on the primitive\r\n * @param distance (signed) distance to move on the tangent.\r\n */\r\n public fractionAndDistanceToPointOnTangent(fraction: number, distance: number): Point3d {\r\n const ray = this.fractionToPointAndUnitTangent(fraction);\r\n return ray.fractionToPoint(distance);\r\n }\r\n\r\n /**\r\n * return the length of the curve.\r\n * * Curve length is always positive.\r\n */\r\n public curveLength(): number {\r\n const context = new CurveLengthContext();\r\n this.emitStrokableParts(context);\r\n return context.getSum();\r\n }\r\n /**\r\n * Returns a (high accuracy) length of the curve between fractional positions\r\n * * Curve length is always positive.\r\n * * Default implementation applies a generic gaussian integration.\r\n * * Most curve classes (certainly LineSegment, LineString, Arc) are expected to provide efficient implementations.\r\n */\r\n public curveLengthBetweenFractions(fraction0: number, fraction1: number): number {\r\n if (fraction0 === fraction1)\r\n return 0.0;\r\n const scale = this.getFractionToDistanceScale();\r\n if (scale !== undefined) {\r\n // We are in luck! simple proportions determine it all !!!\r\n // (for example, a LineSegment3d or a circular arc)\r\n const totalLength = this.curveLength();\r\n return Math.abs((fraction1 - fraction0) * totalLength);\r\n }\r\n const context = new CurveLengthContext(fraction0, fraction1);\r\n this.emitStrokableParts(context);\r\n return Math.abs(context.getSum());\r\n }\r\n\r\n /**\r\n *\r\n * * Run an integration (with a default gaussian quadrature) with a fixed fractional step\r\n * * This is typically called by specific curve type implementations of curveLengthBetweenFractions.\r\n * * For example, in Arc3d implementation of curveLengthBetweenFractions:\r\n * * If the Arc3d is true circular, it the arc is true circular, use the direct `arcLength = radius * sweepRadians`\r\n * * If the Arc3d is not true circular, call this method with an interval count appropriate to eccentricity and sweepRadians.\r\n * @returns Returns an integral estimated by numerical quadrature between the fractional positions.\r\n * @param fraction0 start fraction for integration\r\n * @param fraction1 end fraction for integration\r\n * @param numInterval number of quadrature intervals\r\n */\r\n public curveLengthWithFixedIntervalCountQuadrature(fraction0: number, fraction1: number, numInterval: number, numGauss: number = 5): number {\r\n if (fraction0 > fraction1) {\r\n const fSave = fraction0;\r\n fraction0 = fraction1;\r\n fraction1 = fSave;\r\n }\r\n const context = new CurveLengthContext(fraction0, fraction1, numGauss);\r\n context.announceIntervalForUniformStepStrokes(this, numInterval, fraction0, fraction1);\r\n return Math.abs(context.getSum());\r\n }\r\n\r\n /**\r\n *\r\n * * (Attempt to) find a position on the curve at a signed distance from start fraction.\r\n * * Return the position as a CurveLocationDetail.\r\n * * In the `CurveLocationDetail`, record:\r\n * * `fractional` position\r\n * * `fraction` = coordinates of the point\r\n * * `search\r\n * * `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.\r\n * * `curveSearchStatus` indicates one of:\r\n * * `error` (unusual) computation failed not supported for this curve.\r\n * * `success` full movement completed\r\n * * `stoppedAtBoundary` partial movement completed. This can be due to either\r\n * * `allowExtension` parameter sent as `false`\r\n * * the curve type (e.g. bspline) does not support extended range.\r\n * * if `allowExtension` is true, movement may still end at the startPoint or end point for curves that do not support extended geometry (specifically bsplines)\r\n * * if the curve returns a value (i.e. not `undefined`) for `curve.getFractionToDistanceScale()`, the base class carries out the computation\r\n * and returns a final location.\r\n * * LineSegment3d relies on this.\r\n * * If the curve does not implement the computation or the curve has zero length, the returned `CurveLocationDetail` has\r\n * * `fraction` = the value of `startFraction`\r\n * * `point` = result of `curve.fractionToPoint(startFraction)`\r\n * * `a` = 0\r\n * * `curveStartState` = `CurveSearchStatus.error`\r\n * @param startFraction fractional position where the move starts\r\n * @param signedDistance distance to move. Negative distance is backwards in the fraction space\r\n * @param allowExtension if true, all the move to go beyond the startPoint or endpoint of the curve. If false, do not allow movement beyond the startPoint or endpoint\r\n * @param result optional result.\r\n * @returns A CurveLocationDetail annotated as above. Note that if the curve does not support the calculation, there is still a result which contains the point at the input startFraction, with failure indicated in the `curveStartState` member\r\n */\r\n public moveSignedDistanceFromFraction(startFraction: number, signedDistance: number, allowExtension: boolean, result?: CurveLocationDetail): CurveLocationDetail {\r\n const scale = this.getFractionToDistanceScale();\r\n if (scale !== undefined) {\r\n // We are in luck! simple proportions determine it all !!!\r\n // (for example, a LineSegment3d or a circular arc)\r\n const totalLength = this.curveLength();\r\n const signedFractionMove = Geometry.conditionalDivideFraction(signedDistance, totalLength);\r\n if (signedFractionMove === undefined) {\r\n return CurveLocationDetail.createCurveFractionPointDistanceCurveSearchStatus(\r\n this, startFraction, this.fractionToPoint(startFraction), 0.0, CurveSearchStatus.error);\r\n }\r\n return CurveLocationDetail.createConditionalMoveSignedDistance(\r\n allowExtension,\r\n this,\r\n startFraction,\r\n startFraction + signedFractionMove,\r\n signedDistance,\r\n result);\r\n }\r\n return this.moveSignedDistanceFromFractionGeneric(startFraction, signedDistance, allowExtension, result);\r\n }\r\n /**\r\n * Generic algorithm to search for point at signed distance from a fractional startPoint.\r\n * * This will work for well for smooth curves.\r\n * * Curves with tangent or other low-order-derivative discontinuities may need to implement specialized algorithms.\r\n * * We need to find an endFraction which is the end-of-interval (usually upper) limit of integration of the tangent magnitude from startFraction to endFraction\r\n * * That integral is a function of endFraction.\r\n * * The derivative of that integral with respect to end fraction is the tangent magnitude at end fraction.\r\n * * Use that function and (easily evaluated!) derivative for a Newton iteration\r\n * * TO ALL WHO HAVE FUZZY MEMORIES OF CALCULUS CLASS: \"The derivative of the integral wrt upper limit is the value of the integrand there\" is the\r\n * fundamental theorem of integral calculus !!! The fundamental theorem is not just an abstraction !!! It is being used\r\n * here in its barest possible form !!!\r\n * * See https://en.wikipedia.org/wiki/Fundamental_theorem_of_calculus\r\n * @param startFraction\r\n * @param signedDistance\r\n * @param _allowExtension\r\n * @param result\r\n */\r\n protected moveSignedDistanceFromFractionGeneric(startFraction: number, signedDistance: number, allowExtension: boolean, result?: CurveLocationDetail): CurveLocationDetail {\r\n const limitFraction = signedDistance > 0.0 ? 1.0 : 0.0;\r\n const absDistance = Math.abs(signedDistance);\r\n const directionFactor = signedDistance < 0.0 ? -1.0 : 1.0;\r\n const availableLength = this.curveLengthBetweenFractions(startFraction, limitFraction); // that is always positive\r\n if (availableLength < absDistance && !allowExtension)\r\n return CurveLocationDetail.createConditionalMoveSignedDistance(allowExtension, this, startFraction, limitFraction, signedDistance, result);\r\n const fractionStep = absDistance / availableLength;\r\n let fractionB = Geometry.interpolate(startFraction, fractionStep, limitFraction);\r\n let fractionA = startFraction;\r\n let distanceA = 0.0;\r\n const tol = 1.0e-12 * availableLength;\r\n let numConverged = 0;\r\n const tangent = Ray3d.createXAxis();\r\n // on each loop entry:\r\n // fractionA is the most recent endOfInterval. (It may have been reached by a mixture of forward and backward step.)\r\n // distanceA is the distance to (the point at) fractionA\r\n // fractionB is the next end fraction\r\n for (let iterations = 0; iterations < 10; iterations++) {\r\n const distanceAB = this.curveLengthBetweenFractions(fractionA, fractionB);\r\n const directionAB = fractionB > fractionA ? directionFactor : -directionFactor;\r\n const distance0B = distanceA + directionAB * distanceAB;\r\n const distanceError = absDistance - distance0B;\r\n if (Math.abs(distanceError) < tol) {\r\n numConverged++;\r\n if (numConverged > 1)\r\n break;\r\n } else {\r\n numConverged = 0;\r\n }\r\n this.fractionToPointAndDerivative(fractionB, tangent);\r\n const tangentMagnitude = tangent.direction.magnitude();\r\n fractionA = fractionB;\r\n fractionB = fractionA + directionFactor * distanceError / tangentMagnitude;\r\n if (fractionA === fractionB) { // YES -- that is an exact equality test. When it happens, there's no need for confirming with another iteration.\r\n numConverged = 100;\r\n break;\r\n }\r\n distanceA = distance0B;\r\n }\r\n if (numConverged > 1)\r\n return CurveLocationDetail.createConditionalMoveSignedDistance(false, this, startFraction, fractionB, signedDistance, result);\r\n\r\n result = CurveLocationDetail.createCurveEvaluatedFraction(this, startFraction, result);\r\n result.a = 0.0;\r\n result.curveSearchStatus = CurveSearchStatus.error;\r\n return result;\r\n }\r\n\r\n /**\r\n * * Returns true if the curve's fraction queries extend beyond 0..1.\r\n * * Base class default implementation returns false.\r\n * * These class (and perhaps others in the future) will return true:\r\n * * LineSegment3d\r\n * * LineString3d\r\n * * Arc3d\r\n */\r\n public get isExtensibleFractionSpace(): boolean { return false; }\r\n /**\r\n * Compute a length which may be an fast approximation to the true length.\r\n * This is expected to be either (a) exact or (b) larger than the actual length, but by no more than\r\n * a small multiple, perhaps up to PI/2, but commonly much closer to 1.\r\n *\r\n * * An example use of this is for setting a tolerance which is a small multiple of the curve length.\r\n * * Simple line, circular arc, and transition spiral may return exact length\r\n * * Ellipse may return circumference of some circle or polygon that encloses the ellipse.\r\n * * bspline curve may return control polygon length\r\n * *\r\n */\r\n public abstract quickLength(): number;\r\n /** Search for the curve point that is closest to the spacePoint.\r\n *\r\n * * If the space point is exactly on the curve, this is the reverse of fractionToPoint.\r\n * * Since CurvePrimitive should always have start and end available as candidate points, this method should always succeed\r\n * @param spacePoint point in space\r\n * @param extend true to extend the curve (if possible), false for no extend, single CurveExtendOptions (for both directions), or array of distinct CurveExtendOptions for start and end.\r\n * @returns Returns a CurveLocationDetail structure that holds the details of the close point.\r\n */\r\n public closestPoint(spacePoint: Point3d, extend: VariantCurveExtendParameter): CurveLocationDetail | undefined {\r\n const strokeHandler = new ClosestPointStrokeHandler(spacePoint, extend);\r\n this.emitStrokableParts(strokeHandler);\r\n return strokeHandler.claimResult();\r\n }\r\n /**\r\n * Find intervals of this curvePrimitive that are interior to a clipper\r\n * @param clipper clip structure (e.g. clip planes)\r\n * @param announce (optional) function to be called announcing fractional intervals\" ` announce(fraction0, fraction1, curvePrimitive)`\r\n * @returns true if any \"in\" segments are announced.\r\n */\r\n public announceClipIntervals(_clipper: Clipper, _announce?: AnnounceNumberNumberCurvePrimitive): boolean {\r\n // DEFAULT IMPLEMENTATION -- no interior parts\r\n return false;\r\n }\r\n\r\n /** Return (if possible) a curve primitive which is a portion of this curve.\r\n * @param _fractionA [in] start fraction\r\n * @param _fractionB [in] end fraction\r\n */\r\n public clonePartialCurve(_fractionA: number, _fractionB: number): CurvePrimitive | undefined {\r\n return undefined;\r\n }\r\n /**\r\n * * If the curve primitive has distance-along-curve strictly proportional to curve fraction, return true\r\n * * If distance-along-the-curve is not proportional, return undefined.\r\n * * When defined, the scale factor is always the length of the curve.\r\n * * This scale factor is typically available for these curve types:\r\n * * * All `LineSegment3d`\r\n * * * Arc3d which is a true circular arc (axes perpendicular and of equal length).\r\n * * * CurveChainWithDistanceIndex\r\n * * This scale factor is undefined for these curve types:\r\n * * * Arc3d which is a true ellipse, i.e. unequal lengths of defining vectors or non-perpendicular defining vectors.\r\n * * * bspline and bezier curves\r\n * @returns scale factor or undefined\r\n */\r\n public getFractionToDistanceScale(): number | undefined { return undefined; }\r\n\r\n /** Reverse the curve's data so that its fractional stroking moves in the opposite direction. */\r\n public abstract reverseInPlace(): void;\r\n /**\r\n * Compute intersections with a plane.\r\n * * The intersections are appended to the result array.\r\n * * The base class implementation emits strokes to an AppendPlaneIntersectionStrokeHandler object, which uses a Newton iteration to get\r\n * high-accuracy intersection points within strokes.\r\n * * Derived classes should override this default implementation if there are easy analytic solutions.\r\n * * Derived classes are free to implement extended intersections (e.g. arc!!!)\r\n * @param plane The plane to be intersected.\r\n * @param result Array to receive intersections\r\n * @returns Return the number of CurveLocationDetail's added to the result array.\r\n */\r\n public appendPlaneIntersectionPoints(plane: PlaneAltitudeEvaluator, result: CurveLocationDetail[]): number {\r\n const strokeHandler = new AppendPlaneIntersectionStrokeHandler(plane, result);\r\n const n0 = result.length;\r\n this.emitStrokableParts(strokeHandler);\r\n return result.length - n0;\r\n }\r\n /**\r\n * Examine contents of an array of CurveLocationDetail.\r\n * Filter the intersections according to the parameters.\r\n * @param allowExtend if false, remove points on the extension.\r\n * @param applySnappedCoordinates if true, change the stored fractions and coordinates to exact end values. Otherwise\r\n * use the exact values only for purpose of updating the curveIntervalRole.\r\n * @param startEndFractionTolerance if nonzero, adjust fraction to 0 or 1 with this tolerance.\r\n * @param startEndXYZTolerance if nonzero, adjust to endpoint with this tolerance.\r\n * @internal\r\n */\r\n public static snapAndRestrictDetails(\r\n details: CurveLocationDetail[],\r\n allowExtend: boolean = true,\r\n applySnappedCoordinates: boolean = false,\r\n startEndFractionTolerance = Geometry.smallAngleRadians,\r\n startEndXYZTolerance = Geometry.smallMetricDistance) {\r\n const n0 = details.length;\r\n let acceptIndex = 0;\r\n const point0 = Point3d.create();\r\n const point1 = Point3d.create();\r\n let snappedCoordinates: Point3d | undefined;\r\n for (let candidateIndex = 0; candidateIndex < n0; candidateIndex++) {\r\n snappedCoordinates = undefined;\r\n const detail = details[candidateIndex];\r\n let fraction = detail.fraction;\r\n let accept = allowExtend || Geometry.isIn01(fraction);\r\n if (detail.curve) {\r\n detail.curve.startPoint(point0);\r\n detail.curve.endPoint(point1);\r\n }\r\n\r\n if (startEndFractionTolerance > 0) {\r\n if (Math.abs(fraction) < startEndFractionTolerance) {\r\n fraction = 0.0;\r\n accept = true;\r\n detail.intervalRole = CurveIntervalRole.isolatedAtVertex;\r\n snappedCoordinates = point0;\r\n }\r\n if (Math.abs(fraction - 1.0) < startEndFractionTolerance) {\r\n fraction = 1.0;\r\n accept = true;\r\n detail.intervalRole = CurveIntervalRole.isolatedAtVertex;\r\n snappedCoordinates = point1;\r\n if (detail.curve)\r\n snappedCoordinates = detail.curve.startPoint(point1);\r\n }\r\n }\r\n if (startEndXYZTolerance > 0 && detail.curve !== undefined) {\r\n // REMARK: always test both endpoints. If there is a cyclic fraction space, an intersection marked as \"after\" the end might have wrapped all the way to the beginning.\r\n if (detail.point.distance(point0) <= startEndXYZTolerance) {\r\n fraction = 0.0;\r\n detail.intervalRole = CurveIntervalRole.isolatedAtVertex;\r\n snappedCoordinates = point0;\r\n } else if (detail.point.distance(point1) <= startEndXYZTolerance) {\r\n fraction = 1.0;\r\n detail.intervalRole = CurveIntervalRole.isolatedAtVertex;\r\n snappedCoordinates = point1;\r\n }\r\n }\r\n if (accept) {\r\n if (applySnappedCoordinates) {\r\n detail.fraction = fraction;\r\n if (snappedCoordinates !== undefined)\r\n detail.point.setFrom(snappedCoordinates);\r\n }\r\n if (acceptIndex < candidateIndex)\r\n details[acceptIndex] = detail;\r\n acceptIndex++;\r\n }\r\n\r\n }\r\n if (acceptIndex < n0)\r\n details.length = acceptIndex;\r\n\r\n }\r\n\r\n /** Ask if the curve is within tolerance of a plane.\r\n * @returns Returns true if the curve is completely within tolerance of the plane.\r\n */\r\n public abstract isInPlane(plane: Plane3dByOriginAndUnitNormal): boolean;\r\n /** return the startPoint of the primitive. The default implementation returns fractionToPoint (0.0) */\r\n public startPoint(result?: Point3d): Point3d { return this.fractionToPoint(0.0, result); }\r\n /** return the end point of the primitive. The default implementation returns fractionToPoint(1.0) */\r\n public endPoint(result?: Point3d): Point3d { return this.fractionToPoint(1.0, result); }\r\n /** Add strokes to caller-supplied linestring */\r\n public abstract emitStrokes(dest: LineString3d, options?: StrokeOptions): void;\r\n /** Ask the curve to announce points and simple subcurve fragments for stroking.\r\n * See IStrokeHandler for description of the sequence of the method calls.\r\n */\r\n public abstract emitStrokableParts(dest: IStrokeHandler, options?: StrokeOptions): void;\r\n /**\r\n * return the stroke count required for given options.\r\n * * This returns a single number\r\n * * See computeComponentStrokeCountForOptions to get structured per-component counts and fraction mappings.\r\n * @param options StrokeOptions that determine count\r\n */\r\n public abstract computeStrokeCountForOptions(options?: StrokeOptions): number;\r\n\r\n /**\r\n * attach StrokeCountMap structure to this primitive (and recursively to any children)\r\n * * Base class implementation (here) gets the simple count from computeStrokeCountForOptions and attaches it.\r\n * * LineString3d, arc3d, BezierCurve3d, BezierCurve3dH accept that default.\r\n * * Subdivided primitives (linestring, bspline curve) implement themselves and attach a StrokeCountMap containing the\r\n * total count, and also containing an array of StrokeCountMap per component.\r\n * * For CurvePrimitiveWithDistanceIndex, the top level gets (only) a total count, and each child gets\r\n * its own StrokeCountMap with appropriate structure.\r\n * @param options StrokeOptions that determine count\r\n * @param parentStrokeMap optional map from parent. Its count, curveLength, and a1 values are increased with count and distance from this primitive.\r\n * @return sum of `a0+this.curveLength()`, for use as `a0` of successor in chain.\r\n */\r\n public computeAndAttachRecursiveStrokeCounts(options?: StrokeOptions, parentMap?: StrokeCountMap) {\r\n const n = this.computeStrokeCountForOptions(options);\r\n const a = this.curveLength();\r\n CurvePrimitive.installStrokeCountMap(\r\n this,\r\n StrokeCountMap.createWithCurvePrimitive(this, n, a, 0, a),\r\n parentMap);\r\n }\r\n\r\n /**\r\n * * evaluate strokes at fractions indicated in a StrokeCountMap.\r\n * * Base class implementation (here) gets the simple count from computeStrokeCountForOptions and strokes at uniform fractions.\r\n * * LineString3d, arc3d, BezierCurve3d, BezierCurve3dH accept that default.\r\n * * Subdivided primitives (linestring, bspline curve) implement themselves and evaluate within components.\r\n * * CurvePrimitiveWithDistanceIndex recurses to its children.\r\n * * if packedFraction and packedDerivative arrays are present in the LineString3d, fill them.\r\n * @param map = stroke count data.\r\n * @param linestring = receiver linestring.\r\n * @return number of strokes added. 0 if any errors matching the map to the curve primitive.\r\n */\r\n public addMappedStrokesToLineString3D(map: StrokeCountMap, linestring: LineString3d): number {\r\n const numPoint0 = linestring.numPoints();\r\n if (map.primitive && map.primitive === this && map.numStroke > 0) {\r\n for (let i = 0; i <= map.numStroke; i++) {\r\n const fraction = i / map.numStroke;\r\n linestring.appendFractionToPoint(this, fraction);\r\n }\r\n }\r\n return linestring.numPoints() - numPoint0;\r\n }\r\n\r\n /**\r\n * final install step to save curveMap in curve. If parentMap is given, update its length, count, and a1 fields\r\n * @param curve curve to receive the annotation\r\n * @param map\r\n * @param parentMap\r\n */\r\n public static installStrokeCountMap(curve: CurvePrimitive, curveMap: StrokeCountMap, parentMap?: StrokeCountMap) {\r\n if (parentMap)\r\n parentMap.addToCountAndLength(curveMap.numStroke, curveMap.curveLength);\r\n curve.strokeData = curveMap;\r\n }\r\n /**\r\n * Return an array containing only the curve primitives.\r\n * * This DEFAULT simply pushes `this` to the collectorArray.\r\n * * CurvePrimitiveWithDistanceIndex optionally collects its members.\r\n * @param collectorArray array to receive primitives (pushed -- the array is not cleared)\r\n * @param smallestPossiblePrimitives if false, CurvePrimitiveWithDistanceIndex returns only itself. If true, it recurses to its (otherwise hidden) children.\r\n */\r\n public collectCurvePrimitivesGo(collectorArray: CurvePrimitive[], _smallestPossiblePrimitives: boolean, _explodeLinestrings: boolean = false) {\r\n collectorArray.push(this);\r\n }\r\n\r\n /**\r\n * Return an array containing only the curve primitives.\r\n * * This DEFAULT captures the default result construction and calls collectCurvePrimitivesGo\r\n * @param collectorArray optional array to receive primitives. If present, new primitives are ADDED (without clearing the array.)\r\n * @param smallestPossiblePrimitives if false, CurvePrimitiveWithDistanceIndex returns only itself. If true, it recurses to its (otherwise hidden) children.\r\n */\r\n public collectCurvePrimitives(collectorArray?: CurvePrimitive[], smallestPossiblePrimitives: boolean = false,\r\n explodeLinestrings: boolean = false): CurvePrimitive[] {\r\n const results: CurvePrimitive[] = collectorArray === undefined ? [] : collectorArray;\r\n this.collectCurvePrimitivesGo(results, smallestPossiblePrimitives, explodeLinestrings);\r\n return results;\r\n }\r\n\r\n}\r\n\r\n/** Intermediate class for managing the parentCurve announcements from an IStrokeHandler */\r\nabstract class NewtonRotRStrokeHandler extends NewtonEvaluatorRtoR {\r\n protected _parentCurvePrimitive: CurvePrimitive | undefined;\r\n constructor() {\r\n super();\r\n this._parentCurvePrimitive = undefined;\r\n }\r\n /** retain the parentCurvePrimitive.\r\n * * Calling this method tells the handler that the parent curve is to be used for detail searches.\r\n * * Example: Transition spiral search is based on linestring first, then the exact spiral.\r\n * * Example: CurveChainWithDistanceIndex does NOT do this announcement -- the constituents act independently.\r\n */\r\n public startParentCurvePrimitive(curve: CurvePrimitive | undefined) { this._parentCurvePrimitive = curve; }\r\n /** Forget the parentCurvePrimitive */\r\n public endParentCurvePrimitive(_curve: CurvePrimitive | undefined) { this._parentCurvePrimitive = undefined; }\r\n}\r\n\r\nclass AppendPlaneIntersectionStrokeHandler extends NewtonRotRStrokeHandler implements IStrokeHandler {\r\n private _curve: CurvePrimitive | undefined;\r\n private _plane: PlaneAltitudeEvaluator;\r\n private _intersections: CurveLocationDetail[];\r\n private _fractionA: number = 0;\r\n private _functionA: number = 0;\r\n // private derivativeA: number; <---- Not currently used\r\n private _functionB: number = 0;\r\n private _fractionB: number = 0;\r\n private _derivativeB: number = 0;\r\n private _numThisCurve: number = 0;\r\n // scratch vars for use within methods.\r\n private _ray: Ray3d;\r\n private _newtonSolver: Newton1dUnboundedApproximateDerivative;\r\n\r\n // Return the first defined curve among: this.parentCurvePrimitive, this.curve;\r\n public effectiveCurve(): CurvePrimitive | undefined {\r\n if (this._parentCurvePrimitive)\r\n return this._parentCurvePrimitive;\r\n return this._curve;\r\n }\r\n public get getDerivativeB() { return this._derivativeB; } // <--- DerivativeB is not currently used anywhere. Provided getter to suppress lint error\r\n\r\n public constructor(plane: PlaneAltitudeEvaluator, intersections: CurveLocationDetail[]) {\r\n super();\r\n this._plane = plane;\r\n this._intersections = intersections;\r\n this.startCurvePrimitive(undefined);\r\n this._ray = Ray3d.createZero();\r\n this._newtonSolver = new Newton1dUnboundedApproximateDerivative(this);\r\n }\r\n public startCurvePrimitive(curve: CurvePrimitive | undefined) {\r\n this._curve = curve;\r\n this._fractionA = 0.0;\r\n this._numThisCurve = 0;\r\n this._functionA = 0.0;\r\n // this.derivativeA = 0.0;\r\n }\r\n public endCurvePrimitive() { }\r\n public announceIntervalForUniformStepStrokes(\r\n cp: CurvePrimitive,\r\n numStrokes: number,\r\n fraction0: number,\r\n fraction1: number): void {\r\n this.startCurvePrimitive(cp);\r\n if (numStrokes < 1) numStrokes = 1;\r\n const df = 1.0 / numStrokes;\r\n for (let i = 0; i <= numStrokes; i++) {\r\n const fraction = Geometry.interpolate(fraction0, i * df, fraction1);\r\n cp.fractionToPointAndDerivative(fraction, this._ray);\r\n this.announcePointTangent(this._ray.origin, fraction, this._ray.direction);\r\n }\r\n }\r\n public announceSegmentInterval(\r\n _cp: CurvePrimitive,\r\n point0: Point3d,\r\n point1: Point3d,\r\n _numStrokes: number,\r\n fraction0: number,\r\n fraction1: number): void {\r\n const h0 = this._plane.altitude(point0);\r\n const h1 = this._plane.altitude(point1);\r\n if (h0 * h1 > 0.0)\r\n return;\r\n const fraction01 = Order2Bezier.solveCoffs(h0, h1);\r\n // let numIntersection = 0;\r\n if (fraction01 !== undefined) {\r\n // numIntersection++;\r\n const fraction = Geometry.interpolate(fraction0, fraction01, fraction1);\r\n this._newtonSolver.setX(fraction);\r\n if (this._newtonSolver.runIterations()) {\r\n this.announceSolutionFraction(this._newtonSolver.getX());\r\n }\r\n // this.intersections.push(CurveLocationDetail.createCurveFractionPoint(cp, fraction, cp.fractionToPoint(fraction)));\r\n }\r\n }\r\n private announceSolutionFraction(fraction: number) {\r\n const curve = this.effectiveCurve();\r\n if (curve) {\r\n this._ray = curve.fractionToPointAndDerivative(fraction, this._ray);\r\n this._intersections.push(CurveLocationDetail.createCurveFractionPoint(curve, fraction, this._ray.origin));\r\n }\r\n }\r\n public evaluate(fraction: number): boolean {\r\n const curve = this.effectiveCurve();\r\n if (!curve)\r\n return false;\r\n this.currentF = this._plane.altitude(curve.fractionToPoint(fraction));\r\n return true;\r\n }\r\n /**\r\n * * ASSUME both the \"A\" and \"B\" evaluations (fraction, function, and derivative) are known.\r\n * * If function value changed sign between, interpolate an approximate root and improve it with\r\n * the newton solver.\r\n */\r\n private searchInterval() {\r\n if (this._functionA * this._functionB > 0) return;\r\n if (this._functionA === 0) this.announceSolutionFraction(this._fractionA);\r\n if (this._functionB === 0) this.announceSolutionFraction(this._fractionB);\r\n if (this._functionA * this._functionB < 0) {\r\n const fraction = Geometry.inverseInterpolate(this._fractionA, this._functionA, this._fractionB, this._functionB);\r\n if (fraction) {\r\n this._newtonSolver.setX(fraction);\r\n if (this._newtonSolver.runIterations())\r\n this.announceSolutionFraction(this._newtonSolver.getX());\r\n }\r\n }\r\n }\r\n /** Evaluate and save _functionB, _derivativeB, and _fractionB. */\r\n private evaluateB(xyz: Point3d, fraction: number, tangent: Vector3d) {\r\n this._functionB = this._plane.altitude(xyz);\r\n this._derivativeB = this._plane.velocity(tangent);\r\n this._fractionB = fraction;\r\n }\r\n /**\r\n * Announce point and tangent for evaluations.\r\n * * The function evaluation is saved as the \"B\" function point.\r\n * * The function point count is incremented\r\n * * If function point count is greater than 1, the current interval is searched.\r\n * * The just-evaluated point (\"B\") is saved as the \"old\" (\"A\") evaluation point.\r\n * @param xyz\r\n * @param fraction\r\n * @param tangent\r\n */\r\n public announcePointTangent(xyz: Point3d, fraction: number, tangent: Vector3d): void {\r\n this.evaluateB(xyz, fraction, tangent);\r\n if (this._numThisCurve++ > 0) this.searchInterval();\r\n this._functionA = this._functionB;\r\n this._fractionA = this._fractionB;\r\n }\r\n}\r\n\r\nclass CurveLengthContext implements IStrokeHandler {\r\n private _curve: CurvePrimitive | undefined;\r\n private _summedLength: number;\r\n private _ray: Ray3d;\r\n private _fraction0: number;\r\n private _fraction1: number;\r\n private _gaussMapper: GaussMapper;\r\n\r\n private tangentMagnitude(fraction: number): number {\r\n this._ray = (this._curve as CurvePrimitive).fractionToPointAndDerivative(fraction, this._ray);\r\n return this._ray.direction.magnitude();\r\n }\r\n public getSum() { return this._summedLength; }\r\n\r\n public constructor(fraction0: number = 0.0, fraction1: number = 1.0, numGaussPoints: number = 5) {\r\n this.startCurvePrimitive(undefined);\r\n this._summedLength = 0.0;\r\n this._ray = Ray3d.createZero();\r\n if (fraction0 < fraction1) {\r\n this._fraction0 = fraction0;\r\n this._fraction1 = fraction1;\r\n } else {\r\n this._fraction0 = fraction1;\r\n this._fraction1 = fraction0;\r\n }\r\n this._gaussMapper = new GaussMapper(numGaussPoints);\r\n }\r\n public startCurvePrimitive(curve: CurvePrimitive | undefined) {\r\n this._curve = curve;\r\n }\r\n public startParentCurvePrimitive(_curve: CurvePrimitive) { }\r\n public endParentCurvePrimitive(_curve: CurvePrimitive) { }\r\n\r\n public endCurvePrimitive() { }\r\n public announceIntervalForUniformStepStrokes(\r\n cp: CurvePrimitive,\r\n numStrokes: number,\r\n fraction0: number,\r\n fraction1: number): void {\r\n if (fraction0 < this._fraction0) fraction0 = this._fraction0;\r\n if (fraction1 > this._fraction1) fraction1 = this._fraction1;\r\n if (fraction1 > fraction0) {\r\n this.startCurvePrimitive(cp);\r\n if (numStrokes < 1) numStrokes = 1;\r\n const df = 1.0 / numStrokes;\r\n for (let i = 1; i <= numStrokes; i++) {\r\n const fractionA = Geometry.interpolate(fraction0, (i - 1) * df, fraction1);\r\n const fractionB = i === numStrokes ? fraction1 : Geometry.interpolate(fraction0, (i) * df, fraction1);\r\n const numGauss = this._gaussMapper.mapXAndW(fractionA, fractionB);\r\n for (let k = 0; k < numGauss; k++) {\r\n this._summedLength += this._gaussMapper.gaussW[k] * this.tangentMagnitude(this._gaussMapper.gaussX[k]);\r\n }\r\n }\r\n }\r\n }\r\n public announceSegmentInterval(\r\n _cp: CurvePrimitive,\r\n point0: Point3d,\r\n point1: Point3d,\r\n _numStrokes: number,\r\n fraction0: number,\r\n fraction1: number): void {\r\n const segmentLength = point0.distance(point1);\r\n if (this._fraction0 <= fraction0 && fraction1 <= this._fraction1)\r\n this._summedLength += segmentLength;\r\n else {\r\n let g0 = fraction0;\r\n let g1 = fraction1;\r\n if (g0 < this._fraction0) g0 = this._fraction0;\r\n if (g1 > this._fraction1) g1 = this._fraction1;\r\n if (g1 > g0) {\r\n this._summedLength += segmentLength * (g1 - g0) / (fraction1 - fraction0);\r\n }\r\n }\r\n }\r\n public announcePointTangent(_xyz: Point3d, _fraction: number, _tangent: Vector3d): void {\r\n // uh oh -- need to retain point for next interval\r\n }\r\n}\r\n// context for searching for closest point .. .\r\nclass ClosestPointStrokeHandler extends NewtonRotRStrokeHandler implements IStrokeHandler {\r\n private _curve: CurvePrimitive | undefined;\r\n private _closestPoint: CurveLocationDetail | undefined;\r\n private _spacePoint: Point3d;\r\n private _extend: VariantCurveExtendParameter;\r\n private _fractionA: number = 0;\r\n private _functionA: number = 0;\r\n private _functionB: number = 0;\r\n private _fractionB: number = 0;\r\n private _numThisCurve: number = 0;\r\n // scratch vars for use within methods.\r\n private _workPoint: Point3d;\r\n private _workRay: Ray3d;\r\n private _newtonSolver: Newton1dUnboundedApproximateDerivative;\r\n\r\n public constructor(spacePoint: Point3d, extend: VariantCurveExtendParameter) {\r\n super();\r\n this._spacePoint = spacePoint;\r\n this._workPoint = Point3d.create();\r\n this._workRay = Ray3d.createZero();\r\n this._closestPoint = undefined;\r\n this._extend = extend;\r\n this.startCurvePrimitive(undefined);\r\n this._newtonSolver = new Newton1dUnboundedApproximateDerivative(this);\r\n }\r\n\r\n public claimResult(): CurveLocationDetail | undefined {\r\n if (this._closestPoint) {\r\n this._newtonSolver.setX(this._closestPoint.fraction);\r\n this._curve = this._closestPoint.curve;\r\n if (this._newtonSolver.runIterations()) {\r\n let fraction = this._newtonSolver.getX();\r\n fraction = CurveExtendOptions.correctFraction(this._extend, fraction);\r\n this.announceSolutionFraction(fraction);\r\n }\r\n }\r\n return this._closestPoint;\r\n }\r\n public startCurvePrimitive(curve: CurvePrimitive | undefined) {\r\n this._curve = curve;\r\n this._fractionA = 0.0;\r\n this._numThisCurve = 0;\r\n this._functionA = 0.0;\r\n }\r\n public endCurvePrimitive() { }\r\n public announceIntervalForUniformStepStrokes(\r\n cp: CurvePrimitive,\r\n numStrokes: number,\r\n fraction0: number,\r\n fraction1: number): void {\r\n this.startCurvePrimitive(cp);\r\n if (numStrokes < 1) numStrokes = 1;\r\n const df = 1.0 / numStrokes;\r\n for (let i = 0; i <= numStrokes; i++) {\r\n const fraction = Geometry.interpolate(fraction0, i * df, fraction1);\r\n cp.fractionToPointAndDerivative(fraction, this._workRay);\r\n this.announceRay(fraction, this._workRay);\r\n }\r\n }\r\n\r\n private announceCandidate(cp: CurvePrimitive, fraction: number, point: Point3d) {\r\n const distance = this._spacePoint.distance(point);\r\n if (this._closestPoint && distance > this._closestPoint.a)\r\n return;\r\n this._closestPoint = CurveLocationDetail.createCurveFractionPoint(cp, fraction, point, this._closestPoint);\r\n this._closestPoint.a = distance;\r\n if (this._parentCurvePrimitive !== undefined)\r\n this._closestPoint.curve = this._parentCurvePrimitive;\r\n }\r\n public announceSegmentInterval(\r\n cp: CurvePrimitive,\r\n point0: Point3d,\r\n point1: Point3d,\r\n _numStrokes: number,\r\n fraction0: number,\r\n fraction1: number): void {\r\n let localFraction = this._spacePoint.fractionOfProjectionToLine(point0, point1, 0.0);\r\n // only consider extending the segment if the immediate caller says we are at endpoints ...\r\n if (!this._extend)\r\n localFraction = Geometry.clampToStartEnd(localFraction, 0.0, 1.0);\r\n else {\r\n if (fraction0 !== 0.0)\r\n localFraction = Math.max(localFraction, 0.0);\r\n if (fraction1 !== 1.0)\r\n localFraction = Math.min(localFraction, 1.0);\r\n }\r\n this._workPoint = point0.interpolate(localFraction, point1);\r\n const globalFraction = Geometry.interpolate(fraction0, localFraction, fraction1);\r\n this.announceCandidate(cp, globalFraction, this._workPoint);\r\n }\r\n private searchInterval() {\r\n if (this._functionA * this._functionB > 0) return;\r\n if (this._functionA === 0) this.announceSolutionFraction(this._fractionA);\r\n if (this._functionB === 0) this.announceSolutionFraction(this._fractionB);\r\n if (this._functionA * this._functionB < 0) {\r\n const fraction = Geometry.inverseInterpolate(this._fractionA, this._functionA, this._fractionB, this._functionB);\r\n if (fraction) {\r\n this._newtonSolver.setX(fraction);\r\n if (this._newtonSolver.runIterations())\r\n this.announceSolutionFraction(this._newtonSolver.getX());\r\n }\r\n }\r\n }\r\n private evaluateB(fractionB: number, dataB: Ray3d) {\r\n this._functionB = dataB.dotProductToPoint(this._spacePoint);\r\n this._fractionB = fractionB;\r\n }\r\n private announceSolutionFraction(fraction: number) {\r\n if (this._curve)\r\n this.announceCandidate(this._curve, fraction, this._curve.fractionToPoint(fraction));\r\n }\r\n public evaluate(fraction: number): boolean {\r\n let curve = this._curve;\r\n if (this._parentCurvePrimitive)\r\n curve = this._parentCurvePrimitive;\r\n if (curve) {\r\n this._workRay = curve.fractionToPointAndDerivative(fraction, this._workRay);\r\n this.currentF = this._workRay.dotProductToPoint(this._spacePoint);\r\n return true;\r\n }\r\n return false;\r\n }\r\n public announceRay(fraction: number, data: Ray3d): void {\r\n this.evaluateB(fraction, data);\r\n if (this._numThisCurve++ > 0) this.searchInterval();\r\n this._functionA = this._functionB;\r\n this._fractionA = this._fractionB;\r\n }\r\n public announcePointTangent(point: Point3d, fraction: number, tangent: Vector3d) {\r\n this._workRay.set(point, tangent);\r\n this.announceRay(fraction, this._workRay);\r\n }\r\n}\r\n"]}
1
+ {"version":3,"file":"CurvePrimitive.js","sourceRoot":"","sources":["../../../src/curve/CurvePrimitive.ts"],"names":[],"mappings":"AASA,OAAO,EAAE,cAAc,EAAE,MAAM,+BAA+B,CAAC;AAC/D,OAAO,EAAE,SAAS,EAAE,QAAQ,EAA0B,MAAM,aAAa,CAAC;AAQ1E,OAAO,EAAE,QAAQ,EAAE,MAAM,wBAAwB,CAAC;AAGlD,OAAO,EAAE,OAAO,EAAY,MAAM,+BAA+B,CAAC;AAClE,OAAO,EAAE,KAAK,EAAE,MAAM,qBAAqB,CAAC;AAC5C,OAAO,EAAE,SAAS,EAAE,MAAM,yBAAyB,CAAC;AACpD,OAAO,EAAE,YAAY,EAAE,MAAM,+BAA+B,CAAC;AAC7D,OAAO,EAAE,sCAAsC,EAAE,mBAAmB,EAAE,MAAM,oBAAoB,CAAC;AACjG,OAAO,EAAE,WAAW,EAAE,MAAM,wBAAwB,CAAC;AAErD,OAAO,EAAE,kBAAkB,EAA+B,MAAM,mBAAmB,CAAC;AACpF,OAAO,EAAE,iBAAiB,EAAE,mBAAmB,EAAE,iBAAiB,EAAE,MAAM,uBAAuB,CAAC;AAClG,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAoChD;;;;;;;;;;;;;GAaG;AACH,MAAM,OAAgB,cAAe,SAAQ,aAAa;IAMxD;QAA0B,KAAK,EAAE,CAAC;QALlC,wCAAwC;QACxB,qBAAgB,GAAG,gBAAgB,CAAC;IAIjB,CAAC;IAkCpC;;;;OAIG;IACI,6BAA6B,CAAC,QAAgB,EAAE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AAC,CAAC;IAC5C,CAAC;CACF","sourcesContent":["/*---------------------------------------------------------------------------------------------\r\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\r\n* See LICENSE.md in the project root for license terms and full copyright notice.\r\n*--------------------------------------------------------------------------------------------*/\r\n/** @packageDocumentation\r\n * @module Curve\r\n */\r\nimport { InterpolationCurve3d } from \"../bspline/InterpolationCurve3d\";\r\nimport { Clipper } from \"../clipping/ClipUtils\";\r\nimport { StrokeCountMap } from \"../curve/Query/StrokeCountMap\";\r\nimport { AxisOrder, Geometry, PlaneAltitudeEvaluator } from \"../Geometry\";\r\nimport { AkimaCurve3d } from \"../bspline/AkimaCurve3d\";\r\nimport { BSplineCurve3d } from \"../bspline/BSplineCurve\";\r\nimport { BezierCurve3d } from \"../bspline/BezierCurve3d\";\r\nimport { CurveChainWithDistanceIndex } from \"./CurveChainWithDistanceIndex\";\r\nimport { DirectSpiral3d } from \"./spiral/DirectSpiral3d\";\r\nimport { IntegratedSpiral3d } from \"./spiral/IntegratedSpiral3d\";\r\nimport { IStrokeHandler } from \"../geometry3d/GeometryHandler\";\r\nimport { Matrix3d } from \"../geometry3d/Matrix3d\";\r\nimport { Plane3dByOriginAndUnitNormal } from \"../geometry3d/Plane3dByOriginAndUnitNormal\";\r\nimport { Plane3dByOriginAndVectors } from \"../geometry3d/Plane3dByOriginAndVectors\";\r\nimport { Point3d, Vector3d } from \"../geometry3d/Point3dVector3d\";\r\nimport { Ray3d } from \"../geometry3d/Ray3d\";\r\nimport { Transform } from \"../geometry3d/Transform\";\r\nimport { Order2Bezier } from \"../numerics/BezierPolynomials\";\r\nimport { Newton1dUnboundedApproximateDerivative, NewtonEvaluatorRtoR } from \"../numerics/Newton\";\r\nimport { GaussMapper } from \"../numerics/Quadrature\";\r\nimport { Arc3d } from \"./Arc3d\";\r\nimport { CurveExtendOptions, VariantCurveExtendParameter } from \"./CurveExtendMode\";\r\nimport { CurveIntervalRole, CurveLocationDetail, CurveSearchStatus } from \"./CurveLocationDetail\";\r\nimport { GeometryQuery } from \"./GeometryQuery\";\r\nimport { LineSegment3d } from \"./LineSegment3d\";\r\nimport { LineString3d } from \"./LineString3d\";\r\nimport { StrokeOptions } from \"./StrokeOptions\";\r\n\r\n/** Describes the concrete type of a [[CurvePrimitive]]. Each type name maps to a specific subclass and can be used for type-switching in conditional statements.\r\n * - \"arc\" => [[Arc3d]]\r\n * - \"lineSegment\" => [[LineSegment3d]]\r\n * - \"lineString\" => [[LineString3d]]\r\n * - \"bsplineCurve\" => [[BSplineCurve3dBase]] which is an intermediate class implemented by [[BSplineCurve3d]] and [[BSplineCurve3dH]]\r\n * - \"bezierCurve\" => [[BezierCurveBase]] which is an intermediate class implemented by [[BezierCurve3d]] and [[BezierCurve3dH]]\r\n * - \"transitionSpiral\" => [[TransitionSpiral3d]]\r\n * - \"curveChainWithDistanceIndex\" => [[CurveChainWithDistanceIndex]]\r\n * @see [[AnyCurvePrimitive]] for a union type that supports compile-time type narrowing.\r\n * @public\r\n */\r\nexport type CurvePrimitiveType = \"arc\" | \"lineSegment\" | \"lineString\" | \"bsplineCurve\" | \"bezierCurve\" | \"transitionSpiral\" | \"curveChainWithDistanceIndex\" | \"interpolationCurve\" | \"akimaCurve\";\r\n\r\n/** Union type for subclasses of [[CurvePrimitive]]. Specific subclasses can be discriminated at compile- or run-time using [[CurvePrimitive.curvePrimitiveType]].\r\n * @public\r\n */\r\nexport type AnyCurvePrimitive = Arc3d | LineSegment3d | LineString3d | BSplineCurve3d | BezierCurve3d | DirectSpiral3d | IntegratedSpiral3d | CurveChainWithDistanceIndex | InterpolationCurve3d | AkimaCurve3d;\r\n\r\n/** function signature for callback which announces a pair of numbers, such as a fractional interval, along with a containing CurvePrimitive.\r\n * @public\r\n */\r\nexport type AnnounceNumberNumberCurvePrimitive = (a0: number, a1: number, cp: CurvePrimitive) => void;\r\n/** Function signature for a callback which announces a pair of numbers\r\n * @public\r\n */\r\n\r\nexport type AnnounceNumberNumber = (a0: number, a1: number) => void;\r\n/** Function signature for a callback which announces a curve primitive\r\n * @public\r\n */\r\nexport type AnnounceCurvePrimitive = (cp: CurvePrimitive) => void;\r\n/**\r\n * A curve primitive is bounded\r\n * A curve primitive maps fractions in 0..1 to points in space.\r\n * As the fraction proceeds from 0 towards 1, the point moves \"forward\" along the curve.\r\n * True distance along the curve is not always strictly proportional to fraction.\r\n * * LineSegment3d always has proportional fraction and distance\r\n * * an Arc3d which is true circular has proportional fraction and distance\r\n * * A LineString3d is not proportional (except for special case of all segments of equal length)\r\n * * A Spiral3d is proportional\r\n * * A BsplineCurve3d is only proportional for special cases.\r\n *\r\n * For fractions outside 0..1, the curve primitive class may either (a) return the near endpoint or (b) evaluate an extended curve.\r\n * @public\r\n */\r\nexport abstract class CurvePrimitive extends GeometryQuery {\r\n /** String name for schema properties */\r\n public readonly geometryCategory = \"curvePrimitive\";\r\n /** String name for schema properties */\r\n public abstract readonly curvePrimitiveType: CurvePrimitiveType;\r\n\r\n protected constructor() { super(); }\r\n /**\r\n * data attached during stroking for facets.\r\n */\r\n public strokeData?: StrokeCountMap;\r\n /**\r\n * data attached in curve cutting.\r\n * @internal\r\n */\r\n public startCut?: CurveLocationDetail;\r\n /**\r\n * data attached in curve cutting.\r\n * @internal\r\n */\r\n public endCut?: CurveLocationDetail;\r\n /**\r\n * data attached by various algorithms (e.g. Region booleans)\r\n */\r\n public parent?: any;\r\n\r\n /** Return the point (x,y,z) on the curve at fractional position.\r\n * @param fraction fractional position along the geometry.\r\n * @returns Returns a point on the curve.\r\n */\r\n public abstract fractionToPoint(fraction: number, result?: Point3d): Point3d;\r\n /** Return the point (x,y,z) and derivative on the curve at fractional position.\r\n *\r\n * * Note that this derivative is \"derivative of xyz with respect to fraction.\"\r\n * * this derivative shows the speed of the \"fractional point\" moving along the curve.\r\n * * this is not generally a unit vector. use fractionToPointAndUnitTangent for a unit vector.\r\n * @param fraction fractional position along the geometry.\r\n * @returns Returns a ray whose origin is the curve point and direction is the derivative with respect to the fraction.\r\n */\r\n public abstract fractionToPointAndDerivative(fraction: number, result?: Ray3d): Ray3d;\r\n /**\r\n * Returns a ray whose origin is the curve point and direction is the unit tangent.\r\n * @param fraction fractional position on the curve\r\n * @param result optional preallocated ray.\r\n */\r\n public fractionToPointAndUnitTangent(fraction: number, result?: Ray3d): Ray3d {\r\n const ray = this.fractionToPointAndDerivative(fraction, result);\r\n ray.trySetDirectionMagnitudeInPlace(1.0);\r\n return ray;\r\n }\r\n /**\r\n * Returns the (absolute) curvature magnitude.\r\n * * Base implementation in CurvePrimitive computes curvature from the first and second derivative vectors.\r\n * @param fraction fractional position on the curve\r\n */\r\n public fractionToCurvature(fraction: number): number | undefined {\r\n const data = this.fractionToPointAnd2Derivatives(fraction)!;\r\n const cross = data.vectorU.crossProduct(data.vectorV);\r\n const a = cross.magnitude();\r\n const b = data.vectorU.magnitude();\r\n return Geometry.conditionalDivideFraction(a, b * b * b);\r\n }\r\n\r\n /** Return a plane with\r\n *\r\n * * origin at fractional position along the curve\r\n * * vectorU is the first derivative, i.e. tangent vector with length equal to the rate of change with respect to the fraction.\r\n * * vectorV is the second derivative, i.e.derivative of vectorU.\r\n */\r\n public abstract fractionToPointAnd2Derivatives(fraction: number, result?: Plane3dByOriginAndVectors): Plane3dByOriginAndVectors | undefined;\r\n\r\n /** Construct a frenet frame:\r\n * * origin at the point on the curve\r\n * * x axis is unit vector along the curve (tangent)\r\n * * y axis is perpendicular and in the plane of the osculating circle.\r\n * * z axis perpendicular to those.\r\n */\r\n public fractionToFrenetFrame(fraction: number, result?: Transform): Transform | undefined {\r\n const plane = this.fractionToPointAnd2Derivatives(fraction);\r\n if (!plane) return undefined;\r\n let axes = Matrix3d.createRigidFromColumns(plane.vectorU, plane.vectorV, AxisOrder.XYZ);\r\n if (axes)\r\n return Transform.createRefs(plane.origin, axes, result);\r\n // 2nd derivative not distinct -- do arbitrary headsUP ...\r\n const perpVector = Matrix3d.createPerpendicularVectorFavorXYPlane(plane.vectorU, plane.vectorV);\r\n axes = Matrix3d.createRigidFromColumns(plane.vectorU, perpVector, AxisOrder.XYZ);\r\n if (axes)\r\n return Transform.createRefs(plane.origin, axes, result);\r\n return undefined;\r\n }\r\n\r\n /**\r\n * Construct a point extrapolated along tangent at fraction.\r\n * @param fraction fractional position on the primitive\r\n * @param distance (signed) distance to move on the tangent.\r\n */\r\n public fractionAndDistanceToPointOnTangent(fraction: number, distance: number): Point3d {\r\n const ray = this.fractionToPointAndUnitTangent(fraction);\r\n return ray.fractionToPoint(distance);\r\n }\r\n\r\n /**\r\n * return the length of the curve.\r\n * * Curve length is always positive.\r\n */\r\n public curveLength(): number {\r\n const context = new CurveLengthContext();\r\n this.emitStrokableParts(context);\r\n return context.getSum();\r\n }\r\n /**\r\n * Returns a (high accuracy) length of the curve between fractional positions\r\n * * Curve length is always positive.\r\n * * Default implementation applies a generic gaussian integration.\r\n * * Most curve classes (certainly LineSegment, LineString, Arc) are expected to provide efficient implementations.\r\n */\r\n public curveLengthBetweenFractions(fraction0: number, fraction1: number): number {\r\n if (fraction0 === fraction1)\r\n return 0.0;\r\n const scale = this.getFractionToDistanceScale();\r\n if (scale !== undefined) {\r\n // We are in luck! simple proportions determine it all !!!\r\n // (for example, a LineSegment3d or a circular arc)\r\n const totalLength = this.curveLength();\r\n return Math.abs((fraction1 - fraction0) * totalLength);\r\n }\r\n const context = new CurveLengthContext(fraction0, fraction1);\r\n this.emitStrokableParts(context);\r\n return Math.abs(context.getSum());\r\n }\r\n\r\n /**\r\n *\r\n * * Run an integration (with a default gaussian quadrature) with a fixed fractional step\r\n * * This is typically called by specific curve type implementations of curveLengthBetweenFractions.\r\n * * For example, in Arc3d implementation of curveLengthBetweenFractions:\r\n * * If the Arc3d is true circular, it the arc is true circular, use the direct `arcLength = radius * sweepRadians`\r\n * * If the Arc3d is not true circular, call this method with an interval count appropriate to eccentricity and sweepRadians.\r\n * @returns Returns an integral estimated by numerical quadrature between the fractional positions.\r\n * @param fraction0 start fraction for integration\r\n * @param fraction1 end fraction for integration\r\n * @param numInterval number of quadrature intervals\r\n */\r\n public curveLengthWithFixedIntervalCountQuadrature(fraction0: number, fraction1: number, numInterval: number, numGauss: number = 5): number {\r\n if (fraction0 > fraction1) {\r\n const fSave = fraction0;\r\n fraction0 = fraction1;\r\n fraction1 = fSave;\r\n }\r\n const context = new CurveLengthContext(fraction0, fraction1, numGauss);\r\n context.announceIntervalForUniformStepStrokes(this, numInterval, fraction0, fraction1);\r\n return Math.abs(context.getSum());\r\n }\r\n\r\n /**\r\n *\r\n * * (Attempt to) find a position on the curve at a signed distance from start fraction.\r\n * * Return the position as a CurveLocationDetail.\r\n * * In the `CurveLocationDetail`, record:\r\n * * `fractional` position\r\n * * `fraction` = coordinates of the point\r\n * * `search\r\n * * `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.\r\n * * `curveSearchStatus` indicates one of:\r\n * * `error` (unusual) computation failed not supported for this curve.\r\n * * `success` full movement completed\r\n * * `stoppedAtBoundary` partial movement completed. This can be due to either\r\n * * `allowExtension` parameter sent as `false`\r\n * * the curve type (e.g. bspline) does not support extended range.\r\n * * if `allowExtension` is true, movement may still end at the startPoint or end point for curves that do not support extended geometry (specifically bsplines)\r\n * * if the curve returns a value (i.e. not `undefined`) for `curve.getFractionToDistanceScale()`, the base class carries out the computation\r\n * and returns a final location.\r\n * * LineSegment3d relies on this.\r\n * * If the curve does not implement the computation or the curve has zero length, the returned `CurveLocationDetail` has\r\n * * `fraction` = the value of `startFraction`\r\n * * `point` = result of `curve.fractionToPoint(startFraction)`\r\n * * `a` = 0\r\n * * `curveStartState` = `CurveSearchStatus.error`\r\n * @param startFraction fractional position where the move starts\r\n * @param signedDistance distance to move. Negative distance is backwards in the fraction space\r\n * @param allowExtension if true, all the move to go beyond the startPoint or endpoint of the curve. If false, do not allow movement beyond the startPoint or endpoint\r\n * @param result optional result.\r\n * @returns A CurveLocationDetail annotated as above. Note that if the curve does not support the calculation, there is still a result which contains the point at the input startFraction, with failure indicated in the `curveStartState` member\r\n */\r\n public moveSignedDistanceFromFraction(startFraction: number, signedDistance: number, allowExtension: boolean, result?: CurveLocationDetail): CurveLocationDetail {\r\n const scale = this.getFractionToDistanceScale();\r\n if (scale !== undefined) {\r\n // We are in luck! simple proportions determine it all !!!\r\n // (for example, a LineSegment3d or a circular arc)\r\n const totalLength = this.curveLength();\r\n const signedFractionMove = Geometry.conditionalDivideFraction(signedDistance, totalLength);\r\n if (signedFractionMove === undefined) {\r\n return CurveLocationDetail.createCurveFractionPointDistanceCurveSearchStatus(\r\n this, startFraction, this.fractionToPoint(startFraction), 0.0, CurveSearchStatus.error);\r\n }\r\n return CurveLocationDetail.createConditionalMoveSignedDistance(\r\n allowExtension,\r\n this,\r\n startFraction,\r\n startFraction + signedFractionMove,\r\n signedDistance,\r\n result);\r\n }\r\n return this.moveSignedDistanceFromFractionGeneric(startFraction, signedDistance, allowExtension, result);\r\n }\r\n /**\r\n * Generic algorithm to search for point at signed distance from a fractional startPoint.\r\n * * This will work for well for smooth curves.\r\n * * Curves with tangent or other low-order-derivative discontinuities may need to implement specialized algorithms.\r\n * * We need to find an endFraction which is the end-of-interval (usually upper) limit of integration of the tangent magnitude from startFraction to endFraction\r\n * * That integral is a function of endFraction.\r\n * * The derivative of that integral with respect to end fraction is the tangent magnitude at end fraction.\r\n * * Use that function and (easily evaluated!) derivative for a Newton iteration\r\n * * TO ALL WHO HAVE FUZZY MEMORIES OF CALCULUS CLASS: \"The derivative of the integral wrt upper limit is the value of the integrand there\" is the\r\n * fundamental theorem of integral calculus !!! The fundamental theorem is not just an abstraction !!! It is being used\r\n * here in its barest possible form !!!\r\n * * See https://en.wikipedia.org/wiki/Fundamental_theorem_of_calculus\r\n * @param startFraction\r\n * @param signedDistance\r\n * @param _allowExtension\r\n * @param result\r\n */\r\n protected moveSignedDistanceFromFractionGeneric(startFraction: number, signedDistance: number, allowExtension: boolean, result?: CurveLocationDetail): CurveLocationDetail {\r\n const limitFraction = signedDistance > 0.0 ? 1.0 : 0.0;\r\n const absDistance = Math.abs(signedDistance);\r\n const directionFactor = signedDistance < 0.0 ? -1.0 : 1.0;\r\n const availableLength = this.curveLengthBetweenFractions(startFraction, limitFraction); // that is always positive\r\n if (availableLength < absDistance && !allowExtension)\r\n return CurveLocationDetail.createConditionalMoveSignedDistance(allowExtension, this, startFraction, limitFraction, signedDistance, result);\r\n const fractionStep = absDistance / availableLength;\r\n let fractionB = Geometry.interpolate(startFraction, fractionStep, limitFraction);\r\n let fractionA = startFraction;\r\n let distanceA = 0.0;\r\n const tol = 1.0e-12 * availableLength;\r\n let numConverged = 0;\r\n const tangent = Ray3d.createXAxis();\r\n // on each loop entry:\r\n // fractionA is the most recent endOfInterval. (It may have been reached by a mixture of forward and backward step.)\r\n // distanceA is the distance to (the point at) fractionA\r\n // fractionB is the next end fraction\r\n for (let iterations = 0; iterations < 10; iterations++) {\r\n const distanceAB = this.curveLengthBetweenFractions(fractionA, fractionB);\r\n const directionAB = fractionB > fractionA ? directionFactor : -directionFactor;\r\n const distance0B = distanceA + directionAB * distanceAB;\r\n const distanceError = absDistance - distance0B;\r\n if (Math.abs(distanceError) < tol) {\r\n numConverged++;\r\n if (numConverged > 1)\r\n break;\r\n } else {\r\n numConverged = 0;\r\n }\r\n this.fractionToPointAndDerivative(fractionB, tangent);\r\n const tangentMagnitude = tangent.direction.magnitude();\r\n fractionA = fractionB;\r\n fractionB = fractionA + directionFactor * distanceError / tangentMagnitude;\r\n if (fractionA === fractionB) { // YES -- that is an exact equality test. When it happens, there's no need for confirming with another iteration.\r\n numConverged = 100;\r\n break;\r\n }\r\n distanceA = distance0B;\r\n }\r\n if (numConverged > 1)\r\n return CurveLocationDetail.createConditionalMoveSignedDistance(false, this, startFraction, fractionB, signedDistance, result);\r\n\r\n result = CurveLocationDetail.createCurveEvaluatedFraction(this, startFraction, result);\r\n result.a = 0.0;\r\n result.curveSearchStatus = CurveSearchStatus.error;\r\n return result;\r\n }\r\n\r\n /**\r\n * * Returns true if the curve's fraction queries extend beyond 0..1.\r\n * * Base class default implementation returns false.\r\n * * These class (and perhaps others in the future) will return true:\r\n * * LineSegment3d\r\n * * LineString3d\r\n * * Arc3d\r\n */\r\n public get isExtensibleFractionSpace(): boolean { return false; }\r\n /**\r\n * Compute a length which may be an fast approximation to the true length.\r\n * This is expected to be either (a) exact or (b) larger than the actual length, but by no more than\r\n * a small multiple, perhaps up to PI/2, but commonly much closer to 1.\r\n *\r\n * * An example use of this is for setting a tolerance which is a small multiple of the curve length.\r\n * * Simple line, circular arc, and transition spiral may return exact length\r\n * * Ellipse may return circumference of some circle or polygon that encloses the ellipse.\r\n * * bspline curve may return control polygon length\r\n * *\r\n */\r\n public abstract quickLength(): number;\r\n /** Search for the curve point that is closest to the spacePoint.\r\n *\r\n * * If the space point is exactly on the curve, this is the reverse of fractionToPoint.\r\n * * Since CurvePrimitive should always have start and end available as candidate points, this method should always succeed\r\n * @param spacePoint point in space\r\n * @param extend true to extend the curve (if possible), false for no extend, single CurveExtendOptions (for both directions), or array of distinct CurveExtendOptions for start and end.\r\n * @returns Returns a CurveLocationDetail structure that holds the details of the close point.\r\n */\r\n public closestPoint(spacePoint: Point3d, extend: VariantCurveExtendParameter): CurveLocationDetail | undefined {\r\n const strokeHandler = new ClosestPointStrokeHandler(spacePoint, extend);\r\n this.emitStrokableParts(strokeHandler);\r\n return strokeHandler.claimResult();\r\n }\r\n /**\r\n * Find intervals of this curvePrimitive that are interior to a clipper\r\n * @param clipper clip structure (e.g. clip planes)\r\n * @param announce (optional) function to be called announcing fractional intervals\" ` announce(fraction0, fraction1, curvePrimitive)`\r\n * @returns true if any \"in\" segments are announced.\r\n */\r\n public announceClipIntervals(_clipper: Clipper, _announce?: AnnounceNumberNumberCurvePrimitive): boolean {\r\n // DEFAULT IMPLEMENTATION -- no interior parts\r\n return false;\r\n }\r\n\r\n /** Return (if possible) a curve primitive which is a portion of this curve.\r\n * @param _fractionA [in] start fraction\r\n * @param _fractionB [in] end fraction\r\n */\r\n public clonePartialCurve(_fractionA: number, _fractionB: number): CurvePrimitive | undefined {\r\n return undefined;\r\n }\r\n /**\r\n * * If the curve primitive has distance-along-curve strictly proportional to curve fraction, return true\r\n * * If distance-along-the-curve is not proportional, return undefined.\r\n * * When defined, the scale factor is always the length of the curve.\r\n * * This scale factor is typically available for these curve types:\r\n * * * All `LineSegment3d`\r\n * * * Arc3d which is a true circular arc (axes perpendicular and of equal length).\r\n * * * CurveChainWithDistanceIndex\r\n * * This scale factor is undefined for these curve types:\r\n * * * Arc3d which is a true ellipse, i.e. unequal lengths of defining vectors or non-perpendicular defining vectors.\r\n * * * bspline and bezier curves\r\n * @returns scale factor or undefined\r\n */\r\n public getFractionToDistanceScale(): number | undefined { return undefined; }\r\n\r\n /** Reverse the curve's data so that its fractional stroking moves in the opposite direction. */\r\n public abstract reverseInPlace(): void;\r\n /**\r\n * Compute intersections with a plane.\r\n * * The intersections are appended to the result array.\r\n * * The base class implementation emits strokes to an AppendPlaneIntersectionStrokeHandler object, which uses a Newton iteration to get\r\n * high-accuracy intersection points within strokes.\r\n * * Derived classes should override this default implementation if there are easy analytic solutions.\r\n * * Derived classes are free to implement extended intersections (e.g. arc!!!)\r\n * @param plane The plane to be intersected.\r\n * @param result Array to receive intersections\r\n * @returns Return the number of CurveLocationDetail's added to the result array.\r\n */\r\n public appendPlaneIntersectionPoints(plane: PlaneAltitudeEvaluator, result: CurveLocationDetail[]): number {\r\n const strokeHandler = new AppendPlaneIntersectionStrokeHandler(plane, result);\r\n const n0 = result.length;\r\n this.emitStrokableParts(strokeHandler);\r\n return result.length - n0;\r\n }\r\n /**\r\n * Examine contents of an array of CurveLocationDetail.\r\n * Filter the intersections according to the parameters.\r\n * @param allowExtend if false, remove points on the extension.\r\n * @param applySnappedCoordinates if true, change the stored fractions and coordinates to exact end values. Otherwise\r\n * use the exact values only for purpose of updating the curveIntervalRole.\r\n * @param startEndFractionTolerance if nonzero, adjust fraction to 0 or 1 with this tolerance.\r\n * @param startEndXYZTolerance if nonzero, adjust to endpoint with this tolerance.\r\n * @internal\r\n */\r\n public static snapAndRestrictDetails(\r\n details: CurveLocationDetail[],\r\n allowExtend: boolean = true,\r\n applySnappedCoordinates: boolean = false,\r\n startEndFractionTolerance = Geometry.smallAngleRadians,\r\n startEndXYZTolerance = Geometry.smallMetricDistance) {\r\n const n0 = details.length;\r\n let acceptIndex = 0;\r\n const point0 = Point3d.create();\r\n const point1 = Point3d.create();\r\n let snappedCoordinates: Point3d | undefined;\r\n for (let candidateIndex = 0; candidateIndex < n0; candidateIndex++) {\r\n snappedCoordinates = undefined;\r\n const detail = details[candidateIndex];\r\n let fraction = detail.fraction;\r\n let accept = allowExtend || Geometry.isIn01(fraction);\r\n if (detail.curve) {\r\n detail.curve.startPoint(point0);\r\n detail.curve.endPoint(point1);\r\n }\r\n\r\n if (startEndFractionTolerance > 0) {\r\n if (Math.abs(fraction) < startEndFractionTolerance) {\r\n fraction = 0.0;\r\n accept = true;\r\n detail.intervalRole = CurveIntervalRole.isolatedAtVertex;\r\n snappedCoordinates = point0;\r\n }\r\n if (Math.abs(fraction - 1.0) < startEndFractionTolerance) {\r\n fraction = 1.0;\r\n accept = true;\r\n detail.intervalRole = CurveIntervalRole.isolatedAtVertex;\r\n snappedCoordinates = point1;\r\n if (detail.curve)\r\n snappedCoordinates = detail.curve.startPoint(point1);\r\n }\r\n }\r\n if (startEndXYZTolerance > 0 && detail.curve !== undefined) {\r\n // REMARK: always test both endpoints. If there is a cyclic fraction space, an intersection marked as \"after\" the end might have wrapped all the way to the beginning.\r\n if (detail.point.distance(point0) <= startEndXYZTolerance) {\r\n fraction = 0.0;\r\n detail.intervalRole = CurveIntervalRole.isolatedAtVertex;\r\n snappedCoordinates = point0;\r\n } else if (detail.point.distance(point1) <= startEndXYZTolerance) {\r\n fraction = 1.0;\r\n detail.intervalRole = CurveIntervalRole.isolatedAtVertex;\r\n snappedCoordinates = point1;\r\n }\r\n }\r\n if (accept) {\r\n if (applySnappedCoordinates) {\r\n detail.fraction = fraction;\r\n if (snappedCoordinates !== undefined)\r\n detail.point.setFrom(snappedCoordinates);\r\n }\r\n if (acceptIndex < candidateIndex)\r\n details[acceptIndex] = detail;\r\n acceptIndex++;\r\n }\r\n\r\n }\r\n if (acceptIndex < n0)\r\n details.length = acceptIndex;\r\n\r\n }\r\n\r\n /** Ask if the curve is within tolerance of a plane.\r\n * @returns Returns true if the curve is completely within tolerance of the plane.\r\n */\r\n public abstract isInPlane(plane: Plane3dByOriginAndUnitNormal): boolean;\r\n /** return the startPoint of the primitive. The default implementation returns fractionToPoint (0.0) */\r\n public startPoint(result?: Point3d): Point3d { return this.fractionToPoint(0.0, result); }\r\n /** return the end point of the primitive. The default implementation returns fractionToPoint(1.0) */\r\n public endPoint(result?: Point3d): Point3d { return this.fractionToPoint(1.0, result); }\r\n /** Add strokes to caller-supplied linestring */\r\n public abstract emitStrokes(dest: LineString3d, options?: StrokeOptions): void;\r\n /** Ask the curve to announce points and simple subcurve fragments for stroking.\r\n * See IStrokeHandler for description of the sequence of the method calls.\r\n */\r\n public abstract emitStrokableParts(dest: IStrokeHandler, options?: StrokeOptions): void;\r\n /**\r\n * return the stroke count required for given options.\r\n * * This returns a single number\r\n * * See computeComponentStrokeCountForOptions to get structured per-component counts and fraction mappings.\r\n * @param options StrokeOptions that determine count\r\n */\r\n public abstract computeStrokeCountForOptions(options?: StrokeOptions): number;\r\n\r\n /**\r\n * attach StrokeCountMap structure to this primitive (and recursively to any children)\r\n * * Base class implementation (here) gets the simple count from computeStrokeCountForOptions and attaches it.\r\n * * LineString3d, arc3d, BezierCurve3d, BezierCurve3dH accept that default.\r\n * * Subdivided primitives (linestring, bspline curve) implement themselves and attach a StrokeCountMap containing the\r\n * total count, and also containing an array of StrokeCountMap per component.\r\n * * For CurvePrimitiveWithDistanceIndex, the top level gets (only) a total count, and each child gets\r\n * its own StrokeCountMap with appropriate structure.\r\n * @param options StrokeOptions that determine count\r\n * @param parentStrokeMap optional map from parent. Its count, curveLength, and a1 values are increased with count and distance from this primitive.\r\n * @return sum of `a0+this.curveLength()`, for use as `a0` of successor in chain.\r\n */\r\n public computeAndAttachRecursiveStrokeCounts(options?: StrokeOptions, parentMap?: StrokeCountMap) {\r\n const n = this.computeStrokeCountForOptions(options);\r\n const a = this.curveLength();\r\n CurvePrimitive.installStrokeCountMap(\r\n this,\r\n StrokeCountMap.createWithCurvePrimitive(this, n, a, 0, a),\r\n parentMap);\r\n }\r\n\r\n /**\r\n * * evaluate strokes at fractions indicated in a StrokeCountMap.\r\n * * Base class implementation (here) gets the simple count from computeStrokeCountForOptions and strokes at uniform fractions.\r\n * * LineString3d, arc3d, BezierCurve3d, BezierCurve3dH accept that default.\r\n * * Subdivided primitives (linestring, bspline curve) implement themselves and evaluate within components.\r\n * * CurvePrimitiveWithDistanceIndex recurses to its children.\r\n * * if packedFraction and packedDerivative arrays are present in the LineString3d, fill them.\r\n * @param map = stroke count data.\r\n * @param linestring = receiver linestring.\r\n * @return number of strokes added. 0 if any errors matching the map to the curve primitive.\r\n */\r\n public addMappedStrokesToLineString3D(map: StrokeCountMap, linestring: LineString3d): number {\r\n const numPoint0 = linestring.numPoints();\r\n if (map.primitive && map.primitive === this && map.numStroke > 0) {\r\n for (let i = 0; i <= map.numStroke; i++) {\r\n const fraction = i / map.numStroke;\r\n linestring.appendFractionToPoint(this, fraction);\r\n }\r\n }\r\n return linestring.numPoints() - numPoint0;\r\n }\r\n\r\n /**\r\n * final install step to save curveMap in curve. If parentMap is given, update its length, count, and a1 fields\r\n * @param curve curve to receive the annotation\r\n * @param map\r\n * @param parentMap\r\n */\r\n public static installStrokeCountMap(curve: CurvePrimitive, curveMap: StrokeCountMap, parentMap?: StrokeCountMap) {\r\n if (parentMap)\r\n parentMap.addToCountAndLength(curveMap.numStroke, curveMap.curveLength);\r\n curve.strokeData = curveMap;\r\n }\r\n /**\r\n * Return an array containing only the curve primitives.\r\n * * This DEFAULT simply pushes `this` to the collectorArray.\r\n * * CurvePrimitiveWithDistanceIndex optionally collects its members.\r\n * @param collectorArray array to receive primitives (pushed -- the array is not cleared)\r\n * @param smallestPossiblePrimitives if false, CurvePrimitiveWithDistanceIndex returns only itself. If true, it recurses to its (otherwise hidden) children.\r\n */\r\n public collectCurvePrimitivesGo(collectorArray: CurvePrimitive[], _smallestPossiblePrimitives: boolean, _explodeLinestrings: boolean = false) {\r\n collectorArray.push(this);\r\n }\r\n\r\n /**\r\n * Return an array containing only the curve primitives.\r\n * * This DEFAULT captures the default result construction and calls collectCurvePrimitivesGo\r\n * @param collectorArray optional array to receive primitives. If present, new primitives are ADDED (without clearing the array.)\r\n * @param smallestPossiblePrimitives if false, CurvePrimitiveWithDistanceIndex returns only itself. If true, it recurses to its (otherwise hidden) children.\r\n */\r\n public collectCurvePrimitives(collectorArray?: CurvePrimitive[], smallestPossiblePrimitives: boolean = false,\r\n explodeLinestrings: boolean = false): CurvePrimitive[] {\r\n const results: CurvePrimitive[] = collectorArray === undefined ? [] : collectorArray;\r\n this.collectCurvePrimitivesGo(results, smallestPossiblePrimitives, explodeLinestrings);\r\n return results;\r\n }\r\n\r\n}\r\n\r\n/** Intermediate class for managing the parentCurve announcements from an IStrokeHandler */\r\nabstract class NewtonRotRStrokeHandler extends NewtonEvaluatorRtoR {\r\n protected _parentCurvePrimitive: CurvePrimitive | undefined;\r\n constructor() {\r\n super();\r\n this._parentCurvePrimitive = undefined;\r\n }\r\n /** retain the parentCurvePrimitive.\r\n * * Calling this method tells the handler that the parent curve is to be used for detail searches.\r\n * * Example: Transition spiral search is based on linestring first, then the exact spiral.\r\n * * Example: CurveChainWithDistanceIndex does NOT do this announcement -- the constituents act independently.\r\n */\r\n public startParentCurvePrimitive(curve: CurvePrimitive | undefined) { this._parentCurvePrimitive = curve; }\r\n /** Forget the parentCurvePrimitive */\r\n public endParentCurvePrimitive(_curve: CurvePrimitive | undefined) { this._parentCurvePrimitive = undefined; }\r\n}\r\n\r\nclass AppendPlaneIntersectionStrokeHandler extends NewtonRotRStrokeHandler implements IStrokeHandler {\r\n private _curve: CurvePrimitive | undefined;\r\n private _plane: PlaneAltitudeEvaluator;\r\n private _intersections: CurveLocationDetail[];\r\n private _fractionA: number = 0;\r\n private _functionA: number = 0;\r\n // private derivativeA: number; <---- Not currently used\r\n private _functionB: number = 0;\r\n private _fractionB: number = 0;\r\n private _derivativeB: number = 0;\r\n private _numThisCurve: number = 0;\r\n // scratch vars for use within methods.\r\n private _ray: Ray3d;\r\n private _newtonSolver: Newton1dUnboundedApproximateDerivative;\r\n\r\n // Return the first defined curve among: this.parentCurvePrimitive, this.curve;\r\n public effectiveCurve(): CurvePrimitive | undefined {\r\n if (this._parentCurvePrimitive)\r\n return this._parentCurvePrimitive;\r\n return this._curve;\r\n }\r\n public get getDerivativeB() { return this._derivativeB; } // <--- DerivativeB is not currently used anywhere. Provided getter to suppress lint error\r\n\r\n public constructor(plane: PlaneAltitudeEvaluator, intersections: CurveLocationDetail[]) {\r\n super();\r\n this._plane = plane;\r\n this._intersections = intersections;\r\n this.startCurvePrimitive(undefined);\r\n this._ray = Ray3d.createZero();\r\n this._newtonSolver = new Newton1dUnboundedApproximateDerivative(this);\r\n }\r\n public startCurvePrimitive(curve: CurvePrimitive | undefined) {\r\n this._curve = curve;\r\n this._fractionA = 0.0;\r\n this._numThisCurve = 0;\r\n this._functionA = 0.0;\r\n // this.derivativeA = 0.0;\r\n }\r\n public endCurvePrimitive() { }\r\n public announceIntervalForUniformStepStrokes(\r\n cp: CurvePrimitive,\r\n numStrokes: number,\r\n fraction0: number,\r\n fraction1: number): void {\r\n this.startCurvePrimitive(cp);\r\n if (numStrokes < 1) numStrokes = 1;\r\n const df = 1.0 / numStrokes;\r\n for (let i = 0; i <= numStrokes; i++) {\r\n const fraction = Geometry.interpolate(fraction0, i * df, fraction1);\r\n cp.fractionToPointAndDerivative(fraction, this._ray);\r\n this.announcePointTangent(this._ray.origin, fraction, this._ray.direction);\r\n }\r\n }\r\n public announceSegmentInterval(\r\n _cp: CurvePrimitive,\r\n point0: Point3d,\r\n point1: Point3d,\r\n _numStrokes: number,\r\n fraction0: number,\r\n fraction1: number): void {\r\n const h0 = this._plane.altitude(point0);\r\n const h1 = this._plane.altitude(point1);\r\n if (h0 * h1 > 0.0)\r\n return;\r\n const fraction01 = Order2Bezier.solveCoffs(h0, h1);\r\n // let numIntersection = 0;\r\n if (fraction01 !== undefined) {\r\n // numIntersection++;\r\n const fraction = Geometry.interpolate(fraction0, fraction01, fraction1);\r\n this._newtonSolver.setX(fraction);\r\n if (this._newtonSolver.runIterations()) {\r\n this.announceSolutionFraction(this._newtonSolver.getX());\r\n }\r\n // this.intersections.push(CurveLocationDetail.createCurveFractionPoint(cp, fraction, cp.fractionToPoint(fraction)));\r\n }\r\n }\r\n private announceSolutionFraction(fraction: number) {\r\n const curve = this.effectiveCurve();\r\n if (curve) {\r\n this._ray = curve.fractionToPointAndDerivative(fraction, this._ray);\r\n this._intersections.push(CurveLocationDetail.createCurveFractionPoint(curve, fraction, this._ray.origin));\r\n }\r\n }\r\n public evaluate(fraction: number): boolean {\r\n const curve = this.effectiveCurve();\r\n if (!curve)\r\n return false;\r\n this.currentF = this._plane.altitude(curve.fractionToPoint(fraction));\r\n return true;\r\n }\r\n /**\r\n * * ASSUME both the \"A\" and \"B\" evaluations (fraction, function, and derivative) are known.\r\n * * If function value changed sign between, interpolate an approximate root and improve it with\r\n * the newton solver.\r\n */\r\n private searchInterval() {\r\n if (this._functionA * this._functionB > 0) return;\r\n if (this._functionA === 0) this.announceSolutionFraction(this._fractionA);\r\n if (this._functionB === 0) this.announceSolutionFraction(this._fractionB);\r\n if (this._functionA * this._functionB < 0) {\r\n const fraction = Geometry.inverseInterpolate(this._fractionA, this._functionA, this._fractionB, this._functionB);\r\n if (fraction) {\r\n this._newtonSolver.setX(fraction);\r\n if (this._newtonSolver.runIterations())\r\n this.announceSolutionFraction(this._newtonSolver.getX());\r\n }\r\n }\r\n }\r\n /** Evaluate and save _functionB, _derivativeB, and _fractionB. */\r\n private evaluateB(xyz: Point3d, fraction: number, tangent: Vector3d) {\r\n this._functionB = this._plane.altitude(xyz);\r\n this._derivativeB = this._plane.velocity(tangent);\r\n this._fractionB = fraction;\r\n }\r\n /**\r\n * Announce point and tangent for evaluations.\r\n * * The function evaluation is saved as the \"B\" function point.\r\n * * The function point count is incremented\r\n * * If function point count is greater than 1, the current interval is searched.\r\n * * The just-evaluated point (\"B\") is saved as the \"old\" (\"A\") evaluation point.\r\n * @param xyz\r\n * @param fraction\r\n * @param tangent\r\n */\r\n public announcePointTangent(xyz: Point3d, fraction: number, tangent: Vector3d): void {\r\n this.evaluateB(xyz, fraction, tangent);\r\n if (this._numThisCurve++ > 0) this.searchInterval();\r\n this._functionA = this._functionB;\r\n this._fractionA = this._fractionB;\r\n }\r\n}\r\n\r\nclass CurveLengthContext implements IStrokeHandler {\r\n private _curve: CurvePrimitive | undefined;\r\n private _summedLength: number;\r\n private _ray: Ray3d;\r\n private _fraction0: number;\r\n private _fraction1: number;\r\n private _gaussMapper: GaussMapper;\r\n\r\n private tangentMagnitude(fraction: number): number {\r\n this._ray = (this._curve as CurvePrimitive).fractionToPointAndDerivative(fraction, this._ray);\r\n return this._ray.direction.magnitude();\r\n }\r\n public getSum() { return this._summedLength; }\r\n\r\n public constructor(fraction0: number = 0.0, fraction1: number = 1.0, numGaussPoints: number = 5) {\r\n this.startCurvePrimitive(undefined);\r\n this._summedLength = 0.0;\r\n this._ray = Ray3d.createZero();\r\n if (fraction0 < fraction1) {\r\n this._fraction0 = fraction0;\r\n this._fraction1 = fraction1;\r\n } else {\r\n this._fraction0 = fraction1;\r\n this._fraction1 = fraction0;\r\n }\r\n this._gaussMapper = new GaussMapper(numGaussPoints);\r\n }\r\n public startCurvePrimitive(curve: CurvePrimitive | undefined) {\r\n this._curve = curve;\r\n }\r\n public startParentCurvePrimitive(_curve: CurvePrimitive) { }\r\n public endParentCurvePrimitive(_curve: CurvePrimitive) { }\r\n\r\n public endCurvePrimitive() { }\r\n public announceIntervalForUniformStepStrokes(\r\n cp: CurvePrimitive,\r\n numStrokes: number,\r\n fraction0: number,\r\n fraction1: number): void {\r\n if (fraction0 < this._fraction0) fraction0 = this._fraction0;\r\n if (fraction1 > this._fraction1) fraction1 = this._fraction1;\r\n if (fraction1 > fraction0) {\r\n this.startCurvePrimitive(cp);\r\n if (numStrokes < 1) numStrokes = 1;\r\n const df = 1.0 / numStrokes;\r\n for (let i = 1; i <= numStrokes; i++) {\r\n const fractionA = Geometry.interpolate(fraction0, (i - 1) * df, fraction1);\r\n const fractionB = i === numStrokes ? fraction1 : Geometry.interpolate(fraction0, (i) * df, fraction1);\r\n const numGauss = this._gaussMapper.mapXAndW(fractionA, fractionB);\r\n for (let k = 0; k < numGauss; k++) {\r\n this._summedLength += this._gaussMapper.gaussW[k] * this.tangentMagnitude(this._gaussMapper.gaussX[k]);\r\n }\r\n }\r\n }\r\n }\r\n public announceSegmentInterval(\r\n _cp: CurvePrimitive,\r\n point0: Point3d,\r\n point1: Point3d,\r\n _numStrokes: number,\r\n fraction0: number,\r\n fraction1: number): void {\r\n const segmentLength = point0.distance(point1);\r\n if (this._fraction0 <= fraction0 && fraction1 <= this._fraction1)\r\n this._summedLength += segmentLength;\r\n else {\r\n let g0 = fraction0;\r\n let g1 = fraction1;\r\n if (g0 < this._fraction0) g0 = this._fraction0;\r\n if (g1 > this._fraction1) g1 = this._fraction1;\r\n if (g1 > g0) {\r\n this._summedLength += segmentLength * (g1 - g0) / (fraction1 - fraction0);\r\n }\r\n }\r\n }\r\n public announcePointTangent(_xyz: Point3d, _fraction: number, _tangent: Vector3d): void {\r\n // uh oh -- need to retain point for next interval\r\n }\r\n}\r\n// context for searching for closest point .. .\r\nclass ClosestPointStrokeHandler extends NewtonRotRStrokeHandler implements IStrokeHandler {\r\n private _curve: CurvePrimitive | undefined;\r\n private _closestPoint: CurveLocationDetail | undefined;\r\n private _spacePoint: Point3d;\r\n private _extend: VariantCurveExtendParameter;\r\n private _fractionA: number = 0;\r\n private _functionA: number = 0;\r\n private _functionB: number = 0;\r\n private _fractionB: number = 0;\r\n private _numThisCurve: number = 0;\r\n // scratch vars for use within methods.\r\n private _workPoint: Point3d;\r\n private _workRay: Ray3d;\r\n private _newtonSolver: Newton1dUnboundedApproximateDerivative;\r\n\r\n public constructor(spacePoint: Point3d, extend: VariantCurveExtendParameter) {\r\n super();\r\n this._spacePoint = spacePoint;\r\n this._workPoint = Point3d.create();\r\n this._workRay = Ray3d.createZero();\r\n this._closestPoint = undefined;\r\n this._extend = extend;\r\n this.startCurvePrimitive(undefined);\r\n this._newtonSolver = new Newton1dUnboundedApproximateDerivative(this);\r\n }\r\n\r\n public claimResult(): CurveLocationDetail | undefined {\r\n if (this._closestPoint) {\r\n this._newtonSolver.setX(this._closestPoint.fraction);\r\n this._curve = this._closestPoint.curve;\r\n if (this._newtonSolver.runIterations()) {\r\n let fraction = this._newtonSolver.getX();\r\n fraction = CurveExtendOptions.correctFraction(this._extend, fraction);\r\n this.announceSolutionFraction(fraction);\r\n }\r\n }\r\n return this._closestPoint;\r\n }\r\n public needPrimaryGeometryForStrokes() { return true; }\r\n public startCurvePrimitive(curve: CurvePrimitive | undefined) {\r\n this._curve = curve;\r\n this._fractionA = 0.0;\r\n this._numThisCurve = 0;\r\n this._functionA = 0.0;\r\n }\r\n public endCurvePrimitive() { }\r\n public announceIntervalForUniformStepStrokes(\r\n cp: CurvePrimitive,\r\n numStrokes: number,\r\n fraction0: number,\r\n fraction1: number): void {\r\n this.startCurvePrimitive(cp);\r\n this.announceSolutionFraction(0.0); // test start point as closest\r\n this.announceSolutionFraction(1.0); // test end point as closest\r\n if (numStrokes < 1) numStrokes = 1;\r\n const df = 1.0 / numStrokes;\r\n for (let i = 0; i <= numStrokes; i++) {\r\n const fraction = Geometry.interpolate(fraction0, i * df, fraction1);\r\n cp.fractionToPointAndDerivative(fraction, this._workRay);\r\n this.announceRay(fraction, this._workRay);\r\n }\r\n }\r\n\r\n private announceCandidate(cp: CurvePrimitive, fraction: number, point: Point3d) {\r\n const distance = this._spacePoint.distance(point);\r\n if (this._closestPoint && distance > this._closestPoint.a)\r\n return;\r\n this._closestPoint = CurveLocationDetail.createCurveFractionPoint(cp, fraction, point, this._closestPoint);\r\n this._closestPoint.a = distance;\r\n if (this._parentCurvePrimitive !== undefined)\r\n this._closestPoint.curve = this._parentCurvePrimitive;\r\n }\r\n public announceSegmentInterval(\r\n cp: CurvePrimitive,\r\n point0: Point3d,\r\n point1: Point3d,\r\n _numStrokes: number,\r\n fraction0: number,\r\n fraction1: number): void {\r\n let localFraction = this._spacePoint.fractionOfProjectionToLine(point0, point1, 0.0);\r\n // only consider extending the segment if the immediate caller says we are at endpoints ...\r\n if (!this._extend)\r\n localFraction = Geometry.clampToStartEnd(localFraction, 0.0, 1.0);\r\n else {\r\n if (fraction0 !== 0.0)\r\n localFraction = Math.max(localFraction, 0.0);\r\n if (fraction1 !== 1.0)\r\n localFraction = Math.min(localFraction, 1.0);\r\n }\r\n this._workPoint = point0.interpolate(localFraction, point1);\r\n const globalFraction = Geometry.interpolate(fraction0, localFraction, fraction1);\r\n this.announceCandidate(cp, globalFraction, this._workPoint);\r\n }\r\n private searchInterval() {\r\n if (this._functionA * this._functionB > 0) return;\r\n if (this._functionA === 0) this.announceSolutionFraction(this._fractionA);\r\n if (this._functionB === 0) this.announceSolutionFraction(this._fractionB);\r\n if (this._functionA * this._functionB < 0) {\r\n const fraction = Geometry.inverseInterpolate(this._fractionA, this._functionA, this._fractionB, this._functionB);\r\n if (fraction) {\r\n this._newtonSolver.setX(fraction);\r\n if (this._newtonSolver.runIterations())\r\n this.announceSolutionFraction(this._newtonSolver.getX());\r\n }\r\n }\r\n }\r\n private evaluateB(fractionB: number, dataB: Ray3d) {\r\n this._functionB = dataB.dotProductToPoint(this._spacePoint);\r\n this._fractionB = fractionB;\r\n }\r\n private announceSolutionFraction(fraction: number) {\r\n if (this._curve)\r\n this.announceCandidate(this._curve, fraction, this._curve.fractionToPoint(fraction));\r\n }\r\n public evaluate(fraction: number): boolean {\r\n let curve = this._curve;\r\n if (this._parentCurvePrimitive)\r\n curve = this._parentCurvePrimitive;\r\n if (curve) {\r\n this._workRay = curve.fractionToPointAndDerivative(fraction, this._workRay);\r\n this.currentF = this._workRay.dotProductToPoint(this._spacePoint);\r\n return true;\r\n }\r\n return false;\r\n }\r\n public announceRay(fraction: number, data: Ray3d): void {\r\n this.evaluateB(fraction, data);\r\n if (this._numThisCurve++ > 0) this.searchInterval();\r\n this._functionA = this._functionB;\r\n this._fractionA = this._fractionB;\r\n }\r\n public announcePointTangent(point: Point3d, fraction: number, tangent: Vector3d) {\r\n this._workRay.set(point, tangent);\r\n this.announceRay(fraction, this._workRay);\r\n }\r\n}\r\n"]}
@@ -346,9 +346,9 @@ export class DirectSpiral3d extends TransitionSpiral3d {
346
346
  return result;
347
347
  }
348
348
  /** Return the spiral start point. */
349
- startPoint() { return this.activeStrokes.startPoint(); }
349
+ startPoint() { return this.localToWorld.multiplyPoint3d(this.activeStrokes.startPoint()); }
350
350
  /** return the spiral end point. */
351
- endPoint() { return this.activeStrokes.endPoint(); }
351
+ endPoint() { return this.localToWorld.multiplyPoint3d(this.activeStrokes.endPoint()); }
352
352
  /** test if the local to world transform places the spiral xy plane into `plane` */
353
353
  isInPlane(plane) {
354
354
  return plane.isPointInPlane(this.localToWorld.origin)
@@ -1 +1 @@
1
- {"version":3,"file":"DirectSpiral3d.js","sourceRoot":"","sources":["../../../../src/curve/spiral/DirectSpiral3d.ts"],"names":[],"mappings":"AAAA;;;+FAG+F;AAC/F;;GAEG;AACH,OAAO,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAC;AAO1C,OAAO,EAAE,SAAS,EAAE,MAAM,4BAA4B,CAAC;AAEvD,OAAO,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAC/C,OAAO,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC;AAEjD,OAAO,EAAE,yBAAyB,EAAE,MAAM,kBAAkB,CA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U,CAAC;mBAC5D,IAAI,CAAC,YAAY,CAAC,aAAa,CAAC,KAAK,CAAC,YAAY,CAAC;mBACnD,IAAI,CAAC,uBAAuB,CAAC,aAAa,CAAC,KAAK,CAAC,uBAAuB,CAAC;mBACzE,IAAI,CAAC,UAAU,CAAC,aAAa,CAAC,KAAK,CAAC,UAAU,CAAC,CAAC;SACtD;QACD,OAAO,KAAK,CAAC;IACf,CAAC;CACF","sourcesContent":["/*---------------------------------------------------------------------------------------------\r\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\r\n* See LICENSE.md in the project root for license terms and full copyright notice.\r\n*--------------------------------------------------------------------------------------------*/\r\n/** @packageDocumentation\r\n * @module Curve\r\n */\r\nimport { Geometry } from \"../../Geometry\";\r\nimport { GeometryHandler, IStrokeHandler } from \"../../geometry3d/GeometryHandler\";\r\nimport { Plane3dByOriginAndUnitNormal } from \"../../geometry3d/Plane3dByOriginAndUnitNormal\";\r\nimport { Plane3dByOriginAndVectors } from \"../../geometry3d/Plane3dByOriginAndVectors\";\r\nimport { Point3d } from \"../../geometry3d/Point3dVector3d\";\r\nimport { Range3d } from \"../../geometry3d/Range\";\r\nimport { Ray3d } from \"../../geometry3d/Ray3d\";\r\nimport { Segment1d } from \"../../geometry3d/Segment1d\";\r\nimport { Transform } from \"../../geometry3d/Transform\";\r\nimport { LineString3d } from \"../LineString3d\";\r\nimport { StrokeOptions } from \"../StrokeOptions\";\r\nimport { TransitionConditionalProperties } from \"./TransitionConditionalProperties\";\r\nimport { ClothoidSeriesRLEvaluator } from \"./ClothoidSeries\";\r\nimport { CzechSpiralEvaluator, ItalianSpiralEvaluator } from \"./CzechSpiralEvaluator\";\r\nimport { DirectHalfCosineSpiralEvaluator } from \"./DirectHalfCosineSpiralEvaluator\";\r\nimport { AustralianRailCorpXYEvaluator } from \"./AustralianRailCorpXYEvaluator\";\r\nimport { XYCurveEvaluator } from \"./XYCurveEvaluator\";\r\nimport { TransitionSpiral3d } from \"./TransitionSpiral3d\";\r\nimport { Angle } from \"../../geometry3d/Angle\";\r\nimport { MXCubicAlongArcEvaluator } from \"./MXCubicAlongArcSpiralEvaluator\";\r\nimport { PolishCubicEvaluator } from \"./PolishCubicSpiralEvaluator\";\r\n/**\r\n* DirectSpiral3d acts like a TransitionSpiral3d for serialization purposes, but implements spiral types that have \"direct\" xy calculations without the integrations required\r\n* for IntegratedSpiral3d.\r\n* * Each DirectSpiral3d carries an XYCurveEvaluator to give it specialized behavior.\r\n* * Direct spirals that flow through serialization to native imodel02 are create with these static methods:\r\n* * createArema\r\n* * createJapaneseCubic\r\n* * createAustralianRail\r\n* * createDirectHalfCosine\r\n* * createChineseCubic\r\n* * createCzechCubic\r\n* * createPolishCubic\r\n* * createItalian\r\n* * createWesternAustralian\r\n* @public\r\n*/\r\nexport class DirectSpiral3d extends TransitionSpiral3d {\r\n\r\n /** String name for schema properties */\r\n\r\n public readonly curvePrimitiveType = \"transitionSpiral\";\r\n\r\n /** stroked approximation of entire spiral. */\r\n private _globalStrokes: LineString3d;\r\n /** stroked approximation of active spiral.\r\n * * Same count as global -- possibly overly fine, but it gives some consistency between same clothoid constructed as partial versus complete.\r\n * * If no trimming, this points to the same place as the _globalStrokes !!! Don't double transform!!!\r\n */\r\n private _activeStrokes?: LineString3d;\r\n /** Return the internal stroked form of the (possibly partial) spiral */\r\n public get activeStrokes(): LineString3d { return this._activeStrokes !== undefined ? this._activeStrokes : this._globalStrokes; }\r\n\r\n private _nominalL1: number;\r\n private _nominalR1: number;\r\n private _evaluator: XYCurveEvaluator;\r\n\r\n /** Return the nominal end radius. */\r\n public get nominalR1(): number { return this._nominalR1; }\r\n /** Return the nominal distance from inflection to endpoint. */\r\n public get nominalL1(): number { return this._nominalL1; }\r\n /** Return the nominal end curvature */\r\n public get nominalCurvature1(): number { return TransitionSpiral3d.radiusToCurvature(this._nominalR1); }\r\n /** Return the low level evaluator\r\n * @internal\r\n */\r\n public get evaluator(): XYCurveEvaluator { return this._evaluator; }\r\n\r\n // constructor demands radius1 and distance1 for nominal construction.\r\n // caller is responsible for managing intervals of partial spiral\r\n constructor(\r\n localToWorld: Transform,\r\n spiralType: string | undefined,\r\n originalProperties: TransitionConditionalProperties | undefined,\r\n nominalL1: number,\r\n nominalR1: number,\r\n activeFractionInterval: Segment1d | undefined,\r\n evaluator: XYCurveEvaluator) {\r\n super(spiralType, localToWorld, activeFractionInterval, originalProperties);\r\n this._nominalL1 = nominalL1;\r\n this._nominalR1 = nominalR1;\r\n this._evaluator = evaluator;\r\n this._globalStrokes = LineString3d.create();\r\n this._activeStrokes = LineString3d.create();\r\n // initialize for compiler -- but this will be recomputed in refreshComputeProperties ...\r\n this.refreshComputedProperties();\r\n }\r\n /**\r\n * Compute stroke data in an interval.\r\n * @param strokes strokes to clear and refill.\r\n * @param fraction0 start fraction\r\n * @param fraction1 end fraction\r\n */\r\n private computeStrokes(strokes: LineString3d, fractionA: number, fractionB: number, numInterval: number) {\r\n if (numInterval < 1)\r\n numInterval = 1;\r\n strokes.clear();\r\n strokes.ensureEmptyUVParams();\r\n strokes.ensureEmptyFractions();\r\n const distances = strokes.packedUVParams!;\r\n const nominalIntervalLength = Math.abs(fractionB - fractionA) * this._nominalL1;\r\n for (let i = 0; i <= numInterval; i++) {\r\n const fraction = Geometry.interpolate(fractionA, i / numInterval, fractionB);\r\n const nominalDistanceAlong = fraction * nominalIntervalLength;\r\n strokes.packedPoints.pushXYZ(this._evaluator.fractionToX(fraction),\r\n this._evaluator.fractionToY(fraction), 0);\r\n distances.pushXY(fraction, nominalDistanceAlong); // the second distance will be updated below\r\n }\r\n\r\n let fraction0 = distances.getXAtUncheckedPointIndex(0);\r\n let trueDistance0 = distances.getYAtUncheckedPointIndex(0); // whatever was assigned as start distance is fine\r\n let trueDistance1, fraction1;\r\n for (let i = 1; i <= numInterval; i++) {\r\n fraction1 = distances.getXAtUncheckedPointIndex(i);\r\n trueDistance1 = trueDistance0 + this._evaluator.integrateDistanceBetweenFractions(fraction0, fraction1);\r\n distances.setXYZAtCheckedPointIndex(i, fraction1, trueDistance1);\r\n fraction0 = fraction1;\r\n trueDistance0 = trueDistance1;\r\n }\r\n\r\n }\r\n /** Recompute strokes */\r\n public refreshComputedProperties() {\r\n const sweepRadians = this.nominalL1 / (2.0 * this.nominalR1);\r\n const radiansStep = 0.02;\r\n const numInterval = StrokeOptions.applyAngleTol(undefined, 4, sweepRadians, radiansStep);\r\n this.computeStrokes(this._globalStrokes, 0, 1, numInterval);\r\n const numActiveInterval = Math.ceil(this._activeFractionInterval.absoluteDelta() * numInterval);\r\n this._activeStrokes = LineString3d.create();\r\n this.computeStrokes(this._activeStrokes, this._activeFractionInterval.x0, this._activeFractionInterval.x1,\r\n numActiveInterval);\r\n }\r\n /**\r\n * Create a spiral object which uses numXTerm terms from the clothoid X series and numYTerm from the clothoid Y series.\r\n * @param numXTerm number of terms to use from X series\r\n * @param numYTerm number of terms to use from Y series\r\n * @param localToWorld placement frame. Inflection point is at origin, initial direction is along x axis.\r\n * @param nominalL1 design distance from inflection to end point.\r\n * @param nominalR1 design radius at end point.\r\n * @param activeInterval active interval (as fractions of nominalL1 !!!)\r\n */\r\n public static createTruncatedClothoid(\r\n spiralType: string,\r\n localToWorld: Transform,\r\n numXTerm: number, numYTerm: number,\r\n originalProperties: TransitionConditionalProperties | undefined,\r\n nominalL1: number, nominalR1: number,\r\n activeInterval: Segment1d | undefined): DirectSpiral3d | undefined {\r\n if (numXTerm < 1)\r\n numXTerm = 1;\r\n if (numYTerm < 1)\r\n numYTerm = 1;\r\n const evaluator = new ClothoidSeriesRLEvaluator(nominalL1, 1.0 / (2.0 * nominalL1 * nominalR1), numXTerm, numYTerm);\r\n return new DirectSpiral3d(\r\n localToWorld.clone(),\r\n spiralType,\r\n originalProperties,\r\n nominalL1, nominalR1,\r\n activeInterval ? activeInterval.clone() : Segment1d.create(0, 1), evaluator);\r\n }\r\n /**\r\n * Create an Japanese spiral clothoid approximation\r\n * * X is 1 terms of the clothoid series as a function of nominal distance along.\r\n * * Y is 1 terms f the clothoid series as a function of nominal distance along.\r\n * * Remark: This is identical to the ChineseCubic\r\n * @param localToWorld axes with inflection at origin, tangent along x axis\r\n * @param nominalL1 nominal length as used in series LR terms.\r\n * @param nominalR1 nominal final radius as used in series LR terms\r\n * @param activeInterval fractional interval with (0, nominalL1) range for nominal distance along\r\n */\r\n public static createJapaneseCubic(\r\n localToWorld: Transform,\r\n nominalL1: number,\r\n nominalR1: number,\r\n activeInterval?: Segment1d): DirectSpiral3d | undefined {\r\n return this.createTruncatedClothoid(\"JapaneseCubic\", localToWorld, 1, 1, undefined, nominalL1, nominalR1, activeInterval);\r\n }\r\n /**\r\n * Create a czech cubic.\r\n * This is y= m*x^3 with\r\n * * x any point on the x axis\r\n * * `fraction` along the spiral goes to `x = fraction * L`\r\n * * m is gamma / (6RL)\r\n * * 1/(6RL) is the leading term of the sine series.\r\n * * `gamma = 2R/sqrt (4RR-LL)` pushes y up a little bit to simulate the lost series terms.\r\n * @param localToWorld\r\n * @param nominalLx nominal length along x axis\r\n * @param nominalR1\r\n * @param activeInterval\r\n */\r\n public static createCzechCubic(\r\n localToWorld: Transform,\r\n nominalLx: number,\r\n nominalR1: number,\r\n activeInterval?: Segment1d): DirectSpiral3d | undefined {\r\n const evaluator = CzechSpiralEvaluator.create(nominalLx, nominalR1);\r\n if (evaluator === undefined)\r\n return undefined;\r\n return new DirectSpiral3d(\r\n localToWorld.clone(),\r\n \"Czech\",\r\n undefined,\r\n nominalLx, nominalR1,\r\n activeInterval ? activeInterval.clone() : Segment1d.create(0, 1), evaluator);\r\n }\r\n /**\r\n * Create an italian spiral\r\n * This is y= m*x^3 with\r\n * * x any point on the x axis\r\n * * `fraction` along the spiral goes to `x = fraction * L`\r\n * * m is gamma / (6RL)\r\n * * 1/(6RL) is the leading term of the sine series.\r\n * * `gamma = 2R/sqrt (4RR-LL)` pushes y up a little bit to simulate the lost series terms.\r\n * * L in gamma and m is the\r\n * @param localToWorld\r\n * @param nominalL1 nominal length along the spiral\r\n * @param nominalR1\r\n * @param activeInterval\r\n */\r\n public static createItalian(\r\n localToWorld: Transform,\r\n nominalL1: number,\r\n nominalR1: number,\r\n activeInterval?: Segment1d): DirectSpiral3d | undefined {\r\n const evaluator = ItalianSpiralEvaluator.create(nominalL1, nominalR1);\r\n if (evaluator === undefined)\r\n return undefined;\r\n return new DirectSpiral3d(\r\n localToWorld.clone(),\r\n \"Italian\",\r\n undefined,\r\n nominalL1, nominalR1,\r\n activeInterval ? activeInterval.clone() : Segment1d.create(0, 1), evaluator);\r\n }\r\n\r\n /**\r\n * Create an MX Cubic whose nominal length is close to along the curve.\r\n * This is y= m*x^3 with\r\n * * m is 1/ (6RL1)\r\n * * 1/(6RL) is the leading term of the sine series.\r\n * * L1 is an along-the-x-axis distance that is slightly LESS THAN the nominal length\r\n * * x is axis position that is slightly LESS than nominal distance along\r\n * * L1, x use the approximation `x = s * ( 1 - s^4/ (40 R R L L))\r\n * @param localToWorld\r\n * @param nominalL1\r\n * @param nominalR1\r\n * @param activeInterval\r\n */\r\n public static createMXCubicAlongArc(\r\n localToWorld: Transform,\r\n nominalL1: number,\r\n nominalR1: number,\r\n activeInterval?: Segment1d): DirectSpiral3d | undefined {\r\n const evaluator = MXCubicAlongArcEvaluator.create(nominalL1, nominalR1);\r\n if (evaluator === undefined)\r\n return undefined;\r\n return new DirectSpiral3d(\r\n localToWorld.clone(),\r\n \"MXCubicAlongArc\",\r\n undefined,\r\n nominalL1, nominalR1,\r\n activeInterval ? activeInterval.clone() : Segment1d.create(0, 1), evaluator);\r\n }\r\n\r\n /**\r\n * Create a polish cubic\r\n * This is y= m*x^3 with\r\n * * m is 1/ (6RL)\r\n * * 1/(6RL) is the leading term of the sine series.\r\n * * L is nominal length\r\n * * R is nominal end radius.\r\n * * x ranges up to the x axis distance for which the polish distance series produces f(x)=L\r\n * * The support class PolishCubicEvaluator has static methods for the distance series and its inversion.\r\n */\r\n public static createPolishCubic(\r\n localToWorld: Transform,\r\n nominalL1: number,\r\n nominalR1: number,\r\n activeInterval?: Segment1d): DirectSpiral3d | undefined {\r\n const evaluator = PolishCubicEvaluator.create(nominalL1, nominalR1);\r\n if (evaluator === undefined)\r\n return undefined;\r\n return new DirectSpiral3d(\r\n localToWorld.clone(),\r\n \"PolishCubic\",\r\n undefined,\r\n nominalL1, nominalR1,\r\n activeInterval ? activeInterval.clone() : Segment1d.create(0, 1), evaluator);\r\n }\r\n\r\n /**\r\n * Create an AustralianRailCorp spiral\r\n * This is y= m*x^3 with\r\n * * x any point on the x axis\r\n * * `fraction` along the spiral goes to `x = fraction * L`\r\n * * m is gamma / (6RL)\r\n * * 1/(6RL) is the leading term of the sine series.\r\n * * `gamma = 2R/sqrt (4RR-LL)` pushes y up a little bit to simulate the lost series terms.\r\n * @param localToWorld\r\n * @param nominalL1\r\n * @param nominalR1\r\n * @param activeInterval\r\n */\r\n public static createAustralianRail(\r\n localToWorld: Transform,\r\n nominalL1: number,\r\n nominalR1: number,\r\n activeInterval?: Segment1d): DirectSpiral3d | undefined {\r\n const evaluator = AustralianRailCorpXYEvaluator.create(nominalL1, nominalR1);\r\n if (evaluator === undefined)\r\n return undefined;\r\n return new DirectSpiral3d(\r\n localToWorld.clone(),\r\n \"AustralianRailCorp\",\r\n undefined,\r\n nominalL1, nominalR1,\r\n activeInterval ? activeInterval.clone() : Segment1d.create(0, 1), evaluator);\r\n }\r\n\r\n public static createDirectHalfCosine(\r\n localToWorld: Transform,\r\n nominalL1: number,\r\n nominalR1: number,\r\n activeInterval?: Segment1d): DirectSpiral3d | undefined {\r\n return new this(localToWorld, \"HalfCosine\", undefined, nominalL1, nominalR1, activeInterval,\r\n new DirectHalfCosineSpiralEvaluator(nominalL1, nominalR1));\r\n }\r\n /**\r\n * Create an Arema spiral clothoid approximation\r\n * * X is 2 terms of the clothoid series as a function of nominal distance along\r\n * * Y is 2 terms f the clothoid series as a function of nominal distance along\r\n * * Remark: This is identical to the ChineseCubic\r\n * @param localToWorld axes with inflection at origin, tangent along x axis\r\n * @param nominalL1 nominal length as used in series LR terms.\r\n * @param nominalR1 nominal final radius as used in series LR terms\r\n * @param activeInterval fractional interval with (0, nominalL1) range for nominal distance along\r\n */\r\n public static createArema(\r\n localToWorld: Transform,\r\n nominalL1: number,\r\n nominalR1: number,\r\n activeInterval?: Segment1d): DirectSpiral3d | undefined {\r\n return this.createTruncatedClothoid(\"Arema\", localToWorld, 2, 2, undefined, nominalL1, nominalR1, activeInterval);\r\n }\r\n\r\n /**\r\n * Create a Chinese clothoid approximation\r\n * * X is 2 terms of the clothoid series as a function of nominal distance along\r\n * * Y is 2 terms f the clothoid series as a function of nominal distance along\r\n * * Remark: This is identical to the Arema spiral\r\n * @param localToWorld axes with inflection at origin, tangent along x axis\r\n * @param nominalL1 nominal length as used in series LR terms.\r\n * @param nominalR1 nominal final radius as used in series LR terms\r\n * @param activeInterval fractional interval with (0, nominalL1) range for nominal distance along\r\n */\r\n public static createChineseCubic(\r\n localToWorld: Transform,\r\n nominalL1: number,\r\n nominalR1: number,\r\n activeInterval?: Segment1d): DirectSpiral3d | undefined {\r\n return this.createTruncatedClothoid(\"ChineseCubic\", localToWorld, 2, 2, undefined, nominalL1, nominalR1, activeInterval);\r\n }\r\n /**\r\n * Create a Western Australian direct spiral.\r\n * * X is 2 terms of the clothoid series as a function of distance along\r\n * * Y is 1 term (cubic in nominal distance along)\r\n * @param localToWorld axes with inflection at origin, tangent along x axis\r\n * @param nominalL1 nominal length as used in series LR terms.\r\n * @param nominalR1 nominal final radius as used in series LR terms\r\n * @param activeInterval fractional interval with (0, nominalL1) range for nominal distance along\r\n */\r\n public static createWesternAustralian(\r\n localToWorld: Transform,\r\n nominalL1: number,\r\n nominalR1: number,\r\n activeInterval?: Segment1d): DirectSpiral3d | undefined {\r\n return this.createTruncatedClothoid(\"WesternAustralian\", localToWorld, 2, 1, undefined, nominalL1, nominalR1, activeInterval);\r\n }\r\n /**\r\n * Create (if possible) a DirectSpiral3d, applying various strict conditions appropriate to the spiral type.\r\n * The parameter list includes extraneous values in order to directly match IntegratedSpiral3d.create, which has greater flexibility about\r\n * mixtures of values.\r\n * * IMPORTANT RESTRICTIONS\r\n * * Direct spirals must have the inflection at the origin of their coordinate system, aligned with the x axis.\r\n * * hence bearing0 = 0\r\n * * hence radius0 = 0\r\n * * bearing1 is ignored\r\n * * radius1 must be given.\r\n * * arcLength must be given,\r\n * @param spiralType one of the types in `DirectSpiralTypeNames`\r\n * @param radius0 radius (or 0 for tangent to line) at start. Must be ZERO or UNDEFINED\r\n * @param radius1 radius (or 0 for tangent to line) at end.\r\n * @param bearing0 bearing, measured CCW from x axis at start. Must be ZERO or UNDEFINED\r\n * @param bearing1 bearing, measured CCW from x axis at end. IGNORED.\r\n * @param fractionInterval optional fractional interval for an \"active\" portion of the curve. if omitted, the full [0,1] is used.\r\n * @param localToWorld placement transform\r\n */\r\n public static createFromLengthAndRadius(\r\n spiralType: string,\r\n radius0: number | undefined,\r\n radius1: number | undefined,\r\n bearing0: Angle | undefined,\r\n _bearing1: Angle | undefined,\r\n arcLength: number | undefined,\r\n activeInterval: undefined | Segment1d,\r\n localToWorld: Transform): TransitionSpiral3d | undefined {\r\n if (bearing0 !== undefined && !bearing0.isAlmostZero)\r\n return undefined;\r\n if (radius0 !== undefined && !Geometry.isSmallMetricDistance(radius0))\r\n return undefined;\r\n if (radius1 === undefined || Geometry.isSmallMetricDistance(radius1))\r\n return undefined;\r\n if (arcLength === undefined)\r\n return undefined;\r\n if (Geometry.equalStringNoCase(spiralType, \"Arema\"))\r\n return this.createArema(localToWorld, arcLength, radius1, activeInterval);\r\n if (Geometry.equalStringNoCase(spiralType, \"ChineseCubic\"))\r\n return this.createChineseCubic(localToWorld, arcLength, radius1, activeInterval);\r\n if (Geometry.equalStringNoCase(spiralType, \"JapaneseCubic\"))\r\n return this.createJapaneseCubic(localToWorld, arcLength, radius1, activeInterval);\r\n if (Geometry.equalStringNoCase(spiralType, \"HalfCosine\"))\r\n return this.createDirectHalfCosine(localToWorld, arcLength, radius1, activeInterval);\r\n if (Geometry.equalStringNoCase(spiralType, \"Czech\"))\r\n return this.createCzechCubic(localToWorld, arcLength, radius1, activeInterval);\r\n if (Geometry.equalStringNoCase(spiralType, \"Italian\"))\r\n return this.createItalian(localToWorld, arcLength, radius1, activeInterval);\r\n if (Geometry.equalStringNoCase(spiralType, \"AustralianRailCorp\"))\r\n return this.createAustralianRail(localToWorld, arcLength, radius1, activeInterval);\r\n if (Geometry.equalStringNoCase(spiralType, \"MXCubicAlongArc\"))\r\n return this.createMXCubicAlongArc(localToWorld, arcLength, radius1, activeInterval);\r\n if (Geometry.equalStringNoCase(spiralType, \"WesternAustralian\"))\r\n return this.createWesternAustralian(localToWorld, arcLength, radius1, activeInterval);\r\n if (Geometry.equalStringNoCase(spiralType, \"PolishCubic\"))\r\n return this.createPolishCubic(localToWorld, arcLength, radius1, activeInterval);\r\n return undefined;\r\n }\r\n /** Deep clone of this spiral */\r\n public clone(): DirectSpiral3d {\r\n return new DirectSpiral3d(\r\n this.localToWorld.clone(),\r\n this._spiralType,\r\n this.designProperties?.clone(),\r\n this._nominalL1,\r\n this._nominalR1,\r\n this._activeFractionInterval?.clone(),\r\n this._evaluator.clone());\r\n }\r\n\r\n /** Return (if possible) a spiral which is a portion of this curve. */\r\n public override clonePartialCurve(fractionA: number, fractionB: number): DirectSpiral3d | undefined {\r\n const spiralB = this.clone();\r\n const globalFractionA = this._activeFractionInterval.fractionToPoint(fractionA);\r\n const globalFractionB = this._activeFractionInterval.fractionToPoint(fractionB);\r\n spiralB._activeFractionInterval.set(globalFractionA, globalFractionB);\r\n spiralB.refreshComputedProperties();\r\n return spiralB;\r\n }\r\n\r\n /** apply `transform` to this spiral's local to world transform. */\r\n public tryTransformInPlace(transformA: Transform): boolean {\r\n const rigidData = this.applyRigidPartOfTransform(transformA);\r\n if (rigidData !== undefined) {\r\n this._nominalL1 *= rigidData.scale;\r\n this._nominalR1 *= rigidData.scale;\r\n this.evaluator.scaleInPlace(rigidData.scale);\r\n }\r\n this.refreshComputedProperties();\r\n return true;\r\n }\r\n /** Clone with a transform applied */\r\n public cloneTransformed(transform: Transform): DirectSpiral3d {\r\n const result = this.clone();\r\n result.tryTransformInPlace(transform); // ok, we're confident it will always work.\r\n return result;\r\n }\r\n /** Return the spiral start point. */\r\n public override startPoint(): Point3d { return this.activeStrokes.startPoint(); }\r\n /** return the spiral end point. */\r\n public override endPoint(): Point3d { return this.activeStrokes.endPoint(); }\r\n /** test if the local to world transform places the spiral xy plane into `plane` */\r\n public isInPlane(plane: Plane3dByOriginAndUnitNormal): boolean {\r\n return plane.isPointInPlane(this.localToWorld.origin as Point3d)\r\n && Geometry.isSameCoordinate(0.0, this.localToWorld.matrix.dotColumnX(plane.getNormalRef()))\r\n && Geometry.isSameCoordinate(0.0, this.localToWorld.matrix.dotColumnY(plane.getNormalRef()));\r\n }\r\n /** Return quick length of the spiral.\r\n * The tangent vector of a true clothoid is length 1 everywhere, so simple proportion of nominalL1 is a good approximation.\r\n */\r\n public quickLength() {\r\n const distanceData = this._globalStrokes.packedUVParams!;\r\n const n = distanceData.length;\r\n return distanceData.getYAtUncheckedPointIndex(n - 1);\r\n }\r\n /** Return length of the spiral.\r\n * * True length is stored at back of uvParams . . .\r\n */\r\n // use the generic integrator ... public override curveLength() { return this.quickLength(); }\r\n /** Test if `other` is an instance of `TransitionSpiral3d` */\r\n public isSameGeometryClass(other: any): boolean { return other instanceof DirectSpiral3d; }\r\n /** Add strokes from this spiral to `dest`.\r\n * * Linestrings will usually stroke as just their points.\r\n * * If maxEdgeLength is given, this will sub-stroke within the linestring -- not what we want.\r\n */\r\n public emitStrokes(dest: LineString3d, options?: StrokeOptions): void { this.activeStrokes.emitStrokes(dest, options); }\r\n /** emit stroke fragments to `dest` handler. */\r\n public emitStrokableParts(dest: IStrokeHandler, options?: StrokeOptions): void {\r\n const n = this.computeStrokeCountForOptions(options);\r\n const activeStrokes = this.activeStrokes;\r\n dest.startParentCurvePrimitive(this);\r\n if (n <= activeStrokes.numPoints()) {\r\n // this.activeStrokes.emitStrokableParts(dest, options);\r\n dest.announceIntervalForUniformStepStrokes(this, 2 * activeStrokes.numPoints(), 0.0, 1.0);\r\n } else {\r\n dest.announceIntervalForUniformStepStrokes(this, n, 0.0, 1.0);\r\n }\r\n dest.endParentCurvePrimitive(this);\r\n }\r\n\r\n /**\r\n * return the stroke count required for given options.\r\n * @param options StrokeOptions that determine count\r\n */\r\n\r\n public computeStrokeCountForOptions(options?: StrokeOptions): number {\r\n let numStroke;\r\n const nominalRadians = this._nominalL1 / (2.0 * this._nominalR1);\r\n if (options) {\r\n const rMin = Math.abs(this._nominalR1);\r\n numStroke = options.applyTolerancesToArc(rMin, nominalRadians);\r\n numStroke = options.applyMaxEdgeLength(numStroke, this.quickLength());\r\n numStroke = options.applyMinStrokesPerPrimitive(numStroke);\r\n } else {\r\n numStroke = StrokeOptions.applyAngleTol(undefined, 4, nominalRadians, 0.02);\r\n }\r\n numStroke = Math.ceil(this._activeFractionInterval.absoluteDelta() * numStroke);\r\n return numStroke;\r\n }\r\n\r\n /** Reverse the active interval and active strokes.\r\n * * Primary defining data remains unchanged !!!\r\n */\r\n\r\n public reverseInPlace(): void {\r\n this._activeFractionInterval.reverseInPlace();\r\n if (this._activeStrokes === undefined)\r\n this._activeStrokes = this._globalStrokes.clone();\r\n this._activeStrokes.reverseInPlace();\r\n }\r\n /** Evaluate curve point with respect to fraction. */\r\n public fractionToPoint(activeFraction: number, result?: Point3d): Point3d {\r\n const globalFraction = this._activeFractionInterval.fractionToPoint(activeFraction);\r\n result = this._evaluator.fractionToPoint(globalFraction, result);\r\n this.localToWorld.multiplyPoint3d(result, result);\r\n return result;\r\n }\r\n /** Evaluate curve point and derivative with respect to fraction. */\r\n public fractionToPointAndDerivative(activeFraction: number, result?: Ray3d): Ray3d {\r\n const globalFraction = this._activeFractionInterval.fractionToPoint(activeFraction);\r\n result = this._evaluator.fractionToPointAndDerivative(globalFraction, result);\r\n result.direction.scaleInPlace(this._activeFractionInterval.signedDelta());\r\n result.transformInPlace(this.localToWorld);\r\n return result;\r\n }\r\n\r\n /** Return a plane with\r\n *\r\n * * origin at fractional position along the curve\r\n * * vectorU is the first derivative, i.e. tangent vector with length equal to the rate of change with respect to the fraction.\r\n * * vectorV is the second derivative, i.e.derivative of vectorU.\r\n */\r\n\r\n public fractionToPointAnd2Derivatives(activeFraction: number, result?: Plane3dByOriginAndVectors): Plane3dByOriginAndVectors | undefined {\r\n const globalFraction = this._activeFractionInterval.fractionToPoint(activeFraction);\r\n result = this._evaluator.fractionToPointAnd2Derivatives(globalFraction, result);\r\n const a = this._activeFractionInterval.signedDelta();\r\n result.vectorU.scaleInPlace(a);\r\n result.vectorV.scaleInPlace(a * a);\r\n result.transformInPlace(this.localToWorld);\r\n return result;\r\n }\r\n /** Second step of double dispatch: call `handler.handleTransitionSpiral(this)` */\r\n public dispatchToGeometryHandler(handler: GeometryHandler): any {\r\n return handler.handleTransitionSpiral(this);\r\n }\r\n /** extend the range by the strokes of the spiral */\r\n public extendRange(rangeToExtend: Range3d, transform?: Transform): void {\r\n this.activeStrokes.extendRange(rangeToExtend, transform);\r\n }\r\n /** compare various coordinate quantities */\r\n public override isAlmostEqual(other: any): boolean {\r\n if (other instanceof DirectSpiral3d) {\r\n return Geometry.isSameCoordinate(this._nominalL1, other._nominalL1)\r\n && Geometry.isSameCoordinate(this._nominalR1, other._nominalR1)\r\n && this.localToWorld.isAlmostEqual(other.localToWorld)\r\n && this._activeFractionInterval.isAlmostEqual(other._activeFractionInterval)\r\n && this._evaluator.isAlmostEqual(other._evaluator);\r\n }\r\n return false;\r\n }\r\n}\r\n"]}
1
+ {"version":3,"file":"DirectSpiral3d.js","sourceRoot":"","sources":["../../../../src/curve/spiral/DirectSpiral3d.ts"],"names":[],"mappings":"AAAA;;;+FAG+F;AAC/F;;GAEG;AACH,OAAO,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAC;AAO1C,OAAO,EAAE,SAAS,EAAE,MAAM,4BAA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D,CAAC;IACD,4CAA4C;IAC5B,aAAa,CAAC,KAAU;QACtC,IAAI,KAAK,YAAY,cAAc,EAAE;YACnC,OAAO,QAAQ,CAAC,gBAAgB,CAAC,IAAI,CAAC,UAAU,EAAE,KAAK,CAAC,UAAU,CAAC;mBAC9D,QAAQ,CAAC,gBAAgB,CAAC,IAAI,CAAC,UAAU,EAAE,KAAK,CAAC,UAAU,CAAC;mBAC5D,IAAI,CAAC,YAAY,CAAC,aAAa,CAAC,KAAK,CAAC,YAAY,CAAC;mBACnD,IAAI,CAAC,uBAAuB,CAAC,aAAa,CAAC,KAAK,CAAC,uBAAuB,CAAC;mBACzE,IAAI,CAAC,UAAU,CAAC,aAAa,CAAC,KAAK,CAAC,UAAU,CAAC,CAAC;SACtD;QACD,OAAO,KAAK,CAAC;IACf,CAAC;CACF","sourcesContent":["/*---------------------------------------------------------------------------------------------\r\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\r\n* See LICENSE.md in the project root for license terms and full copyright notice.\r\n*--------------------------------------------------------------------------------------------*/\r\n/** @packageDocumentation\r\n * @module Curve\r\n */\r\nimport { Geometry } from \"../../Geometry\";\r\nimport { GeometryHandler, IStrokeHandler } from \"../../geometry3d/GeometryHandler\";\r\nimport { Plane3dByOriginAndUnitNormal } from \"../../geometry3d/Plane3dByOriginAndUnitNormal\";\r\nimport { Plane3dByOriginAndVectors } from \"../../geometry3d/Plane3dByOriginAndVectors\";\r\nimport { Point3d } from \"../../geometry3d/Point3dVector3d\";\r\nimport { Range3d } from \"../../geometry3d/Range\";\r\nimport { Ray3d } from \"../../geometry3d/Ray3d\";\r\nimport { Segment1d } from \"../../geometry3d/Segment1d\";\r\nimport { Transform } from \"../../geometry3d/Transform\";\r\nimport { LineString3d } from \"../LineString3d\";\r\nimport { StrokeOptions } from \"../StrokeOptions\";\r\nimport { TransitionConditionalProperties } from \"./TransitionConditionalProperties\";\r\nimport { ClothoidSeriesRLEvaluator } from \"./ClothoidSeries\";\r\nimport { CzechSpiralEvaluator, ItalianSpiralEvaluator } from \"./CzechSpiralEvaluator\";\r\nimport { DirectHalfCosineSpiralEvaluator } from \"./DirectHalfCosineSpiralEvaluator\";\r\nimport { AustralianRailCorpXYEvaluator } from \"./AustralianRailCorpXYEvaluator\";\r\nimport { XYCurveEvaluator } from \"./XYCurveEvaluator\";\r\nimport { TransitionSpiral3d } from \"./TransitionSpiral3d\";\r\nimport { Angle } from \"../../geometry3d/Angle\";\r\nimport { MXCubicAlongArcEvaluator } from \"./MXCubicAlongArcSpiralEvaluator\";\r\nimport { PolishCubicEvaluator } from \"./PolishCubicSpiralEvaluator\";\r\n/**\r\n* DirectSpiral3d acts like a TransitionSpiral3d for serialization purposes, but implements spiral types that have \"direct\" xy calculations without the integrations required\r\n* for IntegratedSpiral3d.\r\n* * Each DirectSpiral3d carries an XYCurveEvaluator to give it specialized behavior.\r\n* * Direct spirals that flow through serialization to native imodel02 are create with these static methods:\r\n* * createArema\r\n* * createJapaneseCubic\r\n* * createAustralianRail\r\n* * createDirectHalfCosine\r\n* * createChineseCubic\r\n* * createCzechCubic\r\n* * createPolishCubic\r\n* * createItalian\r\n* * createWesternAustralian\r\n* @public\r\n*/\r\nexport class DirectSpiral3d extends TransitionSpiral3d {\r\n\r\n /** String name for schema properties */\r\n\r\n public readonly curvePrimitiveType = \"transitionSpiral\";\r\n\r\n /** stroked approximation of entire spiral. */\r\n private _globalStrokes: LineString3d;\r\n /** stroked approximation of active spiral.\r\n * * Same count as global -- possibly overly fine, but it gives some consistency between same clothoid constructed as partial versus complete.\r\n * * If no trimming, this points to the same place as the _globalStrokes !!! Don't double transform!!!\r\n */\r\n private _activeStrokes?: LineString3d;\r\n /** Return the internal stroked form of the (possibly partial) spiral */\r\n public get activeStrokes(): LineString3d { return this._activeStrokes !== undefined ? this._activeStrokes : this._globalStrokes; }\r\n\r\n private _nominalL1: number;\r\n private _nominalR1: number;\r\n private _evaluator: XYCurveEvaluator;\r\n\r\n /** Return the nominal end radius. */\r\n public get nominalR1(): number { return this._nominalR1; }\r\n /** Return the nominal distance from inflection to endpoint. */\r\n public get nominalL1(): number { return this._nominalL1; }\r\n /** Return the nominal end curvature */\r\n public get nominalCurvature1(): number { return TransitionSpiral3d.radiusToCurvature(this._nominalR1); }\r\n /** Return the low level evaluator\r\n * @internal\r\n */\r\n public get evaluator(): XYCurveEvaluator { return this._evaluator; }\r\n\r\n // constructor demands radius1 and distance1 for nominal construction.\r\n // caller is responsible for managing intervals of partial spiral\r\n constructor(\r\n localToWorld: Transform,\r\n spiralType: string | undefined,\r\n originalProperties: TransitionConditionalProperties | undefined,\r\n nominalL1: number,\r\n nominalR1: number,\r\n activeFractionInterval: Segment1d | undefined,\r\n evaluator: XYCurveEvaluator) {\r\n super(spiralType, localToWorld, activeFractionInterval, originalProperties);\r\n this._nominalL1 = nominalL1;\r\n this._nominalR1 = nominalR1;\r\n this._evaluator = evaluator;\r\n this._globalStrokes = LineString3d.create();\r\n this._activeStrokes = LineString3d.create();\r\n // initialize for compiler -- but this will be recomputed in refreshComputeProperties ...\r\n this.refreshComputedProperties();\r\n }\r\n /**\r\n * Compute stroke data in an interval.\r\n * @param strokes strokes to clear and refill.\r\n * @param fraction0 start fraction\r\n * @param fraction1 end fraction\r\n */\r\n private computeStrokes(strokes: LineString3d, fractionA: number, fractionB: number, numInterval: number) {\r\n if (numInterval < 1)\r\n numInterval = 1;\r\n strokes.clear();\r\n strokes.ensureEmptyUVParams();\r\n strokes.ensureEmptyFractions();\r\n const distances = strokes.packedUVParams!;\r\n const nominalIntervalLength = Math.abs(fractionB - fractionA) * this._nominalL1;\r\n for (let i = 0; i <= numInterval; i++) {\r\n const fraction = Geometry.interpolate(fractionA, i / numInterval, fractionB);\r\n const nominalDistanceAlong = fraction * nominalIntervalLength;\r\n strokes.packedPoints.pushXYZ(this._evaluator.fractionToX(fraction),\r\n this._evaluator.fractionToY(fraction), 0);\r\n distances.pushXY(fraction, nominalDistanceAlong); // the second distance will be updated below\r\n }\r\n\r\n let fraction0 = distances.getXAtUncheckedPointIndex(0);\r\n let trueDistance0 = distances.getYAtUncheckedPointIndex(0); // whatever was assigned as start distance is fine\r\n let trueDistance1, fraction1;\r\n for (let i = 1; i <= numInterval; i++) {\r\n fraction1 = distances.getXAtUncheckedPointIndex(i);\r\n trueDistance1 = trueDistance0 + this._evaluator.integrateDistanceBetweenFractions(fraction0, fraction1);\r\n distances.setXYZAtCheckedPointIndex(i, fraction1, trueDistance1);\r\n fraction0 = fraction1;\r\n trueDistance0 = trueDistance1;\r\n }\r\n\r\n }\r\n /** Recompute strokes */\r\n public refreshComputedProperties() {\r\n const sweepRadians = this.nominalL1 / (2.0 * this.nominalR1);\r\n const radiansStep = 0.02;\r\n const numInterval = StrokeOptions.applyAngleTol(undefined, 4, sweepRadians, radiansStep);\r\n this.computeStrokes(this._globalStrokes, 0, 1, numInterval);\r\n const numActiveInterval = Math.ceil(this._activeFractionInterval.absoluteDelta() * numInterval);\r\n this._activeStrokes = LineString3d.create();\r\n this.computeStrokes(this._activeStrokes, this._activeFractionInterval.x0, this._activeFractionInterval.x1,\r\n numActiveInterval);\r\n }\r\n /**\r\n * Create a spiral object which uses numXTerm terms from the clothoid X series and numYTerm from the clothoid Y series.\r\n * @param numXTerm number of terms to use from X series\r\n * @param numYTerm number of terms to use from Y series\r\n * @param localToWorld placement frame. Inflection point is at origin, initial direction is along x axis.\r\n * @param nominalL1 design distance from inflection to end point.\r\n * @param nominalR1 design radius at end point.\r\n * @param activeInterval active interval (as fractions of nominalL1 !!!)\r\n */\r\n public static createTruncatedClothoid(\r\n spiralType: string,\r\n localToWorld: Transform,\r\n numXTerm: number, numYTerm: number,\r\n originalProperties: TransitionConditionalProperties | undefined,\r\n nominalL1: number, nominalR1: number,\r\n activeInterval: Segment1d | undefined): DirectSpiral3d | undefined {\r\n if (numXTerm < 1)\r\n numXTerm = 1;\r\n if (numYTerm < 1)\r\n numYTerm = 1;\r\n const evaluator = new ClothoidSeriesRLEvaluator(nominalL1, 1.0 / (2.0 * nominalL1 * nominalR1), numXTerm, numYTerm);\r\n return new DirectSpiral3d(\r\n localToWorld.clone(),\r\n spiralType,\r\n originalProperties,\r\n nominalL1, nominalR1,\r\n activeInterval ? activeInterval.clone() : Segment1d.create(0, 1), evaluator);\r\n }\r\n /**\r\n * Create an Japanese spiral clothoid approximation\r\n * * X is 1 terms of the clothoid series as a function of nominal distance along.\r\n * * Y is 1 terms f the clothoid series as a function of nominal distance along.\r\n * * Remark: This is identical to the ChineseCubic\r\n * @param localToWorld axes with inflection at origin, tangent along x axis\r\n * @param nominalL1 nominal length as used in series LR terms.\r\n * @param nominalR1 nominal final radius as used in series LR terms\r\n * @param activeInterval fractional interval with (0, nominalL1) range for nominal distance along\r\n */\r\n public static createJapaneseCubic(\r\n localToWorld: Transform,\r\n nominalL1: number,\r\n nominalR1: number,\r\n activeInterval?: Segment1d): DirectSpiral3d | undefined {\r\n return this.createTruncatedClothoid(\"JapaneseCubic\", localToWorld, 1, 1, undefined, nominalL1, nominalR1, activeInterval);\r\n }\r\n /**\r\n * Create a czech cubic.\r\n * This is y= m*x^3 with\r\n * * x any point on the x axis\r\n * * `fraction` along the spiral goes to `x = fraction * L`\r\n * * m is gamma / (6RL)\r\n * * 1/(6RL) is the leading term of the sine series.\r\n * * `gamma = 2R/sqrt (4RR-LL)` pushes y up a little bit to simulate the lost series terms.\r\n * @param localToWorld\r\n * @param nominalLx nominal length along x axis\r\n * @param nominalR1\r\n * @param activeInterval\r\n */\r\n public static createCzechCubic(\r\n localToWorld: Transform,\r\n nominalLx: number,\r\n nominalR1: number,\r\n activeInterval?: Segment1d): DirectSpiral3d | undefined {\r\n const evaluator = CzechSpiralEvaluator.create(nominalLx, nominalR1);\r\n if (evaluator === undefined)\r\n return undefined;\r\n return new DirectSpiral3d(\r\n localToWorld.clone(),\r\n \"Czech\",\r\n undefined,\r\n nominalLx, nominalR1,\r\n activeInterval ? activeInterval.clone() : Segment1d.create(0, 1), evaluator);\r\n }\r\n /**\r\n * Create an italian spiral\r\n * This is y= m*x^3 with\r\n * * x any point on the x axis\r\n * * `fraction` along the spiral goes to `x = fraction * L`\r\n * * m is gamma / (6RL)\r\n * * 1/(6RL) is the leading term of the sine series.\r\n * * `gamma = 2R/sqrt (4RR-LL)` pushes y up a little bit to simulate the lost series terms.\r\n * * L in gamma and m is the\r\n * @param localToWorld\r\n * @param nominalL1 nominal length along the spiral\r\n * @param nominalR1\r\n * @param activeInterval\r\n */\r\n public static createItalian(\r\n localToWorld: Transform,\r\n nominalL1: number,\r\n nominalR1: number,\r\n activeInterval?: Segment1d): DirectSpiral3d | undefined {\r\n const evaluator = ItalianSpiralEvaluator.create(nominalL1, nominalR1);\r\n if (evaluator === undefined)\r\n return undefined;\r\n return new DirectSpiral3d(\r\n localToWorld.clone(),\r\n \"Italian\",\r\n undefined,\r\n nominalL1, nominalR1,\r\n activeInterval ? activeInterval.clone() : Segment1d.create(0, 1), evaluator);\r\n }\r\n\r\n /**\r\n * Create an MX Cubic whose nominal length is close to along the curve.\r\n * This is y= m*x^3 with\r\n * * m is 1/ (6RL1)\r\n * * 1/(6RL) is the leading term of the sine series.\r\n * * L1 is an along-the-x-axis distance that is slightly LESS THAN the nominal length\r\n * * x is axis position that is slightly LESS than nominal distance along\r\n * * L1, x use the approximation `x = s * ( 1 - s^4/ (40 R R L L))\r\n * @param localToWorld\r\n * @param nominalL1\r\n * @param nominalR1\r\n * @param activeInterval\r\n */\r\n public static createMXCubicAlongArc(\r\n localToWorld: Transform,\r\n nominalL1: number,\r\n nominalR1: number,\r\n activeInterval?: Segment1d): DirectSpiral3d | undefined {\r\n const evaluator = MXCubicAlongArcEvaluator.create(nominalL1, nominalR1);\r\n if (evaluator === undefined)\r\n return undefined;\r\n return new DirectSpiral3d(\r\n localToWorld.clone(),\r\n \"MXCubicAlongArc\",\r\n undefined,\r\n nominalL1, nominalR1,\r\n activeInterval ? activeInterval.clone() : Segment1d.create(0, 1), evaluator);\r\n }\r\n\r\n /**\r\n * Create a polish cubic\r\n * This is y= m*x^3 with\r\n * * m is 1/ (6RL)\r\n * * 1/(6RL) is the leading term of the sine series.\r\n * * L is nominal length\r\n * * R is nominal end radius.\r\n * * x ranges up to the x axis distance for which the polish distance series produces f(x)=L\r\n * * The support class PolishCubicEvaluator has static methods for the distance series and its inversion.\r\n */\r\n public static createPolishCubic(\r\n localToWorld: Transform,\r\n nominalL1: number,\r\n nominalR1: number,\r\n activeInterval?: Segment1d): DirectSpiral3d | undefined {\r\n const evaluator = PolishCubicEvaluator.create(nominalL1, nominalR1);\r\n if (evaluator === undefined)\r\n return undefined;\r\n return new DirectSpiral3d(\r\n localToWorld.clone(),\r\n \"PolishCubic\",\r\n undefined,\r\n nominalL1, nominalR1,\r\n activeInterval ? activeInterval.clone() : Segment1d.create(0, 1), evaluator);\r\n }\r\n\r\n /**\r\n * Create an AustralianRailCorp spiral\r\n * This is y= m*x^3 with\r\n * * x any point on the x axis\r\n * * `fraction` along the spiral goes to `x = fraction * L`\r\n * * m is gamma / (6RL)\r\n * * 1/(6RL) is the leading term of the sine series.\r\n * * `gamma = 2R/sqrt (4RR-LL)` pushes y up a little bit to simulate the lost series terms.\r\n * @param localToWorld\r\n * @param nominalL1\r\n * @param nominalR1\r\n * @param activeInterval\r\n */\r\n public static createAustralianRail(\r\n localToWorld: Transform,\r\n nominalL1: number,\r\n nominalR1: number,\r\n activeInterval?: Segment1d): DirectSpiral3d | undefined {\r\n const evaluator = AustralianRailCorpXYEvaluator.create(nominalL1, nominalR1);\r\n if (evaluator === undefined)\r\n return undefined;\r\n return new DirectSpiral3d(\r\n localToWorld.clone(),\r\n \"AustralianRailCorp\",\r\n undefined,\r\n nominalL1, nominalR1,\r\n activeInterval ? activeInterval.clone() : Segment1d.create(0, 1), evaluator);\r\n }\r\n\r\n public static createDirectHalfCosine(\r\n localToWorld: Transform,\r\n nominalL1: number,\r\n nominalR1: number,\r\n activeInterval?: Segment1d): DirectSpiral3d | undefined {\r\n return new this(localToWorld, \"HalfCosine\", undefined, nominalL1, nominalR1, activeInterval,\r\n new DirectHalfCosineSpiralEvaluator(nominalL1, nominalR1));\r\n }\r\n /**\r\n * Create an Arema spiral clothoid approximation\r\n * * X is 2 terms of the clothoid series as a function of nominal distance along\r\n * * Y is 2 terms f the clothoid series as a function of nominal distance along\r\n * * Remark: This is identical to the ChineseCubic\r\n * @param localToWorld axes with inflection at origin, tangent along x axis\r\n * @param nominalL1 nominal length as used in series LR terms.\r\n * @param nominalR1 nominal final radius as used in series LR terms\r\n * @param activeInterval fractional interval with (0, nominalL1) range for nominal distance along\r\n */\r\n public static createArema(\r\n localToWorld: Transform,\r\n nominalL1: number,\r\n nominalR1: number,\r\n activeInterval?: Segment1d): DirectSpiral3d | undefined {\r\n return this.createTruncatedClothoid(\"Arema\", localToWorld, 2, 2, undefined, nominalL1, nominalR1, activeInterval);\r\n }\r\n\r\n /**\r\n * Create a Chinese clothoid approximation\r\n * * X is 2 terms of the clothoid series as a function of nominal distance along\r\n * * Y is 2 terms f the clothoid series as a function of nominal distance along\r\n * * Remark: This is identical to the Arema spiral\r\n * @param localToWorld axes with inflection at origin, tangent along x axis\r\n * @param nominalL1 nominal length as used in series LR terms.\r\n * @param nominalR1 nominal final radius as used in series LR terms\r\n * @param activeInterval fractional interval with (0, nominalL1) range for nominal distance along\r\n */\r\n public static createChineseCubic(\r\n localToWorld: Transform,\r\n nominalL1: number,\r\n nominalR1: number,\r\n activeInterval?: Segment1d): DirectSpiral3d | undefined {\r\n return this.createTruncatedClothoid(\"ChineseCubic\", localToWorld, 2, 2, undefined, nominalL1, nominalR1, activeInterval);\r\n }\r\n /**\r\n * Create a Western Australian direct spiral.\r\n * * X is 2 terms of the clothoid series as a function of distance along\r\n * * Y is 1 term (cubic in nominal distance along)\r\n * @param localToWorld axes with inflection at origin, tangent along x axis\r\n * @param nominalL1 nominal length as used in series LR terms.\r\n * @param nominalR1 nominal final radius as used in series LR terms\r\n * @param activeInterval fractional interval with (0, nominalL1) range for nominal distance along\r\n */\r\n public static createWesternAustralian(\r\n localToWorld: Transform,\r\n nominalL1: number,\r\n nominalR1: number,\r\n activeInterval?: Segment1d): DirectSpiral3d | undefined {\r\n return this.createTruncatedClothoid(\"WesternAustralian\", localToWorld, 2, 1, undefined, nominalL1, nominalR1, activeInterval);\r\n }\r\n /**\r\n * Create (if possible) a DirectSpiral3d, applying various strict conditions appropriate to the spiral type.\r\n * The parameter list includes extraneous values in order to directly match IntegratedSpiral3d.create, which has greater flexibility about\r\n * mixtures of values.\r\n * * IMPORTANT RESTRICTIONS\r\n * * Direct spirals must have the inflection at the origin of their coordinate system, aligned with the x axis.\r\n * * hence bearing0 = 0\r\n * * hence radius0 = 0\r\n * * bearing1 is ignored\r\n * * radius1 must be given.\r\n * * arcLength must be given,\r\n * @param spiralType one of the types in `DirectSpiralTypeNames`\r\n * @param radius0 radius (or 0 for tangent to line) at start. Must be ZERO or UNDEFINED\r\n * @param radius1 radius (or 0 for tangent to line) at end.\r\n * @param bearing0 bearing, measured CCW from x axis at start. Must be ZERO or UNDEFINED\r\n * @param bearing1 bearing, measured CCW from x axis at end. IGNORED.\r\n * @param fractionInterval optional fractional interval for an \"active\" portion of the curve. if omitted, the full [0,1] is used.\r\n * @param localToWorld placement transform\r\n */\r\n public static createFromLengthAndRadius(\r\n spiralType: string,\r\n radius0: number | undefined,\r\n radius1: number | undefined,\r\n bearing0: Angle | undefined,\r\n _bearing1: Angle | undefined,\r\n arcLength: number | undefined,\r\n activeInterval: undefined | Segment1d,\r\n localToWorld: Transform): TransitionSpiral3d | undefined {\r\n if (bearing0 !== undefined && !bearing0.isAlmostZero)\r\n return undefined;\r\n if (radius0 !== undefined && !Geometry.isSmallMetricDistance(radius0))\r\n return undefined;\r\n if (radius1 === undefined || Geometry.isSmallMetricDistance(radius1))\r\n return undefined;\r\n if (arcLength === undefined)\r\n return undefined;\r\n if (Geometry.equalStringNoCase(spiralType, \"Arema\"))\r\n return this.createArema(localToWorld, arcLength, radius1, activeInterval);\r\n if (Geometry.equalStringNoCase(spiralType, \"ChineseCubic\"))\r\n return this.createChineseCubic(localToWorld, arcLength, radius1, activeInterval);\r\n if (Geometry.equalStringNoCase(spiralType, \"JapaneseCubic\"))\r\n return this.createJapaneseCubic(localToWorld, arcLength, radius1, activeInterval);\r\n if (Geometry.equalStringNoCase(spiralType, \"HalfCosine\"))\r\n return this.createDirectHalfCosine(localToWorld, arcLength, radius1, activeInterval);\r\n if (Geometry.equalStringNoCase(spiralType, \"Czech\"))\r\n return this.createCzechCubic(localToWorld, arcLength, radius1, activeInterval);\r\n if (Geometry.equalStringNoCase(spiralType, \"Italian\"))\r\n return this.createItalian(localToWorld, arcLength, radius1, activeInterval);\r\n if (Geometry.equalStringNoCase(spiralType, \"AustralianRailCorp\"))\r\n return this.createAustralianRail(localToWorld, arcLength, radius1, activeInterval);\r\n if (Geometry.equalStringNoCase(spiralType, \"MXCubicAlongArc\"))\r\n return this.createMXCubicAlongArc(localToWorld, arcLength, radius1, activeInterval);\r\n if (Geometry.equalStringNoCase(spiralType, \"WesternAustralian\"))\r\n return this.createWesternAustralian(localToWorld, arcLength, radius1, activeInterval);\r\n if (Geometry.equalStringNoCase(spiralType, \"PolishCubic\"))\r\n return this.createPolishCubic(localToWorld, arcLength, radius1, activeInterval);\r\n return undefined;\r\n }\r\n /** Deep clone of this spiral */\r\n public clone(): DirectSpiral3d {\r\n return new DirectSpiral3d(\r\n this.localToWorld.clone(),\r\n this._spiralType,\r\n this.designProperties?.clone(),\r\n this._nominalL1,\r\n this._nominalR1,\r\n this._activeFractionInterval?.clone(),\r\n this._evaluator.clone());\r\n }\r\n\r\n /** Return (if possible) a spiral which is a portion of this curve. */\r\n public override clonePartialCurve(fractionA: number, fractionB: number): DirectSpiral3d | undefined {\r\n const spiralB = this.clone();\r\n const globalFractionA = this._activeFractionInterval.fractionToPoint(fractionA);\r\n const globalFractionB = this._activeFractionInterval.fractionToPoint(fractionB);\r\n spiralB._activeFractionInterval.set(globalFractionA, globalFractionB);\r\n spiralB.refreshComputedProperties();\r\n return spiralB;\r\n }\r\n\r\n /** apply `transform` to this spiral's local to world transform. */\r\n public tryTransformInPlace(transformA: Transform): boolean {\r\n const rigidData = this.applyRigidPartOfTransform(transformA);\r\n if (rigidData !== undefined) {\r\n this._nominalL1 *= rigidData.scale;\r\n this._nominalR1 *= rigidData.scale;\r\n this.evaluator.scaleInPlace(rigidData.scale);\r\n }\r\n this.refreshComputedProperties();\r\n return true;\r\n }\r\n /** Clone with a transform applied */\r\n public cloneTransformed(transform: Transform): DirectSpiral3d {\r\n const result = this.clone();\r\n result.tryTransformInPlace(transform); // ok, we're confident it will always work.\r\n return result;\r\n }\r\n /** Return the spiral start point. */\r\n public override startPoint(): Point3d { return this.localToWorld.multiplyPoint3d(this.activeStrokes.startPoint()); }\r\n /** return the spiral end point. */\r\n public override endPoint(): Point3d { return this.localToWorld.multiplyPoint3d(this.activeStrokes.endPoint()); }\r\n /** test if the local to world transform places the spiral xy plane into `plane` */\r\n public isInPlane(plane: Plane3dByOriginAndUnitNormal): boolean {\r\n return plane.isPointInPlane(this.localToWorld.origin as Point3d)\r\n && Geometry.isSameCoordinate(0.0, this.localToWorld.matrix.dotColumnX(plane.getNormalRef()))\r\n && Geometry.isSameCoordinate(0.0, this.localToWorld.matrix.dotColumnY(plane.getNormalRef()));\r\n }\r\n /** Return quick length of the spiral.\r\n * The tangent vector of a true clothoid is length 1 everywhere, so simple proportion of nominalL1 is a good approximation.\r\n */\r\n public quickLength() {\r\n const distanceData = this._globalStrokes.packedUVParams!;\r\n const n = distanceData.length;\r\n return distanceData.getYAtUncheckedPointIndex(n - 1);\r\n }\r\n /** Return length of the spiral.\r\n * * True length is stored at back of uvParams . . .\r\n */\r\n // use the generic integrator ... public override curveLength() { return this.quickLength(); }\r\n /** Test if `other` is an instance of `TransitionSpiral3d` */\r\n public isSameGeometryClass(other: any): boolean { return other instanceof DirectSpiral3d; }\r\n /** Add strokes from this spiral to `dest`.\r\n * * Linestrings will usually stroke as just their points.\r\n * * If maxEdgeLength is given, this will sub-stroke within the linestring -- not what we want.\r\n */\r\n public emitStrokes(dest: LineString3d, options?: StrokeOptions): void { this.activeStrokes.emitStrokes(dest, options); }\r\n /** emit stroke fragments to `dest` handler. */\r\n public emitStrokableParts(dest: IStrokeHandler, options?: StrokeOptions): void {\r\n const n = this.computeStrokeCountForOptions(options);\r\n const activeStrokes = this.activeStrokes;\r\n dest.startParentCurvePrimitive(this);\r\n if (n <= activeStrokes.numPoints()) {\r\n // this.activeStrokes.emitStrokableParts(dest, options);\r\n dest.announceIntervalForUniformStepStrokes(this, 2 * activeStrokes.numPoints(), 0.0, 1.0);\r\n } else {\r\n dest.announceIntervalForUniformStepStrokes(this, n, 0.0, 1.0);\r\n }\r\n dest.endParentCurvePrimitive(this);\r\n }\r\n\r\n /**\r\n * return the stroke count required for given options.\r\n * @param options StrokeOptions that determine count\r\n */\r\n\r\n public computeStrokeCountForOptions(options?: StrokeOptions): number {\r\n let numStroke;\r\n const nominalRadians = this._nominalL1 / (2.0 * this._nominalR1);\r\n if (options) {\r\n const rMin = Math.abs(this._nominalR1);\r\n numStroke = options.applyTolerancesToArc(rMin, nominalRadians);\r\n numStroke = options.applyMaxEdgeLength(numStroke, this.quickLength());\r\n numStroke = options.applyMinStrokesPerPrimitive(numStroke);\r\n } else {\r\n numStroke = StrokeOptions.applyAngleTol(undefined, 4, nominalRadians, 0.02);\r\n }\r\n numStroke = Math.ceil(this._activeFractionInterval.absoluteDelta() * numStroke);\r\n return numStroke;\r\n }\r\n\r\n /** Reverse the active interval and active strokes.\r\n * * Primary defining data remains unchanged !!!\r\n */\r\n\r\n public reverseInPlace(): void {\r\n this._activeFractionInterval.reverseInPlace();\r\n if (this._activeStrokes === undefined)\r\n this._activeStrokes = this._globalStrokes.clone();\r\n this._activeStrokes.reverseInPlace();\r\n }\r\n /** Evaluate curve point with respect to fraction. */\r\n public fractionToPoint(activeFraction: number, result?: Point3d): Point3d {\r\n const globalFraction = this._activeFractionInterval.fractionToPoint(activeFraction);\r\n result = this._evaluator.fractionToPoint(globalFraction, result);\r\n this.localToWorld.multiplyPoint3d(result, result);\r\n return result;\r\n }\r\n /** Evaluate curve point and derivative with respect to fraction. */\r\n public fractionToPointAndDerivative(activeFraction: number, result?: Ray3d): Ray3d {\r\n const globalFraction = this._activeFractionInterval.fractionToPoint(activeFraction);\r\n result = this._evaluator.fractionToPointAndDerivative(globalFraction, result);\r\n result.direction.scaleInPlace(this._activeFractionInterval.signedDelta());\r\n result.transformInPlace(this.localToWorld);\r\n return result;\r\n }\r\n\r\n /** Return a plane with\r\n *\r\n * * origin at fractional position along the curve\r\n * * vectorU is the first derivative, i.e. tangent vector with length equal to the rate of change with respect to the fraction.\r\n * * vectorV is the second derivative, i.e.derivative of vectorU.\r\n */\r\n\r\n public fractionToPointAnd2Derivatives(activeFraction: number, result?: Plane3dByOriginAndVectors): Plane3dByOriginAndVectors | undefined {\r\n const globalFraction = this._activeFractionInterval.fractionToPoint(activeFraction);\r\n result = this._evaluator.fractionToPointAnd2Derivatives(globalFraction, result);\r\n const a = this._activeFractionInterval.signedDelta();\r\n result.vectorU.scaleInPlace(a);\r\n result.vectorV.scaleInPlace(a * a);\r\n result.transformInPlace(this.localToWorld);\r\n return result;\r\n }\r\n /** Second step of double dispatch: call `handler.handleTransitionSpiral(this)` */\r\n public dispatchToGeometryHandler(handler: GeometryHandler): any {\r\n return handler.handleTransitionSpiral(this);\r\n }\r\n /** extend the range by the strokes of the spiral */\r\n public extendRange(rangeToExtend: Range3d, transform?: Transform): void {\r\n this.activeStrokes.extendRange(rangeToExtend, transform);\r\n }\r\n /** compare various coordinate quantities */\r\n public override isAlmostEqual(other: any): boolean {\r\n if (other instanceof DirectSpiral3d) {\r\n return Geometry.isSameCoordinate(this._nominalL1, other._nominalL1)\r\n && Geometry.isSameCoordinate(this._nominalR1, other._nominalR1)\r\n && this.localToWorld.isAlmostEqual(other.localToWorld)\r\n && this._activeFractionInterval.isAlmostEqual(other._activeFractionInterval)\r\n && this._evaluator.isAlmostEqual(other._evaluator);\r\n }\r\n return false;\r\n }\r\n}\r\n"]}
@@ -76,7 +76,6 @@ export declare class NormalizedBlossTransition extends NormalizedTransition {
76
76
  */
77
77
  fractionToArea(u: number): number;
78
78
  }
79
- /**
80
79
  /**
81
80
  * Transition functions for biquadratic transition
82
81
  * * Curvature is a pair of joining quadratics.
@@ -1 +1 @@
1
- {"version":3,"file":"NormalizedTransition.d.ts","sourceRoot":"","sources":["../../../../src/curve/spiral/NormalizedTransition.ts"],"names":[],"mappings":"AAKA;;GAEG;AACH;;;;;;;;;;;;GAYG;AACH,8BAAsB,oBAAoB;IACxC,iHAAiH;;IAEjH,wFAAwF;aACxE,2BAA2B,CAAC,SAAS,EAAE,MAAM,GAAG,MAAM;IACtE,mEAAmE;aACnD,qCAAqC,CAAC,SAAS,EAAE,MAAM,GAAG,MAAM;IAChF;;OAEG;aACa,cAAc,CAAC,SAAS,EAAE,MAAM,GAAG,MAAM;IACzD,OAAO,CAAC,MAAM,CAAC,kBAAkB,CAAC,CAA+B;IACjE,OAAO,CAAC,MAAM,CAAC,qBAAqB,CAAC,CAAkC;IACvE,OAAO,CAAC,MAAM,CAAC,eAAe,CAAC,CAA4B;IAC3D,OAAO,CAAC,MAAM,CAAC,cAAc,CAAC,CAA2B;IACzD,OAAO,CAAC,MAAM,CAAC,gBAAgB,CAAC,CAA6B;IAE7D;;;;;;;;;;;OAWG;WACW,aAAa,CAAC,IAAI,EAAE,MAAM,GAAG,oBAAoB,GAAG,SAAS;CAa5E;AACD;;;;GAIG;AACH,qBAAa,4BAA6B,SAAQ,oBAAoB;;IAEpE,wFAAwF;IACjF,2BAA2B,CAAC,SAAS,EAAE,MAAM,GAAG,MAAM;IAC7D,mEAAmE;IAC5D,qCAAqC,CAAC,EAAE,EAAE,MAAM,GAAG,MAAM;IAChE;;OAEG;IACI,cAAc,CAAC,SAAS,EAAE,MAAM,GAAG,MAAM;CAGjD;AAED;;;;GAIG;AACH,qBA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,GAAG,MAAM;IAGrD,mEAAmE;IAC5D,qCAAqC,CAAC,CAAC,EAAE,MAAM,GAAG,MAAM;IAG/D;;OAEG;IACI,cAAc,CAAC,CAAC,EAAE,MAAM,GAAG,MAAM;CAMzC;AAED;;;;;;GAMG;AACH,qBAAa,wBAAyB,SAAQ,oBAAoB;;IAEhE,wFAAwF;IACjF,2BAA2B,CAAC,CAAC,EAAE,MAAM,GAAG,MAAM;IAIrD,mEAAmE;IAC5D,qCAAqC,CAAC,CAAC,EAAE,MAAM,GAAG,MAAM;IAI/D;;OAEG;IACI,cAAc,CAAC,CAAC,EAAE,MAAM,GAAG,MAAM;CAIzC;AACD;;;;GAIG;AACH,qBAAa,0BAA2B,SAAQ,oBAAoB;;IAElE,wFAAwF;IACjF,2BAA2B,CAAC,CAAC,EAAE,MAAM,GAAG,MAAM;IAIrD,mEAAmE;IAC5D,qCAAqC,CAAC,CAAC,EAAE,MAAM,GAAG,MAAM;IAI/D;;OAEG;IACI,cAAc,CAAC,CAAC,EAAE,MAAM,GAAG,MAAM;CAIzC"}
@@ -91,7 +91,6 @@ export class NormalizedBlossTransition extends NormalizedTransition {
91
91
  return u * u * u * (1 - 0.5 * u);
92
92
  }
93
93
  }
94
- /**
95
94
  /**
96
95
  * Transition functions for biquadratic transition
97
96
  * * Curvature is a pair of joining quadratics.