@itwin/core-geometry 5.14.0-dev.1 → 5.14.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 (234) hide show
  1. package/CHANGELOG.md +19 -1
  2. package/lib/cjs/bspline/AkimaCurve3d.d.ts +18 -13
  3. package/lib/cjs/bspline/AkimaCurve3d.d.ts.map +1 -1
  4. package/lib/cjs/bspline/AkimaCurve3d.js +19 -16
  5. package/lib/cjs/bspline/AkimaCurve3d.js.map +1 -1
  6. package/lib/cjs/bspline/BSplineCurve.d.ts +2 -1
  7. package/lib/cjs/bspline/BSplineCurve.d.ts.map +1 -1
  8. package/lib/cjs/bspline/BSplineCurve.js +3 -2
  9. package/lib/cjs/bspline/BSplineCurve.js.map +1 -1
  10. package/lib/cjs/bspline/InterpolationCurve3d.d.ts +5 -1
  11. package/lib/cjs/bspline/InterpolationCurve3d.d.ts.map +1 -1
  12. package/lib/cjs/bspline/InterpolationCurve3d.js +11 -11
  13. package/lib/cjs/bspline/InterpolationCurve3d.js.map +1 -1
  14. package/lib/cjs/clipping/ClipUtils.d.ts.map +1 -1
  15. package/lib/cjs/clipping/ClipUtils.js +0 -2
  16. package/lib/cjs/clipping/ClipUtils.js.map +1 -1
  17. package/lib/cjs/curve/CoordinateXYZ.d.ts +2 -2
  18. package/lib/cjs/curve/CoordinateXYZ.d.ts.map +1 -1
  19. package/lib/cjs/curve/CoordinateXYZ.js.map +1 -1
  20. package/lib/cjs/curve/CurveChainWithDistanceIndex.d.ts +5 -5
  21. package/lib/cjs/curve/CurveChainWithDistanceIndex.d.ts.map +1 -1
  22. package/lib/cjs/curve/CurveChainWithDistanceIndex.js +9 -23
  23. package/lib/cjs/curve/CurveChainWithDistanceIndex.js.map +1 -1
  24. package/lib/cjs/curve/CurveCollection.d.ts +20 -4
  25. package/lib/cjs/curve/CurveCollection.d.ts.map +1 -1
  26. package/lib/cjs/curve/CurveCollection.js +39 -2
  27. package/lib/cjs/curve/CurveCollection.js.map +1 -1
  28. package/lib/cjs/curve/CurveFactory.d.ts.map +1 -1
  29. package/lib/cjs/curve/CurveFactory.js +4 -5
  30. package/lib/cjs/curve/CurveFactory.js.map +1 -1
  31. package/lib/cjs/curve/CurveOps.d.ts.map +1 -1
  32. package/lib/cjs/curve/CurveOps.js.map +1 -1
  33. package/lib/cjs/curve/CurvePrimitive.d.ts +10 -3
  34. package/lib/cjs/curve/CurvePrimitive.d.ts.map +1 -1
  35. package/lib/cjs/curve/CurvePrimitive.js +1 -1
  36. package/lib/cjs/curve/CurvePrimitive.js.map +1 -1
  37. package/lib/cjs/curve/CurveProcessor.d.ts +7 -7
  38. package/lib/cjs/curve/CurveProcessor.d.ts.map +1 -1
  39. package/lib/cjs/curve/CurveProcessor.js +19 -3
  40. package/lib/cjs/curve/CurveProcessor.js.map +1 -1
  41. package/lib/cjs/curve/GeometryQuery.d.ts +49 -4
  42. package/lib/cjs/curve/GeometryQuery.d.ts.map +1 -1
  43. package/lib/cjs/curve/GeometryQuery.js +52 -0
  44. package/lib/cjs/curve/GeometryQuery.js.map +1 -1
  45. package/lib/cjs/curve/LineSegment3d.d.ts +1 -1
  46. package/lib/cjs/curve/LineSegment3d.d.ts.map +1 -1
  47. package/lib/cjs/curve/LineSegment3d.js +1 -1
  48. package/lib/cjs/curve/LineSegment3d.js.map +1 -1
  49. package/lib/cjs/curve/Loop.d.ts +18 -2
  50. package/lib/cjs/curve/Loop.d.ts.map +1 -1
  51. package/lib/cjs/curve/Loop.js +26 -1
  52. package/lib/cjs/curve/Loop.js.map +1 -1
  53. package/lib/cjs/curve/ParityRegion.d.ts +7 -2
  54. package/lib/cjs/curve/ParityRegion.d.ts.map +1 -1
  55. package/lib/cjs/curve/ParityRegion.js +9 -8
  56. package/lib/cjs/curve/ParityRegion.js.map +1 -1
  57. package/lib/cjs/curve/Path.d.ts +8 -1
  58. package/lib/cjs/curve/Path.d.ts.map +1 -1
  59. package/lib/cjs/curve/Path.js +12 -0
  60. package/lib/cjs/curve/Path.js.map +1 -1
  61. package/lib/cjs/curve/ProxyCurve.d.ts +1 -1
  62. package/lib/cjs/curve/ProxyCurve.d.ts.map +1 -1
  63. package/lib/cjs/curve/ProxyCurve.js +2 -3
  64. package/lib/cjs/curve/ProxyCurve.js.map +1 -1
  65. package/lib/cjs/curve/Query/PlanarSubdivision.d.ts +36 -35
  66. package/lib/cjs/curve/Query/PlanarSubdivision.d.ts.map +1 -1
  67. package/lib/cjs/curve/Query/PlanarSubdivision.js +4 -4
  68. package/lib/cjs/curve/Query/PlanarSubdivision.js.map +1 -1
  69. package/lib/cjs/curve/RegionOps.d.ts.map +1 -1
  70. package/lib/cjs/curve/RegionOps.js +3 -3
  71. package/lib/cjs/curve/RegionOps.js.map +1 -1
  72. package/lib/cjs/curve/RegionOpsClassificationSweeps.js.map +1 -1
  73. package/lib/cjs/curve/UnionRegion.d.ts +9 -2
  74. package/lib/cjs/curve/UnionRegion.d.ts.map +1 -1
  75. package/lib/cjs/curve/UnionRegion.js +12 -0
  76. package/lib/cjs/curve/UnionRegion.js.map +1 -1
  77. package/lib/cjs/curve/internalContexts/CloneCurvesContext.d.ts +1 -0
  78. package/lib/cjs/curve/internalContexts/CloneCurvesContext.d.ts.map +1 -1
  79. package/lib/cjs/curve/internalContexts/CloneCurvesContext.js +3 -1
  80. package/lib/cjs/curve/internalContexts/CloneCurvesContext.js.map +1 -1
  81. package/lib/cjs/curve/internalContexts/TransformInPlaceContext.d.ts +1 -6
  82. package/lib/cjs/curve/internalContexts/TransformInPlaceContext.d.ts.map +1 -1
  83. package/lib/cjs/curve/internalContexts/TransformInPlaceContext.js +15 -8
  84. package/lib/cjs/curve/internalContexts/TransformInPlaceContext.js.map +1 -1
  85. package/lib/cjs/curve/spiral/DirectSpiral3d.d.ts +5 -2
  86. package/lib/cjs/curve/spiral/DirectSpiral3d.d.ts.map +1 -1
  87. package/lib/cjs/curve/spiral/DirectSpiral3d.js +6 -3
  88. package/lib/cjs/curve/spiral/DirectSpiral3d.js.map +1 -1
  89. package/lib/cjs/curve/spiral/IntegratedSpiral3d.d.ts +5 -2
  90. package/lib/cjs/curve/spiral/IntegratedSpiral3d.d.ts.map +1 -1
  91. package/lib/cjs/curve/spiral/IntegratedSpiral3d.js +6 -3
  92. package/lib/cjs/curve/spiral/IntegratedSpiral3d.js.map +1 -1
  93. package/lib/cjs/geometry3d/Point3dVector3d.d.ts +2 -0
  94. package/lib/cjs/geometry3d/Point3dVector3d.d.ts.map +1 -1
  95. package/lib/cjs/geometry3d/Point3dVector3d.js +4 -0
  96. package/lib/cjs/geometry3d/Point3dVector3d.js.map +1 -1
  97. package/lib/cjs/geometry3d/Range.d.ts +2 -0
  98. package/lib/cjs/geometry3d/Range.d.ts.map +1 -1
  99. package/lib/cjs/geometry3d/Range.js +6 -0
  100. package/lib/cjs/geometry3d/Range.js.map +1 -1
  101. package/lib/cjs/polyface/PolyfaceBuilder.js.map +1 -1
  102. package/lib/cjs/polyface/PolyfaceQuery.js +4 -4
  103. package/lib/cjs/polyface/PolyfaceQuery.js.map +1 -1
  104. package/lib/cjs/serialization/BGFBReader.d.ts.map +1 -1
  105. package/lib/cjs/serialization/BGFBReader.js +5 -2
  106. package/lib/cjs/serialization/BGFBReader.js.map +1 -1
  107. package/lib/cjs/serialization/BGFBWriter.d.ts.map +1 -1
  108. package/lib/cjs/serialization/BGFBWriter.js +1 -2
  109. package/lib/cjs/serialization/BGFBWriter.js.map +1 -1
  110. package/lib/cjs/serialization/IModelJsonSchema.d.ts +56 -41
  111. package/lib/cjs/serialization/IModelJsonSchema.d.ts.map +1 -1
  112. package/lib/cjs/serialization/IModelJsonSchema.js +16 -17
  113. package/lib/cjs/serialization/IModelJsonSchema.js.map +1 -1
  114. package/lib/cjs/topology/Merging.d.ts +4 -2
  115. package/lib/cjs/topology/Merging.d.ts.map +1 -1
  116. package/lib/cjs/topology/Merging.js +23 -20
  117. package/lib/cjs/topology/Merging.js.map +1 -1
  118. package/lib/esm/bspline/AkimaCurve3d.d.ts +18 -13
  119. package/lib/esm/bspline/AkimaCurve3d.d.ts.map +1 -1
  120. package/lib/esm/bspline/AkimaCurve3d.js +19 -16
  121. package/lib/esm/bspline/AkimaCurve3d.js.map +1 -1
  122. package/lib/esm/bspline/BSplineCurve.d.ts +2 -1
  123. package/lib/esm/bspline/BSplineCurve.d.ts.map +1 -1
  124. package/lib/esm/bspline/BSplineCurve.js +3 -2
  125. package/lib/esm/bspline/BSplineCurve.js.map +1 -1
  126. package/lib/esm/bspline/InterpolationCurve3d.d.ts +5 -1
  127. package/lib/esm/bspline/InterpolationCurve3d.d.ts.map +1 -1
  128. package/lib/esm/bspline/InterpolationCurve3d.js +11 -11
  129. package/lib/esm/bspline/InterpolationCurve3d.js.map +1 -1
  130. package/lib/esm/clipping/ClipUtils.d.ts.map +1 -1
  131. package/lib/esm/clipping/ClipUtils.js +0 -2
  132. package/lib/esm/clipping/ClipUtils.js.map +1 -1
  133. package/lib/esm/curve/CoordinateXYZ.d.ts +2 -2
  134. package/lib/esm/curve/CoordinateXYZ.d.ts.map +1 -1
  135. package/lib/esm/curve/CoordinateXYZ.js.map +1 -1
  136. package/lib/esm/curve/CurveChainWithDistanceIndex.d.ts +5 -5
  137. package/lib/esm/curve/CurveChainWithDistanceIndex.d.ts.map +1 -1
  138. package/lib/esm/curve/CurveChainWithDistanceIndex.js +9 -23
  139. package/lib/esm/curve/CurveChainWithDistanceIndex.js.map +1 -1
  140. package/lib/esm/curve/CurveCollection.d.ts +20 -4
  141. package/lib/esm/curve/CurveCollection.d.ts.map +1 -1
  142. package/lib/esm/curve/CurveCollection.js +39 -2
  143. package/lib/esm/curve/CurveCollection.js.map +1 -1
  144. package/lib/esm/curve/CurveFactory.d.ts.map +1 -1
  145. package/lib/esm/curve/CurveFactory.js +4 -5
  146. package/lib/esm/curve/CurveFactory.js.map +1 -1
  147. package/lib/esm/curve/CurveOps.d.ts.map +1 -1
  148. package/lib/esm/curve/CurveOps.js.map +1 -1
  149. package/lib/esm/curve/CurvePrimitive.d.ts +10 -3
  150. package/lib/esm/curve/CurvePrimitive.d.ts.map +1 -1
  151. package/lib/esm/curve/CurvePrimitive.js +1 -1
  152. package/lib/esm/curve/CurvePrimitive.js.map +1 -1
  153. package/lib/esm/curve/CurveProcessor.d.ts +7 -7
  154. package/lib/esm/curve/CurveProcessor.d.ts.map +1 -1
  155. package/lib/esm/curve/CurveProcessor.js +19 -3
  156. package/lib/esm/curve/CurveProcessor.js.map +1 -1
  157. package/lib/esm/curve/GeometryQuery.d.ts +49 -4
  158. package/lib/esm/curve/GeometryQuery.d.ts.map +1 -1
  159. package/lib/esm/curve/GeometryQuery.js +52 -0
  160. package/lib/esm/curve/GeometryQuery.js.map +1 -1
  161. package/lib/esm/curve/LineSegment3d.d.ts +1 -1
  162. package/lib/esm/curve/LineSegment3d.d.ts.map +1 -1
  163. package/lib/esm/curve/LineSegment3d.js +1 -1
  164. package/lib/esm/curve/LineSegment3d.js.map +1 -1
  165. package/lib/esm/curve/Loop.d.ts +18 -2
  166. package/lib/esm/curve/Loop.d.ts.map +1 -1
  167. package/lib/esm/curve/Loop.js +26 -1
  168. package/lib/esm/curve/Loop.js.map +1 -1
  169. package/lib/esm/curve/ParityRegion.d.ts +7 -2
  170. package/lib/esm/curve/ParityRegion.d.ts.map +1 -1
  171. package/lib/esm/curve/ParityRegion.js +9 -8
  172. package/lib/esm/curve/ParityRegion.js.map +1 -1
  173. package/lib/esm/curve/Path.d.ts +8 -1
  174. package/lib/esm/curve/Path.d.ts.map +1 -1
  175. package/lib/esm/curve/Path.js +12 -0
  176. package/lib/esm/curve/Path.js.map +1 -1
  177. package/lib/esm/curve/ProxyCurve.d.ts +1 -1
  178. package/lib/esm/curve/ProxyCurve.d.ts.map +1 -1
  179. package/lib/esm/curve/ProxyCurve.js +2 -3
  180. package/lib/esm/curve/ProxyCurve.js.map +1 -1
  181. package/lib/esm/curve/Query/PlanarSubdivision.d.ts +36 -35
  182. package/lib/esm/curve/Query/PlanarSubdivision.d.ts.map +1 -1
  183. package/lib/esm/curve/Query/PlanarSubdivision.js +4 -4
  184. package/lib/esm/curve/Query/PlanarSubdivision.js.map +1 -1
  185. package/lib/esm/curve/RegionOps.d.ts.map +1 -1
  186. package/lib/esm/curve/RegionOps.js +3 -3
  187. package/lib/esm/curve/RegionOps.js.map +1 -1
  188. package/lib/esm/curve/RegionOpsClassificationSweeps.js.map +1 -1
  189. package/lib/esm/curve/UnionRegion.d.ts +9 -2
  190. package/lib/esm/curve/UnionRegion.d.ts.map +1 -1
  191. package/lib/esm/curve/UnionRegion.js +12 -0
  192. package/lib/esm/curve/UnionRegion.js.map +1 -1
  193. package/lib/esm/curve/internalContexts/CloneCurvesContext.d.ts +1 -0
  194. package/lib/esm/curve/internalContexts/CloneCurvesContext.d.ts.map +1 -1
  195. package/lib/esm/curve/internalContexts/CloneCurvesContext.js +3 -1
  196. package/lib/esm/curve/internalContexts/CloneCurvesContext.js.map +1 -1
  197. package/lib/esm/curve/internalContexts/TransformInPlaceContext.d.ts +1 -6
  198. package/lib/esm/curve/internalContexts/TransformInPlaceContext.d.ts.map +1 -1
  199. package/lib/esm/curve/internalContexts/TransformInPlaceContext.js +15 -8
  200. package/lib/esm/curve/internalContexts/TransformInPlaceContext.js.map +1 -1
  201. package/lib/esm/curve/spiral/DirectSpiral3d.d.ts +5 -2
  202. package/lib/esm/curve/spiral/DirectSpiral3d.d.ts.map +1 -1
  203. package/lib/esm/curve/spiral/DirectSpiral3d.js +6 -3
  204. package/lib/esm/curve/spiral/DirectSpiral3d.js.map +1 -1
  205. package/lib/esm/curve/spiral/IntegratedSpiral3d.d.ts +5 -2
  206. package/lib/esm/curve/spiral/IntegratedSpiral3d.d.ts.map +1 -1
  207. package/lib/esm/curve/spiral/IntegratedSpiral3d.js +6 -3
  208. package/lib/esm/curve/spiral/IntegratedSpiral3d.js.map +1 -1
  209. package/lib/esm/geometry3d/Point3dVector3d.d.ts +2 -0
  210. package/lib/esm/geometry3d/Point3dVector3d.d.ts.map +1 -1
  211. package/lib/esm/geometry3d/Point3dVector3d.js +4 -0
  212. package/lib/esm/geometry3d/Point3dVector3d.js.map +1 -1
  213. package/lib/esm/geometry3d/Range.d.ts +2 -0
  214. package/lib/esm/geometry3d/Range.d.ts.map +1 -1
  215. package/lib/esm/geometry3d/Range.js +6 -0
  216. package/lib/esm/geometry3d/Range.js.map +1 -1
  217. package/lib/esm/polyface/PolyfaceBuilder.js.map +1 -1
  218. package/lib/esm/polyface/PolyfaceQuery.js +4 -4
  219. package/lib/esm/polyface/PolyfaceQuery.js.map +1 -1
  220. package/lib/esm/serialization/BGFBReader.d.ts.map +1 -1
  221. package/lib/esm/serialization/BGFBReader.js +5 -2
  222. package/lib/esm/serialization/BGFBReader.js.map +1 -1
  223. package/lib/esm/serialization/BGFBWriter.d.ts.map +1 -1
  224. package/lib/esm/serialization/BGFBWriter.js +1 -2
  225. package/lib/esm/serialization/BGFBWriter.js.map +1 -1
  226. package/lib/esm/serialization/IModelJsonSchema.d.ts +56 -41
  227. package/lib/esm/serialization/IModelJsonSchema.d.ts.map +1 -1
  228. package/lib/esm/serialization/IModelJsonSchema.js +16 -17
  229. package/lib/esm/serialization/IModelJsonSchema.js.map +1 -1
  230. package/lib/esm/topology/Merging.d.ts +4 -2
  231. package/lib/esm/topology/Merging.d.ts.map +1 -1
  232. package/lib/esm/topology/Merging.js +23 -20
  233. package/lib/esm/topology/Merging.js.map +1 -1
  234. package/package.json +3 -3
@@ -1 +1 @@
1
- {"version":3,"file":"BSplineCurve.js","sourceRoot":"","sources":["../../../src/bspline/BSplineCurve.ts"],"names":[],"mappings":";AAAA;;;+FAG+F;AAC/F;;GAEG;;;AAGH,sEAAsF;AACtF,4DAAyD;AACzD,yFAAsF;AACtF,mGAAgG;AAEhG,0DAAuD;AACvD,kEAA+D;AAE/D,0CAA+D;AAE/D,qEAAkE;AAElE,uFAAoF;AACpF,mEAAkE;AAClE,6DAA0D;AAC1D,+CAAuD;AACvD,+CAA4C;A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qB;QAC9D,MAAM,MAAM,GAAG,IAAI,CAAC,OAAO,CAAC,UAAU,CAAC;QACvC,MAAM,CAAC,GAAG,MAAM,CAAC,MAAM,GAAG,CAAC,CAAC;QAC5B,IAAI,SAAS,EAAE,CAAC;YACd,KAAK,IAAI,EAAE,GAAG,CAAC,EAAE,EAAE,GAAG,CAAC,EAAE,EAAE,IAAI,CAAC;gBAC9B,aAAa,CAAC,oBAAoB,CAAC,SAAS,EAAE,MAAM,CAAC,EAAE,CAAC,EAAE,MAAM,CAAC,EAAE,GAAG,CAAC,CAAC,EAAE,MAAM,CAAC,EAAE,GAAG,CAAC,CAAC,CAAC,CAAC;QAC9F,CAAC;aAAM,CAAC;YACN,KAAK,IAAI,EAAE,GAAG,CAAC,EAAE,EAAE,GAAG,CAAC,EAAE,EAAE,IAAI,CAAC;gBAC9B,aAAa,CAAC,SAAS,CAAC,MAAM,CAAC,EAAE,CAAC,EAAE,MAAM,CAAC,EAAE,GAAG,CAAC,CAAC,EAAE,MAAM,CAAC,EAAE,GAAG,CAAC,CAAC,CAAC,CAAC;QACxE,CAAC;IACH,CAAC;CACF;AAxbD,wCAwbC","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 Bspline\r\n */\r\n\r\nimport { VariantCurveExtendParameter } from \"../curve/CurveExtendMode\";\r\nimport { CurveIntervalRole, CurveLocationDetail } from \"../curve/CurveLocationDetail\";\r\nimport { CurvePrimitive } from \"../curve/CurvePrimitive\";\r\nimport { CurveOffsetXYHandler } from \"../curve/internalContexts/CurveOffsetXYHandler\";\r\nimport { PlaneAltitudeRangeContext } from \"../curve/internalContexts/PlaneAltitudeRangeContext\";\r\nimport { LineString3d } from \"../curve/LineString3d\";\r\nimport { OffsetOptions } from \"../curve/OffsetOptions\";\r\nimport { StrokeCountMap } from \"../curve/Query/StrokeCountMap\";\r\nimport { StrokeOptions } from \"../curve/StrokeOptions\";\r\nimport { Geometry, PlaneAltitudeEvaluator } from \"../Geometry\";\r\nimport { GeometryHandler, IStrokeHandler } from \"../geometry3d/GeometryHandler\";\r\nimport { GrowableXYZArray } from \"../geometry3d/GrowableXYZArray\";\r\nimport { Plane3dByOriginAndUnitNormal } from \"../geometry3d/Plane3dByOriginAndUnitNormal\";\r\nimport { Plane3dByOriginAndVectors } from \"../geometry3d/Plane3dByOriginAndVectors\";\r\nimport { Point3d, Vector3d } from \"../geometry3d/Point3dVector3d\";\r\nimport { Point3dArray } from \"../geometry3d/PointHelpers\";\r\nimport { Range1d, Range3d } from \"../geometry3d/Range\";\r\nimport { Ray3d } from \"../geometry3d/Ray3d\";\r\nimport { Transform } from \"../geometry3d/Transform\";\r\nimport { Point4d } from \"../geometry4d/Point4d\";\r\nimport { UnivariateBezier } from \"../numerics/BezierPolynomials\";\r\nimport { AkimaCurve3dOptions } from \"./AkimaCurve3d\";\r\nimport { Bezier1dNd } from \"./Bezier1dNd\";\r\nimport { BezierCurve3d } from \"./BezierCurve3d\";\r\nimport { BezierCurve3dH } from \"./BezierCurve3dH\";\r\nimport { BezierCurveBase } from \"./BezierCurveBase\";\r\nimport { BSpline1dNd } from \"./BSpline1dNd\";\r\nimport { BSplineCurveOps } from \"./BSplineCurveOps\";\r\nimport { InterpolationCurve3dOptions } from \"./InterpolationCurve3d\";\r\nimport { BSplineWrapMode, KnotVector } from \"./KnotVector\";\r\n\r\n/**\r\n * Base class for BSplineCurve3d and BSplineCurve3dH.\r\n * * A B-spline curve consists of an array of `knots`, an array of `poles`, and a `degree`.\r\n * * The knot array is a non-decreasing sequence of numbers. It is also called a \"knot vector\".\r\n * * The curve is a parametric function whose domain is a sub-range of its knots.\r\n * * The API sometimes refers to a domain parameter `u` as a \"knot\", even if `u` is not actually an entry in the\r\n * knot array.\r\n * * The curve loosely \"follows\" the line string formed by the poles, aka the \"control polygon\".\r\n * * The curve is a chain of polynomial segments, aka \"spans\" or \"fragments\". B-spline theory identifies these as\r\n * Bezier curves.\r\n * * The polynomial spans all have same `degree`.\r\n * * Each span is controlled by `order = degree + 1` contiguous points in the pole array.\r\n * * There is a strict relationship between knot and poles counts: `numPoles + order = numKnots + 2'.\r\n * * The number of spans is `numSpan = numPoles - degree`.\r\n * * For a span with index `spanIndex`:\r\n * * The `order` relevant poles begin at pole index `spanIndex`.\r\n * * The `2*degree` relevant knots begin at knot index `spanIndex`.\r\n * * The span domain is the knot range `[knot[spanIndex+degree-1], knot[spanIndex+degree]]`.\r\n * * The curve domain is the knot range `[knot[degree-1], knot[numSpan+degree-1]]`, or equivalently\r\n * `[knot[degree-1], knot[numPoles-1]]`. The API refers to this domain as the \"active knot interval\" of the curve.\r\n *\r\n * Nearly all B-spline curves are \"clamped\".\r\n * * This means that in the `knots` array, the first `degree` knots are equal, and the last `degree` knots are equal.\r\n * We say the smallest knot and the largest knot have multiplicity `degree`.\r\n * * Clamping make the curve pass through its first and last poles, with tangents directed along the first and\r\n * last edges of the control polygon.\r\n * * For instance, a cubic B-spline curve with knot vector `[0,0,0,1,2,3,3,3]`\r\n * * can be evaluated at parameter values in the range `[0, 3]`\r\n * * has 3 spans, with domains `[0, 1]`, `[1, 2]`, and `[2, 3]`\r\n * * has 6 poles\r\n * * passes through its first and last poles.\r\n * * The `create` methods may allow the classic convention that has an extra knot at the beginning and end of the\r\n * knot vector.\r\n * * These two extra knots are not actually needed to define the B-spline curve.\r\n * * When the `create` methods recognize the classic setup (`numPoles + order = numKnots`), the extra knots are\r\n * not saved with the BSplineCurve3dBase knots.\r\n *\r\n * * The weighted variant [[BSplineCurve3dH]] has the problem that `CurvePrimitive` 3D typing does not allow the\r\n * undefined result where a homogeneous pole has zero weight; the convention in this case is to return 000.\r\n *\r\n * * Note the class relationships:\r\n * * [[BSpline1dNd]] knows the definitional B-spline recurrence relation with no physical interpretation for the poles.\r\n * * BsplineCurve3dBase owns a protected BSpline1dNd.\r\n * * `BsplineCurve3dBase` is derived from [[CurvePrimitive]], which creates obligation to act as a 3D curve, e.g.,\r\n * * evaluate fraction to point and derivatives wrt fraction.\r\n * * compute intersection with plane.\r\n * * [[BSplineCurve3d]] and [[BSplineCurve3dH]] have variant logic driven by whether or not there are \"weights\" on the poles.\r\n * * For `BSplineCurve3d`, the xyz value of pole calculations are \"final\" values for 3d evaluation.\r\n * * For `BSplineCurve3dH`, various `BSpline1dNd` results with xyzw have to be normalized back to xyz.\r\n *\r\n * * These classes do not support \"periodic\" variants.\r\n * * Periodic curves historically have carried a flag (e.g., \"closed\") indicating that certain un-stored\r\n * leading/trailing knots and poles are understood to wrap around periodically.\r\n * * Instead, these classes carry no such flag. They represent such curves with explicitly wrapped knots/poles.\r\n *\r\n * * Visualization can be found at https://www.itwinjs.org/sandbox/SaeedTorabi/BSpline/\r\n * @public\r\n */\r\nexport abstract class BSplineCurve3dBase extends CurvePrimitive {\r\n /** String name for schema properties. */\r\n public readonly curvePrimitiveType = \"bsplineCurve\";\r\n /** The underlying blocked-pole spline, with simple x,y,z poles. */\r\n protected _bcurve: BSpline1dNd;\r\n private _definitionData?: any;\r\n public set definitionData(data: any) {\r\n this._definitionData = data;\r\n }\r\n public get definitionData(): any {\r\n return this._definitionData;\r\n }\r\n protected constructor(poleDimension: number, numPoles: number, order: number, knots: KnotVector) {\r\n super();\r\n this._bcurve = BSpline1dNd.create(numPoles, poleDimension, order, knots);\r\n }\r\n /** Return the degree (one less than the order) of the curve. */\r\n public get degree(): number {\r\n return this._bcurve.degree;\r\n }\r\n /** Return the order (one more than degree) of the curve. */\r\n public get order(): number {\r\n return this._bcurve.order;\r\n }\r\n /**\r\n * Return the number of Bezier spans in the curve. Note that this number includes the number of null\r\n * spans at repeated knots.\r\n */\r\n public get numSpan(): number {\r\n return this._bcurve.numSpan;\r\n }\r\n /** Return the number of poles. */\r\n public get numPoles(): number {\r\n return this._bcurve.numPoles;\r\n }\r\n /** Return live reference to the poles of the curve. */\r\n public get polesRef(): Float64Array {\r\n return this._bcurve.packedData;\r\n }\r\n /** Return live reference to the knots of the curve. */\r\n public get knotsRef(): Float64Array {\r\n return this._bcurve.knots.knots;\r\n }\r\n /**\r\n * Number of components per pole, e.g.,\r\n * * 3 for conventional (x,y,z) curve.\r\n * * 4 for weighted (wx,wy,wz,w) curve.\r\n */\r\n public get poleDimension(): number {\r\n return this._bcurve.poleLength;\r\n }\r\n /** Return a simple array form of the knots. Optionally replicate the first and last in classic over-clamped manner. */\r\n public copyKnots(includeExtraEndKnot: boolean): number[] {\r\n return this._bcurve.knots.copyKnots(includeExtraEndKnot);\r\n }\r\n /** Get the flag indicating the curve might be suitable for having wrapped \"closed\" interpretation. */\r\n public getWrappable(): BSplineWrapMode {\r\n return this._bcurve.knots.wrappable;\r\n }\r\n /** Set the flag indicating the curve might be suitable for having wrapped \"closed\" interpretation. */\r\n public setWrappable(value: BSplineWrapMode) {\r\n this._bcurve.knots.wrappable = value;\r\n }\r\n /**\r\n * Test knots and poles to determine if it is possible to close (aka \"wrap\") the curve.\r\n * @returns the manner in which it is possible to close the curve. See `BSplineWrapMode` for particulars of each mode.\r\n */\r\n public get isClosableCurve(): BSplineWrapMode {\r\n const mode = this._bcurve.knots.wrappable;\r\n if (mode === BSplineWrapMode.None)\r\n return BSplineWrapMode.None;\r\n if (!this._bcurve.knots.testClosable(mode))\r\n return BSplineWrapMode.None;\r\n if (!this._bcurve.testClosablePolygon(mode))\r\n return BSplineWrapMode.None;\r\n return mode;\r\n }\r\n /** Evaluate the curve at a fractional position within a given span. */\r\n public abstract evaluatePointInSpan(spanIndex: number, spanFraction: number, result?: Point3d): Point3d;\r\n /**\r\n * Evaluate the curve and derivative at a fractional position within a given span.\r\n * * The derivative is with respect to the span fractional parameter, _not_ to the curve's parameter or fractional parameter.\r\n */\r\n public abstract evaluatePointAndDerivativeInSpan(spanIndex: number, spanFraction: number, result?: Ray3d): Ray3d;\r\n /** Evaluate the curve at the given parameter. */\r\n public abstract knotToPoint(knot: number, result?: Point3d): Point3d;\r\n /** Evaluate the curve and derivative at the given parameter. */\r\n public abstract knotToPointAndDerivative(knot: number, result?: Ray3d): Ray3d;\r\n /** Evaluate the curve and two derivatives at the given parameter. */\r\n public abstract knotToPointAnd2Derivatives(knot: number, result?: Plane3dByOriginAndVectors): Plane3dByOriginAndVectors;\r\n /** Evaluate the curve point at the given fractional parameter. */\r\n public fractionToPoint(fraction: number, result?: Point3d): Point3d {\r\n return this.knotToPoint(this._bcurve.knots.fractionToKnot(fraction), result);\r\n }\r\n /** Evaluate the curve and derivative at the given fractional parameter. */\r\n public fractionToPointAndDerivative(fraction: number, result?: Ray3d): Ray3d {\r\n const knot = this._bcurve.knots.fractionToKnot(fraction);\r\n result = this.knotToPointAndDerivative(knot, result);\r\n result.direction.scaleInPlace(this._bcurve.knots.knotLength01);\r\n return result;\r\n }\r\n /** Evaluate the curve and two derivatives at the given fractional parameter. */\r\n public fractionToPointAnd2Derivatives(fraction: number, result?: Plane3dByOriginAndVectors): Plane3dByOriginAndVectors {\r\n const knot = this._bcurve.knots.fractionToKnot(fraction);\r\n result = this.knotToPointAnd2Derivatives(knot, result);\r\n const a = this._bcurve.knots.knotLength01;\r\n result.vectorU.scaleInPlace(a);\r\n result.vectorV.scaleInPlace(a * a);\r\n return result;\r\n }\r\n /** Return the start point of the curve. */\r\n public override startPoint(result?: Point3d): Point3d {\r\n return this.evaluatePointInSpan(0, 0.0, result);\r\n }\r\n /** Return the end point of the curve. */\r\n public override endPoint(result?: Point3d): Point3d {\r\n return this.evaluatePointInSpan(this.numSpan - 1, 1.0, result);\r\n }\r\n /**\r\n * Reverse the curve in place.\r\n * * Poles are reversed.\r\n * * Knot values are mirrored around the middle of the knot array.\r\n */\r\n public reverseInPlace(): void {\r\n this._bcurve.reverseInPlace();\r\n }\r\n /** Return an array with this curve's Bezier fragments. */\r\n public collectBezierSpans(prefer3dH: boolean): BezierCurveBase[] {\r\n const result: BezierCurveBase[] = [];\r\n const numSpans = this.numSpan;\r\n for (let i = 0; i < numSpans; i++) {\r\n if (this._bcurve.knots.isIndexOfRealSpan(i)) {\r\n const span = this.getSaturatedBezierSpan3dOr3dH(i, prefer3dH);\r\n if (span)\r\n result.push(span);\r\n }\r\n }\r\n return result;\r\n }\r\n /**\r\n * Return the Bezier fragment corresponding to the given span of this curve.\r\n * * The concrete return type may be [[BezierCurve3d]] or [[BezierCurve3dH]] according to the instance type and `prefer3dH`.\r\n * @param spanIndex index of span.\r\n * @param prefer3dH true to force promotion to homogeneous.\r\n * @param result optional reusable curve. This will only be reused if its type and order matches.\r\n */\r\n public abstract getSaturatedBezierSpan3dOr3dH(\r\n spanIndex: number, prefer3dH: boolean, result?: BezierCurveBase,\r\n ): BezierCurveBase | undefined;\r\n /**\r\n * Return a specified pole as a Point4d.\r\n * * BSplineCurve3d appends weight 1 to its xyz.\r\n * * BSplineCurve3dH with pole whose \"normalized\" point is (x,y,z) but has weight w returns the weighted form (wx,wy,wz,w).\r\n */\r\n public abstract getPolePoint4d(poleIndex: number, result?: Point4d): Point4d | undefined;\r\n /**\r\n * Return a specified pole as a Point3d.\r\n * * BSplineCurve3d returns its simple xyz.\r\n * * BSplineCurve3dH attempts to normalize its (wx,wy,wz,w) back to (x,y,z), and returns undefined if weight is zero.\r\n * @param poleIndex index of the pole.\r\n * @param result optional result.\r\n */\r\n public abstract getPolePoint3d(poleIndex: number, result?: Point3d): Point3d | undefined;\r\n /** Given a pole index, return the starting index for the contiguous array. */\r\n public poleIndexToDataIndex(poleIndex: number): number | undefined {\r\n if (poleIndex >= 0 && poleIndex < this.numPoles)\r\n return poleIndex * this._bcurve.poleLength;\r\n return undefined;\r\n }\r\n /**\r\n * Search for the curve point that is closest to the spacePoint.\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\r\n * succeed.\r\n * @param spacePoint point in space.\r\n * @param _extend ignored (pass false). A BSplineCurve3dBase cannot be extended.\r\n * @param result optional pre-allocated detail to populate and return.\r\n * @returns details of the closest point.\r\n */\r\n public override closestPoint(\r\n spacePoint: Point3d, _extend: VariantCurveExtendParameter = false, result?: CurveLocationDetail,\r\n ): CurveLocationDetail | undefined {\r\n // seed at start point; final point comes with final bezier perpendicular step\r\n const point = this.fractionToPoint(0);\r\n result = CurveLocationDetail.createCurveFractionPointDistance(this, 0.0, point, point.distance(spacePoint), result);\r\n let span: BezierCurve3dH | undefined;\r\n const numSpans = this.numSpan;\r\n for (let i = 0; i < numSpans; i++) {\r\n if (this._bcurve.knots.isIndexOfRealSpan(i)) {\r\n span = this.getSaturatedBezierSpan3dOr3dH(i, true, span) as BezierCurve3dH;\r\n if (span) {\r\n // if the B-spline is discontinuous, both ends should be tested; ignore that possibility\r\n if (span.updateClosestPointByTruePerpendicular(spacePoint, result, false, true)) {\r\n // the detail records the span bezier; promote it to the parent curve\r\n result.curve = this;\r\n result.fraction = span.fractionToParentFraction(result.fraction);\r\n }\r\n }\r\n }\r\n }\r\n return result;\r\n }\r\n /** Return a deep clone. */\r\n public abstract override clone(): BSplineCurve3dBase;\r\n /** Return a transformed deep clone. */\r\n public override cloneTransformed(transform: Transform): BSplineCurve3dBase {\r\n const curve = this.clone();\r\n curve.tryTransformInPlace(transform);\r\n return curve;\r\n }\r\n /**\r\n * Return a curve primitive which is a portion of this curve.\r\n * @param fractionA start fraction.\r\n * @param fractionB end fraction.\r\n */\r\n public override clonePartialCurve(fractionA: number, fractionB: number): BSplineCurve3dBase {\r\n let clone: BSplineCurve3dBase;\r\n if (fractionA > fractionB) {\r\n clone = this.clonePartialCurve(fractionB, fractionA);\r\n clone.reverseInPlace();\r\n return clone;\r\n }\r\n clone = this.clone();\r\n const origNumKnots = clone._bcurve.knots.knots.length;\r\n let knotA = clone._bcurve.knots.fractionToKnot(fractionA);\r\n let knotB = clone._bcurve.knots.fractionToKnot(fractionB);\r\n clone._bcurve.addKnot(knotA, clone.degree);\r\n clone._bcurve.addKnot(knotB, clone.degree);\r\n if (origNumKnots === clone._bcurve.knots.knots.length)\r\n return clone; // full curve\r\n if (knotA > knotB)\r\n [knotA, knotB] = [knotB, knotA];\r\n // choose first/last knot and pole such that knotA/knotB has degree multiplicity in the new knot sequence\r\n const iStartKnot = clone._bcurve.knots.knotToLeftKnotIndex(knotA) - clone.degree + 1;\r\n const iStartPole = iStartKnot * clone._bcurve.poleLength;\r\n const iLastKnot = clone._bcurve.knots.knotToLeftKnotIndex(knotB);\r\n let iLastKnotLeftMultiple = iLastKnot - clone._bcurve.knots.getKnotMultiplicityAtIndex(iLastKnot) + 1;\r\n if (clone._bcurve.knots.knots[iLastKnot] < knotB)\r\n iLastKnotLeftMultiple = iLastKnot + 1;\r\n const iEndPole = (iLastKnotLeftMultiple + 1) * clone._bcurve.poleLength; // one past last pole\r\n const iEndKnot = iLastKnotLeftMultiple + clone.degree; // one past last knot\r\n // trim the arrays (leave knots unnormalized)\r\n clone._bcurve.knots.setKnotsCapture(clone._bcurve.knots.knots.slice(iStartKnot, iEndKnot));\r\n clone._bcurve.packedData = clone._bcurve.packedData.slice(iStartPole, iEndPole);\r\n clone.setWrappable(BSplineWrapMode.None); // always open\r\n return clone;\r\n }\r\n /**\r\n * Implement `CurvePrimitive.appendPlaneIntersections` to compute intersections of the curve with a plane.\r\n * @param plane the plane with which to intersect the curve. Concrete types include [[Plane3dByOriginAndUnitNormal]],\r\n * [[Point4d]], etc.\r\n * @param result growing array of plane intersections.\r\n * @return number of intersections appended to the array.\r\n */\r\n public override appendPlaneIntersectionPoints(plane: PlaneAltitudeEvaluator, result: CurveLocationDetail[]): number {\r\n const numPole = this.numPoles;\r\n const order = this.order;\r\n const allCoffs = new Float64Array(numPole);\r\n const numSpan = this.numSpan;\r\n const point4d = Point4d.create();\r\n // compute all pole altitudes from the plane\r\n const minMax = Range1d.createNull();\r\n // put the altitudes of all the B-spline poles in one array\r\n for (let i = 0; i < numPole; i++) {\r\n this.getPolePoint4d(i, point4d);\r\n allCoffs[i] = plane.weightedAltitude(point4d);\r\n minMax.extendX(allCoffs[i]);\r\n }\r\n // A univariate B-spline through the altitude poles gives altitude as function of the B-spline knot.\r\n // The (bspline) altitude function for each span is `order` consecutive altitudes.\r\n // If those altitudes bracket zero, the span may potentially have a crossing.\r\n let univariateBezier: UnivariateBezier | undefined;\r\n let numFound = 0;\r\n let previousFraction = -1000.0;\r\n if (minMax.containsX(0.0)) {\r\n for (let spanIndex = 0; spanIndex < numSpan; spanIndex++) {\r\n if (this._bcurve.knots.isIndexOfRealSpan(spanIndex)) { // ignore trivial knot intervals\r\n // outer range test ...\r\n minMax.setNull();\r\n minMax.extendArraySubset(allCoffs, spanIndex, order);\r\n if (minMax.containsX(0.0)) {\r\n // pack the B-spline support into a univariate bezier\r\n univariateBezier = UnivariateBezier.createArraySubset(allCoffs, spanIndex, order, univariateBezier);\r\n // saturate and solve the bezier\r\n Bezier1dNd.saturate1dInPlace(univariateBezier.coffs, this._bcurve.knots, spanIndex);\r\n const roots = univariateBezier.roots(0.0, true);\r\n if (roots) {\r\n for (const spanFraction of roots) {\r\n // promote each local bezier fraction to global fraction and save the curve evaluation at that fraction\r\n numFound++;\r\n const fraction = this._bcurve.knots.spanFractionToFraction(spanIndex, spanFraction);\r\n if (!Geometry.isAlmostEqualNumber(fraction, previousFraction)) {\r\n const detail = CurveLocationDetail.createCurveEvaluatedFraction(this, fraction);\r\n detail.intervalRole = CurveIntervalRole.isolated;\r\n result.push(detail);\r\n previousFraction = fraction;\r\n }\r\n }\r\n }\r\n }\r\n }\r\n }\r\n }\r\n return numFound;\r\n }\r\n /**\r\n * Construct an offset of the instance curve as viewed in the xy-plane (ignoring z).\r\n * @param offsetDistanceOrOptions offset distance (positive to left of the instance curve), or options object.\r\n */\r\n public override constructOffsetXY(offsetDistanceOrOptions: number | OffsetOptions): BSplineCurve3d | undefined {\r\n const options = OffsetOptions.create(offsetDistanceOrOptions);\r\n const handler = new CurveOffsetXYHandler(this, options.leftOffsetDistance);\r\n this.emitStrokableParts(handler, options.strokeOptions);\r\n return handler.claimResult();\r\n }\r\n /**\r\n * Project instance geometry (via dispatch) onto the given ray, and return the extreme fractional parameters\r\n * of projection.\r\n * @param ray ray onto which the instance is projected. A `Vector3d` is treated as a `Ray3d` with zero origin.\r\n * @param lowHigh optional receiver for output.\r\n * @returns range of fractional projection parameters onto the ray, where 0.0 is start of the ray and 1.0 is the\r\n * end of the ray.\r\n */\r\n public override projectedParameterRange(ray: Vector3d | Ray3d, lowHigh?: Range1d): Range1d | undefined {\r\n return PlaneAltitudeRangeContext.findExtremeFractionsAlongDirection(this, ray, lowHigh);\r\n }\r\n}\r\n/**\r\n * A BSplineCurve3d is a B-spline curve whose poles are Point3d.\r\n * See BSplineCurve3dBase for description of knots, order, degree, and poles.\r\n * @public\r\n */\r\nexport class BSplineCurve3d extends BSplineCurve3dBase {\r\n private _workBezier?: BezierCurve3d;\r\n private initializeWorkBezier(): BezierCurve3d {\r\n if (this._workBezier === undefined)\r\n this._workBezier = BezierCurve3d.createOrder(this.order);\r\n return this._workBezier;\r\n }\r\n private constructor(numPoles: number, order: number, knots: KnotVector) {\r\n super(3, numPoles, order, knots);\r\n }\r\n /** Test if `other` is an instance of BSplineCurve3d. */\r\n public isSameGeometryClass(other: any): boolean {\r\n return other instanceof BSplineCurve3d;\r\n }\r\n /** Apply `transform` to the poles. */\r\n public tryTransformInPlace(transform: Transform): boolean {\r\n Point3dArray.multiplyInPlace(transform, this._bcurve.packedData);\r\n return true;\r\n }\r\n /** Get a pole as a simple Point3d. */\r\n public getPolePoint3d(poleIndex: number, result?: Point3d): Point3d | undefined {\r\n const k = this.poleIndexToDataIndex(poleIndex);\r\n if (k !== undefined) {\r\n const data = this._bcurve.packedData;\r\n return Point3d.create(data[k], data[k + 1], data[k + 2], result);\r\n }\r\n return undefined;\r\n }\r\n /** Get a pole as Point4d with weight 1. */\r\n public getPolePoint4d(poleIndex: number, result?: Point4d): Point4d | undefined {\r\n const k = this.poleIndexToDataIndex(poleIndex);\r\n if (k !== undefined) {\r\n const data = this._bcurve.packedData;\r\n return Point4d.create(data[k], data[k + 1], data[k + 2], 1.0, result);\r\n }\r\n return undefined;\r\n }\r\n /**\r\n * Convert the fractional position in the given span to a knot.\r\n * * The returned value is not necessarily a knot, but it is a valid parameter in the domain of the B-spline curve.\r\n */\r\n public spanFractionToKnot(spanIndex: number, spanFraction: number): number {\r\n return this._bcurve.spanFractionToKnot(spanIndex, spanFraction);\r\n }\r\n /** Return a simple array of arrays with the poles as `[[x,y,z],[x,y,z],..]`. */\r\n public copyPoints(): any[] {\r\n return Point3dArray.unpackNumbersToNestedArrays(this._bcurve.packedData, 3);\r\n }\r\n /** Return a simple array of poles' coordinates. */\r\n public copyPointsFloat64Array(): Float64Array {\r\n return this._bcurve.packedData.slice();\r\n }\r\n /** Return a simple array form of the knots. Optionally replicate the first and last in classic over-clamped manner. */\r\n public override copyKnots(includeExtraEndKnot: boolean): number[] {\r\n return this._bcurve.knots.copyKnots(includeExtraEndKnot);\r\n }\r\n /** Create a B-spline with uniform knots. */\r\n public static createUniformKnots(\r\n poles: Point3d[] | Float64Array | GrowableXYZArray, order: number,\r\n ): BSplineCurve3d | undefined {\r\n const numPoles = poles instanceof Float64Array ? poles.length / 3 : poles.length;\r\n if (order < 2 || numPoles < order)\r\n return undefined;\r\n const knots = KnotVector.createUniformClamped(numPoles, order - 1, 0.0, 1.0);\r\n const curve = new BSplineCurve3d(numPoles, order, knots);\r\n if (poles instanceof Float64Array) {\r\n for (let i = 0; i < 3 * numPoles; i++)\r\n curve._bcurve.packedData[i] = poles[i];\r\n } else if (poles instanceof GrowableXYZArray) {\r\n curve._bcurve.packedData = poles.float64Data().slice(0, 3 * numPoles);\r\n } else {\r\n let i = 0;\r\n for (const p of poles) {\r\n curve._bcurve.packedData[i++] = p.x;\r\n curve._bcurve.packedData[i++] = p.y;\r\n curve._bcurve.packedData[i++] = p.z;\r\n }\r\n }\r\n return curve;\r\n }\r\n /**\r\n * Create a smoothly closed B-spline curve with uniform knots.\r\n * * Note that the curve does not start at the first pole.\r\n */\r\n public static createPeriodicUniformKnots(\r\n poles: Point3d[] | Float64Array | GrowableXYZArray, order: number,\r\n ): BSplineCurve3d | undefined {\r\n if (order < 2)\r\n return undefined;\r\n let numPoles = poles instanceof Float64Array ? poles.length / 3 : poles.length;\r\n if (numPoles < 2)\r\n return undefined;\r\n const startPoint = Point3d.createZero();\r\n const endPoint = Point3d.createZero();\r\n let hasClosurePoint = false;\r\n do {\r\n if (poles instanceof Float64Array) {\r\n startPoint.set(poles[0], poles[1], poles[2]);\r\n endPoint.set(poles[3 * numPoles - 3], poles[3 * numPoles - 2], poles[3 * numPoles - 1]);\r\n } else if (poles instanceof GrowableXYZArray) {\r\n poles.getPoint3dAtUncheckedPointIndex(0, startPoint);\r\n poles.getPoint3dAtUncheckedPointIndex(numPoles - 1, endPoint);\r\n } else {\r\n startPoint.setFromPoint3d(poles[0]);\r\n endPoint.setFromPoint3d(poles[numPoles - 1]);\r\n }\r\n if (hasClosurePoint = startPoint.isAlmostEqual(endPoint))\r\n --numPoles; // remove wraparound pole if found\r\n } while (hasClosurePoint && numPoles > 1);\r\n if (numPoles < order)\r\n return undefined;\r\n const degree = order - 1;\r\n const numIntervals = numPoles;\r\n const knots = KnotVector.createUniformWrapped(numIntervals, degree, 0.0, 1.0);\r\n knots.wrappable = BSplineWrapMode.OpenByAddingControlPoints;\r\n // append degree wraparound poles\r\n const curve = new BSplineCurve3d(numPoles + degree, order, knots);\r\n if (poles instanceof Float64Array) {\r\n let i = 0;\r\n for (let j = 0; j < 3 * numPoles; j++)\r\n curve._bcurve.packedData[i++] = poles[j];\r\n for (let j = 0; j < 3 * degree; j++)\r\n curve._bcurve.packedData[i++] = poles[j];\r\n } else if (poles instanceof GrowableXYZArray) {\r\n let i = 0;\r\n for (let j = 0; j < 3 * numPoles; j++)\r\n curve._bcurve.packedData[i++] = poles.float64Data()[j];\r\n for (let j = 0; j < 3 * degree; j++)\r\n curve._bcurve.packedData[i++] = poles.float64Data()[j];\r\n } else {\r\n let i = 0;\r\n for (let j = 0; j < numPoles; j++) {\r\n curve._bcurve.packedData[i++] = poles[j].x;\r\n curve._bcurve.packedData[i++] = poles[j].y;\r\n curve._bcurve.packedData[i++] = poles[j].z;\r\n }\r\n for (let j = 0; j < degree; j++) {\r\n curve._bcurve.packedData[i++] = poles[j].x;\r\n curve._bcurve.packedData[i++] = poles[j].y;\r\n curve._bcurve.packedData[i++] = poles[j].z;\r\n }\r\n }\r\n return curve;\r\n }\r\n /**\r\n * Create a C2 cubic B-spline curve that interpolates the given points and optional end tangents.\r\n * @param options collection of points and end conditions.\r\n */\r\n public static createFromInterpolationCurve3dOptions(options: InterpolationCurve3dOptions): BSplineCurve3d | undefined {\r\n return BSplineCurveOps.createThroughPointsC2Cubic(options);\r\n }\r\n /**\r\n * Create a B-spline curve from an Akima curve.\r\n * @param options collection of points and end conditions.\r\n */\r\n public static createFromAkimaCurve3dOptions(options: AkimaCurve3dOptions): BSplineCurve3d | undefined {\r\n return BSplineCurveOps.createThroughPoints(options.fitPoints, 4); // temporary\r\n }\r\n /**\r\n * Create a B-spline curve with given knots.\r\n * * The poles have several variants:\r\n * * Float64Array(3 * numPoles) in blocks of [x,y,z].\r\n * * Point3d[].\r\n * * number[][], with inner dimension 3.\r\n * * Two count conditions are recognized:\r\n * * If poleArray.length + order === knotArray.length, the first and last are assumed to be the extraneous knots\r\n * of classic clamping.\r\n * * If poleArray.length + order === knotArray.length + 2, the knots are in modern form.\r\n * * Visualization can be found at https://www.itwinjs.org/sandbox/SaeedTorabi/BSpline/\r\n */\r\n public static create(\r\n poleArray: Float64Array | Point3d[] | number[][], knotArray: Float64Array | number[], order: number,\r\n ): BSplineCurve3d | undefined {\r\n if (order < 2)\r\n return undefined;\r\n let numPoles = poleArray.length;\r\n if (poleArray instanceof Float64Array)\r\n numPoles = Math.floor(numPoles / 3); // blocked as xyz\r\n if (numPoles < order)\r\n return undefined;\r\n const numKnots = knotArray.length;\r\n const skipFirstAndLast = (numPoles + order === numKnots); // classic over-clamped input knots\r\n if (!skipFirstAndLast && numPoles + order !== numKnots + 2) // modern knots\r\n return undefined;\r\n const knots = KnotVector.create(knotArray, order - 1, skipFirstAndLast);\r\n const curve = new BSplineCurve3d(numPoles, order, knots);\r\n let i = 0;\r\n if (poleArray instanceof Float64Array) {\r\n for (const coordinate of poleArray)\r\n curve._bcurve.packedData[i++] = coordinate;\r\n } else if (poleArray[0] instanceof Point3d) {\r\n for (const p of poleArray as Point3d[]) {\r\n curve._bcurve.packedData[i++] = p.x;\r\n curve._bcurve.packedData[i++] = p.y;\r\n curve._bcurve.packedData[i++] = p.z;\r\n }\r\n } else if (Array.isArray(poleArray[0]) && poleArray[0].length === 3) {\r\n for (const point of poleArray as number[][])\r\n for (const coord of point)\r\n curve._bcurve.packedData[i++] = coord;\r\n } else {\r\n return undefined; // unexpected poleArray type\r\n }\r\n return curve;\r\n }\r\n /** Return a deep clone. */\r\n public override clone(): BSplineCurve3d {\r\n const knotVector = this._bcurve.knots.clone();\r\n const curve = new BSplineCurve3d(this.numPoles, this.order, knotVector);\r\n curve._bcurve.packedData = this._bcurve.packedData.slice();\r\n return curve;\r\n }\r\n /** Evaluate the curve at a fractional position within a given span. */\r\n public evaluatePointInSpan(spanIndex: number, spanFraction: number, result?: Point3d): Point3d {\r\n this._bcurve.evaluateBuffersInSpan(spanIndex, spanFraction);\r\n return Point3d.createFrom(this._bcurve.poleBuffer, result);\r\n }\r\n /**\r\n * Evaluate the curve and derivative at a fractional position within a given span.\r\n * * The derivative is with respect to the span fractional parameter, _not_ to the curve's parameter or fractional parameter.\r\n */\r\n public evaluatePointAndDerivativeInSpan(spanIndex: number, spanFraction: number): Ray3d {\r\n this._bcurve.evaluateBuffersInSpan1(spanIndex, spanFraction);\r\n return Ray3d.createCapture(\r\n Point3d.createFrom(this._bcurve.poleBuffer),\r\n Vector3d.createFrom(this._bcurve.poleBuffer1),\r\n );\r\n }\r\n /**\r\n * Evaluate the curve at the given parameter.\r\n * @param u parameter in curve domain.\r\n * @param result optional result.\r\n * @returns the point on the curve.\r\n */\r\n public knotToPoint(u: number, result?: Point3d): Point3d {\r\n this._bcurve.evaluateBuffersAtKnot(u);\r\n return Point3d.createFrom(this._bcurve.poleBuffer, result);\r\n }\r\n /**\r\n * Evaluate the curve and derivative at the given parameter.\r\n * @param u parameter in curve domain.\r\n * @param result optional result.\r\n * @returns the ray with origin at the curve point and direction as the derivative.\r\n */\r\n public knotToPointAndDerivative(u: number, result?: Ray3d): Ray3d {\r\n this._bcurve.evaluateBuffersAtKnot(u, 1);\r\n if (!result)\r\n return Ray3d.createCapture(\r\n Point3d.createFrom(this._bcurve.poleBuffer),\r\n Vector3d.createFrom(this._bcurve.poleBuffer1),\r\n );\r\n result.origin.setFrom(this._bcurve.poleBuffer);\r\n result.direction.setFrom(this._bcurve.poleBuffer1);\r\n return result;\r\n }\r\n /**\r\n * Evaluate the curve and two derivatives at the given parameter.\r\n * @param u parameter in the curve domain.\r\n * @param result optional result.\r\n * @returns the plane with origin at the curve point, vectorU as the 1st derivative, and vectorV as the 2nd derivative.\r\n */\r\n public knotToPointAnd2Derivatives(u: number, result?: Plane3dByOriginAndVectors): Plane3dByOriginAndVectors {\r\n this._bcurve.evaluateBuffersAtKnot(u, 2);\r\n return Plane3dByOriginAndVectors.createOriginAndVectorsXYZ(\r\n this._bcurve.poleBuffer[0], this._bcurve.poleBuffer[1], this._bcurve.poleBuffer[2],\r\n this._bcurve.poleBuffer1[0], this._bcurve.poleBuffer1[1], this._bcurve.poleBuffer1[2],\r\n this._bcurve.poleBuffer2[0], this._bcurve.poleBuffer2[1], this._bcurve.poleBuffer2[2],\r\n result,\r\n );\r\n }\r\n /** Test if `this` is almost the same curve as `other`. */\r\n public override isAlmostEqual(other: any): boolean {\r\n if (other instanceof BSplineCurve3d) {\r\n return this._bcurve.knots.isAlmostEqual(other._bcurve.knots)\r\n && Point3dArray.isAlmostEqual(this._bcurve.packedData, other._bcurve.packedData);\r\n }\r\n return false;\r\n }\r\n /** Test if this curve lies entirely in the given plane. */\r\n public isInPlane(plane: Plane3dByOriginAndUnitNormal): boolean {\r\n return Point3dArray.isCloseToPlane(this._bcurve.packedData, plane);\r\n }\r\n /**\r\n * Return the control polygon length as an approximation to the curve length.\r\n * * The returned length is always an overestimate.\r\n */\r\n public quickLength(): number {\r\n return Point3dArray.sumEdgeLengths(this._bcurve.packedData);\r\n }\r\n /** Emit Beziers or strokes (selected by the stroke options) to the handler. */\r\n public emitStrokableParts(handler: IStrokeHandler, options?: StrokeOptions): void {\r\n const workBezier = this.initializeWorkBezier();\r\n const numSpan = this.numSpan;\r\n let numStrokes;\r\n for (let spanIndex = 0; spanIndex < numSpan; spanIndex++) {\r\n const bezier = this.getSaturatedBezierSpan3dOr3dH(spanIndex, false, workBezier);\r\n if (bezier) {\r\n numStrokes = bezier.computeStrokeCountForOptions(options);\r\n if (handler.announceBezierCurve) {\r\n handler.announceBezierCurve(\r\n bezier,\r\n numStrokes,\r\n this,\r\n spanIndex,\r\n this._bcurve.knots.spanFractionToFraction(spanIndex, 0.0),\r\n this._bcurve.knots.spanFractionToFraction(spanIndex, 1.0),\r\n );\r\n\r\n } else {\r\n handler.announceIntervalForUniformStepStrokes(\r\n this,\r\n numStrokes,\r\n this._bcurve.knots.spanFractionToFraction(spanIndex, 0.0),\r\n this._bcurve.knots.spanFractionToFraction(spanIndex, 1.0),\r\n );\r\n }\r\n }\r\n }\r\n }\r\n /**\r\n * Assess length and turn to determine a stroke count.\r\n * @param options stroke options structure.\r\n */\r\n public computeStrokeCountForOptions(options?: StrokeOptions): number {\r\n const workBezier = this.initializeWorkBezier();\r\n const numSpan = this.numSpan;\r\n let numStroke = 0;\r\n for (let spanIndex = 0; spanIndex < numSpan; spanIndex++) {\r\n const bezier = this.getSaturatedBezierSpan3d(spanIndex, workBezier);\r\n if (bezier)\r\n numStroke += bezier.computeStrokeCountForOptions(options);\r\n }\r\n return numStroke;\r\n }\r\n /**\r\n * Compute individual segment stroke counts. Attach in a StrokeCountMap.\r\n * @param options StrokeOptions that determine count\r\n * @param parentStrokeMap evolving parent map.\r\n * @alpha\r\n */\r\n public override computeAndAttachRecursiveStrokeCounts(options?: StrokeOptions, parentStrokeMap?: StrokeCountMap) {\r\n const workBezier = this.initializeWorkBezier();\r\n const numSpan = this.numSpan;\r\n const myData = StrokeCountMap.createWithCurvePrimitiveAndOptionalParent(this, parentStrokeMap, []);\r\n for (let spanIndex = 0; spanIndex < numSpan; spanIndex++) {\r\n const bezier = this.getSaturatedBezierSpan3d(spanIndex, workBezier);\r\n if (bezier) {\r\n const segmentLength = workBezier.curveLength();\r\n const numStrokeOnSegment = workBezier.computeStrokeCountForOptions(options);\r\n myData.addToCountAndLength(numStrokeOnSegment, segmentLength);\r\n }\r\n }\r\n CurvePrimitive.installStrokeCountMap(this, myData, parentStrokeMap);\r\n }\r\n /** Append strokes to the given linestring. */\r\n public emitStrokes(dest: LineString3d, options?: StrokeOptions): void {\r\n const workBezier = this.initializeWorkBezier();\r\n const numSpan = this.numSpan;\r\n for (let spanIndex = 0; spanIndex < numSpan; spanIndex++) {\r\n const bezier = this.getSaturatedBezierSpan3d(spanIndex, workBezier);\r\n if (bezier)\r\n bezier.emitStrokes(dest, options);\r\n }\r\n }\r\n /**\r\n * Test knots and poles to determine if it is possible to close (aka \"wrap\") the curve.\r\n * @returns the manner in which it is possible to close the curve. See `BSplineWrapMode` for particulars of each mode.\r\n */\r\n public get isClosable(): BSplineWrapMode {\r\n return this.isClosableCurve;\r\n }\r\n /**\r\n * Return the Bezier fragment corresponding to the given span of this curve.\r\n * * The concrete return type may be [[BezierCurve3d]] or [[BezierCurve3dH]] according to the instance type and `prefer3dH`.\r\n * @param spanIndex index of span.\r\n * @param result optional reusable curve. This will only be reused if its type and order matches.\r\n */\r\n public getSaturatedBezierSpan3dOr3dH(\r\n spanIndex: number, prefer3dH: boolean, result?: BezierCurveBase,\r\n ): BezierCurveBase | undefined {\r\n if (prefer3dH)\r\n return this.getSaturatedBezierSpan3dH(spanIndex, result);\r\n return this.getSaturatedBezierSpan3d(spanIndex, result);\r\n }\r\n /**\r\n * Return the Bezier fragment corresponding to the given span of this curve.\r\n * @param spanIndex index of span.\r\n * @param result optional reusable curve. This will only be reused if its type and order matches.\r\n */\r\n public getSaturatedBezierSpan3d(spanIndex: number, result?: BezierCurveBase): BezierCurve3d | undefined {\r\n if (spanIndex < 0 || spanIndex >= this.numSpan)\r\n return undefined;\r\n const order = this.order;\r\n if (result === undefined || !(result instanceof BezierCurve3d) || result.order !== order)\r\n result = BezierCurve3d.createOrder(order);\r\n const bezier = result as BezierCurve3d;\r\n bezier.loadSpanPoles(this._bcurve.packedData, spanIndex);\r\n if (bezier.saturateInPlace(this._bcurve.knots, spanIndex))\r\n return bezier;\r\n return undefined;\r\n }\r\n /**\r\n * Return the Bezier fragment corresponding to the given span of this curve.\r\n * @param spanIndex index of span.\r\n * @param result optional reusable curve. This will only be reused if its type and order matches.\r\n */\r\n public getSaturatedBezierSpan3dH(spanIndex: number, result?: BezierCurveBase): BezierCurve3dH | undefined {\r\n if (spanIndex < 0 || spanIndex >= this.numSpan)\r\n return undefined;\r\n const order = this.order;\r\n if (result === undefined || !(result instanceof BezierCurve3dH) || result.order !== order)\r\n result = BezierCurve3dH.createOrder(order);\r\n const bezier = result as BezierCurve3dH;\r\n bezier.loadSpan3dPolesWithWeight(this._bcurve.packedData, spanIndex, 1.0);\r\n if (bezier.saturateInPlace(this._bcurve.knots, spanIndex))\r\n return bezier;\r\n return undefined;\r\n }\r\n /** Second step of double dispatch: call `handler.handleBSplineCurve3d(this)`. */\r\n public dispatchToGeometryHandler(handler: GeometryHandler): any {\r\n return handler.handleBSplineCurve3d(this);\r\n }\r\n /**\r\n * Extend a range so it contains the range of this curve.\r\n * * This computation is based on the poles, not the curve itself, so the returned range is generally larger than the\r\n * tightest possible range.\r\n * @param rangeToExtend range to extend.\r\n * @param transform transform to apply to the poles as they are entered into the range.\r\n */\r\n public extendRange(rangeToExtend: Range3d, transform?: Transform): void {\r\n const buffer = this._bcurve.packedData;\r\n const n = buffer.length - 2;\r\n if (transform) {\r\n for (let i0 = 0; i0 < n; i0 += 3)\r\n rangeToExtend.extendTransformedXYZ(transform, buffer[i0], buffer[i0 + 1], buffer[i0 + 2]);\r\n } else {\r\n for (let i0 = 0; i0 < n; i0 += 3)\r\n rangeToExtend.extendXYZ(buffer[i0], buffer[i0 + 1], buffer[i0 + 2]);\r\n }\r\n }\r\n}\r\n"]}
1
+ {"version":3,"file":"BSplineCurve.js","sourceRoot":"","sources":["../../../src/bspline/BSplineCurve.ts"],"names":[],"mappings":";AAAA;;;+FAG+F;AAC/F;;GAEG;;;AAGH,sEAAsF;AACtF,4DAAyD;AACzD,yFAAsF;AACtF,mGAAgG;AAEhG,0DAAuD;AACvD,kEAA+D;AAE/D,0CAA+D;AAE/D,qEAAkE;AAElE,uFAAoF;AACpF,mEAAkE;AAClE,6DAA0D;AAC1D,+CAAuD;AACvD,+CAA4C;AAE5C,mDAAgD;AAChD,qEAAiE;AAEjE,6CAA0C;AAC1C,mDAAgD;AAChD,qDAAkD;AAElD,+CAA4C;AAC5C,uDAAoD;AAEpD,6CAA2D;AAE3D;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAyDG;AACH,MAAsB,kBAAmB,SAAQ,+BAAc;IAC7D,yCAAyC;IACzB,kBAAkB,GAAG,cAAc,CAAC;IACpD,mEAAmE;IACzD,OAAO,CAAc;IACvB,eAAe,CAAO;IAC9B,IAAW,cAAc,CAAC,IAAS;QACjC,IAAI,CAAC,eAAe,GAAG,IAAI,CAAC;IAC9B,CAAC;IACD,IAAW,cAAc;QACvB,OAAO,IAAI,CAAC,eAAe,CAAC;IAC9B,CAAC;IACD,YAAsB,aAAqB,EAAE,QAAgB,EAAE,KAAa,EAAE,KAAiB;QAC7F,KAAK,EAAE,CAAC;QACR,IAAI,CAAC,OAAO,GAAG,yBAAW,CAA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AM,CAAC,EAAE,GAAG,CAAC,CAAC,CAAC,CAAC;QACxE,CAAC;IACH,CAAC;CACF;AAzbD,wCAybC","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 Bspline\r\n */\r\n\r\nimport { VariantCurveExtendParameter } from \"../curve/CurveExtendMode\";\r\nimport { CurveIntervalRole, CurveLocationDetail } from \"../curve/CurveLocationDetail\";\r\nimport { CurvePrimitive } from \"../curve/CurvePrimitive\";\r\nimport { CurveOffsetXYHandler } from \"../curve/internalContexts/CurveOffsetXYHandler\";\r\nimport { PlaneAltitudeRangeContext } from \"../curve/internalContexts/PlaneAltitudeRangeContext\";\r\nimport { LineString3d } from \"../curve/LineString3d\";\r\nimport { OffsetOptions } from \"../curve/OffsetOptions\";\r\nimport { StrokeCountMap } from \"../curve/Query/StrokeCountMap\";\r\nimport { StrokeOptions } from \"../curve/StrokeOptions\";\r\nimport { Geometry, PlaneAltitudeEvaluator } from \"../Geometry\";\r\nimport { GeometryHandler, IStrokeHandler } from \"../geometry3d/GeometryHandler\";\r\nimport { GrowableXYZArray } from \"../geometry3d/GrowableXYZArray\";\r\nimport { Plane3dByOriginAndUnitNormal } from \"../geometry3d/Plane3dByOriginAndUnitNormal\";\r\nimport { Plane3dByOriginAndVectors } from \"../geometry3d/Plane3dByOriginAndVectors\";\r\nimport { Point3d, Vector3d } from \"../geometry3d/Point3dVector3d\";\r\nimport { Point3dArray } from \"../geometry3d/PointHelpers\";\r\nimport { Range1d, Range3d } from \"../geometry3d/Range\";\r\nimport { Ray3d } from \"../geometry3d/Ray3d\";\r\nimport { Transform } from \"../geometry3d/Transform\";\r\nimport { Point4d } from \"../geometry4d/Point4d\";\r\nimport { UnivariateBezier } from \"../numerics/BezierPolynomials\";\r\nimport { AkimaCurve3dOptions } from \"./AkimaCurve3d\";\r\nimport { Bezier1dNd } from \"./Bezier1dNd\";\r\nimport { BezierCurve3d } from \"./BezierCurve3d\";\r\nimport { BezierCurve3dH } from \"./BezierCurve3dH\";\r\nimport { BezierCurveBase } from \"./BezierCurveBase\";\r\nimport { BSpline1dNd } from \"./BSpline1dNd\";\r\nimport { BSplineCurveOps } from \"./BSplineCurveOps\";\r\nimport { InterpolationCurve3dOptions } from \"./InterpolationCurve3d\";\r\nimport { BSplineWrapMode, KnotVector } from \"./KnotVector\";\r\n\r\n/**\r\n * Base class for BSplineCurve3d and BSplineCurve3dH.\r\n * * A B-spline curve consists of an array of `knots`, an array of `poles`, and a `degree`.\r\n * * The knot array is a non-decreasing sequence of numbers. It is also called a \"knot vector\".\r\n * * The curve is a parametric function whose domain is a sub-range of its knots.\r\n * * The API sometimes refers to a domain parameter `u` as a \"knot\", even if `u` is not actually an entry in the\r\n * knot array.\r\n * * The curve loosely \"follows\" the line string formed by the poles, aka the \"control polygon\".\r\n * * The curve is a chain of polynomial segments, aka \"spans\" or \"fragments\". B-spline theory identifies these as\r\n * Bezier curves.\r\n * * The polynomial spans all have same `degree`.\r\n * * Each span is controlled by `order = degree + 1` contiguous points in the pole array.\r\n * * There is a strict relationship between knot and poles counts: `numPoles + order = numKnots + 2'.\r\n * * The number of spans is `numSpan = numPoles - degree`.\r\n * * For a span with index `spanIndex`:\r\n * * The `order` relevant poles begin at pole index `spanIndex`.\r\n * * The `2*degree` relevant knots begin at knot index `spanIndex`.\r\n * * The span domain is the knot range `[knot[spanIndex+degree-1], knot[spanIndex+degree]]`.\r\n * * The curve domain is the knot range `[knot[degree-1], knot[numSpan+degree-1]]`, or equivalently\r\n * `[knot[degree-1], knot[numPoles-1]]`. The API refers to this domain as the \"active knot interval\" of the curve.\r\n *\r\n * Nearly all B-spline curves are \"clamped\".\r\n * * This means that in the `knots` array, the first `degree` knots are equal, and the last `degree` knots are equal.\r\n * We say the smallest knot and the largest knot have multiplicity `degree`.\r\n * * Clamping make the curve pass through its first and last poles, with tangents directed along the first and\r\n * last edges of the control polygon.\r\n * * For instance, a cubic B-spline curve with knot vector `[0,0,0,1,2,3,3,3]`\r\n * * can be evaluated at parameter values in the range `[0, 3]`\r\n * * has 3 spans, with domains `[0, 1]`, `[1, 2]`, and `[2, 3]`\r\n * * has 6 poles\r\n * * passes through its first and last poles.\r\n * * The `create` methods may allow the classic convention that has an extra knot at the beginning and end of the\r\n * knot vector.\r\n * * These two extra knots are not actually needed to define the B-spline curve.\r\n * * When the `create` methods recognize the classic setup (`numPoles + order = numKnots`), the extra knots are\r\n * not saved with the BSplineCurve3dBase knots.\r\n *\r\n * * The weighted variant [[BSplineCurve3dH]] has the problem that `CurvePrimitive` 3D typing does not allow the\r\n * undefined result where a homogeneous pole has zero weight; the convention in this case is to return 000.\r\n *\r\n * * Note the class relationships:\r\n * * [[BSpline1dNd]] knows the definitional B-spline recurrence relation with no physical interpretation for the poles.\r\n * * BsplineCurve3dBase owns a protected BSpline1dNd.\r\n * * `BsplineCurve3dBase` is derived from [[CurvePrimitive]], which creates obligation to act as a 3D curve, e.g.,\r\n * * evaluate fraction to point and derivatives wrt fraction.\r\n * * compute intersection with plane.\r\n * * [[BSplineCurve3d]] and [[BSplineCurve3dH]] have variant logic driven by whether or not there are \"weights\" on the poles.\r\n * * For `BSplineCurve3d`, the xyz value of pole calculations are \"final\" values for 3d evaluation.\r\n * * For `BSplineCurve3dH`, various `BSpline1dNd` results with xyzw have to be normalized back to xyz.\r\n *\r\n * * These classes do not support \"periodic\" variants.\r\n * * Periodic curves historically have carried a flag (e.g., \"closed\") indicating that certain un-stored\r\n * leading/trailing knots and poles are understood to wrap around periodically.\r\n * * Instead, these classes carry no such flag. They represent such curves with explicitly wrapped knots/poles.\r\n *\r\n * * Visualization can be found at https://www.itwinjs.org/sandbox/SaeedTorabi/BSpline/\r\n * @public\r\n */\r\nexport abstract class BSplineCurve3dBase extends CurvePrimitive {\r\n /** String name for schema properties. */\r\n public readonly curvePrimitiveType = \"bsplineCurve\";\r\n /** The underlying blocked-pole spline, with simple x,y,z poles. */\r\n protected _bcurve: BSpline1dNd;\r\n private _definitionData?: any;\r\n public set definitionData(data: any) {\r\n this._definitionData = data;\r\n }\r\n public get definitionData(): any {\r\n return this._definitionData;\r\n }\r\n protected constructor(poleDimension: number, numPoles: number, order: number, knots: KnotVector) {\r\n super();\r\n this._bcurve = BSpline1dNd.create(numPoles, poleDimension, order, knots);\r\n }\r\n /** Return the degree (one less than the order) of the curve. */\r\n public get degree(): number {\r\n return this._bcurve.degree;\r\n }\r\n /** Return the order (one more than degree) of the curve. */\r\n public get order(): number {\r\n return this._bcurve.order;\r\n }\r\n /**\r\n * Return the number of Bezier spans in the curve. Note that this number includes the number of null\r\n * spans at repeated knots.\r\n */\r\n public get numSpan(): number {\r\n return this._bcurve.numSpan;\r\n }\r\n /** Return the number of poles. */\r\n public get numPoles(): number {\r\n return this._bcurve.numPoles;\r\n }\r\n /** Return live reference to the poles of the curve. */\r\n public get polesRef(): Float64Array {\r\n return this._bcurve.packedData;\r\n }\r\n /** Return live reference to the knots of the curve. */\r\n public get knotsRef(): Float64Array {\r\n return this._bcurve.knots.knots;\r\n }\r\n /**\r\n * Number of components per pole, e.g.,\r\n * * 3 for conventional (x,y,z) curve.\r\n * * 4 for weighted (wx,wy,wz,w) curve.\r\n */\r\n public get poleDimension(): number {\r\n return this._bcurve.poleLength;\r\n }\r\n /** Return a simple array form of the knots. Optionally replicate the first and last in classic over-clamped manner. */\r\n public copyKnots(includeExtraEndKnot: boolean): number[] {\r\n return this._bcurve.knots.copyKnots(includeExtraEndKnot);\r\n }\r\n /** Get the flag indicating the curve might be suitable for having wrapped \"closed\" interpretation. */\r\n public getWrappable(): BSplineWrapMode {\r\n return this._bcurve.knots.wrappable;\r\n }\r\n /** Set the flag indicating the curve might be suitable for having wrapped \"closed\" interpretation. */\r\n public setWrappable(value: BSplineWrapMode) {\r\n this._bcurve.knots.wrappable = value;\r\n }\r\n /**\r\n * Test knots and poles to determine if it is possible to close (aka \"wrap\") the curve.\r\n * @returns the manner in which it is possible to close the curve. See `BSplineWrapMode` for particulars of each mode.\r\n */\r\n public get isClosableCurve(): BSplineWrapMode {\r\n const mode = this._bcurve.knots.wrappable;\r\n if (mode === BSplineWrapMode.None)\r\n return BSplineWrapMode.None;\r\n if (!this._bcurve.knots.testClosable(mode))\r\n return BSplineWrapMode.None;\r\n if (!this._bcurve.testClosablePolygon(mode))\r\n return BSplineWrapMode.None;\r\n return mode;\r\n }\r\n /** Evaluate the curve at a fractional position within a given span. */\r\n public abstract evaluatePointInSpan(spanIndex: number, spanFraction: number, result?: Point3d): Point3d;\r\n /**\r\n * Evaluate the curve and derivative at a fractional position within a given span.\r\n * * The derivative is with respect to the span fractional parameter, _not_ to the curve's parameter or fractional parameter.\r\n */\r\n public abstract evaluatePointAndDerivativeInSpan(spanIndex: number, spanFraction: number, result?: Ray3d): Ray3d;\r\n /** Evaluate the curve at the given parameter. */\r\n public abstract knotToPoint(knot: number, result?: Point3d): Point3d;\r\n /** Evaluate the curve and derivative at the given parameter. */\r\n public abstract knotToPointAndDerivative(knot: number, result?: Ray3d): Ray3d;\r\n /** Evaluate the curve and two derivatives at the given parameter. */\r\n public abstract knotToPointAnd2Derivatives(knot: number, result?: Plane3dByOriginAndVectors): Plane3dByOriginAndVectors;\r\n /** Evaluate the curve point at the given fractional parameter. */\r\n public fractionToPoint(fraction: number, result?: Point3d): Point3d {\r\n return this.knotToPoint(this._bcurve.knots.fractionToKnot(fraction), result);\r\n }\r\n /** Evaluate the curve and derivative at the given fractional parameter. */\r\n public fractionToPointAndDerivative(fraction: number, result?: Ray3d): Ray3d {\r\n const knot = this._bcurve.knots.fractionToKnot(fraction);\r\n result = this.knotToPointAndDerivative(knot, result);\r\n result.direction.scaleInPlace(this._bcurve.knots.knotLength01);\r\n return result;\r\n }\r\n /** Evaluate the curve and two derivatives at the given fractional parameter. */\r\n public fractionToPointAnd2Derivatives(fraction: number, result?: Plane3dByOriginAndVectors): Plane3dByOriginAndVectors {\r\n const knot = this._bcurve.knots.fractionToKnot(fraction);\r\n result = this.knotToPointAnd2Derivatives(knot, result);\r\n const a = this._bcurve.knots.knotLength01;\r\n result.vectorU.scaleInPlace(a);\r\n result.vectorV.scaleInPlace(a * a);\r\n return result;\r\n }\r\n /** Return the start point of the curve. */\r\n public override startPoint(result?: Point3d): Point3d {\r\n return this.evaluatePointInSpan(0, 0.0, result);\r\n }\r\n /** Return the end point of the curve. */\r\n public override endPoint(result?: Point3d): Point3d {\r\n return this.evaluatePointInSpan(this.numSpan - 1, 1.0, result);\r\n }\r\n /**\r\n * Reverse the curve in place.\r\n * * Poles are reversed.\r\n * * Knot values are mirrored around the middle of the knot array.\r\n */\r\n public reverseInPlace(): void {\r\n this._bcurve.reverseInPlace();\r\n }\r\n /** Return an array with this curve's Bezier fragments. */\r\n public collectBezierSpans(prefer3dH: boolean): BezierCurveBase[] {\r\n const result: BezierCurveBase[] = [];\r\n const numSpans = this.numSpan;\r\n for (let i = 0; i < numSpans; i++) {\r\n if (this._bcurve.knots.isIndexOfRealSpan(i)) {\r\n const span = this.getSaturatedBezierSpan3dOr3dH(i, prefer3dH);\r\n if (span)\r\n result.push(span);\r\n }\r\n }\r\n return result;\r\n }\r\n /**\r\n * Return the Bezier fragment corresponding to the given span of this curve.\r\n * * The concrete return type may be [[BezierCurve3d]] or [[BezierCurve3dH]] according to the instance type and `prefer3dH`.\r\n * @param spanIndex index of span.\r\n * @param prefer3dH true to force promotion to homogeneous.\r\n * @param result optional reusable curve. This will only be reused if its type and order matches.\r\n */\r\n public abstract getSaturatedBezierSpan3dOr3dH(\r\n spanIndex: number, prefer3dH: boolean, result?: BezierCurveBase,\r\n ): BezierCurveBase | undefined;\r\n /**\r\n * Return a specified pole as a Point4d.\r\n * * BSplineCurve3d appends weight 1 to its xyz.\r\n * * BSplineCurve3dH with pole whose \"normalized\" point is (x,y,z) but has weight w returns the weighted form (wx,wy,wz,w).\r\n */\r\n public abstract getPolePoint4d(poleIndex: number, result?: Point4d): Point4d | undefined;\r\n /**\r\n * Return a specified pole as a Point3d.\r\n * * BSplineCurve3d returns its simple xyz.\r\n * * BSplineCurve3dH attempts to normalize its (wx,wy,wz,w) back to (x,y,z), and returns undefined if weight is zero.\r\n * @param poleIndex index of the pole.\r\n * @param result optional result.\r\n */\r\n public abstract getPolePoint3d(poleIndex: number, result?: Point3d): Point3d | undefined;\r\n /** Given a pole index, return the starting index for the contiguous array. */\r\n public poleIndexToDataIndex(poleIndex: number): number | undefined {\r\n if (poleIndex >= 0 && poleIndex < this.numPoles)\r\n return poleIndex * this._bcurve.poleLength;\r\n return undefined;\r\n }\r\n /**\r\n * Search for the curve point that is closest to the spacePoint.\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\r\n * succeed.\r\n * @param spacePoint point in space.\r\n * @param _extend ignored (pass false). A BSplineCurve3dBase cannot be extended.\r\n * @param result optional pre-allocated detail to populate and return.\r\n * @returns details of the closest point.\r\n */\r\n public override closestPoint(\r\n spacePoint: Point3d, _extend: VariantCurveExtendParameter = false, result?: CurveLocationDetail,\r\n ): CurveLocationDetail | undefined {\r\n // seed at start point; final point comes with final bezier perpendicular step\r\n const point = this.fractionToPoint(0);\r\n result = CurveLocationDetail.createCurveFractionPointDistance(this, 0.0, point, point.distance(spacePoint), result);\r\n let span: BezierCurve3dH | undefined;\r\n const numSpans = this.numSpan;\r\n for (let i = 0; i < numSpans; i++) {\r\n if (this._bcurve.knots.isIndexOfRealSpan(i)) {\r\n span = this.getSaturatedBezierSpan3dOr3dH(i, true, span) as BezierCurve3dH;\r\n if (span) {\r\n // if the B-spline is discontinuous, both ends should be tested; ignore that possibility\r\n if (span.updateClosestPointByTruePerpendicular(spacePoint, result, false, true)) {\r\n // the detail records the span bezier; promote it to the parent curve\r\n result.curve = this;\r\n result.fraction = span.fractionToParentFraction(result.fraction);\r\n }\r\n }\r\n }\r\n }\r\n return result;\r\n }\r\n /** Return a deep clone. */\r\n public abstract override clone(): BSplineCurve3dBase;\r\n /** Return a transformed deep clone. */\r\n public override cloneTransformed(transform: Transform): BSplineCurve3dBase {\r\n const curve = this.clone();\r\n curve.tryTransformInPlace(transform);\r\n return curve;\r\n }\r\n /**\r\n * Return a curve primitive which is a portion of this curve.\r\n * @param fractionA start fraction.\r\n * @param fractionB end fraction.\r\n */\r\n public override clonePartialCurve(fractionA: number, fractionB: number): BSplineCurve3dBase {\r\n let clone: BSplineCurve3dBase;\r\n if (fractionA > fractionB) {\r\n clone = this.clonePartialCurve(fractionB, fractionA);\r\n clone.reverseInPlace();\r\n return clone;\r\n }\r\n clone = this.clone();\r\n const origNumKnots = clone._bcurve.knots.knots.length;\r\n let knotA = clone._bcurve.knots.fractionToKnot(fractionA);\r\n let knotB = clone._bcurve.knots.fractionToKnot(fractionB);\r\n clone._bcurve.addKnot(knotA, clone.degree);\r\n clone._bcurve.addKnot(knotB, clone.degree);\r\n if (origNumKnots === clone._bcurve.knots.knots.length)\r\n return clone; // full curve\r\n if (knotA > knotB)\r\n [knotA, knotB] = [knotB, knotA];\r\n // choose first/last knot and pole such that knotA/knotB has degree multiplicity in the new knot sequence\r\n const iStartKnot = clone._bcurve.knots.knotToLeftKnotIndex(knotA) - clone.degree + 1;\r\n const iStartPole = iStartKnot * clone._bcurve.poleLength;\r\n const iLastKnot = clone._bcurve.knots.knotToLeftKnotIndex(knotB);\r\n let iLastKnotLeftMultiple = iLastKnot - clone._bcurve.knots.getKnotMultiplicityAtIndex(iLastKnot) + 1;\r\n if (clone._bcurve.knots.knots[iLastKnot] < knotB)\r\n iLastKnotLeftMultiple = iLastKnot + 1;\r\n const iEndPole = (iLastKnotLeftMultiple + 1) * clone._bcurve.poleLength; // one past last pole\r\n const iEndKnot = iLastKnotLeftMultiple + clone.degree; // one past last knot\r\n // trim the arrays (leave knots unnormalized)\r\n clone._bcurve.knots.setKnotsCapture(clone._bcurve.knots.knots.slice(iStartKnot, iEndKnot));\r\n clone._bcurve.packedData = clone._bcurve.packedData.slice(iStartPole, iEndPole);\r\n clone.setWrappable(BSplineWrapMode.None); // always open\r\n return clone;\r\n }\r\n /**\r\n * Implement `CurvePrimitive.appendPlaneIntersections` to compute intersections of the curve with a plane.\r\n * @param plane the plane with which to intersect the curve. Concrete types include [[Plane3dByOriginAndUnitNormal]],\r\n * [[Point4d]], etc.\r\n * @param result growing array of plane intersections.\r\n * @return number of intersections appended to the array.\r\n */\r\n public override appendPlaneIntersectionPoints(plane: PlaneAltitudeEvaluator, result: CurveLocationDetail[]): number {\r\n const numPole = this.numPoles;\r\n const order = this.order;\r\n const allCoffs = new Float64Array(numPole);\r\n const numSpan = this.numSpan;\r\n const point4d = Point4d.create();\r\n // compute all pole altitudes from the plane\r\n const minMax = Range1d.createNull();\r\n // put the altitudes of all the B-spline poles in one array\r\n for (let i = 0; i < numPole; i++) {\r\n this.getPolePoint4d(i, point4d);\r\n allCoffs[i] = plane.weightedAltitude(point4d);\r\n minMax.extendX(allCoffs[i]);\r\n }\r\n // A univariate B-spline through the altitude poles gives altitude as function of the B-spline knot.\r\n // The (bspline) altitude function for each span is `order` consecutive altitudes.\r\n // If those altitudes bracket zero, the span may potentially have a crossing.\r\n let univariateBezier: UnivariateBezier | undefined;\r\n let numFound = 0;\r\n let previousFraction = -1000.0;\r\n if (minMax.containsX(0.0)) {\r\n for (let spanIndex = 0; spanIndex < numSpan; spanIndex++) {\r\n if (this._bcurve.knots.isIndexOfRealSpan(spanIndex)) { // ignore trivial knot intervals\r\n // outer range test ...\r\n minMax.setNull();\r\n minMax.extendArraySubset(allCoffs, spanIndex, order);\r\n if (minMax.containsX(0.0)) {\r\n // pack the B-spline support into a univariate bezier\r\n univariateBezier = UnivariateBezier.createArraySubset(allCoffs, spanIndex, order, univariateBezier);\r\n // saturate and solve the bezier\r\n Bezier1dNd.saturate1dInPlace(univariateBezier.coffs, this._bcurve.knots, spanIndex);\r\n const roots = univariateBezier.roots(0.0, true);\r\n if (roots) {\r\n for (const spanFraction of roots) {\r\n // promote each local bezier fraction to global fraction and save the curve evaluation at that fraction\r\n numFound++;\r\n const fraction = this._bcurve.knots.spanFractionToFraction(spanIndex, spanFraction);\r\n if (!Geometry.isAlmostEqualNumber(fraction, previousFraction)) {\r\n const detail = CurveLocationDetail.createCurveEvaluatedFraction(this, fraction);\r\n detail.intervalRole = CurveIntervalRole.isolated;\r\n result.push(detail);\r\n previousFraction = fraction;\r\n }\r\n }\r\n }\r\n }\r\n }\r\n }\r\n }\r\n return numFound;\r\n }\r\n /**\r\n * Construct an offset of the instance curve as viewed in the xy-plane (ignoring z).\r\n * @param offsetDistanceOrOptions offset distance (positive to left of the instance curve), or options object.\r\n */\r\n public override constructOffsetXY(offsetDistanceOrOptions: number | OffsetOptions): BSplineCurve3d | undefined {\r\n const options = OffsetOptions.create(offsetDistanceOrOptions);\r\n const handler = new CurveOffsetXYHandler(this, options.leftOffsetDistance);\r\n this.emitStrokableParts(handler, options.strokeOptions);\r\n return handler.claimResult();\r\n }\r\n /**\r\n * Project instance geometry (via dispatch) onto the given ray, and return the extreme fractional parameters\r\n * of projection.\r\n * @param ray ray onto which the instance is projected. A `Vector3d` is treated as a `Ray3d` with zero origin.\r\n * @param lowHigh optional receiver for output.\r\n * @returns range of fractional projection parameters onto the ray, where 0.0 is start of the ray and 1.0 is the\r\n * end of the ray.\r\n */\r\n public override projectedParameterRange(ray: Vector3d | Ray3d, lowHigh?: Range1d): Range1d | undefined {\r\n return PlaneAltitudeRangeContext.findExtremeFractionsAlongDirection(this, ray, lowHigh);\r\n }\r\n}\r\n/**\r\n * A BSplineCurve3d is a B-spline curve whose poles are Point3d.\r\n * See BSplineCurve3dBase for description of knots, order, degree, and poles.\r\n * @public\r\n */\r\nexport class BSplineCurve3d extends BSplineCurve3dBase {\r\n private _workBezier?: BezierCurve3d;\r\n private initializeWorkBezier(): BezierCurve3d {\r\n if (this._workBezier === undefined)\r\n this._workBezier = BezierCurve3d.createOrder(this.order);\r\n return this._workBezier;\r\n }\r\n private constructor(numPoles: number, order: number, knots: KnotVector) {\r\n super(3, numPoles, order, knots);\r\n }\r\n /** Test if `other` is an instance of BSplineCurve3d. */\r\n public isSameGeometryClass(other: any): boolean {\r\n return other instanceof BSplineCurve3d;\r\n }\r\n /** Apply `transform` to the poles. */\r\n public tryTransformInPlace(transform: Transform): boolean {\r\n Point3dArray.multiplyInPlace(transform, this._bcurve.packedData);\r\n return true;\r\n }\r\n /** Get a pole as a simple Point3d. */\r\n public getPolePoint3d(poleIndex: number, result?: Point3d): Point3d | undefined {\r\n const k = this.poleIndexToDataIndex(poleIndex);\r\n if (k !== undefined) {\r\n const data = this._bcurve.packedData;\r\n return Point3d.create(data[k], data[k + 1], data[k + 2], result);\r\n }\r\n return undefined;\r\n }\r\n /** Get a pole as Point4d with weight 1. */\r\n public getPolePoint4d(poleIndex: number, result?: Point4d): Point4d | undefined {\r\n const k = this.poleIndexToDataIndex(poleIndex);\r\n if (k !== undefined) {\r\n const data = this._bcurve.packedData;\r\n return Point4d.create(data[k], data[k + 1], data[k + 2], 1.0, result);\r\n }\r\n return undefined;\r\n }\r\n /**\r\n * Convert the fractional position in the given span to a knot.\r\n * * The returned value is not necessarily a knot, but it is a valid parameter in the domain of the B-spline curve.\r\n */\r\n public spanFractionToKnot(spanIndex: number, spanFraction: number): number {\r\n return this._bcurve.spanFractionToKnot(spanIndex, spanFraction);\r\n }\r\n /** Return a simple array of arrays with the poles as `[[x,y,z],[x,y,z],..]`. */\r\n public copyPoints(): any[] {\r\n return Point3dArray.unpackNumbersToNestedArrays(this._bcurve.packedData, 3);\r\n }\r\n /** Return a simple array of poles' coordinates. */\r\n public copyPointsFloat64Array(): Float64Array {\r\n return this._bcurve.packedData.slice();\r\n }\r\n /** Return a simple array form of the knots. Optionally replicate the first and last in classic over-clamped manner. */\r\n public override copyKnots(includeExtraEndKnot: boolean): number[] {\r\n return this._bcurve.knots.copyKnots(includeExtraEndKnot);\r\n }\r\n /** Create a B-spline with uniform knots. */\r\n public static createUniformKnots(\r\n poles: Point3d[] | Float64Array | GrowableXYZArray, order: number,\r\n ): BSplineCurve3d | undefined {\r\n const numPoles = poles instanceof Float64Array ? poles.length / 3 : poles.length;\r\n if (order < 2 || numPoles < order)\r\n return undefined;\r\n const knots = KnotVector.createUniformClamped(numPoles, order - 1, 0.0, 1.0);\r\n const curve = new BSplineCurve3d(numPoles, order, knots);\r\n if (poles instanceof Float64Array) {\r\n for (let i = 0; i < 3 * numPoles; i++)\r\n curve._bcurve.packedData[i] = poles[i];\r\n } else if (poles instanceof GrowableXYZArray) {\r\n curve._bcurve.packedData = poles.float64Data().slice(0, 3 * numPoles);\r\n } else {\r\n let i = 0;\r\n for (const p of poles) {\r\n curve._bcurve.packedData[i++] = p.x;\r\n curve._bcurve.packedData[i++] = p.y;\r\n curve._bcurve.packedData[i++] = p.z;\r\n }\r\n }\r\n return curve;\r\n }\r\n /**\r\n * Create a smoothly closed B-spline curve with uniform knots.\r\n * * Note that the curve does not start at the first pole.\r\n */\r\n public static createPeriodicUniformKnots(\r\n poles: Point3d[] | Float64Array | GrowableXYZArray, order: number,\r\n ): BSplineCurve3d | undefined {\r\n if (order < 2)\r\n return undefined;\r\n let numPoles = poles instanceof Float64Array ? poles.length / 3 : poles.length;\r\n if (numPoles < 2)\r\n return undefined;\r\n const startPoint = Point3d.createZero();\r\n const endPoint = Point3d.createZero();\r\n let hasClosurePoint = false;\r\n do {\r\n if (poles instanceof Float64Array) {\r\n startPoint.set(poles[0], poles[1], poles[2]);\r\n endPoint.set(poles[3 * numPoles - 3], poles[3 * numPoles - 2], poles[3 * numPoles - 1]);\r\n } else if (poles instanceof GrowableXYZArray) {\r\n poles.getPoint3dAtUncheckedPointIndex(0, startPoint);\r\n poles.getPoint3dAtUncheckedPointIndex(numPoles - 1, endPoint);\r\n } else {\r\n startPoint.setFromPoint3d(poles[0]);\r\n endPoint.setFromPoint3d(poles[numPoles - 1]);\r\n }\r\n if (hasClosurePoint = startPoint.isAlmostEqual(endPoint))\r\n --numPoles; // remove wraparound pole if found\r\n } while (hasClosurePoint && numPoles > 1);\r\n if (numPoles < order)\r\n return undefined;\r\n const degree = order - 1;\r\n const numIntervals = numPoles;\r\n const knots = KnotVector.createUniformWrapped(numIntervals, degree, 0.0, 1.0);\r\n knots.wrappable = BSplineWrapMode.OpenByAddingControlPoints;\r\n // append degree wraparound poles\r\n const curve = new BSplineCurve3d(numPoles + degree, order, knots);\r\n if (poles instanceof Float64Array) {\r\n let i = 0;\r\n for (let j = 0; j < 3 * numPoles; j++)\r\n curve._bcurve.packedData[i++] = poles[j];\r\n for (let j = 0; j < 3 * degree; j++)\r\n curve._bcurve.packedData[i++] = poles[j];\r\n } else if (poles instanceof GrowableXYZArray) {\r\n let i = 0;\r\n for (let j = 0; j < 3 * numPoles; j++)\r\n curve._bcurve.packedData[i++] = poles.float64Data()[j];\r\n for (let j = 0; j < 3 * degree; j++)\r\n curve._bcurve.packedData[i++] = poles.float64Data()[j];\r\n } else {\r\n let i = 0;\r\n for (let j = 0; j < numPoles; j++) {\r\n curve._bcurve.packedData[i++] = poles[j].x;\r\n curve._bcurve.packedData[i++] = poles[j].y;\r\n curve._bcurve.packedData[i++] = poles[j].z;\r\n }\r\n for (let j = 0; j < degree; j++) {\r\n curve._bcurve.packedData[i++] = poles[j].x;\r\n curve._bcurve.packedData[i++] = poles[j].y;\r\n curve._bcurve.packedData[i++] = poles[j].z;\r\n }\r\n }\r\n return curve;\r\n }\r\n /**\r\n * Create a C2 cubic B-spline curve that interpolates the given points and optional end tangents.\r\n * @param options collection of points and end conditions.\r\n */\r\n public static createFromInterpolationCurve3dOptions(options: InterpolationCurve3dOptions): BSplineCurve3d | undefined {\r\n return BSplineCurveOps.createThroughPointsC2Cubic(options);\r\n }\r\n /**\r\n * Create a B-spline curve from an Akima curve.\r\n * * The Akima formulation of the curve is currently replaced by a Greville interpolation.\r\n * @param options data for construction\r\n */\r\n public static createFromAkimaCurve3dOptions(options: AkimaCurve3dOptions): BSplineCurve3d | undefined {\r\n return BSplineCurveOps.createThroughPoints(options.fitPoints, 4);\r\n }\r\n /**\r\n * Create a B-spline curve with given knots.\r\n * * The poles have several variants:\r\n * * Float64Array(3 * numPoles) in blocks of [x,y,z].\r\n * * Point3d[].\r\n * * number[][], with inner dimension 3.\r\n * * Two count conditions are recognized:\r\n * * If poleArray.length + order === knotArray.length, the first and last are assumed to be the extraneous knots\r\n * of classic clamping.\r\n * * If poleArray.length + order === knotArray.length + 2, the knots are in modern form.\r\n * * Visualization can be found at https://www.itwinjs.org/sandbox/SaeedTorabi/BSpline/\r\n */\r\n public static create(\r\n poleArray: Float64Array | Point3d[] | number[][], knotArray: Float64Array | number[], order: number,\r\n ): BSplineCurve3d | undefined {\r\n if (order < 2)\r\n return undefined;\r\n let numPoles = poleArray.length;\r\n if (poleArray instanceof Float64Array)\r\n numPoles = Math.floor(numPoles / 3); // blocked as xyz\r\n if (numPoles < order)\r\n return undefined;\r\n const numKnots = knotArray.length;\r\n const skipFirstAndLast = (numPoles + order === numKnots); // classic over-clamped input knots\r\n if (!skipFirstAndLast && numPoles + order !== numKnots + 2) // modern knots\r\n return undefined;\r\n const knots = KnotVector.create(knotArray, order - 1, skipFirstAndLast);\r\n const curve = new BSplineCurve3d(numPoles, order, knots);\r\n let i = 0;\r\n if (poleArray instanceof Float64Array) {\r\n for (const coordinate of poleArray)\r\n curve._bcurve.packedData[i++] = coordinate;\r\n } else if (poleArray[0] instanceof Point3d) {\r\n for (const p of poleArray as Point3d[]) {\r\n curve._bcurve.packedData[i++] = p.x;\r\n curve._bcurve.packedData[i++] = p.y;\r\n curve._bcurve.packedData[i++] = p.z;\r\n }\r\n } else if (Array.isArray(poleArray[0]) && poleArray[0].length === 3) {\r\n for (const point of poleArray as number[][])\r\n for (const coord of point)\r\n curve._bcurve.packedData[i++] = coord;\r\n } else {\r\n return undefined; // unexpected poleArray type\r\n }\r\n return curve;\r\n }\r\n /** Return a deep clone. */\r\n public override clone(): BSplineCurve3d {\r\n const knotVector = this._bcurve.knots.clone();\r\n const curve = new BSplineCurve3d(this.numPoles, this.order, knotVector);\r\n curve._bcurve.packedData = this._bcurve.packedData.slice();\r\n return curve;\r\n }\r\n /** Evaluate the curve at a fractional position within a given span. */\r\n public evaluatePointInSpan(spanIndex: number, spanFraction: number, result?: Point3d): Point3d {\r\n this._bcurve.evaluateBuffersInSpan(spanIndex, spanFraction);\r\n return Point3d.createFrom(this._bcurve.poleBuffer, result);\r\n }\r\n /**\r\n * Evaluate the curve and derivative at a fractional position within a given span.\r\n * * The derivative is with respect to the span fractional parameter, _not_ to the curve's parameter or fractional parameter.\r\n */\r\n public evaluatePointAndDerivativeInSpan(spanIndex: number, spanFraction: number): Ray3d {\r\n this._bcurve.evaluateBuffersInSpan1(spanIndex, spanFraction);\r\n return Ray3d.createCapture(\r\n Point3d.createFrom(this._bcurve.poleBuffer),\r\n Vector3d.createFrom(this._bcurve.poleBuffer1),\r\n );\r\n }\r\n /**\r\n * Evaluate the curve at the given parameter.\r\n * @param u parameter in curve domain.\r\n * @param result optional result.\r\n * @returns the point on the curve.\r\n */\r\n public knotToPoint(u: number, result?: Point3d): Point3d {\r\n this._bcurve.evaluateBuffersAtKnot(u);\r\n return Point3d.createFrom(this._bcurve.poleBuffer, result);\r\n }\r\n /**\r\n * Evaluate the curve and derivative at the given parameter.\r\n * @param u parameter in curve domain.\r\n * @param result optional result.\r\n * @returns the ray with origin at the curve point and direction as the derivative.\r\n */\r\n public knotToPointAndDerivative(u: number, result?: Ray3d): Ray3d {\r\n this._bcurve.evaluateBuffersAtKnot(u, 1);\r\n if (!result)\r\n return Ray3d.createCapture(\r\n Point3d.createFrom(this._bcurve.poleBuffer),\r\n Vector3d.createFrom(this._bcurve.poleBuffer1),\r\n );\r\n result.origin.setFrom(this._bcurve.poleBuffer);\r\n result.direction.setFrom(this._bcurve.poleBuffer1);\r\n return result;\r\n }\r\n /**\r\n * Evaluate the curve and two derivatives at the given parameter.\r\n * @param u parameter in the curve domain.\r\n * @param result optional result.\r\n * @returns the plane with origin at the curve point, vectorU as the 1st derivative, and vectorV as the 2nd derivative.\r\n */\r\n public knotToPointAnd2Derivatives(u: number, result?: Plane3dByOriginAndVectors): Plane3dByOriginAndVectors {\r\n this._bcurve.evaluateBuffersAtKnot(u, 2);\r\n return Plane3dByOriginAndVectors.createOriginAndVectorsXYZ(\r\n this._bcurve.poleBuffer[0], this._bcurve.poleBuffer[1], this._bcurve.poleBuffer[2],\r\n this._bcurve.poleBuffer1[0], this._bcurve.poleBuffer1[1], this._bcurve.poleBuffer1[2],\r\n this._bcurve.poleBuffer2[0], this._bcurve.poleBuffer2[1], this._bcurve.poleBuffer2[2],\r\n result,\r\n );\r\n }\r\n /** Test if `this` is almost the same curve as `other`. */\r\n public override isAlmostEqual(other: any): boolean {\r\n if (other instanceof BSplineCurve3d) {\r\n return this._bcurve.knots.isAlmostEqual(other._bcurve.knots)\r\n && Point3dArray.isAlmostEqual(this._bcurve.packedData, other._bcurve.packedData);\r\n }\r\n return false;\r\n }\r\n /** Test if this curve lies entirely in the given plane. */\r\n public isInPlane(plane: Plane3dByOriginAndUnitNormal): boolean {\r\n return Point3dArray.isCloseToPlane(this._bcurve.packedData, plane);\r\n }\r\n /**\r\n * Return the control polygon length as an approximation to the curve length.\r\n * * The returned length is always an overestimate.\r\n */\r\n public quickLength(): number {\r\n return Point3dArray.sumEdgeLengths(this._bcurve.packedData);\r\n }\r\n /** Emit Beziers or strokes (selected by the stroke options) to the handler. */\r\n public emitStrokableParts(handler: IStrokeHandler, options?: StrokeOptions): void {\r\n const workBezier = this.initializeWorkBezier();\r\n const numSpan = this.numSpan;\r\n let numStrokes;\r\n for (let spanIndex = 0; spanIndex < numSpan; spanIndex++) {\r\n const bezier = this.getSaturatedBezierSpan3dOr3dH(spanIndex, false, workBezier);\r\n if (bezier) {\r\n numStrokes = bezier.computeStrokeCountForOptions(options);\r\n if (handler.announceBezierCurve) {\r\n handler.announceBezierCurve(\r\n bezier,\r\n numStrokes,\r\n this,\r\n spanIndex,\r\n this._bcurve.knots.spanFractionToFraction(spanIndex, 0.0),\r\n this._bcurve.knots.spanFractionToFraction(spanIndex, 1.0),\r\n );\r\n\r\n } else {\r\n handler.announceIntervalForUniformStepStrokes(\r\n this,\r\n numStrokes,\r\n this._bcurve.knots.spanFractionToFraction(spanIndex, 0.0),\r\n this._bcurve.knots.spanFractionToFraction(spanIndex, 1.0),\r\n );\r\n }\r\n }\r\n }\r\n }\r\n /**\r\n * Assess length and turn to determine a stroke count.\r\n * @param options stroke options structure.\r\n */\r\n public computeStrokeCountForOptions(options?: StrokeOptions): number {\r\n const workBezier = this.initializeWorkBezier();\r\n const numSpan = this.numSpan;\r\n let numStroke = 0;\r\n for (let spanIndex = 0; spanIndex < numSpan; spanIndex++) {\r\n const bezier = this.getSaturatedBezierSpan3d(spanIndex, workBezier);\r\n if (bezier)\r\n numStroke += bezier.computeStrokeCountForOptions(options);\r\n }\r\n return numStroke;\r\n }\r\n /**\r\n * Compute individual segment stroke counts. Attach in a StrokeCountMap.\r\n * @param options StrokeOptions that determine count\r\n * @param parentStrokeMap evolving parent map.\r\n * @alpha\r\n */\r\n public override computeAndAttachRecursiveStrokeCounts(options?: StrokeOptions, parentStrokeMap?: StrokeCountMap) {\r\n const workBezier = this.initializeWorkBezier();\r\n const numSpan = this.numSpan;\r\n const myData = StrokeCountMap.createWithCurvePrimitiveAndOptionalParent(this, parentStrokeMap, []);\r\n for (let spanIndex = 0; spanIndex < numSpan; spanIndex++) {\r\n const bezier = this.getSaturatedBezierSpan3d(spanIndex, workBezier);\r\n if (bezier) {\r\n const segmentLength = workBezier.curveLength();\r\n const numStrokeOnSegment = workBezier.computeStrokeCountForOptions(options);\r\n myData.addToCountAndLength(numStrokeOnSegment, segmentLength);\r\n }\r\n }\r\n CurvePrimitive.installStrokeCountMap(this, myData, parentStrokeMap);\r\n }\r\n /** Append strokes to the given linestring. */\r\n public emitStrokes(dest: LineString3d, options?: StrokeOptions): void {\r\n const workBezier = this.initializeWorkBezier();\r\n const numSpan = this.numSpan;\r\n for (let spanIndex = 0; spanIndex < numSpan; spanIndex++) {\r\n const bezier = this.getSaturatedBezierSpan3d(spanIndex, workBezier);\r\n if (bezier)\r\n bezier.emitStrokes(dest, options);\r\n }\r\n }\r\n /**\r\n * Test knots and poles to determine if it is possible to close (aka \"wrap\") the curve.\r\n * @returns the manner in which it is possible to close the curve. See `BSplineWrapMode` for particulars of each mode.\r\n */\r\n public get isClosable(): BSplineWrapMode {\r\n return this.isClosableCurve;\r\n }\r\n /**\r\n * Return the Bezier fragment corresponding to the given span of this curve.\r\n * * The concrete return type may be [[BezierCurve3d]] or [[BezierCurve3dH]] according to the instance type and `prefer3dH`.\r\n * @param spanIndex index of span.\r\n * @param result optional reusable curve. This will only be reused if its type and order matches.\r\n */\r\n public getSaturatedBezierSpan3dOr3dH(\r\n spanIndex: number, prefer3dH: boolean, result?: BezierCurveBase,\r\n ): BezierCurveBase | undefined {\r\n if (prefer3dH)\r\n return this.getSaturatedBezierSpan3dH(spanIndex, result);\r\n return this.getSaturatedBezierSpan3d(spanIndex, result);\r\n }\r\n /**\r\n * Return the Bezier fragment corresponding to the given span of this curve.\r\n * @param spanIndex index of span.\r\n * @param result optional reusable curve. This will only be reused if its type and order matches.\r\n */\r\n public getSaturatedBezierSpan3d(spanIndex: number, result?: BezierCurveBase): BezierCurve3d | undefined {\r\n if (spanIndex < 0 || spanIndex >= this.numSpan)\r\n return undefined;\r\n const order = this.order;\r\n if (result === undefined || !(result instanceof BezierCurve3d) || result.order !== order)\r\n result = BezierCurve3d.createOrder(order);\r\n const bezier = result as BezierCurve3d;\r\n bezier.loadSpanPoles(this._bcurve.packedData, spanIndex);\r\n if (bezier.saturateInPlace(this._bcurve.knots, spanIndex))\r\n return bezier;\r\n return undefined;\r\n }\r\n /**\r\n * Return the Bezier fragment corresponding to the given span of this curve.\r\n * @param spanIndex index of span.\r\n * @param result optional reusable curve. This will only be reused if its type and order matches.\r\n */\r\n public getSaturatedBezierSpan3dH(spanIndex: number, result?: BezierCurveBase): BezierCurve3dH | undefined {\r\n if (spanIndex < 0 || spanIndex >= this.numSpan)\r\n return undefined;\r\n const order = this.order;\r\n if (result === undefined || !(result instanceof BezierCurve3dH) || result.order !== order)\r\n result = BezierCurve3dH.createOrder(order);\r\n const bezier = result as BezierCurve3dH;\r\n bezier.loadSpan3dPolesWithWeight(this._bcurve.packedData, spanIndex, 1.0);\r\n if (bezier.saturateInPlace(this._bcurve.knots, spanIndex))\r\n return bezier;\r\n return undefined;\r\n }\r\n /** Second step of double dispatch: call `handler.handleBSplineCurve3d(this)`. */\r\n public dispatchToGeometryHandler(handler: GeometryHandler): any {\r\n return handler.handleBSplineCurve3d(this);\r\n }\r\n /**\r\n * Extend a range so it contains the range of this curve.\r\n * * This computation is based on the poles, not the curve itself, so the returned range is generally larger than the\r\n * tightest possible range.\r\n * @param rangeToExtend range to extend.\r\n * @param transform transform to apply to the poles as they are entered into the range.\r\n */\r\n public extendRange(rangeToExtend: Range3d, transform?: Transform): void {\r\n const buffer = this._bcurve.packedData;\r\n const n = buffer.length - 2;\r\n if (transform) {\r\n for (let i0 = 0; i0 < n; i0 += 3)\r\n rangeToExtend.extendTransformedXYZ(transform, buffer[i0], buffer[i0 + 1], buffer[i0 + 2]);\r\n } else {\r\n for (let i0 = 0; i0 < n; i0 += 3)\r\n rangeToExtend.extendXYZ(buffer[i0], buffer[i0 + 1], buffer[i0 + 2]);\r\n }\r\n }\r\n}\r\n"]}
@@ -101,7 +101,9 @@ export declare class InterpolationCurve3dOptions {
101
101
  clone(): InterpolationCurve3dOptions;
102
102
  /** Clone with strongly typed members reduced to simple json. */
103
103
  static create(source: InterpolationCurve3dProps): InterpolationCurve3dOptions;
104
+ /** Vector equality test, with the additional rule that the zero vector matches undefined. */
104
105
  private static areAlmostEqualAllow000AsUndefined;
106
+ /** Whether the two options are equivalent or both undefined. */
105
107
  static areAlmostEqual(dataA: InterpolationCurve3dOptions | undefined, dataB: InterpolationCurve3dOptions | undefined): boolean;
106
108
  /** reverse the order or sense of all start-to-end related properties. */
107
109
  reverseInPlace(): void;
@@ -114,6 +116,7 @@ export declare class InterpolationCurve3dOptions {
114
116
  * @public
115
117
  */
116
118
  export declare class InterpolationCurve3d extends ProxyCurve {
119
+ /** String name for schema properties. */
117
120
  readonly curvePrimitiveType = "interpolationCurve";
118
121
  private _options;
119
122
  /** CAPTURE properties and proxy curve. */
@@ -164,7 +167,8 @@ export declare class InterpolationCurve3d extends ProxyCurve {
164
167
  /** Return a deep clone */
165
168
  clone(): InterpolationCurve3d;
166
169
  /** Return a transformed clone. */
167
- cloneTransformed(transform: Transform): InterpolationCurve3d | undefined;
170
+ cloneTransformed(transform: Transform): InterpolationCurve3d;
171
+ /** Test if this [[InterpolationCurve3d]] is almost equal to another GeometryQuery object. */
168
172
  isAlmostEqual(other: GeometryQuery): boolean;
169
173
  /** Test if `other` is also an [[InterpolationCurve3d]] */
170
174
  isSameGeometryClass(other: GeometryQuery): boolean;
@@ -1 +1 @@
1
- {"version":3,"file":"InterpolationCurve3d.d.ts","sourceRoot":"","sources":["../../../src/bspline/InterpolationCurve3d.ts"],"names":[],"mappings":"AAIA;;GAEG;AAGH,OAAO,EAAE,OAAO,EAAE,MAAM,uBAAuB,CAAC;AAChD,OAAO,EAAE,kCAAkC,EAAkB,MAAM,yBAAyB,CAAC;AAC7F,OAAO,EAAE,aAAa,EAAE,MAAM,wBAAwB,CAAC;AACvD,OAAO,EAAE,UAAU,EAAE,MAAM,qBAAqB,CAAC;AAEjD,OAAO,EAAE,eAAe,EAAE,MAAM,+BAA+B,CAAC;AAChE,OAAO,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,+BAA+B,CAAC;AAElE,OAAO,EAAE,SAAS,EAAE,MAAM,yBAAyB,CAAC;AACpD,OAAO,EAAE,QAAQ,EAAE,MAAM,wBAAwB,CAAC;AAClD,OAAO,EAAE,cAAc,EAAE,MAAM,gBAAgB,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AAG,OAAO;IA6BrI,yEAAyE;IAClE,cAAc;CAStB;AAED;;;;;;GAMG;AACH,qBAAa,oBAAqB,SAAQ,UAAU;IAClD,yCAAyC;IACzC,SAAgB,kBAAkB,wBAAwB;IAC1D,OAAO,CAAC,QAAQ,CAA8B;IAC9C,0CAA0C;IAC1C,OAAO;IAIP,sFAAsF;IACtE,yBAAyB,CAAC,OAAO,EAAE,eAAe,GAAG,GAAG;IAMxE;;;;OAIG;WACW,MAAM,CAAC,OAAO,EAAE,2BAA2B,GAAG,yBAAyB,GAAG,oBAAoB,GAAG,SAAS;IASxH;;;OAGG;WACW,aAAa,CAAC,OAAO,EAAE,2BAA2B,GAAG,oBAAoB,GAAG,SAAS;IAMnG,wDAAwD;IACxD,IAAoB,UAAU,IAAI,cAAc,CAE/C;IACD,uEAAuE;IAChE,yBAAyB,IAAI,YAAY;IAIhD;;;OAGG;IACI,MAAM,IAAI,GAAG;IAGpB,sFAAsF;IAC/E,UAAU,IAAI,yBAAyB;IAI9C,iCAAiC;IACjC,IAAW,OAAO,IAAI,2BAA2B,CAA0B;IAE3E;;;OAGG;IACI,cAAc,IAAI,IAAI;IAI7B;;OAEG;IACI,mBAAmB,CAAC,SAAS,EAAE,SAAS,GAAG,OAAO;IASzD;;;;;;OAMG;IACa,qBAAqB,CAAC,OAAO,EAAE,OAAO,EAAE,QAAQ,CAAC,EAAE,kCAAkC,GAAG,OAAO;IAG/G,0BAA0B;IACV,KAAK,IAAI,oBAAoB;IAG7C,kCAAkC;IAClB,gBAAgB,CAAC,SAAS,EAAE,SAAS,GAAG,oBAAoB;IAI5E,6FAA6F;IAC7E,aAAa,CAAC,KAAK,EAAE,aAAa,GAAG,OAAO;IAO5D,0DAA0D;IACnD,mBAAmB,CAAC,KAAK,EAAE,aAAa,GAAG,OAAO;CAE1D"}
@@ -134,8 +134,7 @@ class InterpolationCurve3dOptions {
134
134
  result._endTangent = source.endTangent ? Point3dVector3d_1.Vector3d.fromJSON(source.endTangent) : undefined;
135
135
  return result;
136
136
  }
137
- // ugh.
138
- // vector equality test with awkward rule that 000 matches undefined.
137
+ /** Vector equality test, with the additional rule that the zero vector matches undefined. */
139
138
  static areAlmostEqualAllow000AsUndefined(a, b) {
140
139
  if (a !== undefined && a.maxAbs() === 0)
141
140
  a = undefined;
@@ -145,6 +144,7 @@ class InterpolationCurve3dOptions {
145
144
  return a.isAlmostEqual(b);
146
145
  return a === undefined && b === undefined;
147
146
  }
147
+ /** Whether the two options are equivalent or both undefined. */
148
148
  static areAlmostEqual(dataA, dataB) {
149
149
  if (dataA === undefined && dataB === undefined)
150
150
  return true;
@@ -194,6 +194,7 @@ exports.InterpolationCurve3dOptions = InterpolationCurve3dOptions;
194
194
  * @public
195
195
  */
196
196
  class InterpolationCurve3d extends ProxyCurve_1.ProxyCurve {
197
+ /** String name for schema properties. */
197
198
  curvePrimitiveType = "interpolationCurve";
198
199
  _options;
199
200
  /** CAPTURE properties and proxy curve. */
@@ -266,15 +267,13 @@ class InterpolationCurve3d extends ProxyCurve_1.ProxyCurve {
266
267
  * Transform this [[InterpolationCurve3d]] and its defining data in place
267
268
  */
268
269
  tryTransformInPlace(transform) {
269
- const proxyOk = this._proxyCurve.tryTransformInPlace(transform);
270
- if (proxyOk) {
271
- transform.multiplyPoint3dArrayInPlace(this._options.fitPoints);
272
- if (this._options.startTangent)
273
- transform.multiplyVectorInPlace(this._options.startTangent);
274
- if (this._options.endTangent)
275
- transform.multiplyVectorInPlace(this._options.endTangent);
276
- }
277
- return proxyOk;
270
+ this._proxyCurve.tryTransformInPlace(transform);
271
+ transform.multiplyPoint3dArrayInPlace(this._options.fitPoints);
272
+ if (this._options.startTangent)
273
+ transform.multiplyVectorInPlace(this._options.startTangent);
274
+ if (this._options.endTangent)
275
+ transform.multiplyVectorInPlace(this._options.endTangent);
276
+ return true; // we know this succeeds
278
277
  }
279
278
  /**
280
279
  * Find intervals of this CurvePrimitive that are interior to a clipper.
@@ -294,6 +293,7 @@ class InterpolationCurve3d extends ProxyCurve_1.ProxyCurve {
294
293
  cloneTransformed(transform) {
295
294
  return super.cloneTransformed(transform);
296
295
  }
296
+ /** Test if this [[InterpolationCurve3d]] is almost equal to another GeometryQuery object. */
297
297
  isAlmostEqual(other) {
298
298
  if (other instanceof InterpolationCurve3d) {
299
299
  return InterpolationCurve3dOptions.areAlmostEqual(this._options, other._options);
@@ -1 +1 @@
1
- {"version":3,"file":"InterpolationCurve3d.js","sourceRoot":"","sources":["../../../src/bspline/InterpolationCurve3d.ts"],"names":[],"mappings":";AAAA;;;+FAG+F;AAC/F;;GAEG;;;AAEH,gEAA6D;AAI7D,oDAAiD;AACjD,0CAAuC;AAEvC,mEAAkE;AAClE,6DAA0D;AAG1D,iDAAgD;AA8BhD;;;;;GAKG;AACH,MAAa,2BAA2B;IACtC;;;;OAIG;IACH,YAAmB,SAAqB,EAAE,KAAgB;QACxD,IAAI,CAAC,UAAU,GAAG,SAAS,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,EAAE,CAAC;QAC7C,IAAI,CAAC,MAAM,GAAG,KAAK,CAAC;IACtB,CAAC;IAEO,MAAM,CAAU;IAChB,OAAO,CAAW;IAClB,gBAAgB,CAAU;IAC1B,mBAAmB,CAAU;IAC7B,mBAAmB,CAAU;IAC7B,kBAAkB,CAAU;IAC5B,aAAa,CAAY;IACzB,WAAW,CAAY;IACvB,UAAU,CAAY;IACtB,MAAM,CAAY;IAE1B,0BAA0B;IAC1B,IAAW,KAAK,KAAa,OAAO,mBAAQ,CAAC,aAAa,CAAC,IAAI,CAAC,MAAM,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC;IAC7E,IAAW,KAAK,CAAC,GAAW,IAAI,IAAI,CAAC,MAAM,GAAG,GAAG,CAAC,CAAC,CAAC;IACpD,2BAA2B;IAC3B,IAAW,MAAM,KAAc,OAAO,mBAAQ,CAAC,YAAY,CAAC,IAAI,CAAC,OAAO,EAAE,KAAK,CAAC,CAAC,CAAC,CAAC;IACnF,IAAW,MA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------------------------------------------------------\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 Bspline\r\n */\r\n\r\nimport { BSplineCurveOps } from \"../bspline/BSplineCurveOps\";\r\nimport { Clipper } from \"../clipping/ClipUtils\";\r\nimport { AnnounceNumberNumberCurvePrimitive, CurvePrimitive } from \"../curve/CurvePrimitive\";\r\nimport { GeometryQuery } from \"../curve/GeometryQuery\";\r\nimport { ProxyCurve } from \"../curve/ProxyCurve\";\r\nimport { Geometry } from \"../Geometry\";\r\nimport { GeometryHandler } from \"../geometry3d/GeometryHandler\";\r\nimport { Point3d, Vector3d } from \"../geometry3d/Point3dVector3d\";\r\nimport { Point3dArray } from \"../geometry3d/PointHelpers\";\r\nimport { Transform } from \"../geometry3d/Transform\";\r\nimport { XYZProps } from \"../geometry3d/XYZProps\";\r\nimport { BSplineCurve3d } from \"./BSplineCurve\";\r\n\r\n/**\r\n * fitPoints and end condition data for [[InterpolationCurve3d]]\r\n * * This is a \"json compatible\" version of [[InterpolationCurve3dOptions]]\r\n * @public\r\n */\r\nexport interface InterpolationCurve3dProps {\r\n /** The order of the computed B-spline curve (one more than its degree). */\r\n order?: number;\r\n /** Whether the B-spline construction should be periodic. Default is `false`. */\r\n closed?: boolean;\r\n /** If closed and no knots, compute chord length knots (1) or uniform knots (0, default). Chord length knots give best fit. */\r\n isChordLenKnots?: number;\r\n /** If !closed but first and last fitPoints are equal, pivot computed start/end tangent(s) so that they are colinear (1) or leave them be (0, default). */\r\n isColinearTangents?: number;\r\n /** If !closed and start/endTangent is defined, set its magnitude to the first/last fit point chord length (1) or to the magnitude of the Bessel tangent (0, default). Bessel gives best fit. */\r\n isChordLenTangents?: number;\r\n /** If !closed and start/endTangent is `undefined`, compute it using the natural end condition (1) or Bessel (0, default). Bessel gives best fit. */\r\n isNaturalTangents?: number;\r\n /** Optional start tangent, pointing into curve. Magnitude is ignored. */\r\n startTangent?: XYZProps;\r\n /** Optional end tangent, pointing into curve. Magnitude is ignored. */\r\n endTangent?: XYZProps;\r\n /** Points that the curve must pass through. */\r\n fitPoints: XYZProps[];\r\n /** Optional parameters for curve fitting, one per fit point. If `undefined`, knots are computed. */\r\n knots?: number[];\r\n}\r\n\r\n/**\r\n * fitPoints and end condition data for [[InterpolationCurve3d]]\r\n * * This is a \"typed object\" version of the serializer-friendly [[InterpolationCurve3dProps]]\r\n * * Typical use cases rarely require all parameters, so the constructor does not itemize them as parameters.\r\n * @public\r\n */\r\nexport class InterpolationCurve3dOptions {\r\n /**\r\n * Constructor.\r\n * @param fitPoints points to CAPTURE\r\n * @param knots array to CAPTURE\r\n */\r\n public constructor(fitPoints?: Point3d[], knots?: number[]) {\r\n this._fitPoints = fitPoints ? fitPoints : [];\r\n this._knots = knots;\r\n }\r\n\r\n private _order?: number;\r\n private _closed?: boolean;\r\n private _isChordLenKnots?: number;\r\n private _isColinearTangents?: number;\r\n private _isChordLenTangents?: number;\r\n private _isNaturalTangents?: number;\r\n private _startTangent?: Vector3d;\r\n private _endTangent?: Vector3d;\r\n private _fitPoints: Point3d[];\r\n private _knots?: number[];\r\n\r\n /** `order` as property */\r\n public get order(): number { return Geometry.resolveNumber(this._order, 4); }\r\n public set order(val: number) { this._order = val; }\r\n /** `closed` as property */\r\n public get closed(): boolean { return Geometry.resolveValue(this._closed, false); }\r\n public set closed(val: boolean) { this._closed = val; }\r\n /** `isChordLenKnots` as property */\r\n public get isChordLenKnots(): number { return Geometry.resolveNumber(this._isChordLenKnots, 0); }\r\n public set isChordLenKnots(val: number) { this._isChordLenKnots = val; }\r\n /** `isColinearTangents` as property */\r\n public get isColinearTangents(): number { return Geometry.resolveNumber(this._isColinearTangents, 0); }\r\n public set isColinearTangents(val: number) { this._isColinearTangents = val; }\r\n /** `isChordLenTangents` as property */\r\n public get isChordLenTangents(): number { return Geometry.resolveNumber(this._isChordLenTangents, 0); }\r\n public set isChordLenTangents(val: number) { this._isChordLenTangents = val; }\r\n /** `isNaturalTangents` as property */\r\n public get isNaturalTangents(): number { return Geometry.resolveNumber(this._isNaturalTangents, 0); }\r\n public set isNaturalTangents(val: number) { this._isNaturalTangents = val; }\r\n /** access POSSIBLY UNDEFINED start tangent. Setter CAPTURES. */\r\n public get startTangent(): Vector3d | undefined { return this._startTangent; }\r\n public set startTangent(val: Vector3d | undefined) { this._startTangent = val; }\r\n /** access POSSIBLY UNDEFINED end tangent. Setter CAPTURES. */\r\n public get endTangent(): Vector3d | undefined { return this._endTangent; }\r\n public set endTangent(val: Vector3d | undefined) { this._endTangent = val; }\r\n /** access POINTER TO fit points. Setter CAPTURES. */\r\n public get fitPoints(): Point3d[] { return this._fitPoints; }\r\n public set fitPoints(val: Point3d[]) { this._fitPoints = val; }\r\n /** access POSSIBLY UNDEFINED knots array. Setter CAPTURES. */\r\n public get knots(): number[] | undefined { return this._knots; }\r\n public set knots(val: number[] | undefined) { this._knots = val; }\r\n\r\n /** One step setup of properties not named in constructor.\r\n * * CAPTURE pointers to tangents.\r\n * * OPTIONALLY downgrade \"0\" values to undefined.\r\n */\r\n public captureOptionalProps(\r\n order: number | undefined,\r\n closed: boolean | undefined,\r\n isChordLenKnots: number | undefined,\r\n isColinearTangents: number | undefined,\r\n isChordLenTangent: number | undefined,\r\n isNaturalTangents: number | undefined,\r\n startTangent: Vector3d | undefined,\r\n endTangent: Vector3d | undefined,\r\n ) {\r\n this._order = Geometry.resolveToUndefined(order, 0);\r\n this._closed = Geometry.resolveToUndefined(closed, false);\r\n this._isChordLenKnots = Geometry.resolveToUndefined(isChordLenKnots, 0);\r\n this._isColinearTangents = Geometry.resolveToUndefined(isColinearTangents, 0);\r\n this._isChordLenTangents = Geometry.resolveToUndefined(isChordLenTangent, 0);\r\n this._isNaturalTangents = Geometry.resolveToUndefined(isNaturalTangents, 0);\r\n this._startTangent = startTangent;\r\n this._endTangent = endTangent;\r\n\r\n }\r\n /** Clone with strongly typed members reduced to simple json, with \"undefined\" members omitted */\r\n public cloneAsInterpolationCurve3dProps(): InterpolationCurve3dProps {\r\n const props: InterpolationCurve3dProps = {\r\n fitPoints: Point3dArray.cloneDeepJSONNumberArrays(this.fitPoints),\r\n knots: this._knots?.slice(),\r\n };\r\n if (this._order !== undefined)\r\n props.order = this._order;\r\n if (this._closed !== undefined)\r\n props.closed = this._closed;\r\n if (this._isChordLenKnots !== undefined)\r\n props.isChordLenKnots = this._isChordLenKnots;\r\n if (this._isColinearTangents !== undefined)\r\n props.isColinearTangents = this._isColinearTangents;\r\n if (this._isChordLenTangents !== undefined)\r\n props.isChordLenTangents = this._isChordLenTangents;\r\n if (this._isNaturalTangents !== undefined)\r\n props.isNaturalTangents = this._isNaturalTangents;\r\n if (this._startTangent !== undefined)\r\n props.startTangent = this._startTangent?.toArray();\r\n if (this._endTangent !== undefined)\r\n props.endTangent = this._endTangent?.toArray();\r\n return props;\r\n }\r\n /** Clone with strongly typed members reduced to simple json. */\r\n public clone(): InterpolationCurve3dOptions {\r\n const clone = new InterpolationCurve3dOptions(Point3dArray.clonePoint3dArray(this.fitPoints), this.knots?.slice());\r\n clone._order = this.order;\r\n clone._closed = this.closed;\r\n clone._isChordLenKnots = this.isChordLenKnots;\r\n clone._isColinearTangents = this.isColinearTangents;\r\n clone._isChordLenTangents = this.isChordLenTangents;\r\n clone._isNaturalTangents = this.isNaturalTangents;\r\n clone._startTangent = this._startTangent?.clone();\r\n clone._endTangent = this._endTangent?.clone();\r\n return clone;\r\n }\r\n\r\n /** Clone with strongly typed members reduced to simple json. */\r\n public static create(source: InterpolationCurve3dProps): InterpolationCurve3dOptions {\r\n const result = new InterpolationCurve3dOptions(Point3dArray.clonePoint3dArray(source.fitPoints), source.knots?.slice());\r\n result._order = source.order;\r\n result._closed = source.closed;\r\n result._isChordLenKnots = source.isChordLenKnots;\r\n result._isColinearTangents = source.isColinearTangents;\r\n result._isChordLenTangents = source.isChordLenTangents;\r\n result._isNaturalTangents = source.isNaturalTangents;\r\n result._startTangent = source.startTangent ? Vector3d.fromJSON(source.startTangent) : undefined;\r\n result._endTangent = source.endTangent ? Vector3d.fromJSON(source.endTangent) : undefined;\r\n return result;\r\n }\r\n // ugh.\r\n // vector equality test with awkward rule that 000 matches undefined.\r\n private static areAlmostEqualAllow000AsUndefined(a: Vector3d | undefined, b: Vector3d | undefined): boolean {\r\n if (a !== undefined && a.maxAbs() === 0)\r\n a = undefined;\r\n if (b !== undefined && b.maxAbs() === 0)\r\n b = undefined;\r\n if (a !== undefined && b !== undefined)\r\n return a.isAlmostEqual(b);\r\n return a === undefined && b === undefined;\r\n }\r\n public static areAlmostEqual(dataA: InterpolationCurve3dOptions | undefined, dataB: InterpolationCurve3dOptions | undefined): boolean {\r\n if (dataA === undefined && dataB === undefined)\r\n return true;\r\n if (dataA !== undefined && dataB !== undefined) {\r\n if (Geometry.areEqualAllowUndefined(dataA.order, dataB.order)\r\n && Geometry.areEqualAllowUndefined(dataA.closed, dataB.closed)\r\n && Geometry.areEqualAllowUndefined(dataA.isChordLenKnots, dataB.isChordLenKnots)\r\n && Geometry.areEqualAllowUndefined(dataA.isColinearTangents, dataB.isColinearTangents)\r\n && Geometry.areEqualAllowUndefined(dataA.isNaturalTangents, dataB.isNaturalTangents)\r\n && this.areAlmostEqualAllow000AsUndefined(dataA.startTangent, dataB.startTangent)\r\n && this.areAlmostEqualAllow000AsUndefined(dataA.endTangent, dataB.endTangent)\r\n && Geometry.almostEqualArrays(dataA.fitPoints, dataB.fitPoints, (a: Point3d, b: Point3d) => a.isAlmostEqual(b))) {\r\n if (Geometry.almostEqualNumberArrays(dataA.knots, dataB.knots, (a: number, b: number) => a === b))\r\n return true;\r\n if (dataA.knots === undefined && dataB.knots === undefined)\r\n return true;\r\n /* alas .. need to allow tricky mismatch of end replication */\r\n let knotsA = dataA.knots, knotsB = dataB.knots;\r\n if (dataA.knots === undefined) // construct undefined knots to compare against defined knots\r\n knotsA = BSplineCurveOps.C2CubicFit.constructFitParametersFromPoints(dataA.fitPoints, dataA.isChordLenKnots, dataA.closed);\r\n else if (dataB.knots === undefined)\r\n knotsB = BSplineCurveOps.C2CubicFit.constructFitParametersFromPoints(dataB.fitPoints, dataB.isChordLenKnots, dataB.closed);\r\n knotsA = BSplineCurveOps.C2CubicFit.convertCubicKnotVectorToFitParams(knotsA, dataA.fitPoints.length, false);\r\n knotsB = BSplineCurveOps.C2CubicFit.convertCubicKnotVectorToFitParams(knotsB, dataB.fitPoints.length, false);\r\n return Geometry.almostEqualNumberArrays(knotsA, knotsB, (a: number, b: number) => Geometry.isAlmostEqualNumber(a, b));\r\n }\r\n }\r\n return false;\r\n }\r\n /** reverse the order or sense of all start-to-end related properties. */\r\n public reverseInPlace() {\r\n this.fitPoints.reverse();\r\n if (this.knots)\r\n this.knots.reverse();\r\n // Swap pointers to tangents. They don't need to be negated because they point into the curve.\r\n const oldStart = this._startTangent;\r\n this._startTangent = this.endTangent;\r\n this._endTangent = oldStart;\r\n }\r\n}\r\n\r\n/**\r\n * Interpolating curve.\r\n * * Derive from [[ProxyCurve]]\r\n * * Use a [[BSplineCurve3d]] as the proxy\r\n * *\r\n * @public\r\n */\r\nexport class InterpolationCurve3d extends ProxyCurve {\r\n public readonly curvePrimitiveType = \"interpolationCurve\";\r\n private _options: InterpolationCurve3dOptions;\r\n /** CAPTURE properties and proxy curve. */\r\n private constructor(properties: InterpolationCurve3dOptions, proxyCurve: CurvePrimitive) {\r\n super(proxyCurve);\r\n this._options = properties;\r\n }\r\n /** Second step of double dispatch: call `handler.handleInterpolationCurve3d(this)` */\r\n public override dispatchToGeometryHandler(handler: GeometryHandler): any {\r\n let result = handler.handleInterpolationCurve3d(this);\r\n if (undefined === result) // if handler doesn't specialize on interpolation curves, default to proxy\r\n result = this._proxyCurve.dispatchToGeometryHandler(handler);\r\n return result;\r\n }\r\n /**\r\n * Create an [[InterpolationCurve3d]] based on points, knots, and other properties in the [[InterpolationCurve3dProps]] or [[InterpolationCurve3dOptions]].\r\n * * This saves a COPY OF the options or props.\r\n * * Use createCapture () if the options or props can be used without copy\r\n */\r\n public static create(options: InterpolationCurve3dOptions | InterpolationCurve3dProps): InterpolationCurve3d | undefined {\r\n let optionsCopy;\r\n if (options instanceof InterpolationCurve3dOptions) {\r\n optionsCopy = options.clone();\r\n } else {\r\n optionsCopy = InterpolationCurve3dOptions.create(options);\r\n }\r\n return InterpolationCurve3d.createCapture(optionsCopy);\r\n }\r\n /**\r\n * Create an [[InterpolationCurve3d]]\r\n * * The options object is captured into the new curve object (not copied)\r\n */\r\n public static createCapture(options: InterpolationCurve3dOptions): InterpolationCurve3d | undefined {\r\n const proxyCurve = BSplineCurve3d.createFromInterpolationCurve3dOptions(options);\r\n if (proxyCurve)\r\n return new InterpolationCurve3d(options, proxyCurve);\r\n return undefined;\r\n }\r\n /** Return the (pointer to) the proxy B-spline curve. */\r\n public override get proxyCurve(): BSplineCurve3d {\r\n return this._proxyCurve as BSplineCurve3d;\r\n }\r\n /** Return a (copy of) the defining points, packed as a Float64Array */\r\n public copyFitPointsFloat64Array(): Float64Array {\r\n return Point3dArray.cloneXYZPropsAsFloat64Array(this._options.fitPoints);\r\n }\r\n\r\n /**\r\n * Return json key-value pairs for for this [[InterpolationCurve3d]].\r\n * @returns\r\n */\r\n public toJSON(): any {\r\n return this._options.cloneAsInterpolationCurve3dProps();\r\n }\r\n /** Clone the [[InterpolationCurve3dProps]] object in this [[InterpolationCurve3d]] */\r\n public cloneProps(): InterpolationCurve3dProps {\r\n return this._options.cloneAsInterpolationCurve3dProps();\r\n }\r\n\r\n /** return the options pointer */\r\n public get options(): InterpolationCurve3dOptions { return this._options; }\r\n\r\n /**\r\n * Reverse the curve direction.\r\n * * This updates both the defining properties and the proxy bspline.\r\n */\r\n public reverseInPlace(): void {\r\n this._proxyCurve.reverseInPlace();\r\n this._options.reverseInPlace();\r\n }\r\n /**\r\n * Transform this [[InterpolationCurve3d]] and its defining data in place\r\n */\r\n public tryTransformInPlace(transform: Transform): boolean {\r\n const proxyOk = this._proxyCurve.tryTransformInPlace(transform);\r\n if (proxyOk) {\r\n transform.multiplyPoint3dArrayInPlace(this._options.fitPoints);\r\n if (this._options.startTangent)\r\n transform.multiplyVectorInPlace(this._options.startTangent);\r\n if (this._options.endTangent)\r\n transform.multiplyVectorInPlace(this._options.endTangent);\r\n }\r\n return proxyOk;\r\n }\r\n /**\r\n * Find intervals of this CurvePrimitive that are interior to a clipper.\r\n * * This implementation simply passes the call to the proxy curve.\r\n * @param clipper clip structure (e.g. clip planes).\r\n * @param announce (optional) function to be called announcing fractional intervals of the input curve.\r\n * @returns true if any \"in\" segments are announced.\r\n */\r\n public override announceClipIntervals(clipper: Clipper, announce?: AnnounceNumberNumberCurvePrimitive): boolean {\r\n return this._proxyCurve.announceClipIntervals(clipper, announce);\r\n }\r\n /** Return a deep clone */\r\n public override clone(): InterpolationCurve3d {\r\n return new InterpolationCurve3d(this._options.clone(), this._proxyCurve.clone());\r\n }\r\n /** Return a transformed clone. */\r\n public override cloneTransformed(transform: Transform): InterpolationCurve3d | undefined {\r\n return super.cloneTransformed(transform) as InterpolationCurve3d | undefined;\r\n }\r\n\r\n public override isAlmostEqual(other: GeometryQuery): boolean {\r\n if (other instanceof InterpolationCurve3d) {\r\n return InterpolationCurve3dOptions.areAlmostEqual(this._options, other._options);\r\n }\r\n return false;\r\n }\r\n\r\n /** Test if `other` is also an [[InterpolationCurve3d]] */\r\n public isSameGeometryClass(other: GeometryQuery): boolean { return other instanceof InterpolationCurve3d; }\r\n\r\n}\r\n"]}
1
+ {"version":3,"file":"InterpolationCurve3d.js","sourceRoot":"","sources":["../../../src/bspline/InterpolationCurve3d.ts"],"names":[],"mappings":";AAAA;;;+FAG+F;AAC/F;;GAEG;;;AAEH,gEAA6D;AAI7D,oDAAiD;AACjD,0CAAuC;AAEvC,mEAAkE;AAClE,6DAA0D;AAG1D,iDAAgD;AA8BhD;;;;;GAKG;AACH,MAAa,2BAA2B;IACtC;;;;OAIG;IACH,YAAmB,SAA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AAC,qBAAqB,CAAC,OAAO,EAAE,QAAQ,CAAC,CAAC;IACnE,CAAC;IACD,0BAA0B;IACV,KAAK;QACnB,OAAO,IAAI,oBAAoB,CAAC,IAAI,CAAC,QAAQ,CAAC,KAAK,EAAE,EAAE,IAAI,CAAC,WAAW,CAAC,KAAK,EAAE,CAAC,CAAC;IACnF,CAAC;IACD,kCAAkC;IAClB,gBAAgB,CAAC,SAAoB;QACnD,OAAO,KAAK,CAAC,gBAAgB,CAAC,SAAS,CAAyB,CAAC;IACnE,CAAC;IAED,6FAA6F;IAC7E,aAAa,CAAC,KAAoB;QAChD,IAAI,KAAK,YAAY,oBAAoB,EAAE,CAAC;YAC1C,OAAO,2BAA2B,CAAC,cAAc,CAAC,IAAI,CAAC,QAAQ,EAAE,KAAK,CAAC,QAAQ,CAAC,CAAC;QACnF,CAAC;QACD,OAAO,KAAK,CAAC;IACf,CAAC;IAED,0DAA0D;IACnD,mBAAmB,CAAC,KAAoB,IAAa,OAAO,KAAK,YAAY,oBAAoB,CAAC,CAAC,CAAC;CAE5G;AAlHD,oDAkHC","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 Bspline\r\n */\r\n\r\nimport { BSplineCurveOps } from \"../bspline/BSplineCurveOps\";\r\nimport { Clipper } from \"../clipping/ClipUtils\";\r\nimport { AnnounceNumberNumberCurvePrimitive, CurvePrimitive } from \"../curve/CurvePrimitive\";\r\nimport { GeometryQuery } from \"../curve/GeometryQuery\";\r\nimport { ProxyCurve } from \"../curve/ProxyCurve\";\r\nimport { Geometry } from \"../Geometry\";\r\nimport { GeometryHandler } from \"../geometry3d/GeometryHandler\";\r\nimport { Point3d, Vector3d } from \"../geometry3d/Point3dVector3d\";\r\nimport { Point3dArray } from \"../geometry3d/PointHelpers\";\r\nimport { Transform } from \"../geometry3d/Transform\";\r\nimport { XYZProps } from \"../geometry3d/XYZProps\";\r\nimport { BSplineCurve3d } from \"./BSplineCurve\";\r\n\r\n/**\r\n * fitPoints and end condition data for [[InterpolationCurve3d]]\r\n * * This is a \"json compatible\" version of [[InterpolationCurve3dOptions]]\r\n * @public\r\n */\r\nexport interface InterpolationCurve3dProps {\r\n /** The order of the computed B-spline curve (one more than its degree). */\r\n order?: number;\r\n /** Whether the B-spline construction should be periodic. Default is `false`. */\r\n closed?: boolean;\r\n /** If closed and no knots, compute chord length knots (1) or uniform knots (0, default). Chord length knots give best fit. */\r\n isChordLenKnots?: number;\r\n /** If !closed but first and last fitPoints are equal, pivot computed start/end tangent(s) so that they are colinear (1) or leave them be (0, default). */\r\n isColinearTangents?: number;\r\n /** If !closed and start/endTangent is defined, set its magnitude to the first/last fit point chord length (1) or to the magnitude of the Bessel tangent (0, default). Bessel gives best fit. */\r\n isChordLenTangents?: number;\r\n /** If !closed and start/endTangent is `undefined`, compute it using the natural end condition (1) or Bessel (0, default). Bessel gives best fit. */\r\n isNaturalTangents?: number;\r\n /** Optional start tangent, pointing into curve. Magnitude is ignored. */\r\n startTangent?: XYZProps;\r\n /** Optional end tangent, pointing into curve. Magnitude is ignored. */\r\n endTangent?: XYZProps;\r\n /** Points that the curve must pass through. */\r\n fitPoints: XYZProps[];\r\n /** Optional parameters for curve fitting, one per fit point. If `undefined`, knots are computed. */\r\n knots?: number[];\r\n}\r\n\r\n/**\r\n * fitPoints and end condition data for [[InterpolationCurve3d]]\r\n * * This is a \"typed object\" version of the serializer-friendly [[InterpolationCurve3dProps]]\r\n * * Typical use cases rarely require all parameters, so the constructor does not itemize them as parameters.\r\n * @public\r\n */\r\nexport class InterpolationCurve3dOptions {\r\n /**\r\n * Constructor.\r\n * @param fitPoints points to CAPTURE\r\n * @param knots array to CAPTURE\r\n */\r\n public constructor(fitPoints?: Point3d[], knots?: number[]) {\r\n this._fitPoints = fitPoints ? fitPoints : [];\r\n this._knots = knots;\r\n }\r\n\r\n private _order?: number;\r\n private _closed?: boolean;\r\n private _isChordLenKnots?: number;\r\n private _isColinearTangents?: number;\r\n private _isChordLenTangents?: number;\r\n private _isNaturalTangents?: number;\r\n private _startTangent?: Vector3d;\r\n private _endTangent?: Vector3d;\r\n private _fitPoints: Point3d[];\r\n private _knots?: number[];\r\n\r\n /** `order` as property */\r\n public get order(): number { return Geometry.resolveNumber(this._order, 4); }\r\n public set order(val: number) { this._order = val; }\r\n /** `closed` as property */\r\n public get closed(): boolean { return Geometry.resolveValue(this._closed, false); }\r\n public set closed(val: boolean) { this._closed = val; }\r\n /** `isChordLenKnots` as property */\r\n public get isChordLenKnots(): number { return Geometry.resolveNumber(this._isChordLenKnots, 0); }\r\n public set isChordLenKnots(val: number) { this._isChordLenKnots = val; }\r\n /** `isColinearTangents` as property */\r\n public get isColinearTangents(): number { return Geometry.resolveNumber(this._isColinearTangents, 0); }\r\n public set isColinearTangents(val: number) { this._isColinearTangents = val; }\r\n /** `isChordLenTangents` as property */\r\n public get isChordLenTangents(): number { return Geometry.resolveNumber(this._isChordLenTangents, 0); }\r\n public set isChordLenTangents(val: number) { this._isChordLenTangents = val; }\r\n /** `isNaturalTangents` as property */\r\n public get isNaturalTangents(): number { return Geometry.resolveNumber(this._isNaturalTangents, 0); }\r\n public set isNaturalTangents(val: number) { this._isNaturalTangents = val; }\r\n /** access POSSIBLY UNDEFINED start tangent. Setter CAPTURES. */\r\n public get startTangent(): Vector3d | undefined { return this._startTangent; }\r\n public set startTangent(val: Vector3d | undefined) { this._startTangent = val; }\r\n /** access POSSIBLY UNDEFINED end tangent. Setter CAPTURES. */\r\n public get endTangent(): Vector3d | undefined { return this._endTangent; }\r\n public set endTangent(val: Vector3d | undefined) { this._endTangent = val; }\r\n /** access POINTER TO fit points. Setter CAPTURES. */\r\n public get fitPoints(): Point3d[] { return this._fitPoints; }\r\n public set fitPoints(val: Point3d[]) { this._fitPoints = val; }\r\n /** access POSSIBLY UNDEFINED knots array. Setter CAPTURES. */\r\n public get knots(): number[] | undefined { return this._knots; }\r\n public set knots(val: number[] | undefined) { this._knots = val; }\r\n\r\n /** One step setup of properties not named in constructor.\r\n * * CAPTURE pointers to tangents.\r\n * * OPTIONALLY downgrade \"0\" values to undefined.\r\n */\r\n public captureOptionalProps(\r\n order: number | undefined,\r\n closed: boolean | undefined,\r\n isChordLenKnots: number | undefined,\r\n isColinearTangents: number | undefined,\r\n isChordLenTangent: number | undefined,\r\n isNaturalTangents: number | undefined,\r\n startTangent: Vector3d | undefined,\r\n endTangent: Vector3d | undefined,\r\n ) {\r\n this._order = Geometry.resolveToUndefined(order, 0);\r\n this._closed = Geometry.resolveToUndefined(closed, false);\r\n this._isChordLenKnots = Geometry.resolveToUndefined(isChordLenKnots, 0);\r\n this._isColinearTangents = Geometry.resolveToUndefined(isColinearTangents, 0);\r\n this._isChordLenTangents = Geometry.resolveToUndefined(isChordLenTangent, 0);\r\n this._isNaturalTangents = Geometry.resolveToUndefined(isNaturalTangents, 0);\r\n this._startTangent = startTangent;\r\n this._endTangent = endTangent;\r\n\r\n }\r\n /** Clone with strongly typed members reduced to simple json, with \"undefined\" members omitted */\r\n public cloneAsInterpolationCurve3dProps(): InterpolationCurve3dProps {\r\n const props: InterpolationCurve3dProps = {\r\n fitPoints: Point3dArray.cloneDeepJSONNumberArrays(this.fitPoints),\r\n knots: this._knots?.slice(),\r\n };\r\n if (this._order !== undefined)\r\n props.order = this._order;\r\n if (this._closed !== undefined)\r\n props.closed = this._closed;\r\n if (this._isChordLenKnots !== undefined)\r\n props.isChordLenKnots = this._isChordLenKnots;\r\n if (this._isColinearTangents !== undefined)\r\n props.isColinearTangents = this._isColinearTangents;\r\n if (this._isChordLenTangents !== undefined)\r\n props.isChordLenTangents = this._isChordLenTangents;\r\n if (this._isNaturalTangents !== undefined)\r\n props.isNaturalTangents = this._isNaturalTangents;\r\n if (this._startTangent !== undefined)\r\n props.startTangent = this._startTangent?.toArray();\r\n if (this._endTangent !== undefined)\r\n props.endTangent = this._endTangent?.toArray();\r\n return props;\r\n }\r\n /** Clone with strongly typed members reduced to simple json. */\r\n public clone(): InterpolationCurve3dOptions {\r\n const clone = new InterpolationCurve3dOptions(Point3dArray.clonePoint3dArray(this.fitPoints), this.knots?.slice());\r\n clone._order = this.order;\r\n clone._closed = this.closed;\r\n clone._isChordLenKnots = this.isChordLenKnots;\r\n clone._isColinearTangents = this.isColinearTangents;\r\n clone._isChordLenTangents = this.isChordLenTangents;\r\n clone._isNaturalTangents = this.isNaturalTangents;\r\n clone._startTangent = this._startTangent?.clone();\r\n clone._endTangent = this._endTangent?.clone();\r\n return clone;\r\n }\r\n\r\n /** Clone with strongly typed members reduced to simple json. */\r\n public static create(source: InterpolationCurve3dProps): InterpolationCurve3dOptions {\r\n const result = new InterpolationCurve3dOptions(Point3dArray.clonePoint3dArray(source.fitPoints), source.knots?.slice());\r\n result._order = source.order;\r\n result._closed = source.closed;\r\n result._isChordLenKnots = source.isChordLenKnots;\r\n result._isColinearTangents = source.isColinearTangents;\r\n result._isChordLenTangents = source.isChordLenTangents;\r\n result._isNaturalTangents = source.isNaturalTangents;\r\n result._startTangent = source.startTangent ? Vector3d.fromJSON(source.startTangent) : undefined;\r\n result._endTangent = source.endTangent ? Vector3d.fromJSON(source.endTangent) : undefined;\r\n return result;\r\n }\r\n /** Vector equality test, with the additional rule that the zero vector matches undefined. */\r\n private static areAlmostEqualAllow000AsUndefined(a: Vector3d | undefined, b: Vector3d | undefined): boolean {\r\n if (a !== undefined && a.maxAbs() === 0)\r\n a = undefined;\r\n if (b !== undefined && b.maxAbs() === 0)\r\n b = undefined;\r\n if (a !== undefined && b !== undefined)\r\n return a.isAlmostEqual(b);\r\n return a === undefined && b === undefined;\r\n }\r\n /** Whether the two options are equivalent or both undefined. */\r\n public static areAlmostEqual(dataA: InterpolationCurve3dOptions | undefined, dataB: InterpolationCurve3dOptions | undefined): boolean {\r\n if (dataA === undefined && dataB === undefined)\r\n return true;\r\n if (dataA !== undefined && dataB !== undefined) {\r\n if (Geometry.areEqualAllowUndefined(dataA.order, dataB.order)\r\n && Geometry.areEqualAllowUndefined(dataA.closed, dataB.closed)\r\n && Geometry.areEqualAllowUndefined(dataA.isChordLenKnots, dataB.isChordLenKnots)\r\n && Geometry.areEqualAllowUndefined(dataA.isColinearTangents, dataB.isColinearTangents)\r\n && Geometry.areEqualAllowUndefined(dataA.isNaturalTangents, dataB.isNaturalTangents)\r\n && this.areAlmostEqualAllow000AsUndefined(dataA.startTangent, dataB.startTangent)\r\n && this.areAlmostEqualAllow000AsUndefined(dataA.endTangent, dataB.endTangent)\r\n && Geometry.almostEqualArrays(dataA.fitPoints, dataB.fitPoints, (a: Point3d, b: Point3d) => a.isAlmostEqual(b))) {\r\n if (Geometry.almostEqualNumberArrays(dataA.knots, dataB.knots, (a: number, b: number) => a === b))\r\n return true;\r\n if (dataA.knots === undefined && dataB.knots === undefined)\r\n return true;\r\n /* alas .. need to allow tricky mismatch of end replication */\r\n let knotsA = dataA.knots, knotsB = dataB.knots;\r\n if (dataA.knots === undefined) // construct undefined knots to compare against defined knots\r\n knotsA = BSplineCurveOps.C2CubicFit.constructFitParametersFromPoints(dataA.fitPoints, dataA.isChordLenKnots, dataA.closed);\r\n else if (dataB.knots === undefined)\r\n knotsB = BSplineCurveOps.C2CubicFit.constructFitParametersFromPoints(dataB.fitPoints, dataB.isChordLenKnots, dataB.closed);\r\n knotsA = BSplineCurveOps.C2CubicFit.convertCubicKnotVectorToFitParams(knotsA, dataA.fitPoints.length, false);\r\n knotsB = BSplineCurveOps.C2CubicFit.convertCubicKnotVectorToFitParams(knotsB, dataB.fitPoints.length, false);\r\n return Geometry.almostEqualNumberArrays(knotsA, knotsB, (a: number, b: number) => Geometry.isAlmostEqualNumber(a, b));\r\n }\r\n }\r\n return false;\r\n }\r\n /** reverse the order or sense of all start-to-end related properties. */\r\n public reverseInPlace() {\r\n this.fitPoints.reverse();\r\n if (this.knots)\r\n this.knots.reverse();\r\n // Swap pointers to tangents. They don't need to be negated because they point into the curve.\r\n const oldStart = this._startTangent;\r\n this._startTangent = this.endTangent;\r\n this._endTangent = oldStart;\r\n }\r\n}\r\n\r\n/**\r\n * Interpolating curve.\r\n * * Derive from [[ProxyCurve]]\r\n * * Use a [[BSplineCurve3d]] as the proxy\r\n * *\r\n * @public\r\n */\r\nexport class InterpolationCurve3d extends ProxyCurve {\r\n /** String name for schema properties. */\r\n public readonly curvePrimitiveType = \"interpolationCurve\";\r\n private _options: InterpolationCurve3dOptions;\r\n /** CAPTURE properties and proxy curve. */\r\n private constructor(properties: InterpolationCurve3dOptions, proxyCurve: CurvePrimitive) {\r\n super(proxyCurve);\r\n this._options = properties;\r\n }\r\n /** Second step of double dispatch: call `handler.handleInterpolationCurve3d(this)` */\r\n public override dispatchToGeometryHandler(handler: GeometryHandler): any {\r\n let result = handler.handleInterpolationCurve3d(this);\r\n if (undefined === result) // if handler doesn't specialize on interpolation curves, default to proxy\r\n result = this._proxyCurve.dispatchToGeometryHandler(handler);\r\n return result;\r\n }\r\n /**\r\n * Create an [[InterpolationCurve3d]] based on points, knots, and other properties in the [[InterpolationCurve3dProps]] or [[InterpolationCurve3dOptions]].\r\n * * This saves a COPY OF the options or props.\r\n * * Use createCapture () if the options or props can be used without copy\r\n */\r\n public static create(options: InterpolationCurve3dOptions | InterpolationCurve3dProps): InterpolationCurve3d | undefined {\r\n let optionsCopy;\r\n if (options instanceof InterpolationCurve3dOptions) {\r\n optionsCopy = options.clone();\r\n } else {\r\n optionsCopy = InterpolationCurve3dOptions.create(options);\r\n }\r\n return InterpolationCurve3d.createCapture(optionsCopy);\r\n }\r\n /**\r\n * Create an [[InterpolationCurve3d]]\r\n * * The options object is captured into the new curve object (not copied)\r\n */\r\n public static createCapture(options: InterpolationCurve3dOptions): InterpolationCurve3d | undefined {\r\n const proxyCurve = BSplineCurve3d.createFromInterpolationCurve3dOptions(options);\r\n if (proxyCurve)\r\n return new InterpolationCurve3d(options, proxyCurve);\r\n return undefined;\r\n }\r\n /** Return the (pointer to) the proxy B-spline curve. */\r\n public override get proxyCurve(): BSplineCurve3d {\r\n return this._proxyCurve as BSplineCurve3d;\r\n }\r\n /** Return a (copy of) the defining points, packed as a Float64Array */\r\n public copyFitPointsFloat64Array(): Float64Array {\r\n return Point3dArray.cloneXYZPropsAsFloat64Array(this._options.fitPoints);\r\n }\r\n\r\n /**\r\n * Return json key-value pairs for for this [[InterpolationCurve3d]].\r\n * @returns\r\n */\r\n public toJSON(): any {\r\n return this._options.cloneAsInterpolationCurve3dProps();\r\n }\r\n /** Clone the [[InterpolationCurve3dProps]] object in this [[InterpolationCurve3d]] */\r\n public cloneProps(): InterpolationCurve3dProps {\r\n return this._options.cloneAsInterpolationCurve3dProps();\r\n }\r\n\r\n /** return the options pointer */\r\n public get options(): InterpolationCurve3dOptions { return this._options; }\r\n\r\n /**\r\n * Reverse the curve direction.\r\n * * This updates both the defining properties and the proxy bspline.\r\n */\r\n public reverseInPlace(): void {\r\n this._proxyCurve.reverseInPlace();\r\n this._options.reverseInPlace();\r\n }\r\n /**\r\n * Transform this [[InterpolationCurve3d]] and its defining data in place\r\n */\r\n public tryTransformInPlace(transform: Transform): boolean {\r\n this._proxyCurve.tryTransformInPlace(transform);\r\n transform.multiplyPoint3dArrayInPlace(this._options.fitPoints);\r\n if (this._options.startTangent)\r\n transform.multiplyVectorInPlace(this._options.startTangent);\r\n if (this._options.endTangent)\r\n transform.multiplyVectorInPlace(this._options.endTangent);\r\n return true; // we know this succeeds\r\n }\r\n /**\r\n * Find intervals of this CurvePrimitive that are interior to a clipper.\r\n * * This implementation simply passes the call to the proxy curve.\r\n * @param clipper clip structure (e.g. clip planes).\r\n * @param announce (optional) function to be called announcing fractional intervals of the input curve.\r\n * @returns true if any \"in\" segments are announced.\r\n */\r\n public override announceClipIntervals(clipper: Clipper, announce?: AnnounceNumberNumberCurvePrimitive): boolean {\r\n return this._proxyCurve.announceClipIntervals(clipper, announce);\r\n }\r\n /** Return a deep clone */\r\n public override clone(): InterpolationCurve3d {\r\n return new InterpolationCurve3d(this._options.clone(), this._proxyCurve.clone());\r\n }\r\n /** Return a transformed clone. */\r\n public override cloneTransformed(transform: Transform): InterpolationCurve3d {\r\n return super.cloneTransformed(transform) as InterpolationCurve3d;\r\n }\r\n\r\n /** Test if this [[InterpolationCurve3d]] is almost equal to another GeometryQuery object. */\r\n public override isAlmostEqual(other: GeometryQuery): boolean {\r\n if (other instanceof InterpolationCurve3d) {\r\n return InterpolationCurve3dOptions.areAlmostEqual(this._options, other._options);\r\n }\r\n return false;\r\n }\r\n\r\n /** Test if `other` is also an [[InterpolationCurve3d]] */\r\n public isSameGeometryClass(other: GeometryQuery): boolean { return other instanceof InterpolationCurve3d; }\r\n\r\n}\r\n"]}