@itwin/core-geometry 3.5.0-dev.35 → 3.5.0-dev.41

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 (173) hide show
  1. package/lib/cjs/Geometry.d.ts +13 -0
  2. package/lib/cjs/Geometry.d.ts.map +1 -1
  3. package/lib/cjs/Geometry.js.map +1 -1
  4. package/lib/cjs/bspline/BSplineCurve.d.ts +1 -1
  5. package/lib/cjs/bspline/BSplineCurve.js +1 -1
  6. package/lib/cjs/bspline/BSplineCurve.js.map +1 -1
  7. package/lib/cjs/bspline/KnotVector.d.ts.map +1 -1
  8. package/lib/cjs/bspline/KnotVector.js +3 -0
  9. package/lib/cjs/bspline/KnotVector.js.map +1 -1
  10. package/lib/cjs/curve/CurveChainWithDistanceIndex.d.ts +7 -5
  11. package/lib/cjs/curve/CurveChainWithDistanceIndex.d.ts.map +1 -1
  12. package/lib/cjs/curve/CurveChainWithDistanceIndex.js +37 -29
  13. package/lib/cjs/curve/CurveChainWithDistanceIndex.js.map +1 -1
  14. package/lib/cjs/curve/CurveCollection.d.ts +4 -2
  15. package/lib/cjs/curve/CurveCollection.d.ts.map +1 -1
  16. package/lib/cjs/curve/CurveCollection.js +14 -2
  17. package/lib/cjs/curve/CurveCollection.js.map +1 -1
  18. package/lib/cjs/curve/CurvePrimitive.d.ts +13 -17
  19. package/lib/cjs/curve/CurvePrimitive.d.ts.map +1 -1
  20. package/lib/cjs/curve/CurvePrimitive.js +51 -340
  21. package/lib/cjs/curve/CurvePrimitive.js.map +1 -1
  22. package/lib/cjs/curve/LineString3d.d.ts +11 -1
  23. package/lib/cjs/curve/LineString3d.d.ts.map +1 -1
  24. package/lib/cjs/curve/LineString3d.js +30 -23
  25. package/lib/cjs/curve/LineString3d.js.map +1 -1
  26. package/lib/cjs/curve/internalContexts/AppendPlaneIntersectionStrokeHandler.d.ts +55 -0
  27. package/lib/cjs/curve/internalContexts/AppendPlaneIntersectionStrokeHandler.d.ts.map +1 -0
  28. package/lib/cjs/curve/internalContexts/AppendPlaneIntersectionStrokeHandler.js +143 -0
  29. package/lib/cjs/curve/internalContexts/AppendPlaneIntersectionStrokeHandler.js.map +1 -0
  30. package/lib/cjs/curve/internalContexts/ClosestPointStrokeHandler.d.ts +43 -0
  31. package/lib/cjs/curve/internalContexts/ClosestPointStrokeHandler.d.ts.map +1 -0
  32. package/lib/cjs/curve/internalContexts/ClosestPointStrokeHandler.js +146 -0
  33. package/lib/cjs/curve/internalContexts/ClosestPointStrokeHandler.js.map +1 -0
  34. package/lib/cjs/curve/internalContexts/CurveLengthContext.d.ts +33 -0
  35. package/lib/cjs/curve/internalContexts/CurveLengthContext.d.ts.map +1 -0
  36. package/lib/cjs/curve/internalContexts/CurveLengthContext.js +91 -0
  37. package/lib/cjs/curve/internalContexts/CurveLengthContext.js.map +1 -0
  38. package/lib/cjs/curve/internalContexts/NewtonRtoRStrokeHandler.d.ts +21 -0
  39. package/lib/cjs/curve/internalContexts/NewtonRtoRStrokeHandler.d.ts.map +1 -0
  40. package/lib/cjs/curve/internalContexts/NewtonRtoRStrokeHandler.js +34 -0
  41. package/lib/cjs/curve/internalContexts/NewtonRtoRStrokeHandler.js.map +1 -0
  42. package/lib/cjs/curve/spiral/DirectSpiral3d.d.ts +2 -2
  43. package/lib/cjs/curve/spiral/DirectSpiral3d.d.ts.map +1 -1
  44. package/lib/cjs/curve/spiral/DirectSpiral3d.js +15 -8
  45. package/lib/cjs/curve/spiral/DirectSpiral3d.js.map +1 -1
  46. package/lib/cjs/geometry3d/Angle.d.ts +20 -10
  47. package/lib/cjs/geometry3d/Angle.d.ts.map +1 -1
  48. package/lib/cjs/geometry3d/Angle.js +30 -15
  49. package/lib/cjs/geometry3d/Angle.js.map +1 -1
  50. package/lib/cjs/geometry3d/Matrix3d.d.ts +25 -8
  51. package/lib/cjs/geometry3d/Matrix3d.d.ts.map +1 -1
  52. package/lib/cjs/geometry3d/Matrix3d.js +67 -15
  53. package/lib/cjs/geometry3d/Matrix3d.js.map +1 -1
  54. package/lib/cjs/geometry3d/Point2dVector2d.d.ts +23 -8
  55. package/lib/cjs/geometry3d/Point2dVector2d.d.ts.map +1 -1
  56. package/lib/cjs/geometry3d/Point2dVector2d.js +40 -13
  57. package/lib/cjs/geometry3d/Point2dVector2d.js.map +1 -1
  58. package/lib/cjs/geometry3d/Point3dVector3d.d.ts +90 -55
  59. package/lib/cjs/geometry3d/Point3dVector3d.d.ts.map +1 -1
  60. package/lib/cjs/geometry3d/Point3dVector3d.js +254 -123
  61. package/lib/cjs/geometry3d/Point3dVector3d.js.map +1 -1
  62. package/lib/cjs/geometry3d/Range.d.ts +0 -1
  63. package/lib/cjs/geometry3d/Range.d.ts.map +1 -1
  64. package/lib/cjs/geometry3d/Range.js +0 -1
  65. package/lib/cjs/geometry3d/Range.js.map +1 -1
  66. package/lib/cjs/geometry3d/Transform.d.ts.map +1 -1
  67. package/lib/cjs/geometry3d/Transform.js.map +1 -1
  68. package/lib/cjs/polyface/PolyfaceBuilder.d.ts.map +1 -1
  69. package/lib/cjs/polyface/PolyfaceBuilder.js.map +1 -1
  70. package/lib/cjs/serialization/IModelJsonSchema.d.ts +1 -1
  71. package/lib/cjs/serialization/IModelJsonSchema.d.ts.map +1 -1
  72. package/lib/cjs/serialization/IModelJsonSchema.js +4 -3
  73. package/lib/cjs/serialization/IModelJsonSchema.js.map +1 -1
  74. package/lib/cjs/solid/Sphere.d.ts +1 -1
  75. package/lib/cjs/solid/Sphere.js +3 -3
  76. package/lib/cjs/solid/Sphere.js.map +1 -1
  77. package/lib/cjs/solid/TorusPipe.d.ts +17 -13
  78. package/lib/cjs/solid/TorusPipe.d.ts.map +1 -1
  79. package/lib/cjs/solid/TorusPipe.js +67 -38
  80. package/lib/cjs/solid/TorusPipe.js.map +1 -1
  81. package/lib/cjs/topology/Graph.d.ts +1 -1
  82. package/lib/cjs/topology/Graph.js +1 -1
  83. package/lib/cjs/topology/Graph.js.map +1 -1
  84. package/lib/cjs/topology/Triangulation.d.ts +1 -1
  85. package/lib/cjs/topology/Triangulation.js +1 -1
  86. package/lib/cjs/topology/Triangulation.js.map +1 -1
  87. package/lib/esm/Geometry.d.ts +13 -0
  88. package/lib/esm/Geometry.d.ts.map +1 -1
  89. package/lib/esm/Geometry.js.map +1 -1
  90. package/lib/esm/bspline/BSplineCurve.d.ts +1 -1
  91. package/lib/esm/bspline/BSplineCurve.js +1 -1
  92. package/lib/esm/bspline/BSplineCurve.js.map +1 -1
  93. package/lib/esm/bspline/KnotVector.d.ts.map +1 -1
  94. package/lib/esm/bspline/KnotVector.js +3 -0
  95. package/lib/esm/bspline/KnotVector.js.map +1 -1
  96. package/lib/esm/curve/CurveChainWithDistanceIndex.d.ts +7 -5
  97. package/lib/esm/curve/CurveChainWithDistanceIndex.d.ts.map +1 -1
  98. package/lib/esm/curve/CurveChainWithDistanceIndex.js +37 -29
  99. package/lib/esm/curve/CurveChainWithDistanceIndex.js.map +1 -1
  100. package/lib/esm/curve/CurveCollection.d.ts +4 -2
  101. package/lib/esm/curve/CurveCollection.d.ts.map +1 -1
  102. package/lib/esm/curve/CurveCollection.js +14 -2
  103. package/lib/esm/curve/CurveCollection.js.map +1 -1
  104. package/lib/esm/curve/CurvePrimitive.d.ts +13 -17
  105. package/lib/esm/curve/CurvePrimitive.d.ts.map +1 -1
  106. package/lib/esm/curve/CurvePrimitive.js +46 -335
  107. package/lib/esm/curve/CurvePrimitive.js.map +1 -1
  108. package/lib/esm/curve/LineString3d.d.ts +11 -1
  109. package/lib/esm/curve/LineString3d.d.ts.map +1 -1
  110. package/lib/esm/curve/LineString3d.js +30 -23
  111. package/lib/esm/curve/LineString3d.js.map +1 -1
  112. package/lib/esm/curve/internalContexts/AppendPlaneIntersectionStrokeHandler.d.ts +55 -0
  113. package/lib/esm/curve/internalContexts/AppendPlaneIntersectionStrokeHandler.d.ts.map +1 -0
  114. package/lib/esm/curve/internalContexts/AppendPlaneIntersectionStrokeHandler.js +139 -0
  115. package/lib/esm/curve/internalContexts/AppendPlaneIntersectionStrokeHandler.js.map +1 -0
  116. package/lib/esm/curve/internalContexts/ClosestPointStrokeHandler.d.ts +43 -0
  117. package/lib/esm/curve/internalContexts/ClosestPointStrokeHandler.d.ts.map +1 -0
  118. package/lib/esm/curve/internalContexts/ClosestPointStrokeHandler.js +142 -0
  119. package/lib/esm/curve/internalContexts/ClosestPointStrokeHandler.js.map +1 -0
  120. package/lib/esm/curve/internalContexts/CurveLengthContext.d.ts +33 -0
  121. package/lib/esm/curve/internalContexts/CurveLengthContext.d.ts.map +1 -0
  122. package/lib/esm/curve/internalContexts/CurveLengthContext.js +87 -0
  123. package/lib/esm/curve/internalContexts/CurveLengthContext.js.map +1 -0
  124. package/lib/esm/curve/internalContexts/NewtonRtoRStrokeHandler.d.ts +21 -0
  125. package/lib/esm/curve/internalContexts/NewtonRtoRStrokeHandler.d.ts.map +1 -0
  126. package/lib/esm/curve/internalContexts/NewtonRtoRStrokeHandler.js +30 -0
  127. package/lib/esm/curve/internalContexts/NewtonRtoRStrokeHandler.js.map +1 -0
  128. package/lib/esm/curve/spiral/DirectSpiral3d.d.ts +2 -2
  129. package/lib/esm/curve/spiral/DirectSpiral3d.d.ts.map +1 -1
  130. package/lib/esm/curve/spiral/DirectSpiral3d.js +15 -8
  131. package/lib/esm/curve/spiral/DirectSpiral3d.js.map +1 -1
  132. package/lib/esm/geometry3d/Angle.d.ts +20 -10
  133. package/lib/esm/geometry3d/Angle.d.ts.map +1 -1
  134. package/lib/esm/geometry3d/Angle.js +30 -15
  135. package/lib/esm/geometry3d/Angle.js.map +1 -1
  136. package/lib/esm/geometry3d/Matrix3d.d.ts +25 -8
  137. package/lib/esm/geometry3d/Matrix3d.d.ts.map +1 -1
  138. package/lib/esm/geometry3d/Matrix3d.js +67 -15
  139. package/lib/esm/geometry3d/Matrix3d.js.map +1 -1
  140. package/lib/esm/geometry3d/Point2dVector2d.d.ts +23 -8
  141. package/lib/esm/geometry3d/Point2dVector2d.d.ts.map +1 -1
  142. package/lib/esm/geometry3d/Point2dVector2d.js +40 -13
  143. package/lib/esm/geometry3d/Point2dVector2d.js.map +1 -1
  144. package/lib/esm/geometry3d/Point3dVector3d.d.ts +90 -55
  145. package/lib/esm/geometry3d/Point3dVector3d.d.ts.map +1 -1
  146. package/lib/esm/geometry3d/Point3dVector3d.js +254 -123
  147. package/lib/esm/geometry3d/Point3dVector3d.js.map +1 -1
  148. package/lib/esm/geometry3d/Range.d.ts +0 -1
  149. package/lib/esm/geometry3d/Range.d.ts.map +1 -1
  150. package/lib/esm/geometry3d/Range.js +0 -1
  151. package/lib/esm/geometry3d/Range.js.map +1 -1
  152. package/lib/esm/geometry3d/Transform.d.ts.map +1 -1
  153. package/lib/esm/geometry3d/Transform.js.map +1 -1
  154. package/lib/esm/polyface/PolyfaceBuilder.d.ts.map +1 -1
  155. package/lib/esm/polyface/PolyfaceBuilder.js.map +1 -1
  156. package/lib/esm/serialization/IModelJsonSchema.d.ts +1 -1
  157. package/lib/esm/serialization/IModelJsonSchema.d.ts.map +1 -1
  158. package/lib/esm/serialization/IModelJsonSchema.js +4 -3
  159. package/lib/esm/serialization/IModelJsonSchema.js.map +1 -1
  160. package/lib/esm/solid/Sphere.d.ts +1 -1
  161. package/lib/esm/solid/Sphere.js +3 -3
  162. package/lib/esm/solid/Sphere.js.map +1 -1
  163. package/lib/esm/solid/TorusPipe.d.ts +17 -13
  164. package/lib/esm/solid/TorusPipe.d.ts.map +1 -1
  165. package/lib/esm/solid/TorusPipe.js +67 -38
  166. package/lib/esm/solid/TorusPipe.js.map +1 -1
  167. package/lib/esm/topology/Graph.d.ts +1 -1
  168. package/lib/esm/topology/Graph.js +1 -1
  169. package/lib/esm/topology/Graph.js.map +1 -1
  170. package/lib/esm/topology/Triangulation.d.ts +1 -1
  171. package/lib/esm/topology/Triangulation.js +1 -1
  172. package/lib/esm/topology/Triangulation.js.map +1 -1
  173. package/package.json +4 -4
@@ -1 +1 @@
1
- {"version":3,"file":"BSpline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;QAChB,OAAO,SAAS,CAAC;IACnB,CAAC;IAED;;OAEG;IACa,YAAY,CAAC,KAAsB;QACjD,IAAI,CAAC,OAAO,CAAC,KAAK,CAAC,SAAS,GAAG,KAAK,CAAC;IACvC,CAAC;IACD,iFAAiF;IAC1E,yBAAyB,CAAC,OAAwB;QACvD,OAAO,OAAO,CAAC,oBAAoB,CAAC,IAAI,CAAC,CAAC;IAC5C,CAAC;IACD;;;;;OAKG;IACI,WAAW,CAAC,aAAsB,EAAE,SAAqB;QAC9D,MAAM,MAAM,GAAG,IAAI,CAAC,OAAO,CAAC,UAAU,CAAC;QACvC,MAAM,CAAC,GAAG,MAAM,CAAC,MAAM,GAAG,CAAC,CAAC;QAC5B,IAAI,SAAS,EAAE;YACb,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;SAC7F;aAAM;YACL,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;SACvE;IACH,CAAC;CAEF","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 { CurveIntervalRole, CurveLocationDetail } from \"../curve/CurveLocationDetail\";\r\nimport { CurvePrimitive } from \"../curve/CurvePrimitive\";\r\nimport { LineString3d } from \"../curve/LineString3d\";\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\n/* eslint-disable @typescript-eslint/naming-convention, no-empty, no-console*/\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\nimport { CurveOffsetXYHandler } from \"../curve/internalContexts/CurveOffsetXYHandler\";\r\nimport { OffsetOptions } from \"../curve/internalContexts/PolygonOffsetContext\";\r\n\r\n/**\r\n * Base class for BSplineCurve3d and BSplineCurve3dH.\r\n * * A bspline curve consists of a set of knots and a set of poles.\r\n * * The bspline curve is a function of the independent \"knot axis\" variable\r\n * * The curve \"follows\" the poles loosely.\r\n * * The is a set of polynomial spans.\r\n * * The polynomial spans all have same `degree`.\r\n * * Within each span, the polynomial of that `degree` is controlled by `order = degree + 1` contiguous points called poles.\r\n * * The 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 given `spanIndex`:\r\n * * The `order` poles begin at index `spanIndex`.\r\n * * The `2*order` knots begin as span index\r\n * * The knot interval for this span is from `knot[degree+span-1] to knot[degree+span]`\r\n * * The active part of the knot axis is `knot[degree-1] < knot < knot[degree-1 + numSpan]` i.e. `knot[degree-1] < knot < knot[numPoles]\r\n *\r\n * Nearly all bsplines are \"clamped \".\r\n * * Clamping make the curve pass through its first and last poles, with tangents directed along the first and last edges of the control polygon.\r\n * * The knots for a clamped bspline have `degree` copies of the lowest knot value and `degree` copies of the highest knot value.\r\n * * For instance, the knot vector `[0,0,0,1,2,3,3,3]\r\n * * can be evaluated from `0<=knot<=3`\r\n * * has 3 spans: 0 to 1, 1 to 2, 2 to 3\r\n * * has 6 poles\r\n * * passes through its first and last poles.\r\n * * `create` methods may allow classic convention that has an extra knot at the beginning and end of the knot vector.\r\n * * The extra knots (first and last) were never referenced by the bspline recurrence relations.\r\n * * When the `create` methods recognize the classic setup (`numPoles + order = numKnots`), the extra knot is not saved with the BSplineCurve3dBase knots.\r\n *\r\n * * The weighted variant has the problem that CurvePrimitive 3d typing does not allow undefined result where Point4d has zero weight.\r\n * * The convention for these is to return 000 in such places.\r\n *\r\n * * Note the class relationships:\r\n * * BSpline1dNd knows the bspline recurrence relations for control points (poles) with no physical meaning.\r\n * * BsplineCurve3dBase owns a protected BSpline1dNd\r\n * * BsplineCurve3dBase is derived from CurvePrimitive, which creates obligation to act as a 3D curve, such as\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 need to have certain leading knots and poles replicated at the end\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\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) { this._definitionData = data; }\r\n public get definitionData(): any { return this._definitionData; }\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) as BSpline1dNd;\r\n }\r\n /** Return the degree (one less than the order) of the curve */\r\n public get degree(): number { return this._bcurve.degree; }\r\n /** Return the order (one more than degree) of the curve */\r\n public get order(): number { return this._bcurve.order; }\r\n /** Return the number of bezier spans in the curve. Note that this number includes the number of null spans at repeated knows */\r\n public get numSpan(): number { return this._bcurve.numSpan; }\r\n /** Return the number of poles */\r\n public get numPoles(): number { return this._bcurve.numPoles; }\r\n /**\r\n * return a simple array form of the knots. optionally replicate the first and last\r\n * in classic over-clamped manner\r\n */\r\n public copyKnots(includeExtraEndKnot: boolean): number[] { return this._bcurve.knots.copyKnots(includeExtraEndKnot); }\r\n\r\n /**\r\n * Set the flag indicating the bspline might be suitable for having wrapped \"closed\" interpretation.\r\n */\r\n public setWrappable(value: BSplineWrapMode) {\r\n this._bcurve.knots.wrappable = value;\r\n }\r\n\r\n /** Evaluate at a position given by fractional position within a span. */\r\n public abstract evaluatePointInSpan(spanIndex: number, spanFraction: number, result?: Point3d): Point3d;\r\n /** Evaluate at a position given by fractional position within a span. */\r\n public abstract evaluatePointAndDerivativeInSpan(spanIndex: number, spanFraction: number, result?: Ray3d): Ray3d;\r\n /** Evaluate xyz at a position given by knot. */\r\n public abstract knotToPoint(knot: number, result?: Point3d): Point3d;\r\n /** Evaluate xyz and derivative at position given by a knot value. */\r\n public abstract knotToPointAndDerivative(knot: number, result?: Ray3d): Ray3d;\r\n /** Evaluate xyz and 2 derivatives at position given by a knot value. */\r\n public abstract knotToPointAnd2Derivatives(knot: number, result?: Plane3dByOriginAndVectors): Plane3dByOriginAndVectors;\r\n /** Evaluate the curve point at `fraction` */\r\n public fractionToPoint(fraction: number, result?: Point3d): Point3d {\r\n return this.knotToPoint(this._bcurve.knots.fractionToKnot(fraction), result);\r\n }\r\n /** Construct a ray with\r\n * * origin at the fractional position along the arc\r\n * * direction is the first derivative, i.e. tangent along the curve\r\n */\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\r\n /** Construct a plane with\r\n * * origin at the fractional position along the arc\r\n * * x axis is the first derivative, i.e. tangent along the curve\r\n * * y axis is the second derivative\r\n */\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 /**\r\n * Return the start point of the curve.\r\n */\r\n public override startPoint(): Point3d { return this.evaluatePointInSpan(0, 0.0); }\r\n /**\r\n * Return the end point of the curve\r\n */\r\n public override endPoint(): Point3d { return this.evaluatePointInSpan(this.numSpan - 1, 1.0); }\r\n /** Reverse the curve in place.\r\n * * Poles are reversed\r\n * * knot values are mirrored around the middle of the\r\n */\r\n public reverseInPlace(): void { this._bcurve.reverseInPlace(); }\r\n /**\r\n * Return an array with this curve's bezier fragments.\r\n */\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 a BezierCurveBase for this curve. The concrete return type may be BezierCurve3d or BezierCurve3dH according to the instance type and the prefer3dH parameter.\r\n * @param spanIndex\r\n * @param prefer3dH true to force promotion to homogeneous.\r\n * @param result optional reusable curve. This will only be reused if it is a BezierCurve3d with matching order.\r\n */\r\n public abstract getSaturatedBezierSpan3dOr3dH(spanIndex: number, prefer3dH: boolean, result?: BezierCurveBase): BezierCurveBase | undefined;\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 its weighted (wx,wy,wz,w)\r\n */\r\n public abstract getPolePoint4d(poleIndex: number, result?: Point4d): Point4d | undefined;\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\r\n * @param result optional result\r\n */\r\n public abstract getPolePoint3d(poleIndex: number, result?: Point3d): Point3d | undefined;\r\n\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 *\r\n * * If the space point is exactly on the curve, this is the reverse of fractionToPoint.\r\n * * Since CurvePrimitive should always have start and end available as candidate points, this method should always succeed\r\n * @param spacePoint point in space\r\n * @param extend true to extend the curve (if possible)\r\n * @returns Returns a CurveLocationDetail structure that holds the details of the close point.\r\n */\r\n public override closestPoint(spacePoint: Point3d, _extend: boolean): 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 const result = CurveLocationDetail.createCurveFractionPointDistance(this, 0.0, point, point.distance(spacePoint));\r\n\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 // umm ... if the bspline 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\r\n /** Return a deep clone. */\r\n public abstract override clone(): BSplineCurve3dBase;\r\n\r\n /** Return a transformed deep clone. */\r\n public override cloneTransformed(transform: Transform): BSplineCurve3dBase {\r\n const curve1 = this.clone();\r\n curve1.tryTransformInPlace(transform);\r\n return curve1;\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): BSplineCurve3dBase {\r\n const 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\r\n if (origNumKnots === clone._bcurve.knots.knots.length)\r\n return clone; // full curve\r\n if (knotA > knotB) {\r\n const tmp = knotA; knotA = knotB; knotB = tmp;\r\n }\r\n\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\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`\r\n * @param plane A plane (e.g. specific type Plane3dByOriginAndUnitNormal or Point4d)\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 bspline poles in one array.\r\n for (let i = 0; i < numPole; i++) {\r\n allCoffs[i] = plane.weightedAltitude(this.getPolePoint4d(i, point4d)!);\r\n minMax.extendX(allCoffs[i]);\r\n }\r\n // A univariate bspline through the altitude poles gives altitude as function of the bspline 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 // When that occurs,\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 bspline 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.\r\n // 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 /**\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}\r\n/**\r\n * A BSplineCurve3d is a bspline curve whose poles are Point3d.\r\n * See BSplineCurve3dBase for description of knots, order, degree.\r\n * @public\r\n */\r\nexport class BSplineCurve3d extends BSplineCurve3dBase {\r\n\r\n private _workBezier?: BezierCurve3dH;\r\n private initializeWorkBezier(): BezierCurve3dH {\r\n if (this._workBezier === undefined)\r\n this._workBezier = BezierCurve3dH.createOrder(this.order);\r\n return this._workBezier;\r\n }\r\n /** test of `other` is an instance of BSplineCurve3d */\r\n public isSameGeometryClass(other: any): boolean { return other instanceof BSplineCurve3d; }\r\n /** Apply `transform` to the poles. */\r\n public tryTransformInPlace(transform: Transform): boolean { Point3dArray.multiplyInPlace(transform, this._bcurve.packedData); return true; }\r\n /** Get a pole as 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 /** Convert `spanIndex` and `localFraction` to a knot. */\r\n public spanFractionToKnot(span: number, localFraction: number): number {\r\n return this._bcurve.spanFractionToKnot(span, localFraction);\r\n }\r\n private constructor(numPoles: number, order: number, knots: KnotVector) {\r\n super(3, numPoles, order, knots);\r\n }\r\n /** Return a simple array of arrays with the control points as `[[x,y,z],[x,y,z],..]` */\r\n public copyPoints(): any[] { return Point3dArray.unpackNumbersToNestedArrays(this._bcurve.packedData, 3); }\r\n /** Return a simple array of the control points coordinates */\r\n public copyPointsFloat64Array(): Float64Array { return this._bcurve.packedData.slice(); }\r\n /**\r\n * return a simple array form of the knots. optionally replicate the first and last\r\n * in classic over-clamped manner\r\n */\r\n public override copyKnots(includeExtraEndKnot: boolean): number[] { return this._bcurve.knots.copyKnots(includeExtraEndKnot); }\r\n\r\n /** Create a bspline with uniform knots. */\r\n public static createUniformKnots(poles: Point3d[] | Float64Array | GrowableXYZArray, order: number): BSplineCurve3d | undefined {\r\n const numPoles = poles instanceof Float64Array ? poles.length / 3 : poles.length;\r\n if (order < 1 || 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) { curve._bcurve.packedData[i++] = p.x; curve._bcurve.packedData[i++] = p.y; curve._bcurve.packedData[i++] = p.z; }\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, and first and last poles should be distinct.\r\n */\r\n public static createPeriodicUniformKnots(poles: Point3d[] | Float64Array | GrowableXYZArray, order: number): BSplineCurve3d | undefined {\r\n const numPoles = poles instanceof Float64Array ? poles.length / 3 : poles.length;\r\n if (order < 1 || 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 for (let i = 0; i < 3 * numPoles; i++)\r\n curve._bcurve.packedData[i] = poles[i];\r\n for (let i = 0; i < 3 * degree; i++)\r\n curve._bcurve.packedData[3 * numPoles + i] = poles[i];\r\n } else if (poles instanceof GrowableXYZArray) {\r\n curve._bcurve.packedData = poles.float64Data().slice(0, 3 * numPoles);\r\n for (let i = 0; i < 3 * degree; i++)\r\n curve._bcurve.packedData[3 * numPoles + i] = poles.float64Data()[i];\r\n } else {\r\n let i = 0;\r\n for (const p of poles) { curve._bcurve.packedData[i++] = p.x; curve._bcurve.packedData[i++] = p.y; curve._bcurve.packedData[i++] = p.z; }\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 /**\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 /**\r\n *\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 bspline with given knots.\r\n *\r\n * * Two count conditions are recognized:\r\n *\r\n * ** If poleArray.length + order == knotArray.length, the first and last are assumed to be the\r\n * extraneous knots of classic clamping.\r\n * ** If poleArray.length + order == knotArray.length + 2, the knots are in modern form.\r\n *\r\n */\r\n public static create(poleArray: Float64Array | Point3d[], knotArray: Float64Array | number[], order: number): BSplineCurve3d | undefined {\r\n let numPoles = poleArray.length;\r\n if (poleArray instanceof Float64Array) {\r\n numPoles /= 3; // blocked as xyz\r\n }\r\n const numKnots = knotArray.length;\r\n // shift knots-of-interest limits for overclamped case ...\r\n const skipFirstAndLast = (numPoles + order === numKnots);\r\n if (order < 1 || numPoles < order)\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 if (poleArray instanceof Float64Array) {\r\n let i = 0;\r\n for (const coordinate of poleArray) { curve._bcurve.packedData[i++] = coordinate; }\r\n } else {\r\n let i = 0;\r\n for (const p of poleArray) { curve._bcurve.packedData[i++] = p.x; curve._bcurve.packedData[i++] = p.y; curve._bcurve.packedData[i++] = p.z; }\r\n }\r\n return curve;\r\n }\r\n /** Return a deep clone */\r\n public override clone(): BSplineCurve3d {\r\n const knotVector1 = this._bcurve.knots.clone();\r\n const curve1 = new BSplineCurve3d(this.numPoles, this.order, knotVector1);\r\n curve1._bcurve.packedData = this._bcurve.packedData.slice();\r\n return curve1;\r\n }\r\n\r\n /** Evaluate at a position given by fractional position within a span. */\r\n public evaluatePointInSpan(spanIndex: number, spanFraction: number): Point3d {\r\n this._bcurve.evaluateBuffersInSpan(spanIndex, spanFraction);\r\n return Point3d.createFrom(this._bcurve.poleBuffer);\r\n }\r\n /** Evaluate point and derivative vector at a position given by fractional position within a span.\r\n * * The derivative is with respect to the span fraction (NOT scaled to either global fraction or knot)\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 /** Evaluate at a position given by a knot value. */\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 /** Evaluate at a position given by a knot value. */\r\n public knotToPointAndDerivative(u: number, result?: Ray3d): Ray3d {\r\n this._bcurve.evaluateBuffersAtKnot(u, 1);\r\n if (!result) return Ray3d.createCapture(\r\n Point3d.createFrom(this._bcurve.poleBuffer),\r\n Vector3d.createFrom(this._bcurve.poleBuffer1));\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 at a position given by a knot value. Return point with 2 derivatives. */\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], result);\r\n }\r\n\r\n /** test if 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 is entirely within plane. */\r\n public isInPlane(plane: Plane3dByOriginAndUnitNormal): boolean {\r\n return Point3dArray.isCloseToPlane(this._bcurve.packedData, plane);\r\n }\r\n /** Return the control polygon length as approximation (always overestimate) of the curve length. */\r\n public quickLength(): number { return Point3dArray.sumEdgeLengths(this._bcurve.packedData); }\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 needBeziers = handler.announceBezierCurve !== undefined;\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 (needBeziers) {\r\n handler.announceBezierCurve!(bezier, numStrokes, 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 } else {\r\n handler.announceIntervalForUniformStepStrokes(this, 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.getSaturatedBezierSpan3dH(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\r\n for (let spanIndex = 0; spanIndex < numSpan; spanIndex++) {\r\n const bezier = this.getSaturatedBezierSpan3dH(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 a 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.getSaturatedBezierSpan3dH(spanIndex, workBezier);\r\n if (bezier)\r\n bezier.emitStrokes(dest, options);\r\n }\r\n }\r\n /**\r\n * Test knots, control points, and wrappable flag to see if all agree for a possible wrapping.\r\n * @returns the manner of closing. Se BSplineWrapMode for particulars of each mode.\r\n *\r\n */\r\n public get isClosable(): 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.testCloseablePolygon(mode))\r\n return BSplineWrapMode.None;\r\n return mode;\r\n }\r\n /**\r\n * Return a BezierCurveBase for this curve. The concrete return type may be BezierCurve3d or BezierCurve3dH according to this type.\r\n * @param spanIndex\r\n * @param result optional reusable curve. This will only be reused if it is a BezierCurve3d with matching order.\r\n */\r\n public getSaturatedBezierSpan3dOr3dH(spanIndex: number, prefer3dH: boolean, result?: BezierCurveBase): 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 /**\r\n * Return a CurvePrimitive (which is a BezierCurve3d) for a specified span of this curve.\r\n * @param spanIndex\r\n * @param result optional reusable curve. This will only be reused if it is a BezierCurve3d with matching order.\r\n */\r\n public getSaturatedBezierSpan3d(spanIndex: number, result?: BezierCurveBase): BezierCurveBase | undefined {\r\n if (spanIndex < 0 || spanIndex >= this.numSpan)\r\n return undefined;\r\n\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 result;\r\n return undefined;\r\n }\r\n /**\r\n * Return a CurvePrimitive (which is a BezierCurve3dH) for a specified span of this curve.\r\n * @param spanIndex\r\n * @param result optional reusable curve. This will only be reused if it is a BezierCurve3d with matching order.\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\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\r\n /**\r\n * Set the flag indicating the bspline might be suitable for having wrapped \"closed\" interpretation.\r\n */\r\n public override setWrappable(value: BSplineWrapMode) {\r\n this._bcurve.knots.wrappable = value;\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 in includes the range of this curve\r\n * * REMARK: this is based on the poles, not the exact curve. This is generally larger than the true curve range.\r\n * @param rangeToExtend\r\n * @param transform transform to apply to points 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}\r\n"]}
1
+ {"version":3,"file":"BSplineCurve.js","sourceRoot":"","sources":["../../../src/bspline/BSplineCurve.ts"],"names":[],"mappings":"AAAA;;;+FAG+F;AAC/F;;GAEG;AAEH,2CAA2C;AAC3C,OAAO,EAAE,iBAAiB,EAAE,mBAAmB,EAAE,MAAM,8BAA8B,CAAC;AACtF,OAAO,EAAE,cAAc,EAAE,MAAM,yBAAyB,CAAC;AAEzD,OAAO,EAAE,cAAc,EAAE,MAAM,+BAA+B,CAAC;AAE/D,OAAO,EAAE,QAAQ,EAA0B,MAAM,aAAa,CAAC;AAE/D,OAAO,EAAE,gBAAgB,EAAE,MAAM,gCAAgC,CAAC;AAElE,OAAO,EAAE,yBAAyB,EAAE,MAAM,yCAAyC,CAAC;AACpF,8EAA8E;AAC9E,OAAO,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,+BAA+B,CAAC;AAClE,OAAO,EAAE,YAAY,EAAE,MAAM,4BAA4B,CAAC;AAC1D,OAAO,EAAE,OAAO,EAAW,MAAM,qBAAqB,CAAC;AACvD,OAAO,EAAE,KAAK,EAAE,MAAM,qBAAqB,CAAC;AAE5C,OAAO,EAAE,OAAO,EAAE,MAAM,uBAAuB,CAAC;AAChD,OAAO,EAAE,gBAAgB,EAAE,MAAM,+BAA+B,CAAC;AAEjE,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAC1C,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAChD,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAElD,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAC5C,OAAO,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AAEpD,OAAO,EAAE,eAAe,EAAE,UAAU,EAA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AC,OAAO,CAAC,UAAU,EAAE,SAAS,EAAE,GAAG,CAAC,CAAC;QAC1E,IAAI,MAAM,CAAC,eAAe,CAAC,IAAI,CAAC,OAAO,CAAC,KAAK,EAAE,SAAS,CAAC;YACvD,OAAO,MAAM,CAAC;QAChB,OAAO,SAAS,CAAC;IACnB,CAAC;IAED;;OAEG;IACa,YAAY,CAAC,KAAsB;QACjD,IAAI,CAAC,OAAO,CAAC,KAAK,CAAC,SAAS,GAAG,KAAK,CAAC;IACvC,CAAC;IACD,iFAAiF;IAC1E,yBAAyB,CAAC,OAAwB;QACvD,OAAO,OAAO,CAAC,oBAAoB,CAAC,IAAI,CAAC,CAAC;IAC5C,CAAC;IACD;;;;;OAKG;IACI,WAAW,CAAC,aAAsB,EAAE,SAAqB;QAC9D,MAAM,MAAM,GAAG,IAAI,CAAC,OAAO,CAAC,UAAU,CAAC;QACvC,MAAM,CAAC,GAAG,MAAM,CAAC,MAAM,GAAG,CAAC,CAAC;QAC5B,IAAI,SAAS,EAAE;YACb,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;SAC7F;aAAM;YACL,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;SACvE;IACH,CAAC;CAEF","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 { CurveIntervalRole, CurveLocationDetail } from \"../curve/CurveLocationDetail\";\r\nimport { CurvePrimitive } from \"../curve/CurvePrimitive\";\r\nimport { LineString3d } from \"../curve/LineString3d\";\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\n/* eslint-disable @typescript-eslint/naming-convention, no-empty, no-console*/\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\nimport { CurveOffsetXYHandler } from \"../curve/internalContexts/CurveOffsetXYHandler\";\r\nimport { OffsetOptions } from \"../curve/internalContexts/PolygonOffsetContext\";\r\n\r\n/**\r\n * Base class for BSplineCurve3d and BSplineCurve3dH.\r\n * * A bspline curve consists of a set of knots and a set of poles.\r\n * * The bspline curve is a function of the independent \"knot axis\" variable\r\n * * The curve \"follows\" the poles loosely.\r\n * * The is a set of polynomial spans.\r\n * * The polynomial spans all have same `degree`.\r\n * * Within each span, the polynomial of that `degree` is controlled by `order = degree + 1` contiguous points called poles.\r\n * * The 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 given `spanIndex`:\r\n * * The `order` poles begin at index `spanIndex`.\r\n * * The `2*order` knots begin as span index\r\n * * The knot interval for this span is from `knot[degree+span-1] to knot[degree+span]`\r\n * * The active part of the knot axis is `knot[degree-1] < knot < knot[degree-1 + numSpan]` i.e. `knot[degree-1] < knot < knot[numPoles]\r\n *\r\n * Nearly all bsplines are \"clamped \".\r\n * * Clamping make the curve pass through its first and last poles, with tangents directed along the first and last edges of the control polygon.\r\n * * The knots for a clamped bspline have `degree` copies of the lowest knot value and `degree` copies of the highest knot value.\r\n * * For instance, the knot vector `[0,0,0,1,2,3,3,3]\r\n * * can be evaluated from `0<=knot<=3`\r\n * * has 3 spans: 0 to 1, 1 to 2, 2 to 3\r\n * * has 6 poles\r\n * * passes through its first and last poles.\r\n * * `create` methods may allow classic convention that has an extra knot at the beginning and end of the knot vector.\r\n * * The extra knots (first and last) were never referenced by the bspline recurrence relations.\r\n * * When the `create` methods recognize the classic setup (`numPoles + order = numKnots`), the extra knot is not saved with the BSplineCurve3dBase knots.\r\n *\r\n * * The weighted variant has the problem that CurvePrimitive 3d typing does not allow undefined result where Point4d has zero weight.\r\n * * The convention for these is to return 000 in such places.\r\n *\r\n * * Note the class relationships:\r\n * * BSpline1dNd knows the bspline recurrence relations for control points (poles) with no physical meaning.\r\n * * BsplineCurve3dBase owns a protected BSpline1dNd\r\n * * BsplineCurve3dBase is derived from CurvePrimitive, which creates obligation to act as a 3D curve, such as\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 need to have certain leading knots and poles replicated at the end\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\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) { this._definitionData = data; }\r\n public get definitionData(): any { return this._definitionData; }\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) as BSpline1dNd;\r\n }\r\n /** Return the degree (one less than the order) of the curve */\r\n public get degree(): number { return this._bcurve.degree; }\r\n /** Return the order (one more than degree) of the curve */\r\n public get order(): number { return this._bcurve.order; }\r\n /** Return the number of bezier spans in the curve. Note that this number includes the number of null spans at repeated knows */\r\n public get numSpan(): number { return this._bcurve.numSpan; }\r\n /** Return the number of poles */\r\n public get numPoles(): number { return this._bcurve.numPoles; }\r\n /**\r\n * return a simple array form of the knots. optionally replicate the first and last\r\n * in classic over-clamped manner\r\n */\r\n public copyKnots(includeExtraEndKnot: boolean): number[] { return this._bcurve.knots.copyKnots(includeExtraEndKnot); }\r\n\r\n /**\r\n * Set the flag indicating the bspline might be suitable for having wrapped \"closed\" interpretation.\r\n */\r\n public setWrappable(value: BSplineWrapMode) {\r\n this._bcurve.knots.wrappable = value;\r\n }\r\n\r\n /** Evaluate at a position given by fractional position within a span. */\r\n public abstract evaluatePointInSpan(spanIndex: number, spanFraction: number, result?: Point3d): Point3d;\r\n /** Evaluate at a position given by fractional position within a span. */\r\n public abstract evaluatePointAndDerivativeInSpan(spanIndex: number, spanFraction: number, result?: Ray3d): Ray3d;\r\n /** Evaluate xyz at a position given by knot. */\r\n public abstract knotToPoint(knot: number, result?: Point3d): Point3d;\r\n /** Evaluate xyz and derivative at position given by a knot value. */\r\n public abstract knotToPointAndDerivative(knot: number, result?: Ray3d): Ray3d;\r\n /** Evaluate xyz and 2 derivatives at position given by a knot value. */\r\n public abstract knotToPointAnd2Derivatives(knot: number, result?: Plane3dByOriginAndVectors): Plane3dByOriginAndVectors;\r\n /** Evaluate the curve point at `fraction` */\r\n public fractionToPoint(fraction: number, result?: Point3d): Point3d {\r\n return this.knotToPoint(this._bcurve.knots.fractionToKnot(fraction), result);\r\n }\r\n /** Construct a ray with\r\n * * origin at the fractional position along the arc\r\n * * direction is the first derivative, i.e. tangent along the curve\r\n */\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\r\n /** Construct a plane with\r\n * * origin at the fractional position along the arc\r\n * * x axis is the first derivative, i.e. tangent along the curve\r\n * * y axis is the second derivative\r\n */\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 /**\r\n * Return the start point of the curve.\r\n */\r\n public override startPoint(): Point3d { return this.evaluatePointInSpan(0, 0.0); }\r\n /**\r\n * Return the end point of the curve\r\n */\r\n public override endPoint(): Point3d { return this.evaluatePointInSpan(this.numSpan - 1, 1.0); }\r\n /** Reverse the curve in place.\r\n * * Poles are reversed\r\n * * knot values are mirrored around the middle of the\r\n */\r\n public reverseInPlace(): void { this._bcurve.reverseInPlace(); }\r\n /**\r\n * Return an array with this curve's bezier fragments.\r\n */\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 a BezierCurveBase for this curve. The concrete return type may be BezierCurve3d or BezierCurve3dH according to the instance type and the prefer3dH parameter.\r\n * @param spanIndex\r\n * @param prefer3dH true to force promotion to homogeneous.\r\n * @param result optional reusable curve. This will only be reused if it is a BezierCurve3d with matching order.\r\n */\r\n public abstract getSaturatedBezierSpan3dOr3dH(spanIndex: number, prefer3dH: boolean, result?: BezierCurveBase): BezierCurveBase | undefined;\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 its weighted (wx,wy,wz,w)\r\n */\r\n public abstract getPolePoint4d(poleIndex: number, result?: Point4d): Point4d | undefined;\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\r\n * @param result optional result\r\n */\r\n public abstract getPolePoint3d(poleIndex: number, result?: Point3d): Point3d | undefined;\r\n\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 *\r\n * * If the space point is exactly on the curve, this is the reverse of fractionToPoint.\r\n * * Since CurvePrimitive should always have start and end available as candidate points, this method should always succeed\r\n * @param spacePoint point in space\r\n * @param _extend ignored. A BSplineCurve3dBase cannot be extended.\r\n * @returns Returns a CurveLocationDetail structure that holds the details of the close point.\r\n */\r\n public override closestPoint(spacePoint: Point3d, _extend: boolean): 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 const result = CurveLocationDetail.createCurveFractionPointDistance(this, 0.0, point, point.distance(spacePoint));\r\n\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 // umm ... if the bspline 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\r\n /** Return a deep clone. */\r\n public abstract override clone(): BSplineCurve3dBase;\r\n\r\n /** Return a transformed deep clone. */\r\n public override cloneTransformed(transform: Transform): BSplineCurve3dBase {\r\n const curve1 = this.clone();\r\n curve1.tryTransformInPlace(transform);\r\n return curve1;\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): BSplineCurve3dBase {\r\n const 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\r\n if (origNumKnots === clone._bcurve.knots.knots.length)\r\n return clone; // full curve\r\n if (knotA > knotB) {\r\n const tmp = knotA; knotA = knotB; knotB = tmp;\r\n }\r\n\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\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`\r\n * @param plane A plane (e.g. specific type Plane3dByOriginAndUnitNormal or Point4d)\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 bspline poles in one array.\r\n for (let i = 0; i < numPole; i++) {\r\n allCoffs[i] = plane.weightedAltitude(this.getPolePoint4d(i, point4d)!);\r\n minMax.extendX(allCoffs[i]);\r\n }\r\n // A univariate bspline through the altitude poles gives altitude as function of the bspline 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 // When that occurs,\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 bspline 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.\r\n // 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 /**\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}\r\n/**\r\n * A BSplineCurve3d is a bspline curve whose poles are Point3d.\r\n * See BSplineCurve3dBase for description of knots, order, degree.\r\n * @public\r\n */\r\nexport class BSplineCurve3d extends BSplineCurve3dBase {\r\n\r\n private _workBezier?: BezierCurve3dH;\r\n private initializeWorkBezier(): BezierCurve3dH {\r\n if (this._workBezier === undefined)\r\n this._workBezier = BezierCurve3dH.createOrder(this.order);\r\n return this._workBezier;\r\n }\r\n /** test of `other` is an instance of BSplineCurve3d */\r\n public isSameGeometryClass(other: any): boolean { return other instanceof BSplineCurve3d; }\r\n /** Apply `transform` to the poles. */\r\n public tryTransformInPlace(transform: Transform): boolean { Point3dArray.multiplyInPlace(transform, this._bcurve.packedData); return true; }\r\n /** Get a pole as 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 /** Convert `spanIndex` and `localFraction` to a knot. */\r\n public spanFractionToKnot(span: number, localFraction: number): number {\r\n return this._bcurve.spanFractionToKnot(span, localFraction);\r\n }\r\n private constructor(numPoles: number, order: number, knots: KnotVector) {\r\n super(3, numPoles, order, knots);\r\n }\r\n /** Return a simple array of arrays with the control points as `[[x,y,z],[x,y,z],..]` */\r\n public copyPoints(): any[] { return Point3dArray.unpackNumbersToNestedArrays(this._bcurve.packedData, 3); }\r\n /** Return a simple array of the control points coordinates */\r\n public copyPointsFloat64Array(): Float64Array { return this._bcurve.packedData.slice(); }\r\n /**\r\n * return a simple array form of the knots. optionally replicate the first and last\r\n * in classic over-clamped manner\r\n */\r\n public override copyKnots(includeExtraEndKnot: boolean): number[] { return this._bcurve.knots.copyKnots(includeExtraEndKnot); }\r\n\r\n /** Create a bspline with uniform knots. */\r\n public static createUniformKnots(poles: Point3d[] | Float64Array | GrowableXYZArray, order: number): BSplineCurve3d | undefined {\r\n const numPoles = poles instanceof Float64Array ? poles.length / 3 : poles.length;\r\n if (order < 1 || 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) { curve._bcurve.packedData[i++] = p.x; curve._bcurve.packedData[i++] = p.y; curve._bcurve.packedData[i++] = p.z; }\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, and first and last poles should be distinct.\r\n */\r\n public static createPeriodicUniformKnots(poles: Point3d[] | Float64Array | GrowableXYZArray, order: number): BSplineCurve3d | undefined {\r\n const numPoles = poles instanceof Float64Array ? poles.length / 3 : poles.length;\r\n if (order < 1 || 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 for (let i = 0; i < 3 * numPoles; i++)\r\n curve._bcurve.packedData[i] = poles[i];\r\n for (let i = 0; i < 3 * degree; i++)\r\n curve._bcurve.packedData[3 * numPoles + i] = poles[i];\r\n } else if (poles instanceof GrowableXYZArray) {\r\n curve._bcurve.packedData = poles.float64Data().slice(0, 3 * numPoles);\r\n for (let i = 0; i < 3 * degree; i++)\r\n curve._bcurve.packedData[3 * numPoles + i] = poles.float64Data()[i];\r\n } else {\r\n let i = 0;\r\n for (const p of poles) { curve._bcurve.packedData[i++] = p.x; curve._bcurve.packedData[i++] = p.y; curve._bcurve.packedData[i++] = p.z; }\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 /**\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 /**\r\n *\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 bspline with given knots.\r\n *\r\n * * Two count conditions are recognized:\r\n *\r\n * ** If poleArray.length + order == knotArray.length, the first and last are assumed to be the\r\n * extraneous knots of classic clamping.\r\n * ** If poleArray.length + order == knotArray.length + 2, the knots are in modern form.\r\n *\r\n */\r\n public static create(poleArray: Float64Array | Point3d[], knotArray: Float64Array | number[], order: number): BSplineCurve3d | undefined {\r\n let numPoles = poleArray.length;\r\n if (poleArray instanceof Float64Array) {\r\n numPoles /= 3; // blocked as xyz\r\n }\r\n const numKnots = knotArray.length;\r\n // shift knots-of-interest limits for overclamped case ...\r\n const skipFirstAndLast = (numPoles + order === numKnots);\r\n if (order < 1 || numPoles < order)\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 if (poleArray instanceof Float64Array) {\r\n let i = 0;\r\n for (const coordinate of poleArray) { curve._bcurve.packedData[i++] = coordinate; }\r\n } else {\r\n let i = 0;\r\n for (const p of poleArray) { curve._bcurve.packedData[i++] = p.x; curve._bcurve.packedData[i++] = p.y; curve._bcurve.packedData[i++] = p.z; }\r\n }\r\n return curve;\r\n }\r\n /** Return a deep clone */\r\n public override clone(): BSplineCurve3d {\r\n const knotVector1 = this._bcurve.knots.clone();\r\n const curve1 = new BSplineCurve3d(this.numPoles, this.order, knotVector1);\r\n curve1._bcurve.packedData = this._bcurve.packedData.slice();\r\n return curve1;\r\n }\r\n\r\n /** Evaluate at a position given by fractional position within a span. */\r\n public evaluatePointInSpan(spanIndex: number, spanFraction: number): Point3d {\r\n this._bcurve.evaluateBuffersInSpan(spanIndex, spanFraction);\r\n return Point3d.createFrom(this._bcurve.poleBuffer);\r\n }\r\n /** Evaluate point and derivative vector at a position given by fractional position within a span.\r\n * * The derivative is with respect to the span fraction (NOT scaled to either global fraction or knot)\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 /** Evaluate at a position given by a knot value. */\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 /** Evaluate at a position given by a knot value. */\r\n public knotToPointAndDerivative(u: number, result?: Ray3d): Ray3d {\r\n this._bcurve.evaluateBuffersAtKnot(u, 1);\r\n if (!result) return Ray3d.createCapture(\r\n Point3d.createFrom(this._bcurve.poleBuffer),\r\n Vector3d.createFrom(this._bcurve.poleBuffer1));\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 at a position given by a knot value. Return point with 2 derivatives. */\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], result);\r\n }\r\n\r\n /** test if 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 is entirely within plane. */\r\n public isInPlane(plane: Plane3dByOriginAndUnitNormal): boolean {\r\n return Point3dArray.isCloseToPlane(this._bcurve.packedData, plane);\r\n }\r\n /** Return the control polygon length as approximation (always overestimate) of the curve length. */\r\n public quickLength(): number { return Point3dArray.sumEdgeLengths(this._bcurve.packedData); }\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 needBeziers = handler.announceBezierCurve !== undefined;\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 (needBeziers) {\r\n handler.announceBezierCurve!(bezier, numStrokes, 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 } else {\r\n handler.announceIntervalForUniformStepStrokes(this, 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.getSaturatedBezierSpan3dH(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\r\n for (let spanIndex = 0; spanIndex < numSpan; spanIndex++) {\r\n const bezier = this.getSaturatedBezierSpan3dH(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 a 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.getSaturatedBezierSpan3dH(spanIndex, workBezier);\r\n if (bezier)\r\n bezier.emitStrokes(dest, options);\r\n }\r\n }\r\n /**\r\n * Test knots, control points, and wrappable flag to see if all agree for a possible wrapping.\r\n * @returns the manner of closing. Se BSplineWrapMode for particulars of each mode.\r\n *\r\n */\r\n public get isClosable(): 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.testCloseablePolygon(mode))\r\n return BSplineWrapMode.None;\r\n return mode;\r\n }\r\n /**\r\n * Return a BezierCurveBase for this curve. The concrete return type may be BezierCurve3d or BezierCurve3dH according to this type.\r\n * @param spanIndex\r\n * @param result optional reusable curve. This will only be reused if it is a BezierCurve3d with matching order.\r\n */\r\n public getSaturatedBezierSpan3dOr3dH(spanIndex: number, prefer3dH: boolean, result?: BezierCurveBase): 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 /**\r\n * Return a CurvePrimitive (which is a BezierCurve3d) for a specified span of this curve.\r\n * @param spanIndex\r\n * @param result optional reusable curve. This will only be reused if it is a BezierCurve3d with matching order.\r\n */\r\n public getSaturatedBezierSpan3d(spanIndex: number, result?: BezierCurveBase): BezierCurveBase | undefined {\r\n if (spanIndex < 0 || spanIndex >= this.numSpan)\r\n return undefined;\r\n\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 result;\r\n return undefined;\r\n }\r\n /**\r\n * Return a CurvePrimitive (which is a BezierCurve3dH) for a specified span of this curve.\r\n * @param spanIndex\r\n * @param result optional reusable curve. This will only be reused if it is a BezierCurve3d with matching order.\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\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\r\n /**\r\n * Set the flag indicating the bspline might be suitable for having wrapped \"closed\" interpretation.\r\n */\r\n public override setWrappable(value: BSplineWrapMode) {\r\n this._bcurve.knots.wrappable = value;\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 in includes the range of this curve\r\n * * REMARK: this is based on the poles, not the exact curve. This is generally larger than the true curve range.\r\n * @param rangeToExtend\r\n * @param transform transform to apply to points 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}\r\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"KnotVector.d.ts","sourceRoot":"","sources":["../../../src/bspline/KnotVector.ts"],"names":[],"mappings":"AAIA;;GAEG;AAOH;;;;;;GAMG;AACH,oBAAY,eAAe;IACzB,gCAAgC;IAChC,IAAI,IAAI;IACR;;;OAGG;IACH,yBAAyB,IAAI;IAC7B;;;OAGG;IACH,mBAAmB,IAAI;CACxB;AACD;;;;;;;;;;;;;;GAcG;AACH,qBAAa,UAAU;IACrB,uCAAuC;IAChC,KAAK,EAAE,YAAY,CAAC;IAC3B,mEAAmE;IAC5D,MAAM,EAAE,MAAM,CAAC;IACtB,OAAO,CAAC,MAAM,CAAS;IACvB,OAAO,CAAC,MAAM,CAAS;IAEvB,OAAO,CAAC,SAAS,CAAC,CAAkB;IACpC,0DAA0D;IAC1D,gBAAuB,aAAa,QAAU;IAC9C,+FAA+F;IAC/F,IAAW,QAAQ,WAA0B;IAC7C,gGAAgG;IAChG,IAAW,SAAS,WAA0B;IAC9C,mEAAmE;IACnE,IAAW,aAAa,WAA8B;IACtD,oEAAoE;IACpE,IAAW,cAAc,WAA8C;IACvE,mLAAmL;IACnL,IAAW,SAAS,IACQ,eAAe,CAD4D;IACvG,IAAW,SAAS,CAAC,KAAK,EAAE,eAAe,EAA6B;IACxE,iHAAiH;IACjH,IAAW,QAAQ,WAAuD;IAC1E;;;;;;OAMG;IACH,OAAO;IAkBP,iDAAiD;IAC1C,KAAK,IAAI,UAAU;IA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OAAO,GAAG,MAAM,EAAE;CAyBzD"}
@@ -279,11 +279,13 @@ export class KnotVector {
279
279
  /** Convert localFraction within the interval following an indexed knot to a knot value. */
280
280
  baseKnotFractionToKnot(knotIndex0, localFraction) {
281
281
  const knot0 = this.knots[knotIndex0];
282
+ localFraction = Geometry.clamp(localFraction, 0, 1);
282
283
  return knot0 + localFraction * (this.knots[knotIndex0 + 1] - knot0);
283
284
  }
284
285
  /** Convert localFraction within an indexed bezier span to a knot value. */
285
286
  spanFractionToKnot(spanIndex, localFraction) {
286
287
  const k = this.spanIndexToLeftKnotIndex(spanIndex);
288
+ localFraction = Geometry.clamp(localFraction, 0, 1);
287
289
  return this.knots[k] + localFraction * (this.knots[k + 1] - this.knots[k]);
288
290
  }
289
291
  /** Convert localFraction within an indexed bezier span to fraction of active knot range. */
@@ -293,6 +295,7 @@ export class KnotVector {
293
295
  }
294
296
  /** Return fraction of active knot range to knot value. */
295
297
  fractionToKnot(fraction) {
298
+ fraction = Geometry.clamp(fraction, 0, 1); // B-splines are not extendable
296
299
  return Geometry.interpolate(this.knots[this.degree - 1], fraction, this.knots[this.knots.length - this.degree]);
297
300
  }
298
301
  /**
@@ -1 +1 @@
1
- {"version":3,"file":"KnotVector.js","sourceRoot":"","sources":["../../../src/bspline/KnotVector.ts"],"names":[],"mappings":"AAAA;;;+FAG+F;AAC/F;;GAEG;AAEH,2CAA2C;AAC3C,8EAA8E;AAC9E,OAAO,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AACvC,OAAO,EAAE,WAAW,EAAE,MAAM,4BAA4B,CAAC;AAEzD;;;;;;GAMG;AACH,MAAM,CAAN,IAAY,eAaX;AAbD,WAAY,eAAe;IACzB,gCAAgC;IAChC,qDAAQ,CAAA;IACR;;;OAGG;IACH,+FAA6B,CAAA;IAC7B;;;OAGG;IACH,mFAAuB,CAAA;AACzB,CAAC,EAbW,eAAe,KAAf,eAAe,QAa1B;AACD;;;;;;;;;;;;;;GAcG;AACH,MAAM,OAA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C,MAAM,EAAE,GAAG,IAAI,CAAC,QAAQ,CAAC;QACzB,MAAM,EAAE,GAAG,IAAI,CAAC,SAAS,CAAC;QAC1B,MAAM,KAAK,GAAG,EAAE,GAAG,EAAE,CAAC;QACtB,MAAM,MAAM,GAAG,IAAI,CAAC,MAAM,CAAC;QAC3B,MAAM,MAAM,GAAa,EAAE,CAAC;QAC5B,IAAI,mBAAmB,EAAE;YACvB,IAAI,IAAI,EAAE;gBACR,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,KAAK,CAAC,UAAU,GAAG,MAAM,CAAC,GAAG,KAAK,CAAC,CAAC;aACtD;iBAAM;gBACL,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC;aAC5B;SACF;QACD,KAAK,MAAM,CAAC,IAAI,IAAI,CAAC,KAAK;YAAE,MAAM,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;QAC3C,IAAI,mBAAmB,EAAE;YACvB,IAAI,IAAI,EAAE;gBACR,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,KAAK,CAAC,SAAS,GAAG,MAAM,CAAC,GAAG,KAAK,CAAC,CAAC;aACrD;;gBACC,MAAM,CAAC,IAAI,CAAC,MAAM,CAAC,MAAM,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,CAAC;SAC1C;QACD,OAAO,MAAM,CAAC;IAChB,CAAC;;AA1aD,0DAA0D;AACnC,wBAAa,GAAG,MAAM,CAAC","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\n/* eslint-disable @typescript-eslint/naming-convention, no-empty, no-console*/\r\nimport { Geometry } from \"../Geometry\";\r\nimport { NumberArray } from \"../geometry3d/PointHelpers\";\r\n\r\n/**\r\n * Enumeration of the possible ways of converting a \"periodic\" knot vector to an open knot vector.\r\n * None (0) ==> no wrap possible\r\n * OpenByAddingControlPoints (1) ==> wrapped by adding poles\r\n * OpenByRemovingKnots (2) ==> wrapped by deleting extreme knots.\r\n * @public\r\n */\r\nexport enum BSplineWrapMode {\r\n /** No conversion to periodic */\r\n None = 0,\r\n /** Convert to periodic by removing control points. This is typical for closed bcurve constructed by control points with maximum continuity.\r\n * * Knots stay the same in open and periodic form.\r\n * * Periodic form omits {degree} control points.\r\n */\r\n OpenByAddingControlPoints = 1,\r\n /** Convert to periodic by adding special knots. This is typical of closed bcurve constructed as exact circular or elliptic arc\r\n * * 2 knots on each end are omitted in open form\r\n * * poles stay the same.\r\n */\r\n OpenByRemovingKnots = 2,\r\n}\r\n/**\r\n * Array of non-decreasing numbers acting as a knot array for bsplines.\r\n *\r\n * * Essential identity: numKnots = numPoles + order - 2 = numPoles + degree - 1\r\n * * Various bspline libraries have confusion over how many \"end knots\" are needed. \"Many\" libraries (including MicroStation)\r\n * incorrectly demand \"order\" knots at each end for clamping. But only \"order - 1\" are really needed.\r\n * * This class uses the \"order-1\" convention.\r\n * * This class provides queries to convert among spanIndex and knotIndex\r\n * * A span is a single interval of the knots.\r\n * * The left knot of span {k} is knot {k+degree-1}\r\n * * This class provides queries to convert among spanFraction, fraction of knot range, and knot\r\n * * core computations (evaluateBasisFunctions) have leftKnotIndex and global knot value as inputs. Callers need to\r\n * know their primary values (global knot, spanFraction).\r\n * @public\r\n */\r\nexport class KnotVector {\r\n /** The simple array of knot values. */\r\n public knots: Float64Array;\r\n /** Return the degree of basis functions defined in these knots. */\r\n public degree: number;\r\n private _knot0: number;\r\n private _knot1: number;\r\n\r\n private _wrapMode?: BSplineWrapMode;\r\n /** tolerance for considering two knots to be the same. */\r\n public static readonly knotTolerance = 1.0e-9;\r\n /** Return the leftmost knot value (of the active interval, ignoring unclamped leading knots)*/\r\n public get leftKnot() { return this._knot0; }\r\n /** Return the rightmost knot value (of the active interval, ignoring unclamped leading knots)*/\r\n public get rightKnot() { return this._knot1; }\r\n /** Return the index of the leftmost knot of the active interval */\r\n public get leftKnotIndex() { return this.degree - 1; }\r\n /** Return the index of the rightmost knot of the active interval */\r\n public get rightKnotIndex() { return this.knots.length - this.degree; }\r\n /** Whether the bspline was created by adding poles into \"closed\" structure. This is used by serialize/deserialize to mark knotVector's that were converted from periodic style. */\r\n public get wrappable() { return this._wrapMode === undefined ? BSplineWrapMode.None : this._wrapMode; }\r\n public set wrappable(value: BSplineWrapMode) { this._wrapMode = value; }\r\n /** Return the number of bezier spans. Note that this includes zero-length spans if there are repeated knots. */\r\n public get numSpans() { return this.rightKnotIndex - this.leftKnotIndex; }\r\n /**\r\n *\r\n * * If knots is a number array or Float64Array, the those values become the local knot array.\r\n * * If knots is a simple number, the local knot array is allocated to that size but left as zeros.\r\n * @param knots\r\n * @param degree\r\n */\r\n private constructor(knots: number[] | Float64Array | number, degree: number, wrapMode?: BSplineWrapMode) {\r\n this.degree = degree;\r\n this._wrapMode = wrapMode;\r\n // default values to satisfy compiler -- real values hapn setupFixedValues or final else defers to user\r\n this._knot0 = 0.0;\r\n this._knot1 = 1.0;\r\n // satisfy the initialize checker ..\r\n if (Array.isArray(knots)) { // remark: This ctor is private. The callers (as of April 2019) do not use this path.\r\n this.knots = new Float64Array(knots.length);\r\n this.setKnots(knots);\r\n this.setupFixedValues();\r\n } else if (knots instanceof Float64Array) {\r\n this.knots = knots.slice();\r\n this.setupFixedValues();\r\n } else { // caller is responsible for filling array separately ...\r\n this.knots = new Float64Array(knots);\r\n }\r\n }\r\n /** copy degree and knots to a new KnotVector. */\r\n public clone(): KnotVector { return new KnotVector(this.knots, this.degree, this.wrappable); }\r\n private setupFixedValues() {\r\n // These should be read-only . ..\r\n this._knot0 = this.knots[this.degree - 1];\r\n this._knot1 = this.knots[this.knots.length - this.degree];\r\n }\r\n /** Return the total knot distance from beginning to end. */\r\n public get knotLength01(): number { return this._knot1 - this._knot0; }\r\n /**\r\n * Returns true if all numeric values have wraparound conditions for \"closed\" knotVector with specified wrap mode\r\n * @param mode optional test mode. If undefined, use the this.wrappable.\r\n */\r\n public testClosable(mode?: BSplineWrapMode): boolean {\r\n if (mode === undefined)\r\n mode = this.wrappable;\r\n const leftKnotIndex = this.leftKnotIndex;\r\n const rightKnotIndex = this.rightKnotIndex;\r\n const period = this.rightKnot - this.leftKnot;\r\n const degree = this.degree;\r\n const indexDelta = rightKnotIndex - leftKnotIndex;\r\n // maximum continuity mode . . .\r\n if (mode === BSplineWrapMode.OpenByAddingControlPoints) {\r\n for (let k0 = leftKnotIndex - degree + 1; k0 < leftKnotIndex + degree - 1; k0++) {\r\n const k1 = k0 + indexDelta;\r\n if (!Geometry.isSameCoordinate(this.knots[k0] + period, this.knots[k1]))\r\n return false;\r\n }\r\n return true;\r\n }\r\n // arc mode ...\r\n if (mode === BSplineWrapMode.OpenByRemovingKnots) {\r\n // we expect {degree} replicated knots at each end . . .\r\n const numRepeated = degree - 1;\r\n const leftKnot = this.knots[leftKnotIndex];\r\n const rightKnot = this.knots[rightKnotIndex];\r\n for (let i = 0; i < numRepeated; i++) {\r\n if (!Geometry.isSameCoordinate(leftKnot, this.knots[leftKnotIndex - i - 1]))\r\n return false;\r\n if (!Geometry.isSameCoordinate(rightKnot, this.knots[rightKnotIndex + i + 1]))\r\n return false;\r\n }\r\n return true;\r\n }\r\n\r\n return false;\r\n }\r\n /** Test matching degree and knot values */\r\n public isAlmostEqual(other: KnotVector): boolean {\r\n if (this.degree !== other.degree) return false;\r\n return NumberArray.isAlmostEqual(this.knots, other.knots, KnotVector.knotTolerance);\r\n }\r\n\r\n /** Compute the multiplicity of the input knot, or zero if not a knot. */\r\n public getKnotMultiplicity(knot: number): number {\r\n let m = 0;\r\n for (const k of this.knots) {\r\n if (Math.abs(k - knot) < KnotVector.knotTolerance)\r\n ++m;\r\n else if (knot < k)\r\n break;\r\n }\r\n return m;\r\n }\r\n\r\n /** Compute the multiplicity of the knot at the given index. */\r\n public getKnotMultiplicityAtIndex(knotIndex: number): number {\r\n let m = 0;\r\n if (knotIndex >= 0 && knotIndex < this.knots.length) {\r\n const knot = this.knots[knotIndex];\r\n ++m; // count this knot\r\n for (let i = knotIndex - 1; i >= 0; --i) {\r\n const k = this.knots[i];\r\n if (Math.abs(k - knot) < KnotVector.knotTolerance)\r\n ++m; // found multiple to left of knot\r\n else if (knot > k)\r\n break;\r\n }\r\n for (let i = knotIndex + 1; i < this.knots.length; ++i) {\r\n const k = this.knots[i];\r\n if (Math.abs(k - knot) < KnotVector.knotTolerance)\r\n ++m; // found multiple to right of knot\r\n else if (knot < k)\r\n break;\r\n }\r\n }\r\n return m;\r\n }\r\n\r\n /** Transform knots to span [0,1].\r\n * @returns false if and only if this.knotLength01 is trivial\r\n */\r\n public normalize(): boolean {\r\n if (this.knotLength01 < KnotVector.knotTolerance)\r\n return false;\r\n const divisor = 1.0 / this.knotLength01;\r\n const leftKnot = this.leftKnot;\r\n for (let i = 0; i < this.knots.length; ++i)\r\n this.knots[i] = (this.knots[i] - leftKnot) * divisor;\r\n // explicitly set rightKnot and its multiples to 1.0 to avoid round-off\r\n for (let i = this.rightKnotIndex - 1; i > this.leftKnotIndex && (this.knots[i] === this.knots[this.rightKnotIndex]); --i) this.knots[i] = 1.0;\r\n for (let i = this.rightKnotIndex + 1; i < this.knots.length && (this.knots[i] === this.knots[this.rightKnotIndex]); ++i) this.knots[i] = 1.0;\r\n this.knots[this.rightKnotIndex] = 1.0;\r\n this.setupFixedValues();\r\n return true;\r\n }\r\n\r\n /** install knot values from an array, optionally ignoring first and last.\r\n */\r\n public setKnots(knots: number[] | Float64Array, skipFirstAndLast?: boolean) {\r\n const numAllocate = skipFirstAndLast ? knots.length - 2 : knots.length;\r\n if (numAllocate !== this.knots.length)\r\n this.knots = new Float64Array(numAllocate);\r\n if (skipFirstAndLast) {\r\n for (let i = 1; i + 1 < knots.length; i++)\r\n this.knots[i - 1] = knots[i];\r\n\r\n } else {\r\n for (let i = 0; i < knots.length; i++)\r\n this.knots[i] = knots[i];\r\n }\r\n this.setupFixedValues();\r\n }\r\n\r\n /** install knot values from an array, optionally ignoring first and last. */\r\n public setKnotsCapture(knots: Float64Array) {\r\n this.knots = knots;\r\n this.setupFixedValues();\r\n }\r\n\r\n /**\r\n * Create knot vector with {degree-1} replicated knots at start and end, and uniform knots between.\r\n * @param numPoles Number of poles\r\n * @param degree degree of polynomial\r\n * @param a0 left knot value for active interval\r\n * @param a1 right knot value for active interval\r\n */\r\n public static createUniformClamped(numPoles: number, degree: number, a0: number, a1: number): KnotVector {\r\n const knots = new KnotVector(numPoles + degree - 1, degree);\r\n let k = 0;\r\n for (let m = 0; m < degree; m++)knots.knots[k++] = a0;\r\n const du = 1.0 / (numPoles - degree);\r\n for (let i = 1; i + degree < numPoles; i++)\r\n knots.knots[k++] = a0 + i * du * (a1 - a0);\r\n for (let m = 0; m < degree; m++)knots.knots[k++] = a1;\r\n knots.setupFixedValues();\r\n return knots;\r\n }\r\n /**\r\n * Create knot vector with wraparound knots at start and end, and uniform knots between.\r\n * @param numInterval number of intervals in knot space. (NOT POLE COUNT)\r\n * @param degree degree of polynomial\r\n * @param a0 left knot value for active interval\r\n * @param a1 right knot value for active interval\r\n */\r\n public static createUniformWrapped(numInterval: number, degree: number, a0: number, a1: number): KnotVector {\r\n const knots = new KnotVector(numInterval + 2 * degree - 1, degree);\r\n const du = 1.0 / numInterval;\r\n for (let i = 1 - degree, k = 0; i < numInterval + degree; i++, k++) {\r\n knots.knots[k] = Geometry.interpolate(a0, i * du, a1);\r\n }\r\n knots.setupFixedValues();\r\n return knots;\r\n }\r\n\r\n /**\r\n * Create knot vector with given knot values and degree.\r\n * @param knotArray knot values\r\n * @param degree degree of polynomial\r\n * @param skipFirstAndLast true to skip copying the first and last knot values.\r\n */\r\n public static create(knotArray: number[] | Float64Array, degree: number, skipFirstAndLast?: boolean): KnotVector {\r\n const numAllocate = skipFirstAndLast ? knotArray.length - 2 : knotArray.length;\r\n const knots = new KnotVector(numAllocate, degree);\r\n knots.setKnots(knotArray, skipFirstAndLast);\r\n return knots;\r\n }\r\n\r\n /**\r\n * Return the average of degree consecutive knots beginning at knotIndex.\r\n */\r\n public grevilleKnot(knotIndex: number): number {\r\n if (knotIndex < 0) return this.leftKnot;\r\n if (knotIndex > this.rightKnotIndex) return this.rightKnot;\r\n let sum = 0.0;\r\n for (let i = knotIndex; i < knotIndex + this.degree; i++)\r\n sum += this.knots[i];\r\n return sum / this.degree;\r\n }\r\n /** Return an array sized for a set of the basis function values. */\r\n public createBasisArray(): Float64Array { return new Float64Array(this.degree + 1); }\r\n /** Convert localFraction within the interval following an indexed knot to a knot value. */\r\n public baseKnotFractionToKnot(knotIndex0: number, localFraction: number): number {\r\n const knot0 = this.knots[knotIndex0];\r\n return knot0 + localFraction * (this.knots[knotIndex0 + 1] - knot0);\r\n }\r\n /** Convert localFraction within an indexed bezier span to a knot value. */\r\n public spanFractionToKnot(spanIndex: number, localFraction: number): number {\r\n const k = this.spanIndexToLeftKnotIndex(spanIndex);\r\n return this.knots[k] + localFraction * (this.knots[k + 1] - this.knots[k]);\r\n }\r\n /** Convert localFraction within an indexed bezier span to fraction of active knot range. */\r\n public spanFractionToFraction(spanIndex: number, localFraction: number): number {\r\n const knot = this.spanFractionToKnot(spanIndex, localFraction);\r\n return (knot - this.leftKnot) / (this.rightKnot - this.leftKnot);\r\n }\r\n /** Return fraction of active knot range to knot value. */\r\n public fractionToKnot(fraction: number): number {\r\n return Geometry.interpolate(this.knots[this.degree - 1], fraction, this.knots[this.knots.length - this.degree]);\r\n }\r\n /**\r\n * Evaluate basis functions f[] at knot value u.\r\n *\r\n * @param u knot value for evaluation\r\n * @param f array of order basis function values\r\n */\r\n public evaluateBasisFunctions(knotIndex0: number, u: number, f: Float64Array) {\r\n f[0] = 1.0;\r\n if (this.degree < 1) return;\r\n // direct compute for linear part ...\r\n const u0 = this.knots[knotIndex0];\r\n const u1 = this.knots[knotIndex0 + 1];\r\n f[1] = (u - u0) / (u1 - u0);\r\n f[0] = 1.0 - f[1];\r\n if (this.degree < 2) return;\r\n\r\n for (let depth = 1; depth < this.degree; depth++) {\r\n let kLeft = knotIndex0 - depth;\r\n let kRight = kLeft + depth + 1;\r\n let gCarry = 0.0;\r\n for (let step = 0; step <= depth; step++) {\r\n const tLeft = this.knots[kLeft++];\r\n const tRight = this.knots[kRight++];\r\n const fraction = (u - tLeft) / (tRight - tLeft);\r\n const g1 = f[step] * fraction;\r\n const g0 = f[step] * (1.0 - fraction);\r\n f[step] = gCarry + g0;\r\n gCarry = g1;\r\n }\r\n f[depth + 1] = gCarry;\r\n }\r\n }\r\n\r\n /**\r\n * Evaluate basis functions f[], derivatives df[], and optional second derivatives ddf[] at knot value u.\r\n *\r\n * @param u knot value for evaluation\r\n * @param f array of order basis function values\r\n * @param df array of order basis derivative values\r\n * @param ddf array of order basis second derivative values\r\n */\r\n public evaluateBasisFunctions1(knotIndex0: number, u: number, f: Float64Array, df: Float64Array, ddf?: Float64Array) {\r\n f[0] = 1.0; df[0] = 0.0;\r\n if (this.degree < 1) return;\r\n // direct compute for linear part ...\r\n const u0 = this.knots[knotIndex0];\r\n const u1 = this.knots[knotIndex0 + 1];\r\n // ah = 1/(u1-u0) is the derivative of fraction0\r\n // (-ah) is the derivative of fraction1.\r\n let ah = 1.0 / (u1 - u0);\r\n f[1] = (u - u0) * ah;\r\n f[0] = 1.0 - f[1];\r\n df[0] = -ah; df[1] = ah;\r\n if (ddf) { // first derivative started constant, second derivative started zero.\r\n ddf[0] = 0.0; ddf[1] = 0.0;\r\n }\r\n if (this.degree < 2) return;\r\n for (let depth = 1; depth < this.degree; depth++) {\r\n let kLeft = knotIndex0 - depth;\r\n let kRight = kLeft + depth + 1;\r\n let gCarry = 0.0;\r\n let dgCarry = 0.0;\r\n let ddgCarry = 0.0;\r\n // f, df, ddf, are each row vectors with product of `step` linear terms.\r\n // f is multiplied on the right by matrix V. Each row has 2 nonzero entries (which sum to 1) (0,0,1-fraction, fraction,0,0,0)\r\n // Each row of the derivative dV is two entries (0,0, -1/h, 1/h,0,0,0)\r\n // Hence fnew = f * V\r\n // dfnew = df * V + f * dV\r\n // ddfnew = ddf * V + df*dV + df * dV + f * ddV\r\n // but ddV is zero so\r\n // ddfnew = ddf * V + 2 * df * dV\r\n for (let step = 0; step <= depth; step++) {\r\n const tLeft = this.knots[kLeft++];\r\n const tRight = this.knots[kRight++];\r\n ah = 1.0 / (tRight - tLeft);\r\n const fraction = (u - tLeft) * ah;\r\n const fraction1 = 1.0 - fraction;\r\n const g1 = f[step] * fraction;\r\n const g0 = f[step] * fraction1;\r\n const dg1 = df[step] * fraction + f[step] * ah;\r\n const dg0 = df[step] * fraction1 - f[step] * ah;\r\n const dfSave = 2.0 * df[step] * ah;\r\n f[step] = gCarry + g0;\r\n df[step] = dgCarry + dg0;\r\n gCarry = g1;\r\n dgCarry = dg1;\r\n if (ddf) { // do the backward reference to df before rewriting df !!!\r\n const ddg1 = ddf[step] * fraction + dfSave;\r\n const ddg0 = ddf[step] * fraction1 - dfSave;\r\n ddf[step] = ddgCarry + ddg0;\r\n ddgCarry = ddg1;\r\n }\r\n }\r\n f[depth + 1] = gCarry;\r\n df[depth + 1] = dgCarry;\r\n if (ddf)\r\n ddf[depth + 1] = ddgCarry;\r\n }\r\n }\r\n /** Find the knot span bracketing knots[i] <= u < knots[i+1] and return i.\r\n * * If u has no such bracket, return the smaller index of the closest nontrivial bracket.\r\n * @param u value to bracket\r\n */\r\n public knotToLeftKnotIndex(u: number): number {\r\n for (let i = this.leftKnotIndex; i < this.rightKnotIndex; ++i) {\r\n if (u < this.knots[i + 1])\r\n return i;\r\n }\r\n // for u >= rightKnot, return left index of last nontrivial span\r\n for (let i = this.rightKnotIndex; i > this.leftKnotIndex; --i) {\r\n if (this.knots[i] - this.knots[i - 1] >= KnotVector.knotTolerance)\r\n return i - 1;\r\n }\r\n return this.rightKnotIndex - 1; // shouldn't get here\r\n }\r\n /**\r\n * Given a span index, return the index of the knot at its left.\r\n * @param spanIndex index of span\r\n */\r\n public spanIndexToLeftKnotIndex(spanIndex: number): number {\r\n const d = this.degree;\r\n if (spanIndex <= 0.0) return d - 1;\r\n return Math.min(spanIndex + d - 1, this.knots.length - d - 1);\r\n }\r\n /** Return the knot interval length of indexed bezier span. */\r\n public spanIndexToSpanLength(spanIndex: number): number {\r\n const k = this.spanIndexToLeftKnotIndex(spanIndex);\r\n return this.knots[k + 1] - this.knots[k];\r\n }\r\n /**\r\n * Given a span index, test if it is within range and has nonzero length.\r\n * * note that a false return does not imply there are no more spans. This may be a double knot (zero length span) followed by more real spans\r\n * @param spanIndex index of span to test.\r\n */\r\n public isIndexOfRealSpan(spanIndex: number): boolean {\r\n if (spanIndex >= 0 && spanIndex < this.numSpans)\r\n return !Geometry.isSmallMetricDistance(this.spanIndexToSpanLength(spanIndex));\r\n return false;\r\n }\r\n /** Reflect all knots so `leftKnot` and `rightKnot` are maintained but interval lengths reverse. */\r\n public reflectKnots() {\r\n const a = this.leftKnot;\r\n const b = this.rightKnot;\r\n const numKnots = this.knots.length;\r\n for (let i = 0; i < numKnots; i++)\r\n this.knots[i] = a + (b - this.knots[i]);\r\n this.knots.reverse();\r\n }\r\n /**\r\n * return a simple array form of the knots. optionally replicate the first and last\r\n * in classic over-clamped manner\r\n */\r\n public copyKnots(includeExtraEndKnot: boolean): number[] {\r\n const wrap = this.wrappable === BSplineWrapMode.OpenByAddingControlPoints && this.testClosable();\r\n const leftIndex = this.leftKnotIndex;\r\n const rightIndex = this.rightKnotIndex;\r\n const a0 = this.leftKnot;\r\n const a1 = this.rightKnot;\r\n const delta = a1 - a0;\r\n const degree = this.degree;\r\n const values: number[] = [];\r\n if (includeExtraEndKnot) {\r\n if (wrap) {\r\n values.push(this.knots[rightIndex - degree] - delta);\r\n } else {\r\n values.push(this.knots[0]);\r\n }\r\n }\r\n for (const u of this.knots) values.push(u);\r\n if (includeExtraEndKnot) {\r\n if (wrap) {\r\n values.push(this.knots[leftIndex + degree] + delta);\r\n } else\r\n values.push(values[values.length - 1]);\r\n }\r\n return values;\r\n }\r\n}\r\n"]}
1
+ {"version":3,"file":"KnotVector.js","sourceRoot":"","sources":["../../../src/bspline/KnotVector.ts"],"names":[],"mappings":"AAAA;;;+FAG+F;AAC/F;;GAEG;AAEH,2CAA2C;AAC3C,8EAA8E;AAC9E,OAAO,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AACvC,OAAO,EAAE,WAAW,EAAE,MAAM,4BAA4B,CAAC;AAEzD;;;;;;GAMG;AACH,MAAM,CAAN,IAAY,eAaX;AAbD,WAAY,eAAe;IACzB,gCAAgC;IAChC,qDAAQ,CAAA;IACR;;;OAGG;IACH,+FAA6B,CAAA;IAC7B;;;OAGG;IACH,mFAAuB,CAAA;AACzB,CAAC,EAbW,eAAe,KAAf,eAAe,QAa1B;AACD;;;;;;;;;;;;;;GAcG;AACH,MAAM,OAAO,UAAU;IAwBrB;;;;;;OAMG;IACH,YAAoB,KAAuC,EAAE,MAAc,EAAE,QAA0B;QACrG,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC;QACrB,IAAI,CAAC,SAAS,GAAG,QAAQ,CAAC;QAC1B,uGAAuG;QACvG,IAAI,CAAC,MAAM,GAAG,GAAG,CAAC;QAClB,IAAI,CAAC,MAAM,GAAG,GAAG,CAAC;QAClB,oCAAoC;QACpC,IAAI,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,EAAE,EAAE,uFAAuF;YACjH,IAAI,CAAC,KAAK,GAAG,IAAI,YAAY,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC;YAC5C,IAAI,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC;YACrB,IAAI,CAAC,gBAAgB,EAAE,CAAC;SACzB;aAAM,IAAI,KAAK,YAAY,YAAY,EAAE;YACxC,IAAI,CAAC,KAAK,GAAG,KAAK,CAAC,KAAK,EAAE,CAAC;YAC3B,IAAI,CAAC,gBAAgB,EAAE,CAAC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,CAAC;aACtD;iBAAM;gBACL,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC;aAC5B;SACF;QACD,KAAK,MAAM,CAAC,IAAI,IAAI,CAAC,KAAK;YAAE,MAAM,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;QAC3C,IAAI,mBAAmB,EAAE;YACvB,IAAI,IAAI,EAAE;gBACR,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,KAAK,CAAC,SAAS,GAAG,MAAM,CAAC,GAAG,KAAK,CAAC,CAAC;aACrD;;gBACC,MAAM,CAAC,IAAI,CAAC,MAAM,CAAC,MAAM,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,CAAC;SAC1C;QACD,OAAO,MAAM,CAAC;IAChB,CAAC;;AA7aD,0DAA0D;AACnC,wBAAa,GAAG,MAAM,CAAC","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\n/* eslint-disable @typescript-eslint/naming-convention, no-empty, no-console*/\r\nimport { Geometry } from \"../Geometry\";\r\nimport { NumberArray } from \"../geometry3d/PointHelpers\";\r\n\r\n/**\r\n * Enumeration of the possible ways of converting a \"periodic\" knot vector to an open knot vector.\r\n * None (0) ==> no wrap possible\r\n * OpenByAddingControlPoints (1) ==> wrapped by adding poles\r\n * OpenByRemovingKnots (2) ==> wrapped by deleting extreme knots.\r\n * @public\r\n */\r\nexport enum BSplineWrapMode {\r\n /** No conversion to periodic */\r\n None = 0,\r\n /** Convert to periodic by removing control points. This is typical for closed bcurve constructed by control points with maximum continuity.\r\n * * Knots stay the same in open and periodic form.\r\n * * Periodic form omits {degree} control points.\r\n */\r\n OpenByAddingControlPoints = 1,\r\n /** Convert to periodic by adding special knots. This is typical of closed bcurve constructed as exact circular or elliptic arc\r\n * * 2 knots on each end are omitted in open form\r\n * * poles stay the same.\r\n */\r\n OpenByRemovingKnots = 2,\r\n}\r\n/**\r\n * Array of non-decreasing numbers acting as a knot array for bsplines.\r\n *\r\n * * Essential identity: numKnots = numPoles + order - 2 = numPoles + degree - 1\r\n * * Various bspline libraries have confusion over how many \"end knots\" are needed. \"Many\" libraries (including MicroStation)\r\n * incorrectly demand \"order\" knots at each end for clamping. But only \"order - 1\" are really needed.\r\n * * This class uses the \"order-1\" convention.\r\n * * This class provides queries to convert among spanIndex and knotIndex\r\n * * A span is a single interval of the knots.\r\n * * The left knot of span {k} is knot {k+degree-1}\r\n * * This class provides queries to convert among spanFraction, fraction of knot range, and knot\r\n * * core computations (evaluateBasisFunctions) have leftKnotIndex and global knot value as inputs. Callers need to\r\n * know their primary values (global knot, spanFraction).\r\n * @public\r\n */\r\nexport class KnotVector {\r\n /** The simple array of knot values. */\r\n public knots: Float64Array;\r\n /** Return the degree of basis functions defined in these knots. */\r\n public degree: number;\r\n private _knot0: number;\r\n private _knot1: number;\r\n\r\n private _wrapMode?: BSplineWrapMode;\r\n /** tolerance for considering two knots to be the same. */\r\n public static readonly knotTolerance = 1.0e-9;\r\n /** Return the leftmost knot value (of the active interval, ignoring unclamped leading knots)*/\r\n public get leftKnot() { return this._knot0; }\r\n /** Return the rightmost knot value (of the active interval, ignoring unclamped leading knots)*/\r\n public get rightKnot() { return this._knot1; }\r\n /** Return the index of the leftmost knot of the active interval */\r\n public get leftKnotIndex() { return this.degree - 1; }\r\n /** Return the index of the rightmost knot of the active interval */\r\n public get rightKnotIndex() { return this.knots.length - this.degree; }\r\n /** Whether the bspline was created by adding poles into \"closed\" structure. This is used by serialize/deserialize to mark knotVector's that were converted from periodic style. */\r\n public get wrappable() { return this._wrapMode === undefined ? BSplineWrapMode.None : this._wrapMode; }\r\n public set wrappable(value: BSplineWrapMode) { this._wrapMode = value; }\r\n /** Return the number of bezier spans. Note that this includes zero-length spans if there are repeated knots. */\r\n public get numSpans() { return this.rightKnotIndex - this.leftKnotIndex; }\r\n /**\r\n *\r\n * * If knots is a number array or Float64Array, the those values become the local knot array.\r\n * * If knots is a simple number, the local knot array is allocated to that size but left as zeros.\r\n * @param knots\r\n * @param degree\r\n */\r\n private constructor(knots: number[] | Float64Array | number, degree: number, wrapMode?: BSplineWrapMode) {\r\n this.degree = degree;\r\n this._wrapMode = wrapMode;\r\n // default values to satisfy compiler -- real values hapn setupFixedValues or final else defers to user\r\n this._knot0 = 0.0;\r\n this._knot1 = 1.0;\r\n // satisfy the initialize checker ..\r\n if (Array.isArray(knots)) { // remark: This ctor is private. The callers (as of April 2019) do not use this path.\r\n this.knots = new Float64Array(knots.length);\r\n this.setKnots(knots);\r\n this.setupFixedValues();\r\n } else if (knots instanceof Float64Array) {\r\n this.knots = knots.slice();\r\n this.setupFixedValues();\r\n } else { // caller is responsible for filling array separately ...\r\n this.knots = new Float64Array(knots);\r\n }\r\n }\r\n /** copy degree and knots to a new KnotVector. */\r\n public clone(): KnotVector { return new KnotVector(this.knots, this.degree, this.wrappable); }\r\n private setupFixedValues() {\r\n // These should be read-only . ..\r\n this._knot0 = this.knots[this.degree - 1];\r\n this._knot1 = this.knots[this.knots.length - this.degree];\r\n }\r\n /** Return the total knot distance from beginning to end. */\r\n public get knotLength01(): number { return this._knot1 - this._knot0; }\r\n /**\r\n * Returns true if all numeric values have wraparound conditions for \"closed\" knotVector with specified wrap mode\r\n * @param mode optional test mode. If undefined, use the this.wrappable.\r\n */\r\n public testClosable(mode?: BSplineWrapMode): boolean {\r\n if (mode === undefined)\r\n mode = this.wrappable;\r\n const leftKnotIndex = this.leftKnotIndex;\r\n const rightKnotIndex = this.rightKnotIndex;\r\n const period = this.rightKnot - this.leftKnot;\r\n const degree = this.degree;\r\n const indexDelta = rightKnotIndex - leftKnotIndex;\r\n // maximum continuity mode . . .\r\n if (mode === BSplineWrapMode.OpenByAddingControlPoints) {\r\n for (let k0 = leftKnotIndex - degree + 1; k0 < leftKnotIndex + degree - 1; k0++) {\r\n const k1 = k0 + indexDelta;\r\n if (!Geometry.isSameCoordinate(this.knots[k0] + period, this.knots[k1]))\r\n return false;\r\n }\r\n return true;\r\n }\r\n // arc mode ...\r\n if (mode === BSplineWrapMode.OpenByRemovingKnots) {\r\n // we expect {degree} replicated knots at each end . . .\r\n const numRepeated = degree - 1;\r\n const leftKnot = this.knots[leftKnotIndex];\r\n const rightKnot = this.knots[rightKnotIndex];\r\n for (let i = 0; i < numRepeated; i++) {\r\n if (!Geometry.isSameCoordinate(leftKnot, this.knots[leftKnotIndex - i - 1]))\r\n return false;\r\n if (!Geometry.isSameCoordinate(rightKnot, this.knots[rightKnotIndex + i + 1]))\r\n return false;\r\n }\r\n return true;\r\n }\r\n\r\n return false;\r\n }\r\n /** Test matching degree and knot values */\r\n public isAlmostEqual(other: KnotVector): boolean {\r\n if (this.degree !== other.degree) return false;\r\n return NumberArray.isAlmostEqual(this.knots, other.knots, KnotVector.knotTolerance);\r\n }\r\n\r\n /** Compute the multiplicity of the input knot, or zero if not a knot. */\r\n public getKnotMultiplicity(knot: number): number {\r\n let m = 0;\r\n for (const k of this.knots) {\r\n if (Math.abs(k - knot) < KnotVector.knotTolerance)\r\n ++m;\r\n else if (knot < k)\r\n break;\r\n }\r\n return m;\r\n }\r\n\r\n /** Compute the multiplicity of the knot at the given index. */\r\n public getKnotMultiplicityAtIndex(knotIndex: number): number {\r\n let m = 0;\r\n if (knotIndex >= 0 && knotIndex < this.knots.length) {\r\n const knot = this.knots[knotIndex];\r\n ++m; // count this knot\r\n for (let i = knotIndex - 1; i >= 0; --i) {\r\n const k = this.knots[i];\r\n if (Math.abs(k - knot) < KnotVector.knotTolerance)\r\n ++m; // found multiple to left of knot\r\n else if (knot > k)\r\n break;\r\n }\r\n for (let i = knotIndex + 1; i < this.knots.length; ++i) {\r\n const k = this.knots[i];\r\n if (Math.abs(k - knot) < KnotVector.knotTolerance)\r\n ++m; // found multiple to right of knot\r\n else if (knot < k)\r\n break;\r\n }\r\n }\r\n return m;\r\n }\r\n\r\n /** Transform knots to span [0,1].\r\n * @returns false if and only if this.knotLength01 is trivial\r\n */\r\n public normalize(): boolean {\r\n if (this.knotLength01 < KnotVector.knotTolerance)\r\n return false;\r\n const divisor = 1.0 / this.knotLength01;\r\n const leftKnot = this.leftKnot;\r\n for (let i = 0; i < this.knots.length; ++i)\r\n this.knots[i] = (this.knots[i] - leftKnot) * divisor;\r\n // explicitly set rightKnot and its multiples to 1.0 to avoid round-off\r\n for (let i = this.rightKnotIndex - 1; i > this.leftKnotIndex && (this.knots[i] === this.knots[this.rightKnotIndex]); --i) this.knots[i] = 1.0;\r\n for (let i = this.rightKnotIndex + 1; i < this.knots.length && (this.knots[i] === this.knots[this.rightKnotIndex]); ++i) this.knots[i] = 1.0;\r\n this.knots[this.rightKnotIndex] = 1.0;\r\n this.setupFixedValues();\r\n return true;\r\n }\r\n\r\n /** install knot values from an array, optionally ignoring first and last.\r\n */\r\n public setKnots(knots: number[] | Float64Array, skipFirstAndLast?: boolean) {\r\n const numAllocate = skipFirstAndLast ? knots.length - 2 : knots.length;\r\n if (numAllocate !== this.knots.length)\r\n this.knots = new Float64Array(numAllocate);\r\n if (skipFirstAndLast) {\r\n for (let i = 1; i + 1 < knots.length; i++)\r\n this.knots[i - 1] = knots[i];\r\n\r\n } else {\r\n for (let i = 0; i < knots.length; i++)\r\n this.knots[i] = knots[i];\r\n }\r\n this.setupFixedValues();\r\n }\r\n\r\n /** install knot values from an array, optionally ignoring first and last. */\r\n public setKnotsCapture(knots: Float64Array) {\r\n this.knots = knots;\r\n this.setupFixedValues();\r\n }\r\n\r\n /**\r\n * Create knot vector with {degree-1} replicated knots at start and end, and uniform knots between.\r\n * @param numPoles Number of poles\r\n * @param degree degree of polynomial\r\n * @param a0 left knot value for active interval\r\n * @param a1 right knot value for active interval\r\n */\r\n public static createUniformClamped(numPoles: number, degree: number, a0: number, a1: number): KnotVector {\r\n const knots = new KnotVector(numPoles + degree - 1, degree);\r\n let k = 0;\r\n for (let m = 0; m < degree; m++)knots.knots[k++] = a0;\r\n const du = 1.0 / (numPoles - degree);\r\n for (let i = 1; i + degree < numPoles; i++)\r\n knots.knots[k++] = a0 + i * du * (a1 - a0);\r\n for (let m = 0; m < degree; m++)knots.knots[k++] = a1;\r\n knots.setupFixedValues();\r\n return knots;\r\n }\r\n /**\r\n * Create knot vector with wraparound knots at start and end, and uniform knots between.\r\n * @param numInterval number of intervals in knot space. (NOT POLE COUNT)\r\n * @param degree degree of polynomial\r\n * @param a0 left knot value for active interval\r\n * @param a1 right knot value for active interval\r\n */\r\n public static createUniformWrapped(numInterval: number, degree: number, a0: number, a1: number): KnotVector {\r\n const knots = new KnotVector(numInterval + 2 * degree - 1, degree);\r\n const du = 1.0 / numInterval;\r\n for (let i = 1 - degree, k = 0; i < numInterval + degree; i++, k++) {\r\n knots.knots[k] = Geometry.interpolate(a0, i * du, a1);\r\n }\r\n knots.setupFixedValues();\r\n return knots;\r\n }\r\n\r\n /**\r\n * Create knot vector with given knot values and degree.\r\n * @param knotArray knot values\r\n * @param degree degree of polynomial\r\n * @param skipFirstAndLast true to skip copying the first and last knot values.\r\n */\r\n public static create(knotArray: number[] | Float64Array, degree: number, skipFirstAndLast?: boolean): KnotVector {\r\n const numAllocate = skipFirstAndLast ? knotArray.length - 2 : knotArray.length;\r\n const knots = new KnotVector(numAllocate, degree);\r\n knots.setKnots(knotArray, skipFirstAndLast);\r\n return knots;\r\n }\r\n\r\n /**\r\n * Return the average of degree consecutive knots beginning at knotIndex.\r\n */\r\n public grevilleKnot(knotIndex: number): number {\r\n if (knotIndex < 0) return this.leftKnot;\r\n if (knotIndex > this.rightKnotIndex) return this.rightKnot;\r\n let sum = 0.0;\r\n for (let i = knotIndex; i < knotIndex + this.degree; i++)\r\n sum += this.knots[i];\r\n return sum / this.degree;\r\n }\r\n /** Return an array sized for a set of the basis function values. */\r\n public createBasisArray(): Float64Array { return new Float64Array(this.degree + 1); }\r\n /** Convert localFraction within the interval following an indexed knot to a knot value. */\r\n public baseKnotFractionToKnot(knotIndex0: number, localFraction: number): number {\r\n const knot0 = this.knots[knotIndex0];\r\n localFraction = Geometry.clamp(localFraction, 0, 1);\r\n return knot0 + localFraction * (this.knots[knotIndex0 + 1] - knot0);\r\n }\r\n /** Convert localFraction within an indexed bezier span to a knot value. */\r\n public spanFractionToKnot(spanIndex: number, localFraction: number): number {\r\n const k = this.spanIndexToLeftKnotIndex(spanIndex);\r\n localFraction = Geometry.clamp(localFraction, 0, 1);\r\n return this.knots[k] + localFraction * (this.knots[k + 1] - this.knots[k]);\r\n }\r\n /** Convert localFraction within an indexed bezier span to fraction of active knot range. */\r\n public spanFractionToFraction(spanIndex: number, localFraction: number): number {\r\n const knot = this.spanFractionToKnot(spanIndex, localFraction);\r\n return (knot - this.leftKnot) / (this.rightKnot - this.leftKnot);\r\n }\r\n /** Return fraction of active knot range to knot value. */\r\n public fractionToKnot(fraction: number): number {\r\n fraction = Geometry.clamp(fraction, 0, 1); // B-splines are not extendable\r\n return Geometry.interpolate(this.knots[this.degree - 1], fraction, this.knots[this.knots.length - this.degree]);\r\n }\r\n /**\r\n * Evaluate basis functions f[] at knot value u.\r\n *\r\n * @param u knot value for evaluation\r\n * @param f array of order basis function values\r\n */\r\n public evaluateBasisFunctions(knotIndex0: number, u: number, f: Float64Array) {\r\n f[0] = 1.0;\r\n if (this.degree < 1) return;\r\n // direct compute for linear part ...\r\n const u0 = this.knots[knotIndex0];\r\n const u1 = this.knots[knotIndex0 + 1];\r\n f[1] = (u - u0) / (u1 - u0);\r\n f[0] = 1.0 - f[1];\r\n if (this.degree < 2) return;\r\n\r\n for (let depth = 1; depth < this.degree; depth++) {\r\n let kLeft = knotIndex0 - depth;\r\n let kRight = kLeft + depth + 1;\r\n let gCarry = 0.0;\r\n for (let step = 0; step <= depth; step++) {\r\n const tLeft = this.knots[kLeft++];\r\n const tRight = this.knots[kRight++];\r\n const fraction = (u - tLeft) / (tRight - tLeft);\r\n const g1 = f[step] * fraction;\r\n const g0 = f[step] * (1.0 - fraction);\r\n f[step] = gCarry + g0;\r\n gCarry = g1;\r\n }\r\n f[depth + 1] = gCarry;\r\n }\r\n }\r\n\r\n /**\r\n * Evaluate basis functions f[], derivatives df[], and optional second derivatives ddf[] at knot value u.\r\n *\r\n * @param u knot value for evaluation\r\n * @param f array of order basis function values\r\n * @param df array of order basis derivative values\r\n * @param ddf array of order basis second derivative values\r\n */\r\n public evaluateBasisFunctions1(knotIndex0: number, u: number, f: Float64Array, df: Float64Array, ddf?: Float64Array) {\r\n f[0] = 1.0; df[0] = 0.0;\r\n if (this.degree < 1) return;\r\n // direct compute for linear part ...\r\n const u0 = this.knots[knotIndex0];\r\n const u1 = this.knots[knotIndex0 + 1];\r\n // ah = 1/(u1-u0) is the derivative of fraction0\r\n // (-ah) is the derivative of fraction1.\r\n let ah = 1.0 / (u1 - u0);\r\n f[1] = (u - u0) * ah;\r\n f[0] = 1.0 - f[1];\r\n df[0] = -ah; df[1] = ah;\r\n if (ddf) { // first derivative started constant, second derivative started zero.\r\n ddf[0] = 0.0; ddf[1] = 0.0;\r\n }\r\n if (this.degree < 2) return;\r\n for (let depth = 1; depth < this.degree; depth++) {\r\n let kLeft = knotIndex0 - depth;\r\n let kRight = kLeft + depth + 1;\r\n let gCarry = 0.0;\r\n let dgCarry = 0.0;\r\n let ddgCarry = 0.0;\r\n // f, df, ddf, are each row vectors with product of `step` linear terms.\r\n // f is multiplied on the right by matrix V. Each row has 2 nonzero entries (which sum to 1) (0,0,1-fraction, fraction,0,0,0)\r\n // Each row of the derivative dV is two entries (0,0, -1/h, 1/h,0,0,0)\r\n // Hence fnew = f * V\r\n // dfnew = df * V + f * dV\r\n // ddfnew = ddf * V + df*dV + df * dV + f * ddV\r\n // but ddV is zero so\r\n // ddfnew = ddf * V + 2 * df * dV\r\n for (let step = 0; step <= depth; step++) {\r\n const tLeft = this.knots[kLeft++];\r\n const tRight = this.knots[kRight++];\r\n ah = 1.0 / (tRight - tLeft);\r\n const fraction = (u - tLeft) * ah;\r\n const fraction1 = 1.0 - fraction;\r\n const g1 = f[step] * fraction;\r\n const g0 = f[step] * fraction1;\r\n const dg1 = df[step] * fraction + f[step] * ah;\r\n const dg0 = df[step] * fraction1 - f[step] * ah;\r\n const dfSave = 2.0 * df[step] * ah;\r\n f[step] = gCarry + g0;\r\n df[step] = dgCarry + dg0;\r\n gCarry = g1;\r\n dgCarry = dg1;\r\n if (ddf) { // do the backward reference to df before rewriting df !!!\r\n const ddg1 = ddf[step] * fraction + dfSave;\r\n const ddg0 = ddf[step] * fraction1 - dfSave;\r\n ddf[step] = ddgCarry + ddg0;\r\n ddgCarry = ddg1;\r\n }\r\n }\r\n f[depth + 1] = gCarry;\r\n df[depth + 1] = dgCarry;\r\n if (ddf)\r\n ddf[depth + 1] = ddgCarry;\r\n }\r\n }\r\n /** Find the knot span bracketing knots[i] <= u < knots[i+1] and return i.\r\n * * If u has no such bracket, return the smaller index of the closest nontrivial bracket.\r\n * @param u value to bracket\r\n */\r\n public knotToLeftKnotIndex(u: number): number {\r\n for (let i = this.leftKnotIndex; i < this.rightKnotIndex; ++i) {\r\n if (u < this.knots[i + 1])\r\n return i;\r\n }\r\n // for u >= rightKnot, return left index of last nontrivial span\r\n for (let i = this.rightKnotIndex; i > this.leftKnotIndex; --i) {\r\n if (this.knots[i] - this.knots[i - 1] >= KnotVector.knotTolerance)\r\n return i - 1;\r\n }\r\n return this.rightKnotIndex - 1; // shouldn't get here\r\n }\r\n /**\r\n * Given a span index, return the index of the knot at its left.\r\n * @param spanIndex index of span\r\n */\r\n public spanIndexToLeftKnotIndex(spanIndex: number): number {\r\n const d = this.degree;\r\n if (spanIndex <= 0.0) return d - 1;\r\n return Math.min(spanIndex + d - 1, this.knots.length - d - 1);\r\n }\r\n /** Return the knot interval length of indexed bezier span. */\r\n public spanIndexToSpanLength(spanIndex: number): number {\r\n const k = this.spanIndexToLeftKnotIndex(spanIndex);\r\n return this.knots[k + 1] - this.knots[k];\r\n }\r\n /**\r\n * Given a span index, test if it is within range and has nonzero length.\r\n * * note that a false return does not imply there are no more spans. This may be a double knot (zero length span) followed by more real spans\r\n * @param spanIndex index of span to test.\r\n */\r\n public isIndexOfRealSpan(spanIndex: number): boolean {\r\n if (spanIndex >= 0 && spanIndex < this.numSpans)\r\n return !Geometry.isSmallMetricDistance(this.spanIndexToSpanLength(spanIndex));\r\n return false;\r\n }\r\n /** Reflect all knots so `leftKnot` and `rightKnot` are maintained but interval lengths reverse. */\r\n public reflectKnots() {\r\n const a = this.leftKnot;\r\n const b = this.rightKnot;\r\n const numKnots = this.knots.length;\r\n for (let i = 0; i < numKnots; i++)\r\n this.knots[i] = a + (b - this.knots[i]);\r\n this.knots.reverse();\r\n }\r\n /**\r\n * return a simple array form of the knots. optionally replicate the first and last\r\n * in classic over-clamped manner\r\n */\r\n public copyKnots(includeExtraEndKnot: boolean): number[] {\r\n const wrap = this.wrappable === BSplineWrapMode.OpenByAddingControlPoints && this.testClosable();\r\n const leftIndex = this.leftKnotIndex;\r\n const rightIndex = this.rightKnotIndex;\r\n const a0 = this.leftKnot;\r\n const a1 = this.rightKnot;\r\n const delta = a1 - a0;\r\n const degree = this.degree;\r\n const values: number[] = [];\r\n if (includeExtraEndKnot) {\r\n if (wrap) {\r\n values.push(this.knots[rightIndex - degree] - delta);\r\n } else {\r\n values.push(this.knots[0]);\r\n }\r\n }\r\n for (const u of this.knots) values.push(u);\r\n if (includeExtraEndKnot) {\r\n if (wrap) {\r\n values.push(this.knots[leftIndex + degree] + delta);\r\n } else\r\n values.push(values[values.length - 1]);\r\n }\r\n return values;\r\n }\r\n}\r\n"]}
@@ -33,7 +33,7 @@ export declare class PathFragment {
33
33
  childFraction0: number;
34
34
  /** Fractional position of this fragment end within its curve primitive.. */
35
35
  childFraction1: number;
36
- /** Curve primitive of this fragment, as presented in stroker. Note that his might have become a proxy. */
36
+ /** Curve primitive of this fragment, as presented in stroker. Note that this might have become a proxy. */
37
37
  childCurve: CurvePrimitive;
38
38
  /** optional range */
39
39
  range?: Range3d;
@@ -59,7 +59,7 @@ export declare class PathFragment {
59
59
  chainDistanceToInterpolatedChildFraction(distance: number): number;
60
60
  /** Convert chainDistance to true chidFraction, using detailed moveSignedDistanceFromFraction
61
61
  */
62
- chainDistanceToAccurateChildFraction(chainDistance: number): number;
62
+ chainDistanceToAccurateChildFraction(chainDistance: number, allowExtrapolation?: boolean): number;
63
63
  /** Return the scale factor to map childCurve fraction derivatives to chain fraction derivatives
64
64
  * @param globalDistance total length of the global curve.
65
65
  */
@@ -69,12 +69,14 @@ export declare class PathFragment {
69
69
  * * each `chainDistance` is replaced by `totalDistance-chainDistance`
70
70
  */
71
71
  reverseFractionsAndDistances(totalDistance: number): void;
72
+ /** @deprecated Use childFractionToChainDistance */
73
+ childFractionTChainDistance(fraction: number): number;
72
74
  /**
73
75
  * convert a fractional position on the childCurve to distance in the chain space.
74
76
  * * Return value is SIGNED -- will be negative when fraction < this.childFraction0.
75
77
  * @param fraction fraction along the curve within this fragment
76
78
  */
77
- childFractionTChainDistance(fraction: number): number;
79
+ childFractionToChainDistance(fraction: number): number;
78
80
  }
79
81
  /**
80
82
  * `CurveChainWithDistanceIndex` is a CurvePrimitive whose fractional parameterization is proportional to true
@@ -104,7 +106,7 @@ export declare class CurveChainWithDistanceIndex extends CurvePrimitive {
104
106
  /** Return a deep clone */
105
107
  clone(): CurveChainWithDistanceIndex;
106
108
  /** Return a deep clone */
107
- clonePartialCurve(_fractionA: number, _fractionB: number): CurveChainWithDistanceIndex | undefined;
109
+ clonePartialCurve(fractionA: number, fractionB: number): CurveChainWithDistanceIndex | undefined;
108
110
  /** Ask if the curve is within tolerance of a plane.
109
111
  * @returns Returns true if the curve is completely within tolerance of the plane.
110
112
  */
@@ -154,7 +156,7 @@ export declare class CurveChainWithDistanceIndex extends CurvePrimitive {
154
156
  curveLengthBetweenFractions(fraction0: number, fraction1: number): number;
155
157
  /**
156
158
  * Capture (not clone) a path into a new `CurveChainWithDistanceIndex`
157
- * @param primitives primitive array to be CAPTURED (not cloned)
159
+ * @param path primitive array to be CAPTURED (not cloned)
158
160
  */
159
161
  static createCapture(path: CurveChain, options?: StrokeOptions): CurveChainWithDistanceIndex;
160
162
  /**
@@ -1 +1 @@
1
- {"version":3,"file":"CurveChainWithDistanceIndex.d.ts","sourceRoot":"","sources":["../../../src/curve/CurveChainWithDistanceIndex.ts"],"names":[],"mappings":"AAKA;;GAEG;AAEH,OAAO,EAAE,cAAc,EAAE,MAAM,yBAAyB,CAAC;AACzD,OAAO,EAAE,cAAc,EAAE,MAAM,+BAA+B,CAAC;AAE/D,OAAO,EAAE,eAAe,EAAE,cAAc,EAAE,MAAM,+BAA+B,CAAC;AAChF,OAAO,EAAE,4BAA4B,EAAE,MAAM,4CAA4C,CAAC;AAC1F,OAAO,EAAE,yBAAyB,EAAE,MAAM,yCAAyC,CAAC;AACpF,OAAO,EAAE,OAAO,EAAY,MAAM,+BAA+B,CAAC;AAClE,OAAO,EAAE,OAAO,EAAE,MAAM,qBAAqB,CAAC;AAC9C,OAAO,EAAE,KAAK,EAAE,MAAM,qBAAqB,CAAC;AAC5C,OAAO,EAAE,SAAS,EAAE,MAAM,yBAAyB,CAAC;AACpD,OAAO,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAC;AAC/C,OAAO,EAAuC,2BAA2B,EAAE,MAAM,mBAAmB,CAAC;AACrG,OAAO,EAAE,mBAAmB,EAAE,MAAM,uBAAuB,CAAC;AAC5D,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAChD,OAAO,EAAE,aAAa,EAAE,MAAM,yCAAyC,CAAC;AACxE,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAE9C,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAEhD;;;;;;GAMG;AACH,qBAAa,YAAY;IACvB,mDAAmD;IAC5C,cAAc,EAAE,MAA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