@itwin/core-geometry 3.2.0-dev.0 → 3.2.0-dev.5

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 (187) hide show
  1. package/lib/cjs/bspline/AkimaCurve3d.d.ts +2 -8
  2. package/lib/cjs/bspline/AkimaCurve3d.d.ts.map +1 -1
  3. package/lib/cjs/bspline/AkimaCurve3d.js +2 -17
  4. package/lib/cjs/bspline/AkimaCurve3d.js.map +1 -1
  5. package/lib/cjs/bspline/BSpline1dNd.d.ts +11 -6
  6. package/lib/cjs/bspline/BSpline1dNd.d.ts.map +1 -1
  7. package/lib/cjs/bspline/BSpline1dNd.js +64 -6
  8. package/lib/cjs/bspline/BSpline1dNd.js.map +1 -1
  9. package/lib/cjs/bspline/BSplineCurve.d.ts +9 -13
  10. package/lib/cjs/bspline/BSplineCurve.d.ts.map +1 -1
  11. package/lib/cjs/bspline/BSplineCurve.js +39 -31
  12. package/lib/cjs/bspline/BSplineCurve.js.map +1 -1
  13. package/lib/cjs/bspline/BSplineCurve3dH.d.ts +0 -2
  14. package/lib/cjs/bspline/BSplineCurve3dH.d.ts.map +1 -1
  15. package/lib/cjs/bspline/BSplineCurve3dH.js +0 -6
  16. package/lib/cjs/bspline/BSplineCurve3dH.js.map +1 -1
  17. package/lib/cjs/bspline/BSplineCurveOps.d.ts.map +1 -1
  18. package/lib/cjs/bspline/BSplineCurveOps.js +4 -6
  19. package/lib/cjs/bspline/BSplineCurveOps.js.map +1 -1
  20. package/lib/cjs/bspline/Bezier1dNd.d.ts +8 -11
  21. package/lib/cjs/bspline/Bezier1dNd.d.ts.map +1 -1
  22. package/lib/cjs/bspline/Bezier1dNd.js +13 -14
  23. package/lib/cjs/bspline/Bezier1dNd.js.map +1 -1
  24. package/lib/cjs/bspline/BezierCurve3d.d.ts +0 -6
  25. package/lib/cjs/bspline/BezierCurve3d.d.ts.map +1 -1
  26. package/lib/cjs/bspline/BezierCurve3d.js +0 -14
  27. package/lib/cjs/bspline/BezierCurve3d.js.map +1 -1
  28. package/lib/cjs/bspline/BezierCurve3dH.d.ts +0 -4
  29. package/lib/cjs/bspline/BezierCurve3dH.d.ts.map +1 -1
  30. package/lib/cjs/bspline/BezierCurve3dH.js +0 -8
  31. package/lib/cjs/bspline/BezierCurve3dH.js.map +1 -1
  32. package/lib/cjs/bspline/BezierCurveBase.d.ts +9 -0
  33. package/lib/cjs/bspline/BezierCurveBase.d.ts.map +1 -1
  34. package/lib/cjs/bspline/BezierCurveBase.js +15 -0
  35. package/lib/cjs/bspline/BezierCurveBase.js.map +1 -1
  36. package/lib/cjs/bspline/InterpolationCurve3d.d.ts +2 -8
  37. package/lib/cjs/bspline/InterpolationCurve3d.d.ts.map +1 -1
  38. package/lib/cjs/bspline/InterpolationCurve3d.js +2 -17
  39. package/lib/cjs/bspline/InterpolationCurve3d.js.map +1 -1
  40. package/lib/cjs/bspline/KnotVector.d.ts +24 -9
  41. package/lib/cjs/bspline/KnotVector.d.ts.map +1 -1
  42. package/lib/cjs/bspline/KnotVector.js +86 -26
  43. package/lib/cjs/bspline/KnotVector.js.map +1 -1
  44. package/lib/cjs/curve/Arc3d.d.ts +1 -1
  45. package/lib/cjs/curve/Arc3d.d.ts.map +1 -1
  46. package/lib/cjs/curve/Arc3d.js.map +1 -1
  47. package/lib/cjs/curve/CurveChainWithDistanceIndex.d.ts +3 -3
  48. package/lib/cjs/curve/CurveChainWithDistanceIndex.d.ts.map +1 -1
  49. package/lib/cjs/curve/CurveChainWithDistanceIndex.js +3 -7
  50. package/lib/cjs/curve/CurveChainWithDistanceIndex.js.map +1 -1
  51. package/lib/cjs/curve/CurveCollection.d.ts +2 -2
  52. package/lib/cjs/curve/CurveCollection.d.ts.map +1 -1
  53. package/lib/cjs/curve/CurveCollection.js.map +1 -1
  54. package/lib/cjs/curve/CurveCurveIntersectXY.js +2 -2
  55. package/lib/cjs/curve/CurveCurveIntersectXY.js.map +1 -1
  56. package/lib/cjs/curve/CurvePrimitive.d.ts +4 -0
  57. package/lib/cjs/curve/CurvePrimitive.d.ts.map +1 -1
  58. package/lib/cjs/curve/CurvePrimitive.js.map +1 -1
  59. package/lib/cjs/curve/LineSegment3d.d.ts +1 -1
  60. package/lib/cjs/curve/LineSegment3d.d.ts.map +1 -1
  61. package/lib/cjs/curve/LineSegment3d.js.map +1 -1
  62. package/lib/cjs/curve/LineString3d.d.ts +1 -1
  63. package/lib/cjs/curve/LineString3d.d.ts.map +1 -1
  64. package/lib/cjs/curve/LineString3d.js.map +1 -1
  65. package/lib/cjs/curve/ProxyCurve.d.ts +6 -2
  66. package/lib/cjs/curve/ProxyCurve.d.ts.map +1 -1
  67. package/lib/cjs/curve/ProxyCurve.js +11 -2
  68. package/lib/cjs/curve/ProxyCurve.js.map +1 -1
  69. package/lib/cjs/curve/Query/CurveSplitContext.d.ts.map +1 -1
  70. package/lib/cjs/curve/Query/CurveSplitContext.js +1 -3
  71. package/lib/cjs/curve/Query/CurveSplitContext.js.map +1 -1
  72. package/lib/cjs/curve/StrokeOptions.js +2 -1
  73. package/lib/cjs/curve/StrokeOptions.js.map +1 -1
  74. package/lib/cjs/curve/internalContexts/CloneCurvesContext.js.map +1 -1
  75. package/lib/cjs/curve/internalContexts/CloneWithExpandedLineStrings.d.ts +2 -2
  76. package/lib/cjs/curve/internalContexts/CloneWithExpandedLineStrings.d.ts.map +1 -1
  77. package/lib/cjs/curve/internalContexts/CloneWithExpandedLineStrings.js.map +1 -1
  78. package/lib/cjs/curve/internalContexts/PolygonOffsetContext.js.map +1 -1
  79. package/lib/cjs/curve/spiral/DirectSpiral3d.d.ts +0 -4
  80. package/lib/cjs/curve/spiral/DirectSpiral3d.d.ts.map +1 -1
  81. package/lib/cjs/curve/spiral/DirectSpiral3d.js +0 -15
  82. package/lib/cjs/curve/spiral/DirectSpiral3d.js.map +1 -1
  83. package/lib/cjs/curve/spiral/IntegratedSpiral3d.d.ts +0 -4
  84. package/lib/cjs/curve/spiral/IntegratedSpiral3d.d.ts.map +1 -1
  85. package/lib/cjs/curve/spiral/IntegratedSpiral3d.js +0 -15
  86. package/lib/cjs/curve/spiral/IntegratedSpiral3d.js.map +1 -1
  87. package/lib/cjs/curve/spiral/TransitionSpiral3d.d.ts +8 -0
  88. package/lib/cjs/curve/spiral/TransitionSpiral3d.d.ts.map +1 -1
  89. package/lib/cjs/curve/spiral/TransitionSpiral3d.js +15 -0
  90. package/lib/cjs/curve/spiral/TransitionSpiral3d.js.map +1 -1
  91. package/lib/cjs/polyface/PolyfaceBuilder.js.map +1 -1
  92. package/lib/cjs/solid/RuledSweep.js.map +1 -1
  93. package/lib/cjs/solid/SweepContour.js.map +1 -1
  94. package/lib/esm/bspline/AkimaCurve3d.d.ts +2 -8
  95. package/lib/esm/bspline/AkimaCurve3d.d.ts.map +1 -1
  96. package/lib/esm/bspline/AkimaCurve3d.js +2 -17
  97. package/lib/esm/bspline/AkimaCurve3d.js.map +1 -1
  98. package/lib/esm/bspline/BSpline1dNd.d.ts +11 -6
  99. package/lib/esm/bspline/BSpline1dNd.d.ts.map +1 -1
  100. package/lib/esm/bspline/BSpline1dNd.js +65 -7
  101. package/lib/esm/bspline/BSpline1dNd.js.map +1 -1
  102. package/lib/esm/bspline/BSplineCurve.d.ts +9 -13
  103. package/lib/esm/bspline/BSplineCurve.d.ts.map +1 -1
  104. package/lib/esm/bspline/BSplineCurve.js +39 -31
  105. package/lib/esm/bspline/BSplineCurve.js.map +1 -1
  106. package/lib/esm/bspline/BSplineCurve3dH.d.ts +0 -2
  107. package/lib/esm/bspline/BSplineCurve3dH.d.ts.map +1 -1
  108. package/lib/esm/bspline/BSplineCurve3dH.js +0 -6
  109. package/lib/esm/bspline/BSplineCurve3dH.js.map +1 -1
  110. package/lib/esm/bspline/BSplineCurveOps.d.ts.map +1 -1
  111. package/lib/esm/bspline/BSplineCurveOps.js +4 -6
  112. package/lib/esm/bspline/BSplineCurveOps.js.map +1 -1
  113. package/lib/esm/bspline/Bezier1dNd.d.ts +8 -11
  114. package/lib/esm/bspline/Bezier1dNd.d.ts.map +1 -1
  115. package/lib/esm/bspline/Bezier1dNd.js +13 -14
  116. package/lib/esm/bspline/Bezier1dNd.js.map +1 -1
  117. package/lib/esm/bspline/BezierCurve3d.d.ts +0 -6
  118. package/lib/esm/bspline/BezierCurve3d.d.ts.map +1 -1
  119. package/lib/esm/bspline/BezierCurve3d.js +0 -14
  120. package/lib/esm/bspline/BezierCurve3d.js.map +1 -1
  121. package/lib/esm/bspline/BezierCurve3dH.d.ts +0 -4
  122. package/lib/esm/bspline/BezierCurve3dH.d.ts.map +1 -1
  123. package/lib/esm/bspline/BezierCurve3dH.js +0 -8
  124. package/lib/esm/bspline/BezierCurve3dH.js.map +1 -1
  125. package/lib/esm/bspline/BezierCurveBase.d.ts +9 -0
  126. package/lib/esm/bspline/BezierCurveBase.d.ts.map +1 -1
  127. package/lib/esm/bspline/BezierCurveBase.js +15 -0
  128. package/lib/esm/bspline/BezierCurveBase.js.map +1 -1
  129. package/lib/esm/bspline/InterpolationCurve3d.d.ts +2 -8
  130. package/lib/esm/bspline/InterpolationCurve3d.d.ts.map +1 -1
  131. package/lib/esm/bspline/InterpolationCurve3d.js +2 -17
  132. package/lib/esm/bspline/InterpolationCurve3d.js.map +1 -1
  133. package/lib/esm/bspline/KnotVector.d.ts +24 -9
  134. package/lib/esm/bspline/KnotVector.d.ts.map +1 -1
  135. package/lib/esm/bspline/KnotVector.js +86 -26
  136. package/lib/esm/bspline/KnotVector.js.map +1 -1
  137. package/lib/esm/curve/Arc3d.d.ts +1 -1
  138. package/lib/esm/curve/Arc3d.d.ts.map +1 -1
  139. package/lib/esm/curve/Arc3d.js.map +1 -1
  140. package/lib/esm/curve/CurveChainWithDistanceIndex.d.ts +3 -3
  141. package/lib/esm/curve/CurveChainWithDistanceIndex.d.ts.map +1 -1
  142. package/lib/esm/curve/CurveChainWithDistanceIndex.js +3 -7
  143. package/lib/esm/curve/CurveChainWithDistanceIndex.js.map +1 -1
  144. package/lib/esm/curve/CurveCollection.d.ts +2 -2
  145. package/lib/esm/curve/CurveCollection.d.ts.map +1 -1
  146. package/lib/esm/curve/CurveCollection.js.map +1 -1
  147. package/lib/esm/curve/CurveCurveIntersectXY.js +2 -2
  148. package/lib/esm/curve/CurveCurveIntersectXY.js.map +1 -1
  149. package/lib/esm/curve/CurvePrimitive.d.ts +4 -0
  150. package/lib/esm/curve/CurvePrimitive.d.ts.map +1 -1
  151. package/lib/esm/curve/CurvePrimitive.js.map +1 -1
  152. package/lib/esm/curve/LineSegment3d.d.ts +1 -1
  153. package/lib/esm/curve/LineSegment3d.d.ts.map +1 -1
  154. package/lib/esm/curve/LineSegment3d.js.map +1 -1
  155. package/lib/esm/curve/LineString3d.d.ts +1 -1
  156. package/lib/esm/curve/LineString3d.d.ts.map +1 -1
  157. package/lib/esm/curve/LineString3d.js.map +1 -1
  158. package/lib/esm/curve/ProxyCurve.d.ts +6 -2
  159. package/lib/esm/curve/ProxyCurve.d.ts.map +1 -1
  160. package/lib/esm/curve/ProxyCurve.js +11 -2
  161. package/lib/esm/curve/ProxyCurve.js.map +1 -1
  162. package/lib/esm/curve/Query/CurveSplitContext.d.ts.map +1 -1
  163. package/lib/esm/curve/Query/CurveSplitContext.js +1 -3
  164. package/lib/esm/curve/Query/CurveSplitContext.js.map +1 -1
  165. package/lib/esm/curve/StrokeOptions.js +2 -1
  166. package/lib/esm/curve/StrokeOptions.js.map +1 -1
  167. package/lib/esm/curve/internalContexts/CloneCurvesContext.js.map +1 -1
  168. package/lib/esm/curve/internalContexts/CloneWithExpandedLineStrings.d.ts +2 -2
  169. package/lib/esm/curve/internalContexts/CloneWithExpandedLineStrings.d.ts.map +1 -1
  170. package/lib/esm/curve/internalContexts/CloneWithExpandedLineStrings.js.map +1 -1
  171. package/lib/esm/curve/internalContexts/PolygonOffsetContext.js.map +1 -1
  172. package/lib/esm/curve/spiral/DirectSpiral3d.d.ts +0 -4
  173. package/lib/esm/curve/spiral/DirectSpiral3d.d.ts.map +1 -1
  174. package/lib/esm/curve/spiral/DirectSpiral3d.js +0 -15
  175. package/lib/esm/curve/spiral/DirectSpiral3d.js.map +1 -1
  176. package/lib/esm/curve/spiral/IntegratedSpiral3d.d.ts +0 -4
  177. package/lib/esm/curve/spiral/IntegratedSpiral3d.d.ts.map +1 -1
  178. package/lib/esm/curve/spiral/IntegratedSpiral3d.js +0 -15
  179. package/lib/esm/curve/spiral/IntegratedSpiral3d.js.map +1 -1
  180. package/lib/esm/curve/spiral/TransitionSpiral3d.d.ts +8 -0
  181. package/lib/esm/curve/spiral/TransitionSpiral3d.d.ts.map +1 -1
  182. package/lib/esm/curve/spiral/TransitionSpiral3d.js +15 -0
  183. package/lib/esm/curve/spiral/TransitionSpiral3d.js.map +1 -1
  184. package/lib/esm/polyface/PolyfaceBuilder.js.map +1 -1
  185. package/lib/esm/solid/RuledSweep.js.map +1 -1
  186. package/lib/esm/solid/SweepContour.js.map +1 -1
  187. package/package.json +4 -4
@@ -1 +1 @@
1
- {"version":3,"file":"BezierCurveBase.js","sourceRoot":"","sources":["../../../src/bspline/BezierCurveBase.ts"],"names":[],"mappings":";AAAA;;;+FAG+F;AAC/F;;GAEG;;;AAEH,2CAA2C;AAC3C,4DAAyD;AAEzD,0DAAuD;AACvD,0CAAuC;AACvC,+CAA4C;AAG5C,8EAA8E;AAC9E,mEAAwD;AAIxD,qEAAiE;AACjE,6CAA0C;AAE1C,yFAAsF;AACtF,yFAA+E;AAE/E;;;;;;;;;GASG;AACH,MAAsB,eAAgB,SAAQ,+BAAc;IAe1D,YAAsB,SAAiB,EAAE,IAAkB;QACzD,KAAK,EAAE,CAAC;QAfV,wCAAwC;QACxB,uBAAkB,GAAG,aAAa,CAAC;QAejD,IAAI,CAAC,QAAQ,GAAG,IAAI,uBAAU,CAAC,SAAS,EAAE,IAAI,CAAC,CAAC;QAChD,IAAI,CAAC,WAAW,GAAG,yBAAO,CAAC,MAAM,EAAE,CAAC;QACpC,IAAI,CAAC,WAAW,GAAG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AoC;YAChF,MAAM,OAAO,GAAG,IAAI,CAAC,IAAI,CAAC,OAAO,GAAG,SAAS,CAAC,CAAC,CAAE,qBAAqB;YACtE,IAAI,QAAQ,GAAG,UAAU,GAAG,CAAC,IAAI,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,CAAE,oCAAoC;YACpF,IAAI,IAAI,CAAC,MAAM,GAAG,CAAC;gBACjB,QAAQ,IAAI,CAAC,CAAC,CAAE,qCAAqC;YACvD,MAAM,QAAQ,GAAG,IAAI,CAAC,IAAI,CAAC,QAAQ,GAAG,UAAU,CAAC,CAAC;YAClD,MAAM,QAAQ,GAAG,IAAI,CAAC,MAAM,CAAC,CAAC,6HAA6H;YAC3J,UAAU,GAAG,6BAAa,CAAC,aAAa,CAAC,OAAO,EAC9C,6BAAa,CAAC,kBAAkB,CAAC,OAAO,EAAE,QAAQ,EAAE,OAAO,CAAC,EAAE,QAAQ,EAAE,GAAG,CAAC,CAAC;YAC/E,IAAI,OAAO,EAAE;gBACX,UAAU,GAAG,OAAO,CAAC,+BAA+B,CAAC,UAAU,EAAE,SAAS,EAAE,QAAQ,CAAC,CAAC;aACvF;SACF;QACD,OAAO,UAAU,CAAC;IACpB,CAAC;IAED;;;;;OAKG;IACa,iBAAiB,CAAC,uBAA+C;QAC/E,MAAM,OAAO,GAAG,oCAAa,CAAC,MAAM,CAAC,uBAAuB,CAAC,CAAC;QAC9D,MAAM,OAAO,GAAG,IAAI,2CAAoB,CAAC,IAAI,EAAE,OAAO,CAAC,kBAAkB,CAAC,CAAC;QAC3E,IAAI,CAAC,kBAAkB,CAAC,OAAO,EAAE,OAAO,CAAC,aAAa,CAAC,CAAC;QACxD,OAAO,OAAO,CAAC,WAAW,EAAE,CAAC;IAC/B,CAAC;CACF;AA/ND,0CA+NC","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\n// import { Point2d } from \"../Geometry2d\";\r\nimport { CurvePrimitive } from \"../curve/CurvePrimitive\";\r\nimport { LineString3d } from \"../curve/LineString3d\";\r\nimport { StrokeOptions } from \"../curve/StrokeOptions\";\r\nimport { Geometry } from \"../Geometry\";\r\nimport { Angle } from \"../geometry3d/Angle\";\r\nimport { IStrokeHandler } from \"../geometry3d/GeometryHandler\";\r\nimport { Plane3dByOriginAndUnitNormal } from \"../geometry3d/Plane3dByOriginAndUnitNormal\";\r\n/* eslint-disable @typescript-eslint/naming-convention, no-empty, no-console*/\r\nimport { Point3d } from \"../geometry3d/Point3dVector3d\";\r\nimport { Range3d } from \"../geometry3d/Range\";\r\nimport { Transform } from \"../geometry3d/Transform\";\r\nimport { Point4d } from \"../geometry4d/Point4d\";\r\nimport { UnivariateBezier } from \"../numerics/BezierPolynomials\";\r\nimport { Bezier1dNd } from \"./Bezier1dNd\";\r\nimport { KnotVector } from \"./KnotVector\";\r\nimport { CurveOffsetXYHandler } from \"../curve/internalContexts/CurveOffsetXYHandler\";\r\nimport { OffsetOptions } from \"../curve/internalContexts/PolygonOffsetContext\";\r\n\r\n/**\r\n * Base class for CurvePrimitive (necessarily 3D) with _polygon.\r\n * * This has a Bezier1dNd polygon as a member, and implements dimension-independent methods\r\n * * This exists to support\r\n * * BezierCurve3d -- 3 coordinates x,y,z per block in the Bezier1dNd poles\r\n * * BezierCurve3dH -- 4 coordinates x,y,z,w per block in the Bezier1dNd poles\r\n * * The implementations of \"pure 3d\" queries is based on calling `getPolePoint3d`.\r\n * * This has the subtle failure difference that `getPolePoint3d` call with a valid index on on a 3d curve always succeeds, but on 3dH curve fails when weight is zero.\r\n * @public\r\n */\r\nexport abstract class BezierCurveBase extends CurvePrimitive {\r\n /** String name for schema properties */\r\n public readonly curvePrimitiveType = \"bezierCurve\";\r\n\r\n /** Control points */\r\n protected _polygon: Bezier1dNd;\r\n /** scratch data blocks accessible by concrete class. Initialized to correct blockSize in constructor. */\r\n protected _workData0: Float64Array;\r\n /** scratch data blocks accessible by concrete class. Initialized to correct blockSize in constructor. */\r\n protected _workData1: Float64Array;\r\n /** Scratch xyz point accessible by derived classes. */\r\n protected _workPoint0: Point3d;\r\n /** Scratch xyz point accessible by derived classes. */\r\n protected _workPoint1: Point3d;\r\n\r\n protected constructor(blockSize: number, data: Float64Array) {\r\n super();\r\n this._polygon = new Bezier1dNd(blockSize, data);\r\n this._workPoint0 = Point3d.create();\r\n this._workPoint1 = Point3d.create();\r\n this._workData0 = new Float64Array(blockSize);\r\n this._workData1 = new Float64Array(blockSize);\r\n\r\n }\r\n /** reverse the poles in place */\r\n public reverseInPlace(): void { this._polygon.reverseInPlace(); }\r\n /** saturate the pole in place, using knot intervals from `spanIndex` of the `knotVector` */\r\n public saturateInPlace(knotVector: KnotVector, spanIndex: number): boolean {\r\n const boolStat = this._polygon.saturateInPlace(knotVector, spanIndex);\r\n if (boolStat) {\r\n this.setInterval(\r\n knotVector.spanFractionToFraction(spanIndex, 0.0),\r\n knotVector.spanFractionToFraction(spanIndex, 1.0));\r\n }\r\n return boolStat;\r\n }\r\n /** (property accessor) Return the polynomial degree (one less than order) */\r\n public get degree(): number {\r\n return this._polygon.order - 1;\r\n }\r\n /** (property accessor) Return the polynomial order */\r\n public get order(): number { return this._polygon.order; }\r\n /** (property accessor) Return the number of poles (aka control points) */\r\n public get numPoles(): number { return this._polygon.order; }\r\n /** Get pole `i` as a Point3d.\r\n * * For 3d curve, this is simple a pole access, and only fails (return `undefined`) for invalid index\r\n * * For 4d curve, this deweights the homogeneous pole and can fail due to 0 weight.\r\n */\r\n public abstract getPolePoint3d(i: number, point?: Point3d): Point3d | undefined;\r\n\r\n /** Get pole `i` as a Point4d.\r\n * * For 3d curve, this accesses the simple pole and returns with weight 1.\r\n * * For 4d curve, this accesses the (weighted) pole.\r\n */\r\n public abstract getPolePoint4d(i: number, point?: Point4d): Point4d | undefined;\r\n /** Set mapping to parent curve (e.g. if this bezier is a span extracted from a bspline, this is the knot interval of the span) */\r\n public setInterval(a: number, b: number) { this._polygon.setInterval(a, b); }\r\n /** map `fraction` from this Bezier curves inherent 0..1 range to the (a,b) range of parent\r\n * * ( The parent range should have been previously defined with `setInterval`)\r\n */\r\n public fractionToParentFraction(fraction: number): number { return this._polygon.fractionToParentFraction(fraction); }\r\n\r\n /** append stroke points to a linestring, based on `strokeCount` and `fractionToPoint` from derived class*/\r\n public emitStrokes(dest: LineString3d, options?: StrokeOptions): void {\r\n const numPerSpan = this.computeStrokeCountForOptions(options);\r\n const fractionStep = 1.0 / numPerSpan;\r\n for (let i = 0; i <= numPerSpan; i++) {\r\n const fraction = i * fractionStep;\r\n this.fractionToPoint(fraction, this._workPoint0);\r\n dest.appendStrokePoint(this._workPoint0);\r\n }\r\n }\r\n /** announce intervals with stroke counts */\r\n public emitStrokableParts(handler: IStrokeHandler, _options?: StrokeOptions): void {\r\n const numPerSpan = this.computeStrokeCountForOptions(_options);\r\n handler.announceIntervalForUniformStepStrokes(this, numPerSpan, 0.0, 1.0);\r\n }\r\n /** Return a simple array of arrays with the control points as `[[x,y,z],[x,y,z],..]` */\r\n public copyPolesAsJsonArray(): any[] { return this._polygon.unpackToJsonArrays(); }\r\n\r\n /** return true if all poles are on a plane. */\r\n public isInPlane(plane: Plane3dByOriginAndUnitNormal): boolean {\r\n let point: Point3d | undefined = this._workPoint0;\r\n for (let i = 0; ; i++) {\r\n point = this.getPolePoint3d(i, point);\r\n if (!point)\r\n return true;\r\n if (!plane.isPointInPlane(point))\r\n break; // which gets to return false, which is otherwise unreachable . . .\r\n }\r\n return false;\r\n }\r\n /** Return the length of the control polygon. */\r\n public polygonLength(): number {\r\n if (!this.getPolePoint3d(0, this._workPoint0))\r\n return 0.0;\r\n let i = 0;\r\n let sum = 0.0;\r\n while (this.getPolePoint3d(++i, this._workPoint1)) {\r\n sum += this._workPoint0.distance(this._workPoint1);\r\n this._workPoint0.setFrom(this._workPoint1);\r\n }\r\n return sum;\r\n }\r\n /** Return the start point. (first control point) */\r\n public override startPoint(): Point3d {\r\n const result = this.getPolePoint3d(0)!; // ASSUME non-trivial pole set -- if null comes back, it bubbles out\r\n return result;\r\n }\r\n /** Return the end point. (last control point) */\r\n public override endPoint(): Point3d {\r\n const result = this.getPolePoint3d(this.order - 1)!; // ASSUME non-trivial pole set\r\n return result;\r\n }\r\n /** Return the control polygon length as a quick length estimate. */\r\n public quickLength(): number { return this.polygonLength(); }\r\n /** Concrete classes must implement extendRange . . . */\r\n public abstract override extendRange(rangeToExtend: Range3d, transform?: Transform): void;\r\n /**\r\n * 1D bezier coefficients for use in range computations.\r\n * @internal\r\n */\r\n protected _workBezier?: UnivariateBezier; // available for bezier logic within a method\r\n /** scratch array for use by derived classes, using allocateAndZeroBezierWorkData for sizing. */\r\n protected _workCoffsA?: Float64Array;\r\n /** scratch array for use by derived classes, using allocateAndZeroBezierWorkData for sizing. */\r\n protected _workCoffsB?: Float64Array;\r\n\r\n /**\r\n * set up the _workBezier members with specific order.\r\n * * Try to reuse existing members if their sizes match.\r\n * * Ignore members corresponding to args that are 0 or negative.\r\n * @param primaryBezierOrder order of expected bezier\r\n * @param orderA length of _workCoffsA (simple array)\r\n * @param orderB length of _workCoffsB (simple array)\r\n */\r\n protected allocateAndZeroBezierWorkData(primaryBezierOrder: number, orderA: number, orderB: number) {\r\n if (primaryBezierOrder > 0) {\r\n if (this._workBezier !== undefined && this._workBezier.order === primaryBezierOrder) {\r\n this._workBezier.zero();\r\n } else\r\n this._workBezier = new UnivariateBezier(primaryBezierOrder);\r\n }\r\n if (orderA > 0) {\r\n if (this._workCoffsA !== undefined && this._workCoffsA.length === orderA)\r\n this._workCoffsA.fill(0);\r\n else\r\n this._workCoffsA = new Float64Array(orderA);\r\n }\r\n if (orderB > 0) {\r\n if (this._workCoffsB !== undefined && this._workCoffsB.length === orderB)\r\n this._workCoffsB.fill(0);\r\n else\r\n this._workCoffsB = new Float64Array(orderB);\r\n }\r\n }\r\n /**\r\n * Assess length and turn to determine a stroke count.\r\n * * this method is used by both BSplineCurve3d and BSplineCurve3dH.\r\n * * points are accessed via getPolePoint3d.\r\n * * Hence a zero-weight pole will be a problem\r\n * @param options stroke options structure.\r\n */\r\n public computeStrokeCountForOptions(options?: StrokeOptions): number {\r\n\r\n this.getPolePoint3d(0, this._workPoint0);\r\n this.getPolePoint3d(1, this._workPoint1);\r\n let numStrokes = 1;\r\n if (this._workPoint0 && this._workPoint1) {\r\n let dx0 = this._workPoint1.x - this._workPoint0.x;\r\n let dy0 = this._workPoint1.y - this._workPoint0.y;\r\n let dz0 = this._workPoint1.z - this._workPoint0.z;\r\n let dx1, dy1, dz1; // first differences of leading edge\r\n let sumRadians = 0.0;\r\n let thisLength = Geometry.hypotenuseXYZ(dx0, dy0, dz0);\r\n this._workPoint1.setFromPoint3d(this._workPoint0);\r\n let sumLength = thisLength;\r\n let maxLength = thisLength;\r\n let maxRadians = 0.0;\r\n let thisRadians;\r\n for (let i = 2; this.getPolePoint3d(i, this._workPoint1); i++) {\r\n dx1 = this._workPoint1.x - this._workPoint0.x;\r\n dy1 = this._workPoint1.y - this._workPoint0.y;\r\n dz1 = this._workPoint1.z - this._workPoint0.z;\r\n thisRadians = Angle.radiansBetweenVectorsXYZ(dx0, dy0, dz0, dx1, dy1, dz1);\r\n sumRadians += thisRadians;\r\n maxRadians = Geometry.maxAbsXY(thisRadians, maxRadians);\r\n thisLength = Geometry.hypotenuseXYZ(dx1, dy1, dz1);\r\n sumLength += thisLength;\r\n maxLength = Geometry.maxXY(maxLength, thisLength);\r\n dx0 = dx1;\r\n dy0 = dy1;\r\n dz0 = dz1;\r\n this._workPoint0.setFrom(this._workPoint1);\r\n }\r\n const length1 = maxLength * this.degree; // This may be larger than sumLength\r\n const length2 = Math.sqrt(length1 * sumLength); // This is in between\r\n let radians1 = maxRadians * (this.degree - 1); // As if worst case keeps happening.\r\n if (this.degree < 3)\r\n radians1 *= 3; // so quadratics aren't under-stroked\r\n const radians2 = Math.sqrt(radians1 * sumRadians);\r\n const minCount = this.degree; // NOTE: this means 1) a small, nontrivial, straight Bezier is over-stroked, and 2) options.minStrokesPerPrimitive is ignored\r\n numStrokes = StrokeOptions.applyAngleTol(options,\r\n StrokeOptions.applyMaxEdgeLength(options, minCount, length2), radians2, 0.1);\r\n if (options) {\r\n numStrokes = options.applyChordTolToLengthAndRadians(numStrokes, sumLength, radians1);\r\n }\r\n }\r\n return numStrokes;\r\n }\r\n\r\n /**\r\n * Construct an offset of the instance curve as viewed in the xy-plane (ignoring z).\r\n * * No attempt is made to join the offsets of smaller constituent primitives. To construct a fully joined offset\r\n * for an aggregate instance (e.g., LineString3d, CurveChainWithDistanceIndex), use RegionOps.constructCurveXYOffset() instead.\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): CurvePrimitive | CurvePrimitive[] | 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"]}
1
+ {"version":3,"file":"BezierCurveBase.js","sourceRoot":"","sources":["../../../src/bspline/BezierCurveBase.ts"],"names":[],"mappings":";AAAA;;;+FAG+F;AAC/F;;GAEG;;;AAEH,2CAA2C;AAC3C,4DAAyD;AAEzD,0DAAuD;AACvD,0CAAuC;AACvC,+CAA4C;AAG5C,8EAA8E;AAC9E,mEAAwD;AAIxD,qEAAiE;AACjE,6CAA0C;AAE1C,yFAAsF;AACtF,yFAA+E;AAE/E;;;;;;;;;GASG;AACH,MAAsB,eAAgB,SAAQ,+BAAc;IAe1D,YAAsB,SAAiB,EAAE,IAAkB;QACzD,KAAK,EAAE,CAAC;QAfV,wCAAwC;QACxB,uBAAkB,GAAG,aAAa,CAAC;QAejD,IAAI,CAAC,QAAQ,GAAG,IAAI,uBA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AE,OAAO,CAAC,kBAAkB,CAAC,CAAC;QAC3E,IAAI,CAAC,kBAAkB,CAAC,OAAO,EAAE,OAAO,CAAC,aAAa,CAAC,CAAC;QACxD,OAAO,OAAO,CAAC,WAAW,EAAE,CAAC;IAC/B,CAAC;IAED;;;OAGG;IACc,iBAAiB,CAAC,SAAiB,EAAE,SAAiB;QACrE,MAAM,YAAY,GAAG,IAAI,CAAC,KAAK,EAAE,CAAC;QAClC,YAAY,CAAC,QAAQ,CAAC,0BAA0B,CAAC,SAAS,EAAE,SAAS,CAAC,CAAC;QACvE,OAAO,YAAY,CAAC;IACtB,CAAC;CACF;AAnPD,0CAmPC","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\n// import { Point2d } from \"../Geometry2d\";\r\nimport { CurvePrimitive } from \"../curve/CurvePrimitive\";\r\nimport { LineString3d } from \"../curve/LineString3d\";\r\nimport { StrokeOptions } from \"../curve/StrokeOptions\";\r\nimport { Geometry } from \"../Geometry\";\r\nimport { Angle } from \"../geometry3d/Angle\";\r\nimport { IStrokeHandler } from \"../geometry3d/GeometryHandler\";\r\nimport { Plane3dByOriginAndUnitNormal } from \"../geometry3d/Plane3dByOriginAndUnitNormal\";\r\n/* eslint-disable @typescript-eslint/naming-convention, no-empty, no-console*/\r\nimport { Point3d } from \"../geometry3d/Point3dVector3d\";\r\nimport { Range3d } from \"../geometry3d/Range\";\r\nimport { Transform } from \"../geometry3d/Transform\";\r\nimport { Point4d } from \"../geometry4d/Point4d\";\r\nimport { UnivariateBezier } from \"../numerics/BezierPolynomials\";\r\nimport { Bezier1dNd } from \"./Bezier1dNd\";\r\nimport { KnotVector } from \"./KnotVector\";\r\nimport { CurveOffsetXYHandler } from \"../curve/internalContexts/CurveOffsetXYHandler\";\r\nimport { OffsetOptions } from \"../curve/internalContexts/PolygonOffsetContext\";\r\n\r\n/**\r\n * Base class for CurvePrimitive (necessarily 3D) with _polygon.\r\n * * This has a Bezier1dNd polygon as a member, and implements dimension-independent methods\r\n * * This exists to support\r\n * * BezierCurve3d -- 3 coordinates x,y,z per block in the Bezier1dNd poles\r\n * * BezierCurve3dH -- 4 coordinates x,y,z,w per block in the Bezier1dNd poles\r\n * * The implementations of \"pure 3d\" queries is based on calling `getPolePoint3d`.\r\n * * This has the subtle failure difference that `getPolePoint3d` call with a valid index on on a 3d curve always succeeds, but on 3dH curve fails when weight is zero.\r\n * @public\r\n */\r\nexport abstract class BezierCurveBase extends CurvePrimitive {\r\n /** String name for schema properties */\r\n public readonly curvePrimitiveType = \"bezierCurve\";\r\n\r\n /** Control points */\r\n protected _polygon: Bezier1dNd;\r\n /** scratch data blocks accessible by concrete class. Initialized to correct blockSize in constructor. */\r\n protected _workData0: Float64Array;\r\n /** scratch data blocks accessible by concrete class. Initialized to correct blockSize in constructor. */\r\n protected _workData1: Float64Array;\r\n /** Scratch xyz point accessible by derived classes. */\r\n protected _workPoint0: Point3d;\r\n /** Scratch xyz point accessible by derived classes. */\r\n protected _workPoint1: Point3d;\r\n\r\n protected constructor(blockSize: number, data: Float64Array) {\r\n super();\r\n this._polygon = new Bezier1dNd(blockSize, data);\r\n this._workPoint0 = Point3d.create();\r\n this._workPoint1 = Point3d.create();\r\n this._workData0 = new Float64Array(blockSize);\r\n this._workData1 = new Float64Array(blockSize);\r\n\r\n }\r\n /** reverse the poles in place */\r\n public reverseInPlace(): void { this._polygon.reverseInPlace(); }\r\n /** saturate the pole in place, using knot intervals from `spanIndex` of the `knotVector` */\r\n public saturateInPlace(knotVector: KnotVector, spanIndex: number): boolean {\r\n const boolStat = this._polygon.saturateInPlace(knotVector, spanIndex);\r\n if (boolStat) {\r\n this.setInterval(\r\n knotVector.spanFractionToFraction(spanIndex, 0.0),\r\n knotVector.spanFractionToFraction(spanIndex, 1.0));\r\n }\r\n return boolStat;\r\n }\r\n /** (property accessor) Return the polynomial degree (one less than order) */\r\n public get degree(): number {\r\n return this._polygon.order - 1;\r\n }\r\n /** (property accessor) Return the polynomial order */\r\n public get order(): number { return this._polygon.order; }\r\n /** (property accessor) Return the number of poles (aka control points) */\r\n public get numPoles(): number { return this._polygon.order; }\r\n /** Get pole `i` as a Point3d.\r\n * * For 3d curve, this is simple a pole access, and only fails (return `undefined`) for invalid index\r\n * * For 4d curve, this deweights the homogeneous pole and can fail due to 0 weight.\r\n */\r\n public abstract getPolePoint3d(i: number, point?: Point3d): Point3d | undefined;\r\n\r\n /** Get pole `i` as a Point4d.\r\n * * For 3d curve, this accesses the simple pole and returns with weight 1.\r\n * * For 4d curve, this accesses the (weighted) pole.\r\n */\r\n public abstract getPolePoint4d(i: number, point?: Point4d): Point4d | undefined;\r\n /** Set mapping to parent curve (e.g. if this bezier is a span extracted from a bspline, this is the knot interval of the span) */\r\n public setInterval(a: number, b: number) { this._polygon.setInterval(a, b); }\r\n /** map `fraction` from this Bezier curves inherent 0..1 range to the (a,b) range of parent\r\n * * ( The parent range should have been previously defined with `setInterval`)\r\n */\r\n public fractionToParentFraction(fraction: number): number { return this._polygon.fractionToParentFraction(fraction); }\r\n\r\n /** append stroke points to a linestring, based on `strokeCount` and `fractionToPoint` from derived class*/\r\n public emitStrokes(dest: LineString3d, options?: StrokeOptions): void {\r\n const numPerSpan = this.computeStrokeCountForOptions(options);\r\n const fractionStep = 1.0 / numPerSpan;\r\n for (let i = 0; i <= numPerSpan; i++) {\r\n const fraction = i * fractionStep;\r\n this.fractionToPoint(fraction, this._workPoint0);\r\n dest.appendStrokePoint(this._workPoint0);\r\n }\r\n }\r\n /** announce intervals with stroke counts */\r\n public emitStrokableParts(handler: IStrokeHandler, _options?: StrokeOptions): void {\r\n const numPerSpan = this.computeStrokeCountForOptions(_options);\r\n handler.announceIntervalForUniformStepStrokes(this, numPerSpan, 0.0, 1.0);\r\n }\r\n /** Return a simple array of arrays with the control points as `[[x,y,z],[x,y,z],..]` */\r\n public copyPolesAsJsonArray(): any[] { return this._polygon.unpackToJsonArrays(); }\r\n\r\n /** return true if all poles are on a plane. */\r\n public isInPlane(plane: Plane3dByOriginAndUnitNormal): boolean {\r\n let point: Point3d | undefined = this._workPoint0;\r\n for (let i = 0; ; i++) {\r\n point = this.getPolePoint3d(i, point);\r\n if (!point)\r\n return true;\r\n if (!plane.isPointInPlane(point))\r\n break; // which gets to return false, which is otherwise unreachable . . .\r\n }\r\n return false;\r\n }\r\n /** Return the length of the control polygon. */\r\n public polygonLength(): number {\r\n if (!this.getPolePoint3d(0, this._workPoint0))\r\n return 0.0;\r\n let i = 0;\r\n let sum = 0.0;\r\n while (this.getPolePoint3d(++i, this._workPoint1)) {\r\n sum += this._workPoint0.distance(this._workPoint1);\r\n this._workPoint0.setFrom(this._workPoint1);\r\n }\r\n return sum;\r\n }\r\n /** Return the start point. (first control point) */\r\n public override startPoint(): Point3d {\r\n const result = this.getPolePoint3d(0)!; // ASSUME non-trivial pole set -- if null comes back, it bubbles out\r\n return result;\r\n }\r\n /** Return the end point. (last control point) */\r\n public override endPoint(): Point3d {\r\n const result = this.getPolePoint3d(this.order - 1)!; // ASSUME non-trivial pole set\r\n return result;\r\n }\r\n /** Return the control polygon length as a quick length estimate. */\r\n public quickLength(): number { return this.polygonLength(); }\r\n /** Concrete classes must implement extendRange . . . */\r\n public abstract override extendRange(rangeToExtend: Range3d, transform?: Transform): void;\r\n /**\r\n * 1D bezier coefficients for use in range computations.\r\n * @internal\r\n */\r\n protected _workBezier?: UnivariateBezier; // available for bezier logic within a method\r\n /** scratch array for use by derived classes, using allocateAndZeroBezierWorkData for sizing. */\r\n protected _workCoffsA?: Float64Array;\r\n /** scratch array for use by derived classes, using allocateAndZeroBezierWorkData for sizing. */\r\n protected _workCoffsB?: Float64Array;\r\n\r\n /**\r\n * set up the _workBezier members with specific order.\r\n * * Try to reuse existing members if their sizes match.\r\n * * Ignore members corresponding to args that are 0 or negative.\r\n * @param primaryBezierOrder order of expected bezier\r\n * @param orderA length of _workCoffsA (simple array)\r\n * @param orderB length of _workCoffsB (simple array)\r\n */\r\n protected allocateAndZeroBezierWorkData(primaryBezierOrder: number, orderA: number, orderB: number) {\r\n if (primaryBezierOrder > 0) {\r\n if (this._workBezier !== undefined && this._workBezier.order === primaryBezierOrder) {\r\n this._workBezier.zero();\r\n } else\r\n this._workBezier = new UnivariateBezier(primaryBezierOrder);\r\n }\r\n if (orderA > 0) {\r\n if (this._workCoffsA !== undefined && this._workCoffsA.length === orderA)\r\n this._workCoffsA.fill(0);\r\n else\r\n this._workCoffsA = new Float64Array(orderA);\r\n }\r\n if (orderB > 0) {\r\n if (this._workCoffsB !== undefined && this._workCoffsB.length === orderB)\r\n this._workCoffsB.fill(0);\r\n else\r\n this._workCoffsB = new Float64Array(orderB);\r\n }\r\n }\r\n /**\r\n * Assess length and turn to determine a stroke count.\r\n * * this method is used by both BSplineCurve3d and BSplineCurve3dH.\r\n * * points are accessed via getPolePoint3d.\r\n * * Hence a zero-weight pole will be a problem\r\n * @param options stroke options structure.\r\n */\r\n public computeStrokeCountForOptions(options?: StrokeOptions): number {\r\n\r\n this.getPolePoint3d(0, this._workPoint0);\r\n this.getPolePoint3d(1, this._workPoint1);\r\n let numStrokes = 1;\r\n if (this._workPoint0 && this._workPoint1) {\r\n let dx0 = this._workPoint1.x - this._workPoint0.x;\r\n let dy0 = this._workPoint1.y - this._workPoint0.y;\r\n let dz0 = this._workPoint1.z - this._workPoint0.z;\r\n let dx1, dy1, dz1; // first differences of leading edge\r\n let sumRadians = 0.0;\r\n let thisLength = Geometry.hypotenuseXYZ(dx0, dy0, dz0);\r\n this._workPoint1.setFromPoint3d(this._workPoint0);\r\n let sumLength = thisLength;\r\n let maxLength = thisLength;\r\n let maxRadians = 0.0;\r\n let thisRadians;\r\n for (let i = 2; this.getPolePoint3d(i, this._workPoint1); i++) {\r\n dx1 = this._workPoint1.x - this._workPoint0.x;\r\n dy1 = this._workPoint1.y - this._workPoint0.y;\r\n dz1 = this._workPoint1.z - this._workPoint0.z;\r\n thisRadians = Angle.radiansBetweenVectorsXYZ(dx0, dy0, dz0, dx1, dy1, dz1);\r\n sumRadians += thisRadians;\r\n maxRadians = Geometry.maxAbsXY(thisRadians, maxRadians);\r\n thisLength = Geometry.hypotenuseXYZ(dx1, dy1, dz1);\r\n sumLength += thisLength;\r\n maxLength = Geometry.maxXY(maxLength, thisLength);\r\n dx0 = dx1;\r\n dy0 = dy1;\r\n dz0 = dz1;\r\n this._workPoint0.setFrom(this._workPoint1);\r\n }\r\n const length1 = maxLength * this.degree; // This may be larger than sumLength\r\n const length2 = Math.sqrt(length1 * sumLength); // This is in between\r\n let radians1 = maxRadians * (this.degree - 1); // As if worst case keeps happening.\r\n if (this.degree < 3)\r\n radians1 *= 3; // so quadratics aren't under-stroked\r\n const radians2 = Math.sqrt(radians1 * sumRadians);\r\n const minCount = this.degree; // NOTE: this means 1) a small, nontrivial, straight Bezier is over-stroked, and 2) options.minStrokesPerPrimitive is ignored\r\n numStrokes = StrokeOptions.applyAngleTol(options,\r\n StrokeOptions.applyMaxEdgeLength(options, minCount, length2), radians2, 0.1);\r\n if (options) {\r\n numStrokes = options.applyChordTolToLengthAndRadians(numStrokes, sumLength, radians1);\r\n }\r\n }\r\n return numStrokes;\r\n }\r\n\r\n /** Return a deep clone. */\r\n public abstract override clone(): BezierCurveBase;\r\n\r\n /** Return a transformed deep clone. */\r\n public override cloneTransformed(transform: Transform): BezierCurveBase {\r\n const curve1 = this.clone();\r\n curve1.tryTransformInPlace(transform);\r\n return curve1;\r\n }\r\n\r\n /**\r\n * Construct an offset of the instance curve as viewed in the xy-plane (ignoring z).\r\n * * No attempt is made to join the offsets of smaller constituent primitives. To construct a fully joined offset\r\n * for an aggregate instance (e.g., LineString3d, CurveChainWithDistanceIndex), use RegionOps.constructCurveXYOffset() instead.\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): CurvePrimitive | CurvePrimitive[] | 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 /** Return a curve primitive which is a portion of this curve.\r\n * @param fractionA [in] start fraction\r\n * @param fractionB [in] end fraction\r\n */\r\n public override clonePartialCurve(fractionA: number, fractionB: number): BezierCurveBase {\r\n const partialCurve = this.clone();\r\n partialCurve._polygon.subdivideToIntervalInPlace(fractionA, fractionB);\r\n return partialCurve;\r\n }\r\n}\r\n"]}
@@ -148,14 +148,8 @@ export declare class InterpolationCurve3d extends ProxyCurve {
148
148
  * Transform this [[InterpolationCurve3d]] and its defining data in place
149
149
  */
150
150
  tryTransformInPlace(transform: Transform): boolean;
151
- /**
152
- * Return a transformed clone.
153
- */
154
- cloneTransformed(transform: Transform): GeometryQuery | undefined;
155
- /**
156
- * Return a clone.
157
- */
158
- clone(): GeometryQuery | undefined;
151
+ /** Return a deep clone */
152
+ clone(): InterpolationCurve3d;
159
153
  isAlmostEqual(other: GeometryQuery): boolean;
160
154
  /** Test if `other` is also an [[InterpolationCurve3d]] */
161
155
  isSameGeometryClass(other: GeometryQuery): boolean;
@@ -1 +1 @@
1
- {"version":3,"file":"InterpolationCurve3d.d.ts","sourceRoot":"","sources":["../../../src/bspline/InterpolationCurve3d.ts"],"names":[],"mappings":"AAIA;;GAEG;AAEH,OAAO,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,+BAA+B,CAAC;AAGlE,OAAO,EAAE,UAAU,EAAE,MAAM,qBAAqB,CAAC;AAIjD,OAAO,EAAE,aAAa,EAAE,MAAM,wBAAwB,CAAC;AACvD,OAAO,EAAE,SAAS,EAAE,MAAM,yBAAyB,CAAC;AACpD,OAAO,EAAE,eAAe,EAAE,MAAM,+BAA+B,CAAC;AAChE,OAAO,EA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a,CAAC,OAAO,EAAE,2BAA2B,GAAG,oBAAoB,GAAG,SAAS;IAMnG,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;IAYzD,0BAA0B;IACV,KAAK,IAAI,oBAAoB;IAI7B,aAAa,CAAC,KAAK,EAAE,aAAa,GAAG,OAAO;IAO5D,0DAA0D;IACnD,mBAAmB,CAAC,KAAK,EAAE,aAAa,GAAG,OAAO;CAE1D"}
@@ -261,24 +261,9 @@ class InterpolationCurve3d extends ProxyCurve_1.ProxyCurve {
261
261
  }
262
262
  return proxyOk;
263
263
  }
264
- /**
265
- * Return a transformed clone.
266
- */
267
- cloneTransformed(transform) {
268
- const myClone = this.clone();
269
- if (myClone && (myClone === null || myClone === void 0 ? void 0 : myClone.tryTransformInPlace(transform)))
270
- return myClone;
271
- return undefined;
272
- }
273
- /**
274
- * Return a clone.
275
- */
264
+ /** Return a deep clone */
276
265
  clone() {
277
- const proxyClone = this._proxyCurve.clone();
278
- if (proxyClone) {
279
- return new InterpolationCurve3d(this._options.clone(), proxyClone);
280
- }
281
- return undefined;
266
+ return new InterpolationCurve3d(this._options.clone(), this._proxyCurve.clone());
282
267
  }
283
268
  isAlmostEqual(other) {
284
269
  if (other instanceof InterpolationCurve3d) {
@@ -1 +1 @@
1
- {"version":3,"file":"InterpolationCurve3d.js","sourceRoot":"","sources":["../../../src/bspline/InterpolationCurve3d.ts"],"names":[],"mappings":";AAAA;;;+FAG+F;AAC/F;;GAEG;;;AAEH,mEAAkE;AAClE,0CAAuC;AACvC,6DAA0D;AAC1D,oDAAiD;AAEjD,gEAA6D;AAC7D,iDAAg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AAO,SAAS,CAAC;IACnB,CAAC;IACe,aAAa,CAAC,KAAoB;QAChD,IAAI,KAAK,YAAY,oBAAoB,EAAE;YACzC,OAAO,2BAA2B,CAAC,cAAc,CAAC,IAAI,CAAC,QAAQ,EAAE,KAAK,CAAC,QAAQ,CAAC,CAAC;SAClF;QACD,OAAO,KAAK,CAAC;IACf,CAAC;IACD,0DAA0D;IACnD,mBAAmB,CAAC,KAAoB,IAAa,OAAO,KAAK,YAAY,oBAAoB,CAAC,CAAC,CAAC;CAE5G;AA1GD,oDA0GC","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 { Point3d, Vector3d } from \"../geometry3d/Point3dVector3d\";\r\nimport { Geometry } from \"../Geometry\";\r\nimport { Point3dArray } from \"../geometry3d/PointHelpers\";\r\nimport { ProxyCurve } from \"../curve/ProxyCurve\";\r\nimport { CurvePrimitive } from \"../curve/CurvePrimitive\";\r\nimport { BSplineCurveOps } from \"../bspline/BSplineCurveOps\";\r\nimport { BSplineCurve3d } from \"./BSplineCurve\";\r\nimport { GeometryQuery } from \"../curve/GeometryQuery\";\r\nimport { Transform } from \"../geometry3d/Transform\";\r\nimport { GeometryHandler } from \"../geometry3d/GeometryHandler\";\r\nimport { XYZProps } from \"../geometry3d/XYZProps\";\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 /** order of the computed bspline (one more than degree) */\r\n order?: number;\r\n /** true if the B-spline construction should be periodic */\r\n closed?: boolean;\r\n /** if closed and no knots, compute chord length knots (1) or uniform knots (0). 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). */\r\n isColinearTangents?: number;\r\n /** if !closed and start/endTangent is given, set its magnitude to the first/last fit point chord length (1) or to the magnitude of the Bessel tangent (0). Bessel gives best fit. */\r\n isChordLenTangents?: number;\r\n /** if !closed and start/endTangent is absent, compute it using the natural end condition (1) or Bessel (0). 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 /** parameters for curve fitting, one per fit point */\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 /**\r\n * CAPTURE properties and proxy curve.\r\n */\r\n private constructor(properties: InterpolationCurve3dOptions, proxyCurve: CurvePrimitive) {\r\n super(proxyCurve);\r\n this._options = properties;\r\n }\r\n public override dispatchToGeometryHandler(handler: GeometryHandler) {\r\n return handler.handleInterpolationCurve3d(this);\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 /** 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 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 * Return a transformed clone.\r\n */\r\n public cloneTransformed(transform: Transform): GeometryQuery | undefined {\r\n const myClone = this.clone();\r\n if (myClone && myClone?.tryTransformInPlace(transform))\r\n return myClone;\r\n return undefined;\r\n }\r\n /**\r\n * Return a clone.\r\n */\r\n public clone(): GeometryQuery | undefined {\r\n const proxyClone = this._proxyCurve.clone();\r\n if (proxyClone) {\r\n return new InterpolationCurve3d(this._options.clone(), proxyClone as CurvePrimitive);\r\n }\r\n return undefined;\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 /** 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,mEAAkE;AAClE,0CAAuC;AACvC,6DAA0D;AAC1D,oDAAiD;AAEjD,gEAA6D;AAC7D,iDAAgD;AAkChD;;;;;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;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EAAE,CAAC;IACjC,CAAC;IACD;;OAEG;IACI,mBAAmB,CAAC,SAAoB;QAC7C,MAAM,OAAO,GAAG,IAAI,CAAC,WAAW,CAAC,mBAAmB,CAAC,SAAS,CAAC,CAAC;QAChE,IAAI,OAAO,EAAE;YACX,SAAS,CAAC,2BAA2B,CAAC,IAAI,CAAC,QAAQ,CAAC,SAAS,CAAC,CAAC;YAC/D,IAAI,IAAI,CAAC,QAAQ,CAAC,YAAY;gBAC5B,SAAS,CAAC,qBAAqB,CAAC,IAAI,CAAC,QAAQ,CAAC,YAAY,CAAC,CAAC;YAC9D,IAAI,IAAI,CAAC,QAAQ,CAAC,UAAU;gBAC1B,SAAS,CAAC,qBAAqB,CAAC,IAAI,CAAC,QAAQ,CAAC,UAAU,CAAC,CAAC;SAC7D;QACD,OAAO,OAAO,CAAC;IACjB,CAAC;IAED,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;IAEe,aAAa,CAAC,KAAoB;QAChD,IAAI,KAAK,YAAY,oBAAoB,EAAE;YACzC,OAAO,2BAA2B,CAAC,cAAc,CAAC,IAAI,CAAC,QAAQ,EAAE,KAAK,CAAC,QAAQ,CAAC,CAAC;SAClF;QACD,OAAO,KAAK,CAAC;IACf,CAAC;IAED,0DAA0D;IACnD,mBAAmB,CAAC,KAAoB,IAAa,OAAO,KAAK,YAAY,oBAAoB,CAAC,CAAC,CAAC;CAE5G;AA9FD,oDA8FC","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 { Point3d, Vector3d } from \"../geometry3d/Point3dVector3d\";\r\nimport { Geometry } from \"../Geometry\";\r\nimport { Point3dArray } from \"../geometry3d/PointHelpers\";\r\nimport { ProxyCurve } from \"../curve/ProxyCurve\";\r\nimport { CurvePrimitive } from \"../curve/CurvePrimitive\";\r\nimport { BSplineCurveOps } from \"../bspline/BSplineCurveOps\";\r\nimport { BSplineCurve3d } from \"./BSplineCurve\";\r\nimport { GeometryQuery } from \"../curve/GeometryQuery\";\r\nimport { Transform } from \"../geometry3d/Transform\";\r\nimport { GeometryHandler } from \"../geometry3d/GeometryHandler\";\r\nimport { XYZProps } from \"../geometry3d/XYZProps\";\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 /** order of the computed bspline (one more than degree) */\r\n order?: number;\r\n /** true if the B-spline construction should be periodic */\r\n closed?: boolean;\r\n /** if closed and no knots, compute chord length knots (1) or uniform knots (0). 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). */\r\n isColinearTangents?: number;\r\n /** if !closed and start/endTangent is given, set its magnitude to the first/last fit point chord length (1) or to the magnitude of the Bessel tangent (0). Bessel gives best fit. */\r\n isChordLenTangents?: number;\r\n /** if !closed and start/endTangent is absent, compute it using the natural end condition (1) or Bessel (0). 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 /** parameters for curve fitting, one per fit point */\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 /**\r\n * CAPTURE properties and proxy curve.\r\n */\r\n private constructor(properties: InterpolationCurve3dOptions, proxyCurve: CurvePrimitive) {\r\n super(proxyCurve);\r\n this._options = properties;\r\n }\r\n public override dispatchToGeometryHandler(handler: GeometryHandler) {\r\n return handler.handleInterpolationCurve3d(this);\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 /** 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 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 /** 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\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"]}
@@ -25,7 +25,7 @@ export declare enum BSplineWrapMode {
25
25
  /**
26
26
  * Array of non-decreasing numbers acting as a knot array for bsplines.
27
27
  *
28
- * * Essential identity: numKnots = numPoles + order = numPoles + degree - 1
28
+ * * Essential identity: numKnots = numPoles + order - 2 = numPoles + degree - 1
29
29
  * * Various bspline libraries have confusion over how many "end knots" are needed. "Many" libraries (including MicroStation)
30
30
  * incorrectly demand "order" knots at each end for clamping. But only "order - 1" are really needed.
31
31
  * * This class uses the "order-1" convention.
@@ -33,7 +33,7 @@ export declare enum BSplineWrapMode {
33
33
  * * A span is a single interval of the knots.
34
34
  * * The left knot of span {k} is knot {k+degree-1}
35
35
  * * This class provides queries to convert among spanFraction, fraction of knot range, and knot
36
- * * core computations (evaluateBasisFunctions) have leftKnotIndex and global knot value as inputs. Caller's need to
36
+ * * core computations (evaluateBasisFunctions) have leftKnotIndex and global knot value as inputs. Callers need to
37
37
  * know their primary values (global knot, spanFraction).
38
38
  * @public
39
39
  */
@@ -80,9 +80,19 @@ export declare class KnotVector {
80
80
  testClosable(mode?: BSplineWrapMode): boolean;
81
81
  /** Test matching degree and knot values */
82
82
  isAlmostEqual(other: KnotVector): boolean;
83
+ /** Compute the multiplicity of the input knot, or zero if not a knot. */
84
+ getKnotMultiplicity(knot: number): number;
85
+ /** Compute the multiplicity of the knot at the given index. */
86
+ getKnotMultiplicityAtIndex(knotIndex: number): number;
87
+ /** Transform knots to span [0,1].
88
+ * @returns false if and only if this.knotLength01 is trivial
89
+ */
90
+ normalize(): boolean;
83
91
  /** install knot values from an array, optionally ignoring first and last.
84
92
  */
85
93
  setKnots(knots: number[] | Float64Array, skipFirstAndLast?: boolean): void;
94
+ /** install knot values from an array, optionally ignoring first and last. */
95
+ setKnotsCapture(knots: Float64Array): void;
86
96
  /**
87
97
  * Create knot vector with {degree-1} replicated knots at start and end, and uniform knots between.
88
98
  * @param numPoles Number of poles
@@ -103,13 +113,13 @@ export declare class KnotVector {
103
113
  * Create knot vector with given knot values and degree.
104
114
  * @param knotArray knot values
105
115
  * @param degree degree of polynomial
106
- * @param skipFirstAndLast true to skip class overclamped end knots.
116
+ * @param skipFirstAndLast true to skip copying the first and last knot values.
107
117
  */
108
118
  static create(knotArray: number[] | Float64Array, degree: number, skipFirstAndLast?: boolean): KnotVector;
109
119
  /**
110
- * Return the average of degree consecutive knots beginning at spanIndex.
120
+ * Return the average of degree consecutive knots beginning at knotIndex.
111
121
  */
112
- grevilleKnot(spanIndex: number): number;
122
+ grevilleKnot(knotIndex: number): number;
113
123
  /** Return an array sized for a set of the basis function values. */
114
124
  createBasisArray(): Float64Array;
115
125
  /** Convert localFraction within the interval following an indexed knot to a knot value. */
@@ -124,17 +134,22 @@ export declare class KnotVector {
124
134
  * Evaluate basis functions f[] at knot value u.
125
135
  *
126
136
  * @param u knot value for evaluation
127
- * @param f array of basis values. ASSUMED PROPER LENGTH
137
+ * @param f array of order basis function values
128
138
  */
129
139
  evaluateBasisFunctions(knotIndex0: number, u: number, f: Float64Array): void;
130
140
  /**
131
- * Evaluate basis fucntions f[] at knot value u.
141
+ * Evaluate basis functions f[], derivatives df[], and optional second derivatives ddf[] at knot value u.
132
142
  *
133
143
  * @param u knot value for evaluation
134
- * @param f array of basis values. ASSUMED PROPER LENGTH
144
+ * @param f array of order basis function values
145
+ * @param df array of order basis derivative values
146
+ * @param ddf array of order basis second derivative values
135
147
  */
136
148
  evaluateBasisFunctions1(knotIndex0: number, u: number, f: Float64Array, df: Float64Array, ddf?: Float64Array): void;
137
- /** Return the (highest) index of the knot less than or equal to u */
149
+ /** Find the knot span bracketing knots[i] <= u < knots[i+1] and return i.
150
+ * * If u has no such bracket, return the smaller index of the closest nontrivial bracket.
151
+ * @param u value to bracket
152
+ */
138
153
  knotToLeftKnotIndex(u: number): number;
139
154
  /**
140
155
  * Given a span index, return the index of the knot at its left.
@@ -1 +1 @@
1
- {"version":3,"file":"KnotVector.d.ts","sourceRoot":"","sources":["../../../src/bspline/KnotVector.ts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;IAG/C;;;;;OAKG;IACI,sBAAsB,CAAC,UAAU,EAAE,MAAM,EAAE,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,YAAY;IA2B5E;;;;;;;OAOG;IACI,uBAAuB,CAAC,UAAU,EAAE,MAAM,EAAE,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,YAAY,EAAE,EAAE,EAAE,YAAY,EAAE,GAAG,CAAC,EAAE,YAAY;IA0DnH;;;OAGG;IACI,mBAAmB,CAAC,CAAC,EAAE,MAAM,GAAG,MAAM;IAY7C;;;OAGG;IACI,wBAAwB,CAAC,SAAS,EAAE,MAAM,GAAG,MAAM;IAK1D,8DAA8D;IACvD,qBAAqB,CAAC,SAAS,EAAE,MAAM,GAAG,MAAM;IAIvD;;;;OAIG;IACI,iBAAiB,CAAC,SAAS,EAAE,MAAM,GAAG,OAAO;IAKpD,mGAAmG;IAC5F,YAAY;IAQnB;;;OAGG;IACI,SAAS,CAAC,mBAAmB,EAAE,OAAO,GAAG,MAAM,EAAE;CAyBzD"}
@@ -37,7 +37,7 @@ var BSplineWrapMode;
37
37
  /**
38
38
  * Array of non-decreasing numbers acting as a knot array for bsplines.
39
39
  *
40
- * * Essential identity: numKnots = numPoles + order = numPoles + degree - 1
40
+ * * Essential identity: numKnots = numPoles + order - 2 = numPoles + degree - 1
41
41
  * * Various bspline libraries have confusion over how many "end knots" are needed. "Many" libraries (including MicroStation)
42
42
  * incorrectly demand "order" knots at each end for clamping. But only "order - 1" are really needed.
43
43
  * * This class uses the "order-1" convention.
@@ -45,7 +45,7 @@ var BSplineWrapMode;
45
45
  * * A span is a single interval of the knots.
46
46
  * * The left knot of span {k} is knot {k+degree-1}
47
47
  * * This class provides queries to convert among spanFraction, fraction of knot range, and knot
48
- * * core computations (evaluateBasisFunctions) have leftKnotIndex and global knot value as inputs. Caller's need to
48
+ * * core computations (evaluateBasisFunctions) have leftKnotIndex and global knot value as inputs. Callers need to
49
49
  * know their primary values (global knot, spanFraction).
50
50
  * @public
51
51
  */
@@ -142,6 +142,59 @@ class KnotVector {
142
142
  return false;
143
143
  return PointHelpers_1.NumberArray.isAlmostEqual(this.knots, other.knots, KnotVector.knotTolerance);
144
144
  }
145
+ /** Compute the multiplicity of the input knot, or zero if not a knot. */
146
+ getKnotMultiplicity(knot) {
147
+ let m = 0;
148
+ for (const k of this.knots) {
149
+ if (Math.abs(k - knot) < KnotVector.knotTolerance)
150
+ ++m;
151
+ else if (knot < k)
152
+ break;
153
+ }
154
+ return m;
155
+ }
156
+ /** Compute the multiplicity of the knot at the given index. */
157
+ getKnotMultiplicityAtIndex(knotIndex) {
158
+ let m = 0;
159
+ if (knotIndex >= 0 && knotIndex < this.knots.length) {
160
+ const knot = this.knots[knotIndex];
161
+ ++m; // count this knot
162
+ for (let i = knotIndex - 1; i >= 0; --i) {
163
+ const k = this.knots[i];
164
+ if (Math.abs(k - knot) < KnotVector.knotTolerance)
165
+ ++m; // found multiple to left of knot
166
+ else if (knot > k)
167
+ break;
168
+ }
169
+ for (let i = knotIndex + 1; i < this.knots.length; ++i) {
170
+ const k = this.knots[i];
171
+ if (Math.abs(k - knot) < KnotVector.knotTolerance)
172
+ ++m; // found multiple to right of knot
173
+ else if (knot < k)
174
+ break;
175
+ }
176
+ }
177
+ return m;
178
+ }
179
+ /** Transform knots to span [0,1].
180
+ * @returns false if and only if this.knotLength01 is trivial
181
+ */
182
+ normalize() {
183
+ if (this.knotLength01 < KnotVector.knotTolerance)
184
+ return false;
185
+ const divisor = 1.0 / this.knotLength01;
186
+ const leftKnot = this.leftKnot;
187
+ for (let i = 0; i < this.knots.length; ++i)
188
+ this.knots[i] = (this.knots[i] - leftKnot) * divisor;
189
+ // explicitly set rightKnot and its multiples to 1.0 to avoid round-off
190
+ for (let i = this.rightKnotIndex - 1; i > this.leftKnotIndex && (this.knots[i] === this.knots[this.rightKnotIndex]); --i)
191
+ this.knots[i] = 1.0;
192
+ for (let i = this.rightKnotIndex + 1; i < this.knots.length && (this.knots[i] === this.knots[this.rightKnotIndex]); ++i)
193
+ this.knots[i] = 1.0;
194
+ this.knots[this.rightKnotIndex] = 1.0;
195
+ this.setupFixedValues();
196
+ return true;
197
+ }
145
198
  /** install knot values from an array, optionally ignoring first and last.
146
199
  */
147
200
  setKnots(knots, skipFirstAndLast) {
@@ -158,6 +211,11 @@ class KnotVector {
158
211
  }
159
212
  this.setupFixedValues();
160
213
  }
214
+ /** install knot values from an array, optionally ignoring first and last. */
215
+ setKnotsCapture(knots) {
216
+ this.knots = knots;
217
+ this.setupFixedValues();
218
+ }
161
219
  /**
162
220
  * Create knot vector with {degree-1} replicated knots at start and end, and uniform knots between.
163
221
  * @param numPoles Number of poles
@@ -198,7 +256,7 @@ class KnotVector {
198
256
  * Create knot vector with given knot values and degree.
199
257
  * @param knotArray knot values
200
258
  * @param degree degree of polynomial
201
- * @param skipFirstAndLast true to skip class overclamped end knots.
259
+ * @param skipFirstAndLast true to skip copying the first and last knot values.
202
260
  */
203
261
  static create(knotArray, degree, skipFirstAndLast) {
204
262
  const numAllocate = skipFirstAndLast ? knotArray.length - 2 : knotArray.length;
@@ -207,15 +265,15 @@ class KnotVector {
207
265
  return knots;
208
266
  }
209
267
  /**
210
- * Return the average of degree consecutive knots beginning at spanIndex.
268
+ * Return the average of degree consecutive knots beginning at knotIndex.
211
269
  */
212
- grevilleKnot(spanIndex) {
213
- if (spanIndex < 0)
270
+ grevilleKnot(knotIndex) {
271
+ if (knotIndex < 0)
214
272
  return this.leftKnot;
215
- if (spanIndex > this.rightKnotIndex)
273
+ if (knotIndex > this.rightKnotIndex)
216
274
  return this.rightKnot;
217
275
  let sum = 0.0;
218
- for (let i = spanIndex; i < spanIndex + this.degree; i++)
276
+ for (let i = knotIndex; i < knotIndex + this.degree; i++)
219
277
  sum += this.knots[i];
220
278
  return sum / this.degree;
221
279
  }
@@ -244,7 +302,7 @@ class KnotVector {
244
302
  * Evaluate basis functions f[] at knot value u.
245
303
  *
246
304
  * @param u knot value for evaluation
247
- * @param f array of basis values. ASSUMED PROPER LENGTH
305
+ * @param f array of order basis function values
248
306
  */
249
307
  evaluateBasisFunctions(knotIndex0, u, f) {
250
308
  f[0] = 1.0;
@@ -274,10 +332,12 @@ class KnotVector {
274
332
  }
275
333
  }
276
334
  /**
277
- * Evaluate basis fucntions f[] at knot value u.
335
+ * Evaluate basis functions f[], derivatives df[], and optional second derivatives ddf[] at knot value u.
278
336
  *
279
337
  * @param u knot value for evaluation
280
- * @param f array of basis values. ASSUMED PROPER LENGTH
338
+ * @param f array of order basis function values
339
+ * @param df array of order basis derivative values
340
+ * @param ddf array of order basis second derivative values
281
341
  */
282
342
  evaluateBasisFunctions1(knotIndex0, u, f, df, ddf) {
283
343
  f[0] = 1.0;
@@ -342,21 +402,21 @@ class KnotVector {
342
402
  ddf[depth + 1] = ddgCarry;
343
403
  }
344
404
  }
345
- /** Return the (highest) index of the knot less than or equal to u */
405
+ /** Find the knot span bracketing knots[i] <= u < knots[i+1] and return i.
406
+ * * If u has no such bracket, return the smaller index of the closest nontrivial bracket.
407
+ * @param u value to bracket
408
+ */
346
409
  knotToLeftKnotIndex(u) {
347
- // Anything to left is in the first span . .
348
- const firstLeftKnot = this.degree - 1;
349
- if (u < this.knots[firstLeftKnot + 1])
350
- return firstLeftKnot;
351
- // Anything to right is in the last span ...
352
- const lastLeftKnot = this.knots.length - this.degree - 1;
353
- if (u >= this.knots.length - this.degree)
354
- return this.knots[lastLeftKnot];
355
- // ugh ... linear search ...
356
- for (let i = firstLeftKnot + 1; i < lastLeftKnot; i++)
410
+ for (let i = this.leftKnotIndex; i < this.rightKnotIndex; ++i) {
357
411
  if (u < this.knots[i + 1])
358
- return i; // testing against right side skips over multiple knot cases???
359
- return lastLeftKnot;
412
+ return i;
413
+ }
414
+ // for u >= rightKnot, return left index of last nontrivial span
415
+ for (let i = this.rightKnotIndex; i > this.leftKnotIndex; --i) {
416
+ if (this.knots[i] - this.knots[i - 1] >= KnotVector.knotTolerance)
417
+ return i - 1;
418
+ }
419
+ return this.rightKnotIndex - 1; // shouldn't get here
360
420
  }
361
421
  /**
362
422
  * Given a span index, return the index of the knot at its left.
@@ -366,7 +426,7 @@ class KnotVector {
366
426
  const d = this.degree;
367
427
  if (spanIndex <= 0.0)
368
428
  return d - 1;
369
- return Math.min(spanIndex + d - 1, this.knots.length - d);
429
+ return Math.min(spanIndex + d - 1, this.knots.length - d - 1);
370
430
  }
371
431
  /** Return the knot interval length of indexed bezier span. */
372
432
  spanIndexToSpanLength(spanIndex) {
@@ -379,7 +439,7 @@ class KnotVector {
379
439
  * @param spanIndex index of span to test.
380
440
  */
381
441
  isIndexOfRealSpan(spanIndex) {
382
- if (spanIndex >= 0 && spanIndex < this.knots.length - this.degree)
442
+ if (spanIndex >= 0 && spanIndex < this.numSpans)
383
443
  return !Geometry_1.Geometry.isSmallMetricDistance(this.spanIndexToSpanLength(spanIndex));
384
444
  return false;
385
445
  }