@itwin/core-geometry 4.3.0-dev.12 → 4.3.0-dev.14

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 (149) hide show
  1. package/lib/cjs/bspline/BSpline1dNd.d.ts +12 -2
  2. package/lib/cjs/bspline/BSpline1dNd.d.ts.map +1 -1
  3. package/lib/cjs/bspline/BSpline1dNd.js +27 -17
  4. package/lib/cjs/bspline/BSpline1dNd.js.map +1 -1
  5. package/lib/cjs/bspline/BSplineCurve.d.ts +30 -16
  6. package/lib/cjs/bspline/BSplineCurve.d.ts.map +1 -1
  7. package/lib/cjs/bspline/BSplineCurve.js +68 -44
  8. package/lib/cjs/bspline/BSplineCurve.js.map +1 -1
  9. package/lib/cjs/bspline/BSplineCurve3dH.d.ts +27 -20
  10. package/lib/cjs/bspline/BSplineCurve3dH.d.ts.map +1 -1
  11. package/lib/cjs/bspline/BSplineCurve3dH.js +136 -87
  12. package/lib/cjs/bspline/BSplineCurve3dH.js.map +1 -1
  13. package/lib/cjs/bspline/BSplineSurface.d.ts +138 -74
  14. package/lib/cjs/bspline/BSplineSurface.d.ts.map +1 -1
  15. package/lib/cjs/bspline/BSplineSurface.js +242 -119
  16. package/lib/cjs/bspline/BSplineSurface.js.map +1 -1
  17. package/lib/cjs/bspline/Bezier1dNd.d.ts +18 -4
  18. package/lib/cjs/bspline/Bezier1dNd.d.ts.map +1 -1
  19. package/lib/cjs/bspline/Bezier1dNd.js +19 -5
  20. package/lib/cjs/bspline/Bezier1dNd.js.map +1 -1
  21. package/lib/cjs/bspline/BezierCurve3dH.d.ts.map +1 -1
  22. package/lib/cjs/bspline/BezierCurve3dH.js +2 -1
  23. package/lib/cjs/bspline/BezierCurve3dH.js.map +1 -1
  24. package/lib/cjs/bspline/KnotVector.d.ts +30 -33
  25. package/lib/cjs/bspline/KnotVector.d.ts.map +1 -1
  26. package/lib/cjs/bspline/KnotVector.js +76 -69
  27. package/lib/cjs/bspline/KnotVector.js.map +1 -1
  28. package/lib/cjs/geometry3d/Matrix3d.d.ts +20 -13
  29. package/lib/cjs/geometry3d/Matrix3d.d.ts.map +1 -1
  30. package/lib/cjs/geometry3d/Matrix3d.js +28 -21
  31. package/lib/cjs/geometry3d/Matrix3d.js.map +1 -1
  32. package/lib/cjs/geometry3d/Point3dVector3d.d.ts +3 -2
  33. package/lib/cjs/geometry3d/Point3dVector3d.d.ts.map +1 -1
  34. package/lib/cjs/geometry3d/Point3dVector3d.js +6 -5
  35. package/lib/cjs/geometry3d/Point3dVector3d.js.map +1 -1
  36. package/lib/cjs/geometry3d/PointHelpers.d.ts +58 -20
  37. package/lib/cjs/geometry3d/PointHelpers.d.ts.map +1 -1
  38. package/lib/cjs/geometry3d/PointHelpers.js +213 -62
  39. package/lib/cjs/geometry3d/PointHelpers.js.map +1 -1
  40. package/lib/cjs/geometry3d/Transform.d.ts +2 -3
  41. package/lib/cjs/geometry3d/Transform.d.ts.map +1 -1
  42. package/lib/cjs/geometry3d/Transform.js +2 -3
  43. package/lib/cjs/geometry3d/Transform.js.map +1 -1
  44. package/lib/cjs/geometry4d/Point4d.d.ts +13 -0
  45. package/lib/cjs/geometry4d/Point4d.d.ts.map +1 -1
  46. package/lib/cjs/geometry4d/Point4d.js +21 -0
  47. package/lib/cjs/geometry4d/Point4d.js.map +1 -1
  48. package/lib/cjs/numerics/BezierPolynomials.d.ts +88 -64
  49. package/lib/cjs/numerics/BezierPolynomials.d.ts.map +1 -1
  50. package/lib/cjs/numerics/BezierPolynomials.js +92 -73
  51. package/lib/cjs/numerics/BezierPolynomials.js.map +1 -1
  52. package/lib/cjs/numerics/PascalCoefficients.d.ts +8 -12
  53. package/lib/cjs/numerics/PascalCoefficients.d.ts.map +1 -1
  54. package/lib/cjs/numerics/PascalCoefficients.js +10 -12
  55. package/lib/cjs/numerics/PascalCoefficients.js.map +1 -1
  56. package/lib/cjs/serialization/BGFBReader.d.ts +10 -10
  57. package/lib/cjs/serialization/BGFBReader.d.ts.map +1 -1
  58. package/lib/cjs/serialization/BGFBReader.js +69 -42
  59. package/lib/cjs/serialization/BGFBReader.js.map +1 -1
  60. package/lib/cjs/serialization/BGFBWriter.d.ts +8 -8
  61. package/lib/cjs/serialization/BGFBWriter.d.ts.map +1 -1
  62. package/lib/cjs/serialization/BGFBWriter.js +80 -55
  63. package/lib/cjs/serialization/BGFBWriter.js.map +1 -1
  64. package/lib/cjs/serialization/GeometrySamples.d.ts.map +1 -1
  65. package/lib/cjs/serialization/GeometrySamples.js +6 -8
  66. package/lib/cjs/serialization/GeometrySamples.js.map +1 -1
  67. package/lib/cjs/serialization/IModelJsonSchema.d.ts +6 -14
  68. package/lib/cjs/serialization/IModelJsonSchema.d.ts.map +1 -1
  69. package/lib/cjs/serialization/IModelJsonSchema.js +84 -262
  70. package/lib/cjs/serialization/IModelJsonSchema.js.map +1 -1
  71. package/lib/cjs/serialization/SerializationHelpers.d.ts +109 -0
  72. package/lib/cjs/serialization/SerializationHelpers.d.ts.map +1 -0
  73. package/lib/cjs/serialization/SerializationHelpers.js +591 -0
  74. package/lib/cjs/serialization/SerializationHelpers.js.map +1 -0
  75. package/lib/esm/bspline/BSpline1dNd.d.ts +12 -2
  76. package/lib/esm/bspline/BSpline1dNd.d.ts.map +1 -1
  77. package/lib/esm/bspline/BSpline1dNd.js +27 -17
  78. package/lib/esm/bspline/BSpline1dNd.js.map +1 -1
  79. package/lib/esm/bspline/BSplineCurve.d.ts +30 -16
  80. package/lib/esm/bspline/BSplineCurve.d.ts.map +1 -1
  81. package/lib/esm/bspline/BSplineCurve.js +68 -44
  82. package/lib/esm/bspline/BSplineCurve.js.map +1 -1
  83. package/lib/esm/bspline/BSplineCurve3dH.d.ts +27 -20
  84. package/lib/esm/bspline/BSplineCurve3dH.d.ts.map +1 -1
  85. package/lib/esm/bspline/BSplineCurve3dH.js +137 -88
  86. package/lib/esm/bspline/BSplineCurve3dH.js.map +1 -1
  87. package/lib/esm/bspline/BSplineSurface.d.ts +138 -74
  88. package/lib/esm/bspline/BSplineSurface.d.ts.map +1 -1
  89. package/lib/esm/bspline/BSplineSurface.js +242 -119
  90. package/lib/esm/bspline/BSplineSurface.js.map +1 -1
  91. package/lib/esm/bspline/Bezier1dNd.d.ts +18 -4
  92. package/lib/esm/bspline/Bezier1dNd.d.ts.map +1 -1
  93. package/lib/esm/bspline/Bezier1dNd.js +19 -5
  94. package/lib/esm/bspline/Bezier1dNd.js.map +1 -1
  95. package/lib/esm/bspline/BezierCurve3dH.d.ts.map +1 -1
  96. package/lib/esm/bspline/BezierCurve3dH.js +2 -1
  97. package/lib/esm/bspline/BezierCurve3dH.js.map +1 -1
  98. package/lib/esm/bspline/KnotVector.d.ts +30 -33
  99. package/lib/esm/bspline/KnotVector.d.ts.map +1 -1
  100. package/lib/esm/bspline/KnotVector.js +76 -69
  101. package/lib/esm/bspline/KnotVector.js.map +1 -1
  102. package/lib/esm/geometry3d/Matrix3d.d.ts +20 -13
  103. package/lib/esm/geometry3d/Matrix3d.d.ts.map +1 -1
  104. package/lib/esm/geometry3d/Matrix3d.js +28 -21
  105. package/lib/esm/geometry3d/Matrix3d.js.map +1 -1
  106. package/lib/esm/geometry3d/Point3dVector3d.d.ts +3 -2
  107. package/lib/esm/geometry3d/Point3dVector3d.d.ts.map +1 -1
  108. package/lib/esm/geometry3d/Point3dVector3d.js +6 -5
  109. package/lib/esm/geometry3d/Point3dVector3d.js.map +1 -1
  110. package/lib/esm/geometry3d/PointHelpers.d.ts +58 -20
  111. package/lib/esm/geometry3d/PointHelpers.d.ts.map +1 -1
  112. package/lib/esm/geometry3d/PointHelpers.js +213 -62
  113. package/lib/esm/geometry3d/PointHelpers.js.map +1 -1
  114. package/lib/esm/geometry3d/Transform.d.ts +2 -3
  115. package/lib/esm/geometry3d/Transform.d.ts.map +1 -1
  116. package/lib/esm/geometry3d/Transform.js +2 -3
  117. package/lib/esm/geometry3d/Transform.js.map +1 -1
  118. package/lib/esm/geometry4d/Point4d.d.ts +13 -0
  119. package/lib/esm/geometry4d/Point4d.d.ts.map +1 -1
  120. package/lib/esm/geometry4d/Point4d.js +21 -0
  121. package/lib/esm/geometry4d/Point4d.js.map +1 -1
  122. package/lib/esm/numerics/BezierPolynomials.d.ts +88 -64
  123. package/lib/esm/numerics/BezierPolynomials.d.ts.map +1 -1
  124. package/lib/esm/numerics/BezierPolynomials.js +92 -73
  125. package/lib/esm/numerics/BezierPolynomials.js.map +1 -1
  126. package/lib/esm/numerics/PascalCoefficients.d.ts +8 -12
  127. package/lib/esm/numerics/PascalCoefficients.d.ts.map +1 -1
  128. package/lib/esm/numerics/PascalCoefficients.js +10 -12
  129. package/lib/esm/numerics/PascalCoefficients.js.map +1 -1
  130. package/lib/esm/serialization/BGFBReader.d.ts +10 -10
  131. package/lib/esm/serialization/BGFBReader.d.ts.map +1 -1
  132. package/lib/esm/serialization/BGFBReader.js +69 -42
  133. package/lib/esm/serialization/BGFBReader.js.map +1 -1
  134. package/lib/esm/serialization/BGFBWriter.d.ts +8 -8
  135. package/lib/esm/serialization/BGFBWriter.d.ts.map +1 -1
  136. package/lib/esm/serialization/BGFBWriter.js +80 -55
  137. package/lib/esm/serialization/BGFBWriter.js.map +1 -1
  138. package/lib/esm/serialization/GeometrySamples.d.ts.map +1 -1
  139. package/lib/esm/serialization/GeometrySamples.js +7 -9
  140. package/lib/esm/serialization/GeometrySamples.js.map +1 -1
  141. package/lib/esm/serialization/IModelJsonSchema.d.ts +6 -14
  142. package/lib/esm/serialization/IModelJsonSchema.d.ts.map +1 -1
  143. package/lib/esm/serialization/IModelJsonSchema.js +85 -263
  144. package/lib/esm/serialization/IModelJsonSchema.js.map +1 -1
  145. package/lib/esm/serialization/SerializationHelpers.d.ts +109 -0
  146. package/lib/esm/serialization/SerializationHelpers.d.ts.map +1 -0
  147. package/lib/esm/serialization/SerializationHelpers.js +588 -0
  148. package/lib/esm/serialization/SerializationHelpers.js.map +1 -0
  149. package/package.json +3 -3
@@ -0,0 +1 @@
1
+ {"version":3,"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;aACF;YAED,8BAA8B;YAC9B,IAAI,CAAC,eAAe;gBAClB,IAAI,CAAC,OAAO,CAAC,KAAK,GAAG,uBAAU,CAAC,SAAS,CAAC,IAAI,CAAC,OAAO,CAAC,KAAK,EAAE,IAAI,CAAC,OAAO,CAAC,KAAK,GAAG,CAAC,EAAE,IAAI,EAAE,IAAI,CAAC,OAAO,CAAC,QAAQ,CAAC,CAAC;YACrH,IAAI,CAAC,eAAe;gBAClB,IAAI,CAAC,OAAO,CAAC,KAAK,GAAG,uBAAU,CAAC,SAAS,CAAC,IAAI,CAAC,OAAO,CAAC,KAAK,EAAE,IAAI,CAAC,OAAO,CAAC,KAAK,GAAG,CAAC,EAAE,IAAI,EAAE,IAAI,CAAC,OAAO,CAAC,QAAQ,CAAC,CAAC;YAErH,+BAA+B,CAAC,IAAI,EAAE,OAAO,CAAC,CAAC;YAC/C,OAAO,IAAI,CAAC;QACd,CAAC;KACF;IAjLY,2BAAM,SAiLlB,CAAA;AACH,CAAC,EAlnBgB,oBAAoB,GAApB,4BAAoB,KAApB,4BAAoB,QAknBpC","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\r\n/** @packageDocumentation\r\n * @module Serialization\r\n */\r\nimport { BSplineWrapMode, KnotVector } from \"../bspline/KnotVector\";\r\nimport { NumberArray } from \"../geometry3d/PointHelpers\";\r\n\r\n/**\r\n * `SerializationHelpers` namespace has helper classes for serializing and deserializing geometry.\r\n * @internal\r\n */\r\nexport namespace SerializationHelpers {\r\n export interface BSplineParams {\r\n numPoles: number;\r\n order: number;\r\n closed?: boolean;\r\n knots: number[] | Float64Array;\r\n wrapMode?: BSplineWrapMode;\r\n }\r\n export interface BSplineCurveData {\r\n poles: number[][] | Float64Array;\r\n dim: number; // # coordinates per pole = inner dimension of poles array (3,4)\r\n weights?: number[] | Float64Array; // if defined, poles are assumed to be weighted and dim 3\r\n params: BSplineParams;\r\n }\r\n export interface BSplineSurfaceData {\r\n poles: number[][][] | Float64Array;\r\n dim: number; // # coordinates per pole = inner dimension of poles array (3,4)\r\n weights?: number[][] | Float64Array; // if defined, poles are assumed to be weighted and dim 3\r\n uParams: BSplineParams; // uParams.numPoles = # cols (middle dimension) of poles\r\n vParams: BSplineParams; // vParams.numPoles = # rows (outer dimension) of poles\r\n }\r\n export interface BSplineDataOptions {\r\n jsonPoles?: boolean; // type of output pole/weight arrays. true: structured number array; false: Float64Array; undefined: either\r\n jsonKnots?: boolean; // type of output knot arrays. true: number array; false: Float64Array; undefined: either\r\n removeExtraKnots?: boolean; // extraneous knot handling during Import: true: remove them; false | undefined: leave them. Has no effect during Export, which always outputs the extraneous knots.\r\n }\r\n\r\n /** Constructor with required data. Inputs are captured, not copied. */\r\n export function createBSplineCurveData(poles: number[][] | Float64Array, dim: number, knots: number[] | Float64Array, numPoles: number, order: number): BSplineCurveData {\r\n return { poles, dim, params: { numPoles, order, knots } };\r\n }\r\n\r\n /** Constructor with required data. Inputs are captured, not copied. */\r\n export function createBSplineSurfaceData(poles: number[][][] | Float64Array, dim: number, uKnots: number[] | Float64Array, uNumPoles: number, uOrder: number, vKnots: number[] | Float64Array, vNumPoles: number, vOrder: number): BSplineSurfaceData {\r\n return { poles, dim, uParams: { numPoles: uNumPoles, order: uOrder, knots: uKnots }, vParams: { numPoles: vNumPoles, order: vOrder, knots: vKnots } };\r\n }\r\n\r\n /** Clone curve data */\r\n export function cloneBSplineCurveData(source: BSplineCurveData): BSplineCurveData {\r\n return {\r\n poles: (source.poles instanceof Float64Array) ? new Float64Array(source.poles) : NumberArray.copy2d(source.poles),\r\n dim: source.dim,\r\n weights: source.weights ? source.weights.slice() : undefined,\r\n params: {\r\n numPoles: source.params.numPoles,\r\n order: source.params.order,\r\n closed: source.params.closed,\r\n knots: source.params.knots.slice(),\r\n wrapMode: source.params.wrapMode,\r\n },\r\n };\r\n }\r\n\r\n /** Clone surface data */\r\n export function cloneBSplineSurfaceData(source: BSplineSurfaceData): BSplineSurfaceData {\r\n return {\r\n poles: (source.poles instanceof Float64Array) ? new Float64Array(source.poles) : NumberArray.copy3d(source.poles),\r\n dim: source.dim,\r\n weights: source.weights ? ((source.weights instanceof Float64Array) ? source.weights.slice() : NumberArray.copy2d(source.weights)) : undefined,\r\n uParams: {\r\n numPoles: source.uParams.numPoles,\r\n order: source.uParams.order,\r\n closed: source.uParams.closed,\r\n knots: source.uParams.knots.slice(),\r\n wrapMode: source.uParams.wrapMode,\r\n },\r\n vParams: {\r\n numPoles: source.vParams.numPoles,\r\n order: source.vParams.order,\r\n closed: source.vParams.closed,\r\n knots: source.vParams.knots.slice(),\r\n wrapMode: source.vParams.wrapMode,\r\n },\r\n };\r\n }\r\n\r\n /** Copy from source to dest */\r\n function copyBSplineCurveDataPoles(source: BSplineCurveData): {poles?: number[][], weights?: number[]} {\r\n let nPole = 0;\r\n let nCoordPerPole = 0;\r\n let nPoleCoords = 0;\r\n let poleDimProduct = 0;\r\n if (source.poles instanceof Float64Array) {\r\n nPole = source.params.numPoles;\r\n nCoordPerPole = source.dim;\r\n nPoleCoords = source.poles.length;\r\n poleDimProduct = nPole * nCoordPerPole;\r\n } else {\r\n nPole = source.poles.length;\r\n if (nPole > 0)\r\n nCoordPerPole = source.poles[0].length;\r\n nPoleCoords = poleDimProduct = nPole * nCoordPerPole;\r\n }\r\n if (0 === poleDimProduct || poleDimProduct > nPoleCoords || nCoordPerPole !== source.dim)\r\n return {};\r\n\r\n let nWeight = 0;\r\n let nWeightCoords = 0;\r\n let weightDimProduct = 0;\r\n if (source.weights !== undefined) {\r\n if (source.weights instanceof Float64Array) {\r\n nWeight = source.params.numPoles;\r\n nWeightCoords = source.weights.length;\r\n weightDimProduct = nWeight;\r\n } else {\r\n nWeight = source.weights.length;\r\n nWeightCoords = weightDimProduct = nWeight;\r\n }\r\n if (0 === weightDimProduct || weightDimProduct > nWeightCoords || nWeight !== nPole)\r\n return {};\r\n }\r\n\r\n // convert variant source to structured number array\r\n let poles: number[][] | undefined;\r\n let weights: number[] | undefined;\r\n if (source.poles instanceof Float64Array)\r\n poles = NumberArray.unpack2d(source.poles, nCoordPerPole);\r\n else\r\n poles = NumberArray.copy2d(source.poles);\r\n if (poles && source.weights)\r\n weights = NumberArray.create(source.weights);\r\n return {poles, weights};\r\n }\r\n\r\n /** Copy from source to dest */\r\n function copyBSplineSurfaceDataPoles(source: BSplineSurfaceData): {poles?: number[][][], weights?: number[][]} {\r\n let nPoleRow = 0;\r\n let nPolePerRow = 0;\r\n let nCoordPerPole = 0;\r\n let nCoords = 0;\r\n let poleDimProduct = 0;\r\n if (source.poles instanceof Float64Array) {\r\n nPoleRow = source.vParams.numPoles;\r\n nPolePerRow = source.uParams.numPoles;\r\n nCoordPerPole = source.dim;\r\n nCoords = source.poles.length;\r\n poleDimProduct = nPoleRow * nPolePerRow * nCoordPerPole;\r\n } else {\r\n nPoleRow = source.poles.length;\r\n if (nPoleRow > 0)\r\n nPolePerRow = source.poles[0].length;\r\n if (nPolePerRow > 0)\r\n nCoordPerPole = source.poles[0][0].length;\r\n nCoords = poleDimProduct = nPoleRow * nPolePerRow * nCoordPerPole;\r\n }\r\n if (0 === poleDimProduct || poleDimProduct > nCoords || nCoordPerPole !== source.dim)\r\n return {};\r\n\r\n let nWeightRow = 0;\r\n let nWeightPerRow = 0;\r\n let nWeightCoords = 0;\r\n let weightDimProduct = 0;\r\n if (source.weights !== undefined) {\r\n if (source.weights instanceof Float64Array) {\r\n nWeightRow = source.vParams.numPoles;\r\n nWeightPerRow = source.uParams.numPoles;\r\n nWeightCoords = source.weights.length;\r\n weightDimProduct = nWeightRow * nWeightPerRow;\r\n } else {\r\n nWeightRow = source.weights.length;\r\n if (nWeightRow > 0)\r\n nWeightPerRow = source.weights[0].length;\r\n nWeightCoords = weightDimProduct = nWeightRow * nWeightPerRow;\r\n }\r\n if (0 === weightDimProduct || weightDimProduct > nWeightCoords || nWeightRow !== nPoleRow || nWeightPerRow !== nPolePerRow)\r\n return {};\r\n }\r\n\r\n // convert variant source to structured number array\r\n let poles: number[][][] | undefined;\r\n let weights: number[][] | undefined;\r\n if (source.poles instanceof Float64Array)\r\n poles = NumberArray.unpack3d(source.poles, nPolePerRow, nCoordPerPole);\r\n else\r\n poles = NumberArray.copy3d(source.poles);\r\n if (poles && source.weights) {\r\n if (source.weights instanceof Float64Array)\r\n weights = NumberArray.unpack2d(source.weights, nWeightPerRow);\r\n else\r\n weights = NumberArray.copy2d(source.weights);\r\n }\r\n return {poles, weights};\r\n }\r\n\r\n /** Convert data arrays to the types specified by options. */\r\n function convertBSplineCurveDataArrays(data: BSplineCurveData, options?: BSplineDataOptions) {\r\n if (undefined !== options?.jsonPoles) {\r\n const packedPoles = data.poles instanceof Float64Array;\r\n if (options.jsonPoles && packedPoles)\r\n data.poles = NumberArray.unpack2d(data.poles as Float64Array, data.dim)!;\r\n else if (!options.jsonPoles && !packedPoles)\r\n data.poles = NumberArray.pack(data.poles as number[][]);\r\n\r\n if (data.weights) {\r\n const packedWeights = data.weights instanceof Float64Array;\r\n if (options.jsonPoles && packedWeights)\r\n data.weights = NumberArray.create(data.weights);\r\n else if (!options.jsonPoles && !packedWeights)\r\n data.weights = NumberArray.pack(data.weights as number[]);\r\n }\r\n }\r\n if (undefined !== options?.jsonKnots) {\r\n const packedKnots = data.params.knots instanceof Float64Array;\r\n if (options.jsonKnots && packedKnots)\r\n data.params.knots = NumberArray.create(data.params.knots);\r\n else if (!options.jsonKnots && !packedKnots)\r\n data.params.knots = NumberArray.pack(data.params.knots as number[]);\r\n }\r\n }\r\n\r\n /** Convert data arrays to the types specified by options. */\r\n function convertBSplineSurfaceDataArrays(data: BSplineSurfaceData, options?: BSplineDataOptions) {\r\n if (undefined !== options?.jsonPoles) {\r\n const packedPoles = data.poles instanceof Float64Array;\r\n if (options.jsonPoles && packedPoles)\r\n data.poles = NumberArray.unpack3d(data.poles as Float64Array, data.uParams.numPoles, data.dim)!;\r\n else if (!options.jsonPoles && !packedPoles)\r\n data.poles = NumberArray.pack(data.poles as number[][][]);\r\n\r\n if (data.weights) {\r\n const packedWeights = data.weights instanceof Float64Array;\r\n if (options.jsonPoles && packedWeights)\r\n data.weights = NumberArray.unpack2d(data.weights as Float64Array, data.uParams.numPoles);\r\n else if (!options.jsonPoles && !packedWeights)\r\n data.weights = NumberArray.pack(data.weights as number[][]);\r\n }\r\n }\r\n if (undefined !== options?.jsonKnots) {\r\n const packedKnotsU = data.uParams.knots instanceof Float64Array;\r\n if (options.jsonKnots && packedKnotsU)\r\n data.uParams.knots = NumberArray.create(data.uParams.knots);\r\n else if (!options.jsonKnots && !packedKnotsU)\r\n data.uParams.knots = NumberArray.pack(data.uParams.knots as number[]);\r\n\r\n const packedKnotsV = data.vParams.knots instanceof Float64Array;\r\n if (options.jsonKnots && packedKnotsV)\r\n data.vParams.knots = NumberArray.create(data.vParams.knots);\r\n else if (!options.jsonKnots && !packedKnotsV)\r\n data.vParams.knots = NumberArray.pack(data.vParams.knots as number[]);\r\n }\r\n }\r\n\r\n export class Import {\r\n /** copy knots, with options to control destination type and extraneous knot removal */\r\n private static copyKnots(knots: Float64Array | number[], options?: BSplineDataOptions, iStart?: number, iEnd?: number): Float64Array| number[] {\r\n if (undefined === iStart)\r\n iStart = 0;\r\n if (undefined === iEnd)\r\n iEnd = knots.length;\r\n if (options?.removeExtraKnots) {\r\n ++iStart; // ignore start knot\r\n --iEnd; // ignore end knot\r\n }\r\n let newNumKnots = iEnd - iStart;\r\n if (newNumKnots < 0)\r\n newNumKnots = 0;\r\n const newKnots = options?.jsonKnots ? new Array<number>(newNumKnots) : new Float64Array(newNumKnots);\r\n for (let i = iStart, k = 0; i < iEnd; i++, k++)\r\n newKnots[k] = knots[i];\r\n return newKnots;\r\n }\r\n\r\n /**\r\n * Recognize the special legacy periodic B-spline data of mode BSplineWrapMode.OpenByRemovingKnots, and return the corresponding modern open clamped knots.\r\n * * Note that the B-spline poles corresponding to the converted knots remain unchanged, but it is assumed that first and last poles are equal.\r\n * * Example: the legacy 7-point quadratic circle periodic knots {-1/3 0 0 0 1/3 1/3 2/3 2/3 1 1 1 4/3} are converted to open knots {0 0 1/3 1/3 2/3 2/3 1 1}.\r\n * * General form of knot vector (k = order, d = k-1 = degree, p = numPoles):\r\n * * * legacy input: {k/2 periodically extended knots} {start knot multiplicity k} {p-k interior knots} {end knot multiplicity k} {d/2 periodically extended knots}\r\n * * * converted output: {start knot multiplicity d} {p-k interior knots} {end knot multiplicity d}\r\n * @param knots classic knot vector to test\r\n * @param numPoles number of poles\r\n * @param order B-spline order\r\n * @param options for output type, extraneous knot removal\r\n * @returns open knots if legacy periodic B-spline input data is recognized; otherwise, undefined\r\n * @see Export.closeLegacyPeriodicKnots\r\n */\r\n private static openLegacyPeriodicKnots(knots: Float64Array | number[], numPoles: number, order: number, options?: BSplineDataOptions): Float64Array | number[] | undefined {\r\n const numKnots = knots.length;\r\n if (order < 2 || numPoles + 2 * order - 1 !== numKnots)\r\n return undefined; // not legacy periodic knots\r\n\r\n const startKnot = knots[order - 1];\r\n const endKnot = knots[numKnots - order];\r\n const iStart0 = Math.floor(order / 2); // index of first expected multiple of the start knot\r\n const iEnd0 = iStart0 + numPoles; // index of first expected multiple of the end knot\r\n const iEnd1 = iEnd0 + order; // one past index of last expected multiple of the end knot\r\n for (let i = 0; i < order; ++i) {\r\n if (Math.abs(knots[iStart0 + i] - startKnot) >= KnotVector.knotTolerance)\r\n return undefined; // start knot multiplicity too small\r\n if (Math.abs(knots[iEnd0 + i] - endKnot) >= KnotVector.knotTolerance)\r\n return undefined; // end knot multiplicity too small\r\n }\r\n return this.copyKnots(knots, options, iStart0, iEnd1);\r\n }\r\n\r\n /** Prepare imported B-spline curve data for eventual conversion to BSplineCurve3d | BSplineCurve3dH:\r\n * * Opens legacy \"fake\" periodic data by expanding knots\r\n * * Opens true periodic data by expanding poles and weights\r\n * @param data updated in place. If poles/weights/knots are updated, their respective arrays are reallocated.\r\n * @param options output specifications\r\n * @returns whether data was successfully prepared\r\n */\r\n public static prepareBSplineCurveData(data: BSplineCurveData, options?: BSplineDataOptions): boolean {\r\n let polesExpanded: number[][] | undefined;\r\n let weightsExpanded: number[] | undefined;\r\n let knotsCorrected: number[] | Float64Array | undefined;\r\n data.params.wrapMode = undefined;\r\n\r\n if (true === data.params.closed) {\r\n knotsCorrected = this.openLegacyPeriodicKnots(data.params.knots, data.params.numPoles, data.params.order, options);\r\n if (undefined !== knotsCorrected) {\r\n // legacy periodic knots removed, poles untouched\r\n data.params.knots = knotsCorrected;\r\n data.params.wrapMode = BSplineWrapMode.OpenByRemovingKnots;\r\n } else {\r\n // wrap poles, knots untouched\r\n if (!polesExpanded) {\r\n const arrays = copyBSplineCurveDataPoles(data);\r\n if (undefined === arrays.poles)\r\n return false; // invalid input\r\n data.poles = polesExpanded = arrays.poles;\r\n data.weights = weightsExpanded = arrays.weights;\r\n }\r\n for (let i = 0; i < data.params.order - 1; ++i) {\r\n const wraparoundPt = [];\r\n for (let j = 0; j < data.dim; ++j)\r\n wraparoundPt.push(polesExpanded[i][j]);\r\n polesExpanded.push(wraparoundPt); // append degree wraparound poles\r\n }\r\n if (weightsExpanded) {\r\n for (let i = 0; i < data.params.order - 1; ++i)\r\n weightsExpanded.push(weightsExpanded[i]); // append degree wraparound weights\r\n }\r\n data.params.numPoles += data.params.order - 1;\r\n data.params.wrapMode = BSplineWrapMode.OpenByAddingControlPoints;\r\n }\r\n }\r\n\r\n if (options?.removeExtraKnots) {\r\n if (!knotsCorrected)\r\n data.params.knots = this.copyKnots(data.params.knots, options);\r\n }\r\n\r\n data.params.closed = undefined; // we are open\r\n\r\n convertBSplineCurveDataArrays(data, options);\r\n return true;\r\n }\r\n\r\n /** Prepare imported B-spline surface data for eventual conversion to BSplineSurface3d | BSplineSurface3dH:\r\n * * Opens legacy \"fake\" periodic data by expanding knots\r\n * * Opens true periodic data by expanding poles and weights\r\n * @param data updated in place. If poles/weights/knots are updated, their respective arrays are reallocated.\r\n * @param options output specifications\r\n * @returns whether data was successfully prepared\r\n */\r\n public static prepareBSplineSurfaceData(data: BSplineSurfaceData, options?: BSplineDataOptions): boolean {\r\n let polesExpanded: number[][][] | undefined;\r\n let weightsExpanded: number[][] | undefined;\r\n let uKnotsCorrected: number[] | Float64Array | undefined;\r\n let vKnotsCorrected: number[] | Float64Array | undefined;\r\n data.uParams.wrapMode = data.vParams.wrapMode = undefined;\r\n\r\n if (true === data.uParams.closed) {\r\n uKnotsCorrected = this.openLegacyPeriodicKnots(data.uParams.knots, data.uParams.numPoles, data.uParams.order, options);\r\n if (undefined !== uKnotsCorrected) {\r\n // legacy periodic knots removed, poles untouched\r\n data.uParams.knots = uKnotsCorrected;\r\n data.uParams.wrapMode = BSplineWrapMode.OpenByRemovingKnots;\r\n } else {\r\n // wrap poles, knots untouched\r\n if (!polesExpanded) {\r\n const arrays = copyBSplineSurfaceDataPoles(data);\r\n if (undefined === arrays.poles)\r\n return false; // invalid input\r\n data.poles = polesExpanded = arrays.poles;\r\n data.weights = weightsExpanded = arrays.weights;\r\n }\r\n for (let i = 0; i < data.vParams.numPoles; ++i) { // #rows\r\n for (let j = 0; j < data.uParams.order - 1; ++j) {\r\n const wraparoundPt = [];\r\n for (let k = 0; k < data.dim; ++k)\r\n wraparoundPt.push(polesExpanded[i][j][k]);\r\n polesExpanded[i].push(wraparoundPt); // append degreeU wraparound poles to each row\r\n }\r\n }\r\n if (weightsExpanded) {\r\n for (let i = 0; i < data.vParams.numPoles; ++i) // #rows\r\n for (let j = 0; j < data.uParams.order - 1; ++j)\r\n weightsExpanded[i].push(weightsExpanded[i][j]); // append degreeU wraparound weights to each row\r\n }\r\n data.uParams.numPoles += data.uParams.order - 1;\r\n data.uParams.wrapMode = BSplineWrapMode.OpenByAddingControlPoints;\r\n }\r\n }\r\n\r\n if (true === data.vParams.closed) {\r\n vKnotsCorrected = this.openLegacyPeriodicKnots(data.vParams.knots, data.vParams.numPoles, data.vParams.order, options);\r\n if (undefined !== vKnotsCorrected) {\r\n // legacy periodic knots removed, poles untouched\r\n data.vParams.knots = vKnotsCorrected;\r\n data.vParams.wrapMode = BSplineWrapMode.OpenByRemovingKnots;\r\n } else {\r\n // wrap poles, knots untouched\r\n if (!polesExpanded) {\r\n const arrays = copyBSplineSurfaceDataPoles(data);\r\n if (undefined === arrays.poles)\r\n return false; // invalid input\r\n data.poles = polesExpanded = arrays.poles;\r\n data.weights = weightsExpanded = arrays.weights;\r\n }\r\n for (let i = 0; i < data.vParams.order - 1; ++i) {\r\n const wrapAroundRow = [];\r\n for (let j = 0; j < data.uParams.numPoles; ++j) { // #cols\r\n const wrapAroundPt = [];\r\n for (let k = 0; k < data.dim; ++k)\r\n wrapAroundPt.push(polesExpanded[i][j][k]);\r\n wrapAroundRow.push(wrapAroundPt);\r\n }\r\n polesExpanded.push(wrapAroundRow); // append degreeV wraparound rows of poles\r\n }\r\n if (weightsExpanded) {\r\n for (let i = 0; i < data.vParams.order - 1; ++i) {\r\n const wrapAroundRow = [];\r\n for (let j = 0; j < data.uParams.numPoles; ++j) // #cols\r\n wrapAroundRow.push(weightsExpanded[i][j]);\r\n weightsExpanded.push(wrapAroundRow); // append degreeV wraparound rows of weights\r\n }\r\n }\r\n data.vParams.numPoles += data.vParams.order - 1;\r\n data.vParams.wrapMode = BSplineWrapMode.OpenByAddingControlPoints;\r\n }\r\n }\r\n\r\n if (options?.removeExtraKnots) {\r\n if (!uKnotsCorrected)\r\n data.uParams.knots = this.copyKnots(data.uParams.knots, options);\r\n if (!vKnotsCorrected)\r\n data.vParams.knots = this.copyKnots(data.vParams.knots, options);\r\n }\r\n\r\n data.uParams.closed = data.vParams.closed = undefined; // we are open\r\n\r\n convertBSplineSurfaceDataArrays(data, options);\r\n return true;\r\n }\r\n }\r\n\r\n export class Export {\r\n /**\r\n * Restore special legacy periodic B-spline knots opened via BSplineWrapMode.OpenByRemovingKnots logic.\r\n * @param knots modern knot vector: {start knot multiplicity d} {p-k interior knots} {end knot multiplicity d}\r\n * @param order B-spline order\r\n * @param options for output type\r\n * @param wrapMode wrap mode of the knots\r\n * @returns legacy periodic knots (with classic extraneous start/end knot) if wrapMode recognized; otherwise, undefined\r\n * @see Import.openLegacyPeriodicKnots\r\n */\r\n private static closeLegacyPeriodicKnots(knots: Float64Array | number[], order: number, options?: BSplineDataOptions, wrapMode?: BSplineWrapMode): Float64Array | number[] | undefined {\r\n if (wrapMode === undefined || wrapMode !== BSplineWrapMode.OpenByRemovingKnots)\r\n return undefined;\r\n\r\n const degree = order - 1;\r\n const leftIndex = degree - 1;\r\n const rightIndex = knots.length - degree;\r\n const leftKnot = knots[leftIndex];\r\n const rightKnot = knots[rightIndex];\r\n const knotPeriod = rightKnot - leftKnot;\r\n const newNumKnots = knots.length + degree + 2;\r\n const newKnots = options?.jsonKnots ? new Array<number>(newNumKnots) : new Float64Array(newNumKnots);\r\n\r\n let k = 0;\r\n for (let i = Math.floor(order / 2); i > 0; --i)\r\n newKnots[k++] = knots[rightIndex - i] - knotPeriod;\r\n newKnots[k++] = leftKnot; // extraneous start knot\r\n for (const knot of knots)\r\n newKnots[k++] = knot;\r\n newKnots[k++] = rightKnot; // extraneous end knot\r\n for (let i = 1; i <= Math.floor(degree / 2); ++i)\r\n newKnots[k++] = knots[leftIndex + i] + knotPeriod;\r\n\r\n return newKnots;\r\n }\r\n\r\n /**\r\n * Prepare data from a B-spline curve for export.\r\n * * adds classic extraneous knot at start and end of knot vector\r\n * * re-closes periodic data based on BSplineWrapMode\r\n * @param data updated in place. If poles/weights/knots are updated, their respective arrays are reallocated.\r\n * @param options output specifications\r\n * @returns whether data was successfully prepared\r\n */\r\n public static prepareBSplineCurveData(data: BSplineCurveData, options?: BSplineDataOptions): boolean {\r\n let polesTrimmed: number[][] | undefined;\r\n let weightsTrimmed: number[] | undefined;\r\n let knotsCorrected: number[] | Float64Array | undefined;\r\n data.params.closed = undefined;\r\n\r\n switch (data.params.wrapMode) {\r\n case BSplineWrapMode.OpenByRemovingKnots: {\r\n // add legacy periodic and extraneous knots, poles untouched\r\n knotsCorrected = this.closeLegacyPeriodicKnots(data.params.knots, data.params.order, options, data.params.wrapMode);\r\n if (undefined === knotsCorrected)\r\n return false; // invalid input\r\n data.params.knots = knotsCorrected;\r\n data.params.closed = true;\r\n break;\r\n }\r\n case BSplineWrapMode.OpenByAddingControlPoints: {\r\n // unwrap poles, knots untouched\r\n if (!polesTrimmed) {\r\n const arrays = copyBSplineCurveDataPoles(data);\r\n if (undefined === arrays.poles)\r\n return false; // invalid input\r\n data.poles = polesTrimmed = arrays.poles;\r\n data.weights = weightsTrimmed = arrays.weights;\r\n }\r\n for (let i = 0; i < data.params.order - 1; ++i)\r\n polesTrimmed.pop(); // remove last degree poles\r\n if (weightsTrimmed) {\r\n for (let i = 0; i < data.params.order - 1; ++i)\r\n weightsTrimmed.pop(); // remove last degree weights\r\n }\r\n data.params.numPoles -= data.params.order - 1;\r\n data.params.closed = true;\r\n break;\r\n }\r\n }\r\n\r\n // always add extraneous knots\r\n if (!knotsCorrected)\r\n data.params.knots = KnotVector.copyKnots(data.params.knots, data.params.order - 1, true, data.params.wrapMode);\r\n\r\n convertBSplineCurveDataArrays(data, options);\r\n return true;\r\n }\r\n\r\n /**\r\n * Prepare data from a B-spline surface for export.\r\n * * adds classic extraneous knot at start and end of knot vectors\r\n * * re-closes periodic data based on BSplineWrapMode\r\n * @param data updated in place. If poles/weights/knots are updated, their respective arrays are reallocated.\r\n * @param options output specifications\r\n * @returns whether data was successfully prepared\r\n */\r\n public static prepareBSplineSurfaceData(data: BSplineSurfaceData, options?: BSplineDataOptions): boolean {\r\n let polesTrimmed: number[][][] | undefined;\r\n let weightsTrimmed: number[][] | undefined;\r\n let uKnotsCorrected: number[] | Float64Array | undefined;\r\n let vKnotsCorrected: number[] | Float64Array | undefined;\r\n data.uParams.closed = data.vParams.closed = undefined;\r\n\r\n switch (data.uParams.wrapMode) {\r\n case BSplineWrapMode.OpenByRemovingKnots: {\r\n // add legacy periodic and extraneous knots, poles untouched\r\n uKnotsCorrected = this.closeLegacyPeriodicKnots(data.uParams.knots, data.uParams.order, options, data.uParams.wrapMode);\r\n if (undefined === uKnotsCorrected)\r\n return false; // invalid input\r\n data.uParams.knots = uKnotsCorrected;\r\n data.uParams.closed = true;\r\n break;\r\n }\r\n case BSplineWrapMode.OpenByAddingControlPoints: {\r\n // unwrap poles, knots untouched\r\n if (!polesTrimmed) {\r\n const arrays = copyBSplineSurfaceDataPoles(data);\r\n if (undefined === arrays.poles)\r\n return false; // invalid input\r\n data.poles = polesTrimmed = arrays.poles;\r\n data.weights = weightsTrimmed = arrays.weights;\r\n }\r\n for (let i = 0; i < data.vParams.numPoles; ++i) // #rows\r\n for (let j = 0; j < data.uParams.order - 1; ++j)\r\n polesTrimmed[i].pop(); // remove last degreeU poles from each row\r\n if (weightsTrimmed) {\r\n for (let i = 0; i < data.vParams.numPoles; ++i) // #rows\r\n for (let j = 0; j < data.uParams.order - 1; ++j)\r\n weightsTrimmed[i].pop(); // remove last degreeU weights from each row\r\n }\r\n data.uParams.numPoles -= data.uParams.order - 1;\r\n data.uParams.closed = true;\r\n break;\r\n }\r\n }\r\n\r\n switch (data.vParams.wrapMode) {\r\n case BSplineWrapMode.OpenByRemovingKnots: {\r\n // add legacy periodic and extraneous knots, poles untouched\r\n vKnotsCorrected = this.closeLegacyPeriodicKnots(data.vParams.knots, data.vParams.order, options, data.vParams.wrapMode);\r\n if (undefined === vKnotsCorrected)\r\n return false; // invalid input\r\n data.vParams.knots = vKnotsCorrected;\r\n data.vParams.closed = true;\r\n break;\r\n }\r\n case BSplineWrapMode.OpenByAddingControlPoints: {\r\n // unwrap poles, knots untouched\r\n if (!polesTrimmed) {\r\n const arrays = copyBSplineSurfaceDataPoles(data);\r\n if (undefined === arrays.poles)\r\n return false; // invalid input\r\n data.poles = polesTrimmed = arrays.poles;\r\n data.weights = weightsTrimmed = arrays.weights;\r\n }\r\n for (let i = 0; i < data.vParams.order - 1; ++i)\r\n polesTrimmed.pop(); // remove last degreeV rows of poles\r\n if (weightsTrimmed) {\r\n for (let i = 0; i < data.vParams.order - 1; ++i)\r\n weightsTrimmed.pop(); // remove last degreeV rows of weights\r\n }\r\n data.vParams.numPoles -= data.vParams.order - 1;\r\n data.vParams.closed = true;\r\n break;\r\n }\r\n }\r\n\r\n // always add extraneous knots\r\n if (!uKnotsCorrected)\r\n data.uParams.knots = KnotVector.copyKnots(data.uParams.knots, data.uParams.order - 1, true, data.uParams.wrapMode);\r\n if (!vKnotsCorrected)\r\n data.vParams.knots = KnotVector.copyKnots(data.vParams.knots, data.vParams.order - 1, true, data.vParams.wrapMode);\r\n\r\n convertBSplineSurfaceDataArrays(data, options);\r\n return true;\r\n }\r\n }\r\n}\r\n"]}
@@ -58,8 +58,11 @@ export declare class BSpline1dNd {
58
58
  static create(numPoles: number, poleLength: number, order: number, knots: KnotVector): BSpline1dNd | undefined;
59
59
  /** Map a span index and local fraction to knot value. */
60
60
  spanFractionToKnot(span: number, localFraction: number): number;
61
- /** Evaluate the `order` basis functions (and optionally one or two derivatives) at a given fractional position within indexed span. */
62
- evaluateBasisFunctionsInSpan(spanIndex: number, spanFraction: number, f: Float64Array, df?: Float64Array, ddf?: Float64Array): void;
61
+ /**
62
+ * Evaluate the `order` basis functions (and optionally one or two derivatives) at a given fractional position within indexed span.
63
+ * @returns true if and only if output arrays are sufficiently sized
64
+ */
65
+ evaluateBasisFunctionsInSpan(spanIndex: number, spanFraction: number, f: Float64Array, df?: Float64Array, ddf?: Float64Array): boolean;
63
66
  /**
64
67
  * * Evaluate the basis functions at spanIndex and fraction.
65
68
  * * Evaluations are stored in the preallocated `this.basisBuffer`
@@ -90,8 +93,15 @@ export declare class BSpline1dNd {
90
93
  * Test if the leading and trailing polygon coordinates are replicated in the manner of a "closed" bspline polygon which has been expanded
91
94
  * to act as a normal bspline.
92
95
  * @returns true if `degree` leading and trailing polygon blocks match
96
+ * @deprecated in 4.x. Use testClosablePolygon instead.
93
97
  */
94
98
  testCloseablePolygon(mode?: BSplineWrapMode): boolean;
99
+ /**
100
+ * Test if the leading and trailing polygon coordinates are replicated in the manner of a "closed" bspline polygon which has been expanded
101
+ * to act as a normal bspline.
102
+ * @returns true if `degree` leading and trailing polygon blocks match
103
+ */
104
+ testClosablePolygon(mode?: BSplineWrapMode): boolean;
95
105
  /** Insert knot and resulting pole into the instance, optionally multiple times.
96
106
  * @param knot the knot to be inserted (may already exist in the KnotVector)
97
107
  * @param totalMultiplicity the total multiplicity of the knot on return
@@ -1 +1 @@
1
- {"version":3,"file":"BSpline1dNd.d.ts","sourceRoot":"","sources":["../../../src/bspline/BSpline1dNd.ts"],"names":[],"mappings":"AAIA;;GAEG;AAKH,OAAO,EAAE,OAAO,EAAE,MAAM,+BAA+B,CAAC;AACxD,OAAO,EAAE,eAAe,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAE3D;;;;;GAKG;AACH,qBAAa,WAAW;IACtB,2BAA2B;IACpB,KAAK,EAAE,UAAU,CAAC;IACzB,uDAAuD;IAChD,UAAU,EAAE,YAAY,CAAC;IAChC,wEAAwE;IACjE,UAAU,EAAE,MAAM,CAAC;IAC1B,gEAAgE;IAChE,IAAW,MAAM,IAAI,MAAM,CAA8B;IACzD,+FAA+F;IAC/F,IAAW,KAAK,IAAI,MAAM,CAAkC;IAC5D,oGAAoG;IACpG,IAAW,OAAO,IAAI,MAAM,CAA8C;IAC1E,qDAAqD;IACrD,IAAW,QAAQ,IAAI,MAAM,CAAqD;IAClF;;OAEG;IACI,cAAc,CAAC,CAAC,EAAE,MAAM,EAAE,MAAM,CAAC,EAAE,OAAO,GAAG,OAAO,GAAG,SAAS;IACvE,+EAA+E;IACxE,WAAW,EAAE,YAAY,CAAC;IACjC,oFAAoF;IAC7E,UAAU,EAAE,YAAY,CAAC;IAChC,+EAA+E;IACxE,YAAY,EAAE,YAAY,CAAC;IAClC,+EAA+E;IACxE,YAAY,EAAE,YAAY,CAAC;IAClC,oFAAoF;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S;IAGrH,yDAAyD;IAClD,kBAAkB,CAAC,IAAI,EAAE,MAAM,EAAE,aAAa,EAAE,MAAM,GAAG,MAAM;IAItE;;;MAGE;IACK,4BAA4B,CAAC,SAAS,EAAE,MAAM,EAAE,YAAY,EAAE,MAAM,EAAE,CAAC,EAAE,YAAY,EAAE,EAAE,CAAC,EAAE,YAAY,EAAE,GAAG,CAAC,EAAE,YAAY,GAAG,OAAO;IAS7I;;;;;SAKK;IACE,qBAAqB,CAAC,SAAS,EAAE,MAAM,EAAE,YAAY,EAAE,MAAM;IAIpE;;;;;SAKK;IACE,sBAAsB,CAAC,SAAS,EAAE,MAAM,EAAE,YAAY,EAAE,MAAM;IAKrE,wFAAwF;IACjF,oBAAoB,CAAC,SAAS,EAAE,MAAM;IAO7C,uHAAuH;IAChH,qBAAqB,CAAC,SAAS,EAAE,MAAM;IAS9C,wHAAwH;IACjH,qBAAqB,CAAC,SAAS,EAAE,MAAM;IAS9C,4HAA4H;IACrH,qBAAqB,CAAC,CAAC,EAAE,MAAM,EAAE,aAAa,GAAE,MAAU;IAgBjE;;OAEG;IACI,cAAc,IAAI,IAAI;IAgB7B;;;;;OAKG;IACI,oBAAoB,CAAC,IAAI,CAAC,EAAE,eAAe,GAAG,OAAO;IAG5D;;;;OAIG;IACI,mBAAmB,CAAC,IAAI,CAAC,EAAE,eAAe,GAAG,OAAO;IAqB3D;;;OAGG;IACI,OAAO,CAAC,IAAI,EAAE,MAAM,EAAE,iBAAiB,EAAE,MAAM,GAAG,OAAO;CA2DjE"}
@@ -61,7 +61,10 @@ export class BSpline1dNd {
61
61
  spanFractionToKnot(span, localFraction) {
62
62
  return this.knots.spanFractionToKnot(span, localFraction);
63
63
  }
64
- /** Evaluate the `order` basis functions (and optionally one or two derivatives) at a given fractional position within indexed span. */
64
+ /**
65
+ * Evaluate the `order` basis functions (and optionally one or two derivatives) at a given fractional position within indexed span.
66
+ * @returns true if and only if output arrays are sufficiently sized
67
+ */
65
68
  evaluateBasisFunctionsInSpan(spanIndex, spanFraction, f, df, ddf) {
66
69
  if (spanIndex < 0)
67
70
  spanIndex = 0;
@@ -164,28 +167,35 @@ export class BSpline1dNd {
164
167
  * Test if the leading and trailing polygon coordinates are replicated in the manner of a "closed" bspline polygon which has been expanded
165
168
  * to act as a normal bspline.
166
169
  * @returns true if `degree` leading and trailing polygon blocks match
170
+ * @deprecated in 4.x. Use testClosablePolygon instead.
167
171
  */
168
172
  testCloseablePolygon(mode) {
173
+ return this.testClosablePolygon(mode);
174
+ }
175
+ /**
176
+ * Test if the leading and trailing polygon coordinates are replicated in the manner of a "closed" bspline polygon which has been expanded
177
+ * to act as a normal bspline.
178
+ * @returns true if `degree` leading and trailing polygon blocks match
179
+ */
180
+ testClosablePolygon(mode) {
169
181
  if (mode === undefined)
170
182
  mode = this.knots.wrappable;
171
- const degree = this.degree;
183
+ let numPolesToTest = 0;
184
+ if (mode === BSplineWrapMode.OpenByAddingControlPoints)
185
+ numPolesToTest = this.degree;
186
+ else if (mode === BSplineWrapMode.OpenByRemovingKnots)
187
+ numPolesToTest = 1;
188
+ else
189
+ return false;
190
+ // check for wraparound poles
172
191
  const blockSize = this.poleLength;
173
- const indexDelta = (this.numPoles - this.degree) * blockSize;
174
- const data = this.packedData;
175
- if (mode === BSplineWrapMode.OpenByAddingControlPoints) {
176
- // expect {degree} matched points.
177
- const numValuesToTest = degree * blockSize;
178
- for (let i0 = 0; i0 < numValuesToTest; i0++) {
179
- if (!Geometry.isSameCoordinate(data[i0], data[i0 + indexDelta]))
180
- return false;
181
- }
182
- return true;
192
+ const indexDelta = (this.numPoles - numPolesToTest) * blockSize;
193
+ const numValuesToTest = numPolesToTest * blockSize;
194
+ for (let i0 = 0; i0 < numValuesToTest; i0++) {
195
+ if (!Geometry.isSameCoordinate(this.packedData[i0], this.packedData[i0 + indexDelta]))
196
+ return false;
183
197
  }
184
- if (mode === BSplineWrapMode.OpenByRemovingKnots) {
185
- // no pole conditions are applied.
186
- return true;
187
- }
188
- return false;
198
+ return true;
189
199
  }
190
200
  /** Insert knot and resulting pole into the instance, optionally multiple times.
191
201
  * @param knot the knot to be inserted (may already exist in the KnotVector)
@@ -1 +1 @@
1
- {"version":3,"file":"BSpline1dNd.js","sourceRoot":"","sources":["../../../src/bspline/BSpline1dNd.ts"],"names":[],"mappings":"AAAA;;;+FAG+F;AAC/F;;GAEG;AAEH,2CAA2C;AAC3C,OAAO,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AACvC,mEAAmE;AACnE,OAAO,EAAE,OAAO,EAAE,MAAM,+BAA+B,CAAC;AACxD,OAAO,EAAE,eAAe,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAE3D;;;;;GAKG;AACH,MAAM,OAAO,WAAW;IAOtB,gEAAgE;IAChE,IAAW,MAAM,KAAa,OAAO,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC,CAAC;IACzD,+FAA+F;IAC/F,IAAW,KAAK,KAAa,OAAO,IAAI,CAAC,KAAK,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,CAAC;IAC5D,oGAAoG;IACpG,IAAW,OAAO,KAAa,OAAO,IAAI,CAAC,QAAQ,GAAG,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC,CAAC;IAC1E,qDAAqD;IACrD,IAAW,QAAQ,KAAa,OAAO,IAAI,CAAC,UAAU,CAAC,MAAM,GAAG,IAAI,CAAC,UAAU,CAAC,CAAC,CAAC;IAClF;;OAEG;IACI,cAAc,CAAC,CAAS,EAAE,MAAgB,IAAyB,OAAO,OAAO,CAAC,gBAAgB,CAAC,IAAI,CAAC,UAAU,EAAE,CAAC,EAAE,MAAM,CAAC,CAAC,CAAC,CAAC;IAcxI;;;;;;OAMG;IACH,YAAsB,QAAgB,EAAE,UAAkB,EAAE,KAAa,EAAE,KAAiB;QAC1F,IAAI,CAAC,KAAK,GAAG,KAAK,CAAC;QACnB,IAAI,CAAC,UAAU,GAAG,IAAI,YAAY,CAAC,QAAQ,GAAG,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,GAAG,CAAC,CAAC,GAAG,CAAC,CAAC,GAAG,IAAI,CAAC,UAAU,EAAE,EAAE,CAAC,EAAE;oBACpE,OAAO,CAAC,IAAI,EAAE,CAAC,GAAG,QAAQ,CAAC,WAAW,CAAC,aAAa,CAAC,CAAC,GAAG,IAAI,CAAC,UAAU,CAAC,EAAE,QAAQ,EAAE,aAAa,CAAC,CAAC,CAAC,CAAC,CAAC;iBACxG;aACF;YAED,oFAAoF;YACpF,aAAa,CAAC,UAAU,CAAC,CAAC,MAAM,GAAG,IAAI,CAAC,MAAM,CAAC,GAAG,IAAI,CAAC,UAAU,EAAE,CAAC,MAAM,GAAG,IAAI,CAAC,MAAM,GAAG,CAAC,CAAC,GAAG,IAAI,CAAC,UAAU,EAAE,aAAa,GAAG,IAAI,CAAC,UAAU,CAAC,CAAC;YAClJ,IAAI,KAAK,GAAG,MAAM,GAAG,IAAI,CAAC,UAAU,CAAC;YACrC,KAAK,MAAM,CAAC,IAAI,OAAO;gBACrB,aAAa,CAAC,KAAK,EAAE,CAAC,GAAG,CAAC,CAAC,CAAE,6BAA6B;YAE5D,0EAA0E;YAC1E,QAAQ,CAAC,UAAU,CAAC,SAAS,GAAG,CAAC,EAAE,SAAS,GAAG,CAAC,EAAE,aAAa,CAAC,CAAC;YACjE,QAAQ,CAAC,SAAS,GAAG,CAAC,CAAC,GAAG,IAAI,CAAC;YAE/B,EAAE,SAAS,CAAC;YACZ,EAAE,aAAa,CAAC;YAChB,EAAE,aAAa,CAAC;SACjB;QACD,IAAI,CAAC,KAAK,CAAC,eAAe,CAAC,QAAQ,CAAC,CAAC;QACrC,IAAI,CAAC,UAAU,GAAG,aAAa,CAAC;QAChC,OAAO,IAAI,CAAC;IACd,CAAC;CACF","sourcesContent":["/*---------------------------------------------------------------------------------------------\r\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\r\n* See LICENSE.md in the project root for license terms and full copyright notice.\r\n*--------------------------------------------------------------------------------------------*/\r\n/** @packageDocumentation\r\n * @module Bspline\r\n */\r\n\r\n// import { Point2d } from \"../Geometry2d\";\r\nimport { Geometry } from \"../Geometry\";\r\n/* eslint-disable @typescript-eslint/naming-convention, no-empty */\r\nimport { Point3d } from \"../geometry3d/Point3dVector3d\";\r\nimport { BSplineWrapMode, KnotVector } from \"./KnotVector\";\r\n\r\n/** Bspline knots and poles for 1d-to-Nd.\r\n * * The \"pole\" (aka control point) of this class is a block of `poleLength` numbers.\r\n * * Derived classes (not this class) assign meaning such as x,y,z,w.\r\n * * for instance, an instance of this class with `poleLength===3` does not know if its poles are x,y,z or weighted 2D x,y,w\r\n * @public\r\n */\r\nexport class BSpline1dNd {\r\n /** knots of the bspline */\r\n public knots: KnotVector;\r\n /** poles, packed in blocks of `poleLength` doubles. */\r\n public packedData: Float64Array;\r\n /** (property accessor) Return the number of numeric values per pole. */\r\n public poleLength: number;\r\n /** (property accessor) Return the degree of the polynomials. */\r\n public get degree(): number { return this.knots.degree; }\r\n /** (property accessor) Return the number of order (one more than degree) of the polynomials */\r\n public get order(): number { return this.knots.degree + 1; }\r\n /** (property accessor) Return the number of bezier spans (including null spans at multiple knots)*/\r\n public get numSpan(): number { return this.numPoles - this.knots.degree; }\r\n /** (property accessor) Return the number of poles*/\r\n public get numPoles(): number { return this.packedData.length / this.poleLength; }\r\n /** copy 3 values of pole `i` into a point.\r\n * * The calling class is responsible for knowing if this is an appropriate access to the blocked data.\r\n */\r\n public getPoint3dPole(i: number, result?: Point3d): Point3d | undefined { return Point3d.createFromPacked(this.packedData, i, result); }\r\n /** preallocated array (length === `order`) used as temporary in evaluations */\r\n public basisBuffer: Float64Array; // one set of basis function values. ALLOCATED BY CTOR FOR FREQUENT REUSE\r\n /** preallocated array (length === `poleLength`) used as temporary in evaluations */\r\n public poleBuffer: Float64Array; // one set of target values. ALLOCATED BY CTOR FOR FREQUENT REUSE\r\n /** preallocated array (length === `order`) used as temporary in evaluations */\r\n public basisBuffer1: Float64Array; // one set of basis function values. ALLOCATED BY CTOR FOR FREQUENT REUSE\r\n /** preallocated array (length === `order`) used as temporary in evaluations */\r\n public basisBuffer2: Float64Array; // one set of basis function values. ALLOCATED BY CTOR FOR FREQUENT REUSE\r\n /** preallocated array (length === `poleLength`) used as temporary in evaluations */\r\n public poleBuffer1: Float64Array; // one set of target values. ALLOCATED BY CTOR FOR FREQUENT REUSE\r\n /** preallocated array (length === `poleLength`) used as temporary in evaluations */\r\n public poleBuffer2: Float64Array; // one set of target values. ALLOCATED BY CTOR FOR FREQUENT REUSE\r\n\r\n /**\r\n * initialize arrays for given spline dimensions.\r\n * @param numPoles number of poles\r\n * @param poleLength number of coordinates per pole (e.g.. 3 for 3D unweighted, 4 for 3d weighted, 2 for 2d unweighted, 3 for 2d weighted)\r\n * @param order number of poles in support for a section of the bspline\r\n * @param knots KnotVector. This is captured, not cloned.\r\n */\r\n protected constructor(numPoles: number, poleLength: number, order: number, knots: KnotVector) {\r\n this.knots = knots;\r\n this.packedData = new Float64Array(numPoles * poleLength);\r\n this.poleLength = poleLength;\r\n this.basisBuffer = new Float64Array(order);\r\n this.poleBuffer = new Float64Array(poleLength);\r\n this.basisBuffer1 = new Float64Array(order);\r\n this.basisBuffer2 = new Float64Array(order);\r\n this.poleBuffer1 = new Float64Array(poleLength);\r\n this.poleBuffer2 = new Float64Array(poleLength);\r\n }\r\n\r\n /**\r\n * create a 1Bspline1dNd`\r\n * @param numPoles number of poles\r\n * @param poleLength number of coordinates per pole (e.g.. 3 for 3D unweighted, 4 for 3d weighted, 2 for 2d unweighted, 3 for 2d weighted)\r\n * @param order number of poles in support for a section of the bspline\r\n * @param knots KnotVector. This is captured, not cloned.\r\n */\r\n public static create(numPoles: number, poleLength: number, order: number, knots: KnotVector): BSpline1dNd | undefined {\r\n return new BSpline1dNd(numPoles, poleLength, order, knots);\r\n }\r\n /** Map a span index and local fraction to knot value. */\r\n public spanFractionToKnot(span: number, localFraction: number): number {\r\n return this.knots.spanFractionToKnot(span, localFraction);\r\n }\r\n\r\n /** Evaluate the `order` basis functions (and optionally one or two derivatives) at a given fractional position within indexed span. */\r\n public evaluateBasisFunctionsInSpan(spanIndex: number, spanFraction: number, f: Float64Array, df?: Float64Array, ddf?: Float64Array) {\r\n if (spanIndex < 0) spanIndex = 0;\r\n if (spanIndex >= this.numSpan) spanIndex = this.numSpan - 1;\r\n const knotIndex0 = spanIndex + this.degree - 1;\r\n const globalKnot = this.knots.baseKnotFractionToKnot(knotIndex0, spanFraction);\r\n return df ?\r\n this.knots.evaluateBasisFunctions1(knotIndex0, globalKnot, f, df, ddf) :\r\n this.knots.evaluateBasisFunctions(knotIndex0, globalKnot, f);\r\n }\r\n /**\r\n * * Evaluate the basis functions at spanIndex and fraction.\r\n * * Evaluations are stored in the preallocated `this.basisBuffer`\r\n * * Immediately do the summations of the basis values times the respective control points\r\n * * Summations are stored in the preallocated `this.poleBuffer`\r\n * */\r\n public evaluateBuffersInSpan(spanIndex: number, spanFraction: number) {\r\n this.evaluateBasisFunctionsInSpan(spanIndex, spanFraction, this.basisBuffer);\r\n this.sumPoleBufferForSpan(spanIndex);\r\n }\r\n /**\r\n * * Evaluate the basis functions and one derivative at spanIndex and fraction.\r\n * * Evaluations are stored in the preallocated `this.basisBuffer`\r\n * * Immediately do the summations of the basis values times the respective control points\r\n * * Summations are stored in the preallocated `this.poleBuffer` and `this.poleBuffer1`\r\n * */\r\n public evaluateBuffersInSpan1(spanIndex: number, spanFraction: number) {\r\n this.evaluateBasisFunctionsInSpan(spanIndex, spanFraction, this.basisBuffer, this.basisBuffer1);\r\n this.sumPoleBufferForSpan(spanIndex);\r\n this.sumPoleBuffer1ForSpan(spanIndex);\r\n }\r\n /** sum poles in `poleBuffer` at span `spanIndex` by the weights in the `basisBuffer` */\r\n public sumPoleBufferForSpan(spanIndex: number) {\r\n this.poleBuffer.fill(0);\r\n let k = spanIndex * this.poleLength;\r\n for (const f of this.basisBuffer) {\r\n for (let j = 0; j < this.poleLength; j++) { this.poleBuffer[j] += f * this.packedData[k++]; }\r\n }\r\n }\r\n /** sum poles in `poleBuffer1` at span `spanIndex` by the weights in the `basisBuffer1`, i.e. form first derivatives */\r\n public sumPoleBuffer1ForSpan(spanIndex: number) {\r\n this.poleBuffer1.fill(0);\r\n let k = spanIndex * this.poleLength;\r\n for (const f of this.basisBuffer1) {\r\n for (let j = 0; j < this.poleLength; j++) {\r\n this.poleBuffer1[j] += f * this.packedData[k++];\r\n }\r\n }\r\n }\r\n /** sum poles in `poleBuffer2` at span `spanIndex` by the weights in the `basisBuffer2`, i.e. form second derivatives */\r\n public sumPoleBuffer2ForSpan(spanIndex: number) {\r\n this.poleBuffer2.fill(0);\r\n let k = spanIndex * this.poleLength;\r\n for (const f of this.basisBuffer2) {\r\n for (let j = 0; j < this.poleLength; j++) {\r\n this.poleBuffer2[j] += f * this.packedData[k++];\r\n }\r\n }\r\n }\r\n /** Evaluate the function values and 1 or 2 derivatives into `this.poleBuffer`, `this.poleBuffer1` and `this.poleBuffer2` */\r\n public evaluateBuffersAtKnot(u: number, numDerivative: number = 0) {\r\n const knotIndex0 = this.knots.knotToLeftKnotIndex(u);\r\n if (numDerivative < 1) {\r\n this.knots.evaluateBasisFunctions(knotIndex0, u, this.basisBuffer);\r\n this.sumPoleBufferForSpan(knotIndex0 - this.degree + 1);\r\n } else if (numDerivative === 1) {\r\n this.knots.evaluateBasisFunctions1(knotIndex0, u, this.basisBuffer, this.basisBuffer1);\r\n this.sumPoleBufferForSpan(knotIndex0 - this.degree + 1);\r\n this.sumPoleBuffer1ForSpan(knotIndex0 - this.degree + 1);\r\n } else {\r\n this.knots.evaluateBasisFunctions1(knotIndex0, u, this.basisBuffer, this.basisBuffer1, this.basisBuffer2);\r\n this.sumPoleBufferForSpan(knotIndex0 - this.degree + 1);\r\n this.sumPoleBuffer1ForSpan(knotIndex0 - this.degree + 1);\r\n this.sumPoleBuffer2ForSpan(knotIndex0 - this.degree + 1);\r\n }\r\n }\r\n /**\r\n * Reverse the (blocked) poles (in `this.packedData` in place.\r\n */\r\n public reverseInPlace(): void {\r\n // reverse poles in blocks ...\r\n const b = this.poleLength;\r\n const data = this.packedData;\r\n for (let i0 = 0, j0 = b * (this.numPoles - 1);\r\n i0 < j0;\r\n i0 += b, j0 -= b) {\r\n let t = 0;\r\n for (let i = 0; i < b; i++) {\r\n t = data[i0 + i];\r\n data[i0 + i] = data[j0 + i];\r\n data[j0 + i] = t;\r\n }\r\n }\r\n this.knots.reflectKnots();\r\n }\r\n /**\r\n * Test if the leading and trailing polygon coordinates are replicated in the manner of a \"closed\" bspline polygon which has been expanded\r\n * to act as a normal bspline.\r\n * @returns true if `degree` leading and trailing polygon blocks match\r\n */\r\n public testCloseablePolygon(mode?: BSplineWrapMode): boolean {\r\n if (mode === undefined)\r\n mode = this.knots.wrappable;\r\n const degree = this.degree;\r\n const blockSize = this.poleLength;\r\n const indexDelta = (this.numPoles - this.degree) * blockSize;\r\n const data = this.packedData;\r\n if (mode === BSplineWrapMode.OpenByAddingControlPoints) {\r\n // expect {degree} matched points.\r\n const numValuesToTest = degree * blockSize;\r\n for (let i0 = 0; i0 < numValuesToTest; i0++) {\r\n if (!Geometry.isSameCoordinate(data[i0], data[i0 + indexDelta]))\r\n return false;\r\n }\r\n return true;\r\n }\r\n\r\n if (mode === BSplineWrapMode.OpenByRemovingKnots) {\r\n // no pole conditions are applied.\r\n return true;\r\n }\r\n\r\n return false;\r\n }\r\n\r\n /** Insert knot and resulting pole into the instance, optionally multiple times.\r\n * @param knot the knot to be inserted (may already exist in the KnotVector)\r\n * @param totalMultiplicity the total multiplicity of the knot on return\r\n */\r\n public addKnot(knot: number, totalMultiplicity: number): boolean {\r\n if (knot < this.knots.leftKnot || knot > this.knots.rightKnot)\r\n return false; // invalid input\r\n let iLeftKnot = this.knots.knotToLeftKnotIndex(knot);\r\n\r\n // snap input if too close to an existing knot\r\n if (Math.abs(knot - this.knots.knots[iLeftKnot]) < KnotVector.knotTolerance) {\r\n knot = this.knots.knots[iLeftKnot]; // snap to left knot of bracket\r\n } else if (Math.abs(knot - this.knots.knots[iLeftKnot + 1]) < KnotVector.knotTolerance) {\r\n iLeftKnot += this.knots.getKnotMultiplicityAtIndex(iLeftKnot + 1);\r\n if (iLeftKnot > this.knots.rightKnotIndex)\r\n return true; // nothing to do\r\n knot = this.knots.knots[iLeftKnot]; // snap to left knot of next bracket\r\n }\r\n const numKnotsToAdd = Math.min(totalMultiplicity, this.degree) - this.knots.getKnotMultiplicity(knot);\r\n if (numKnotsToAdd <= 0)\r\n return true; // nothing to do\r\n\r\n // working arrays and pole buffer\r\n let currKnotCount = this.knots.knots.length;\r\n const newKnots = new Float64Array(currKnotCount + numKnotsToAdd);\r\n for (let i = 0; i < currKnotCount; ++i)\r\n newKnots[i] = this.knots.knots[i];\r\n let currPoleCount = this.numPoles;\r\n const newPackedData = new Float64Array(this.packedData.length + (numKnotsToAdd * this.poleLength));\r\n for (let i = 0; i < this.packedData.length; ++i)\r\n newPackedData[i] = this.packedData[i];\r\n const dataBuf = new Float64Array(this.degree * this.poleLength); // holds degree poles\r\n\r\n // each iteration adds one knot and one pole to the working arrays (cf. Farin 4e)\r\n for (let iter = 0; iter < numKnotsToAdd; ++iter) {\r\n // fill the buffer with new poles obtained from control polygon corner cutting\r\n let iBuf = 0;\r\n const iStart = iLeftKnot - this.degree + 2;\r\n for (let i = iStart; i < iStart + this.degree; ++i) {\r\n const fraction = (knot - newKnots[i - 1]) / (newKnots[i + this.degree - 1] - newKnots[i - 1]);\r\n for (let j = i * this.poleLength; j < (i + 1) * this.poleLength; ++j) {\r\n dataBuf[iBuf++] = Geometry.interpolate(newPackedData[j - this.poleLength], fraction, newPackedData[j]);\r\n }\r\n }\r\n\r\n // overwrite degree-1 poles with degree new poles, shifting tail to the right by one\r\n newPackedData.copyWithin((iStart + this.degree) * this.poleLength, (iStart + this.degree - 1) * this.poleLength, currPoleCount * this.poleLength);\r\n let iData = iStart * this.poleLength;\r\n for (const d of dataBuf)\r\n newPackedData[iData++] = d; // overwrite degree new poles\r\n\r\n // add the knot to newKnots in position, shifting tail to the right by one\r\n newKnots.copyWithin(iLeftKnot + 2, iLeftKnot + 1, currKnotCount);\r\n newKnots[iLeftKnot + 1] = knot;\r\n\r\n ++iLeftKnot;\r\n ++currKnotCount;\r\n ++currPoleCount;\r\n }\r\n this.knots.setKnotsCapture(newKnots);\r\n this.packedData = newPackedData;\r\n return true;\r\n }\r\n}\r\n"]}
1
+ {"version":3,"file":"BSpline1dNd.js","sourceRoot":"","sources":["../../../src/bspline/BSpline1dNd.ts"],"names":[],"mappings":"AAAA;;;+FAG+F;AAC/F;;GAEG;AAEH,2CAA2C;AAC3C,OAAO,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AACvC,mEAAmE;AACnE,OAAO,EAAE,OAAO,EAAE,MAAM,+BAA+B,CAAC;AACxD,OAAO,EAAE,eAAe,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAE3D;;;;;GAKG;AACH,MAAM,OAAO,WAAW;IAOtB,gEAAgE;IAChE,IAAW,MAAM,KAAa,OAAO,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC,CAAC;IACzD,+FAA+F;IAC/F,IAAW,KAAK,KAAa,OAAO,IAAI,CAAC,KAAK,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,CAAC;IAC5D,oGAAoG;IACpG,IAAW,OAAO,KAAa,OAAO,IAAI,CAAC,QAAQ,GAAG,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC,CAAC;IAC1E,qDAAqD;IACrD,IAAW,QAAQ,KAAa,OAAO,IAAI,CAAC,UAAU,CAAC,MAAM,GAAG,IAAI,CAAC,UAAU,CAAC,CAAC,CAAC;IAClF;;OAEG;IACI,cAAc,CAAC,CAAS,EAAE,MAAgB,IAAyB,OAAO,OAAO,CAAC,gBAAgB,CAAC,IAAI,CAAC,UAAU,EAAE,CAAC,EAAE,MAAM,CAAC,CAAC,CAAC,CAAC;IAcxI;;;;;;OAMG;IACH,YAAsB,QAAgB,EAAE,UAA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AAa,CAAC;QAChC,OAAO,IAAI,CAAC;IACd,CAAC;CACF","sourcesContent":["/*---------------------------------------------------------------------------------------------\r\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\r\n* See LICENSE.md in the project root for license terms and full copyright notice.\r\n*--------------------------------------------------------------------------------------------*/\r\n/** @packageDocumentation\r\n * @module Bspline\r\n */\r\n\r\n// import { Point2d } from \"../Geometry2d\";\r\nimport { Geometry } from \"../Geometry\";\r\n/* eslint-disable @typescript-eslint/naming-convention, no-empty */\r\nimport { Point3d } from \"../geometry3d/Point3dVector3d\";\r\nimport { BSplineWrapMode, KnotVector } from \"./KnotVector\";\r\n\r\n/** Bspline knots and poles for 1d-to-Nd.\r\n * * The \"pole\" (aka control point) of this class is a block of `poleLength` numbers.\r\n * * Derived classes (not this class) assign meaning such as x,y,z,w.\r\n * * for instance, an instance of this class with `poleLength===3` does not know if its poles are x,y,z or weighted 2D x,y,w\r\n * @public\r\n */\r\nexport class BSpline1dNd {\r\n /** knots of the bspline */\r\n public knots: KnotVector;\r\n /** poles, packed in blocks of `poleLength` doubles. */\r\n public packedData: Float64Array;\r\n /** (property accessor) Return the number of numeric values per pole. */\r\n public poleLength: number;\r\n /** (property accessor) Return the degree of the polynomials. */\r\n public get degree(): number { return this.knots.degree; }\r\n /** (property accessor) Return the number of order (one more than degree) of the polynomials */\r\n public get order(): number { return this.knots.degree + 1; }\r\n /** (property accessor) Return the number of bezier spans (including null spans at multiple knots)*/\r\n public get numSpan(): number { return this.numPoles - this.knots.degree; }\r\n /** (property accessor) Return the number of poles*/\r\n public get numPoles(): number { return this.packedData.length / this.poleLength; }\r\n /** copy 3 values of pole `i` into a point.\r\n * * The calling class is responsible for knowing if this is an appropriate access to the blocked data.\r\n */\r\n public getPoint3dPole(i: number, result?: Point3d): Point3d | undefined { return Point3d.createFromPacked(this.packedData, i, result); }\r\n /** preallocated array (length === `order`) used as temporary in evaluations */\r\n public basisBuffer: Float64Array; // one set of basis function values. ALLOCATED BY CTOR FOR FREQUENT REUSE\r\n /** preallocated array (length === `poleLength`) used as temporary in evaluations */\r\n public poleBuffer: Float64Array; // one set of target values. ALLOCATED BY CTOR FOR FREQUENT REUSE\r\n /** preallocated array (length === `order`) used as temporary in evaluations */\r\n public basisBuffer1: Float64Array; // one set of basis function values. ALLOCATED BY CTOR FOR FREQUENT REUSE\r\n /** preallocated array (length === `order`) used as temporary in evaluations */\r\n public basisBuffer2: Float64Array; // one set of basis function values. ALLOCATED BY CTOR FOR FREQUENT REUSE\r\n /** preallocated array (length === `poleLength`) used as temporary in evaluations */\r\n public poleBuffer1: Float64Array; // one set of target values. ALLOCATED BY CTOR FOR FREQUENT REUSE\r\n /** preallocated array (length === `poleLength`) used as temporary in evaluations */\r\n public poleBuffer2: Float64Array; // one set of target values. ALLOCATED BY CTOR FOR FREQUENT REUSE\r\n\r\n /**\r\n * initialize arrays for given spline dimensions.\r\n * @param numPoles number of poles\r\n * @param poleLength number of coordinates per pole (e.g.. 3 for 3D unweighted, 4 for 3d weighted, 2 for 2d unweighted, 3 for 2d weighted)\r\n * @param order number of poles in support for a section of the bspline\r\n * @param knots KnotVector. This is captured, not cloned.\r\n */\r\n protected constructor(numPoles: number, poleLength: number, order: number, knots: KnotVector) {\r\n this.knots = knots;\r\n this.packedData = new Float64Array(numPoles * poleLength);\r\n this.poleLength = poleLength;\r\n this.basisBuffer = new Float64Array(order);\r\n this.poleBuffer = new Float64Array(poleLength);\r\n this.basisBuffer1 = new Float64Array(order);\r\n this.basisBuffer2 = new Float64Array(order);\r\n this.poleBuffer1 = new Float64Array(poleLength);\r\n this.poleBuffer2 = new Float64Array(poleLength);\r\n }\r\n\r\n /**\r\n * create a 1Bspline1dNd`\r\n * @param numPoles number of poles\r\n * @param poleLength number of coordinates per pole (e.g.. 3 for 3D unweighted, 4 for 3d weighted, 2 for 2d unweighted, 3 for 2d weighted)\r\n * @param order number of poles in support for a section of the bspline\r\n * @param knots KnotVector. This is captured, not cloned.\r\n */\r\n public static create(numPoles: number, poleLength: number, order: number, knots: KnotVector): BSpline1dNd | undefined {\r\n return new BSpline1dNd(numPoles, poleLength, order, knots);\r\n }\r\n /** Map a span index and local fraction to knot value. */\r\n public spanFractionToKnot(span: number, localFraction: number): number {\r\n return this.knots.spanFractionToKnot(span, localFraction);\r\n }\r\n\r\n /**\r\n * Evaluate the `order` basis functions (and optionally one or two derivatives) at a given fractional position within indexed span.\r\n * @returns true if and only if output arrays are sufficiently sized\r\n */\r\n public evaluateBasisFunctionsInSpan(spanIndex: number, spanFraction: number, f: Float64Array, df?: Float64Array, ddf?: Float64Array): boolean {\r\n if (spanIndex < 0) spanIndex = 0;\r\n if (spanIndex >= this.numSpan) spanIndex = this.numSpan - 1;\r\n const knotIndex0 = spanIndex + this.degree - 1;\r\n const globalKnot = this.knots.baseKnotFractionToKnot(knotIndex0, spanFraction);\r\n return df ?\r\n this.knots.evaluateBasisFunctions1(knotIndex0, globalKnot, f, df, ddf) :\r\n this.knots.evaluateBasisFunctions(knotIndex0, globalKnot, f);\r\n }\r\n /**\r\n * * Evaluate the basis functions at spanIndex and fraction.\r\n * * Evaluations are stored in the preallocated `this.basisBuffer`\r\n * * Immediately do the summations of the basis values times the respective control points\r\n * * Summations are stored in the preallocated `this.poleBuffer`\r\n * */\r\n public evaluateBuffersInSpan(spanIndex: number, spanFraction: number) {\r\n this.evaluateBasisFunctionsInSpan(spanIndex, spanFraction, this.basisBuffer);\r\n this.sumPoleBufferForSpan(spanIndex);\r\n }\r\n /**\r\n * * Evaluate the basis functions and one derivative at spanIndex and fraction.\r\n * * Evaluations are stored in the preallocated `this.basisBuffer`\r\n * * Immediately do the summations of the basis values times the respective control points\r\n * * Summations are stored in the preallocated `this.poleBuffer` and `this.poleBuffer1`\r\n * */\r\n public evaluateBuffersInSpan1(spanIndex: number, spanFraction: number) {\r\n this.evaluateBasisFunctionsInSpan(spanIndex, spanFraction, this.basisBuffer, this.basisBuffer1);\r\n this.sumPoleBufferForSpan(spanIndex);\r\n this.sumPoleBuffer1ForSpan(spanIndex);\r\n }\r\n /** sum poles in `poleBuffer` at span `spanIndex` by the weights in the `basisBuffer` */\r\n public sumPoleBufferForSpan(spanIndex: number) {\r\n this.poleBuffer.fill(0);\r\n let k = spanIndex * this.poleLength;\r\n for (const f of this.basisBuffer) {\r\n for (let j = 0; j < this.poleLength; j++) { this.poleBuffer[j] += f * this.packedData[k++]; }\r\n }\r\n }\r\n /** sum poles in `poleBuffer1` at span `spanIndex` by the weights in the `basisBuffer1`, i.e. form first derivatives */\r\n public sumPoleBuffer1ForSpan(spanIndex: number) {\r\n this.poleBuffer1.fill(0);\r\n let k = spanIndex * this.poleLength;\r\n for (const f of this.basisBuffer1) {\r\n for (let j = 0; j < this.poleLength; j++) {\r\n this.poleBuffer1[j] += f * this.packedData[k++];\r\n }\r\n }\r\n }\r\n /** sum poles in `poleBuffer2` at span `spanIndex` by the weights in the `basisBuffer2`, i.e. form second derivatives */\r\n public sumPoleBuffer2ForSpan(spanIndex: number) {\r\n this.poleBuffer2.fill(0);\r\n let k = spanIndex * this.poleLength;\r\n for (const f of this.basisBuffer2) {\r\n for (let j = 0; j < this.poleLength; j++) {\r\n this.poleBuffer2[j] += f * this.packedData[k++];\r\n }\r\n }\r\n }\r\n /** Evaluate the function values and 1 or 2 derivatives into `this.poleBuffer`, `this.poleBuffer1` and `this.poleBuffer2` */\r\n public evaluateBuffersAtKnot(u: number, numDerivative: number = 0) {\r\n const knotIndex0 = this.knots.knotToLeftKnotIndex(u);\r\n if (numDerivative < 1) {\r\n this.knots.evaluateBasisFunctions(knotIndex0, u, this.basisBuffer);\r\n this.sumPoleBufferForSpan(knotIndex0 - this.degree + 1);\r\n } else if (numDerivative === 1) {\r\n this.knots.evaluateBasisFunctions1(knotIndex0, u, this.basisBuffer, this.basisBuffer1);\r\n this.sumPoleBufferForSpan(knotIndex0 - this.degree + 1);\r\n this.sumPoleBuffer1ForSpan(knotIndex0 - this.degree + 1);\r\n } else {\r\n this.knots.evaluateBasisFunctions1(knotIndex0, u, this.basisBuffer, this.basisBuffer1, this.basisBuffer2);\r\n this.sumPoleBufferForSpan(knotIndex0 - this.degree + 1);\r\n this.sumPoleBuffer1ForSpan(knotIndex0 - this.degree + 1);\r\n this.sumPoleBuffer2ForSpan(knotIndex0 - this.degree + 1);\r\n }\r\n }\r\n /**\r\n * Reverse the (blocked) poles (in `this.packedData` in place.\r\n */\r\n public reverseInPlace(): void {\r\n // reverse poles in blocks ...\r\n const b = this.poleLength;\r\n const data = this.packedData;\r\n for (let i0 = 0, j0 = b * (this.numPoles - 1);\r\n i0 < j0;\r\n i0 += b, j0 -= b) {\r\n let t = 0;\r\n for (let i = 0; i < b; i++) {\r\n t = data[i0 + i];\r\n data[i0 + i] = data[j0 + i];\r\n data[j0 + i] = t;\r\n }\r\n }\r\n this.knots.reflectKnots();\r\n }\r\n /**\r\n * Test if the leading and trailing polygon coordinates are replicated in the manner of a \"closed\" bspline polygon which has been expanded\r\n * to act as a normal bspline.\r\n * @returns true if `degree` leading and trailing polygon blocks match\r\n * @deprecated in 4.x. Use testClosablePolygon instead.\r\n */\r\n public testCloseablePolygon(mode?: BSplineWrapMode): boolean {\r\n return this.testClosablePolygon(mode);\r\n }\r\n /**\r\n * Test if the leading and trailing polygon coordinates are replicated in the manner of a \"closed\" bspline polygon which has been expanded\r\n * to act as a normal bspline.\r\n * @returns true if `degree` leading and trailing polygon blocks match\r\n */\r\n public testClosablePolygon(mode?: BSplineWrapMode): boolean {\r\n if (mode === undefined)\r\n mode = this.knots.wrappable;\r\n let numPolesToTest = 0;\r\n if (mode === BSplineWrapMode.OpenByAddingControlPoints)\r\n numPolesToTest = this.degree;\r\n else if (mode === BSplineWrapMode.OpenByRemovingKnots)\r\n numPolesToTest = 1;\r\n else\r\n return false;\r\n // check for wraparound poles\r\n const blockSize = this.poleLength;\r\n const indexDelta = (this.numPoles - numPolesToTest) * blockSize;\r\n const numValuesToTest = numPolesToTest * blockSize;\r\n for (let i0 = 0; i0 < numValuesToTest; i0++) {\r\n if (!Geometry.isSameCoordinate(this.packedData[i0], this.packedData[i0 + indexDelta]))\r\n return false;\r\n }\r\n return true;\r\n }\r\n\r\n /** Insert knot and resulting pole into the instance, optionally multiple times.\r\n * @param knot the knot to be inserted (may already exist in the KnotVector)\r\n * @param totalMultiplicity the total multiplicity of the knot on return\r\n */\r\n public addKnot(knot: number, totalMultiplicity: number): boolean {\r\n if (knot < this.knots.leftKnot || knot > this.knots.rightKnot)\r\n return false; // invalid input\r\n let iLeftKnot = this.knots.knotToLeftKnotIndex(knot);\r\n\r\n // snap input if too close to an existing knot\r\n if (Math.abs(knot - this.knots.knots[iLeftKnot]) < KnotVector.knotTolerance) {\r\n knot = this.knots.knots[iLeftKnot]; // snap to left knot of bracket\r\n } else if (Math.abs(knot - this.knots.knots[iLeftKnot + 1]) < KnotVector.knotTolerance) {\r\n iLeftKnot += this.knots.getKnotMultiplicityAtIndex(iLeftKnot + 1);\r\n if (iLeftKnot > this.knots.rightKnotIndex)\r\n return true; // nothing to do\r\n knot = this.knots.knots[iLeftKnot]; // snap to left knot of next bracket\r\n }\r\n const numKnotsToAdd = Math.min(totalMultiplicity, this.degree) - this.knots.getKnotMultiplicity(knot);\r\n if (numKnotsToAdd <= 0)\r\n return true; // nothing to do\r\n\r\n // working arrays and pole buffer\r\n let currKnotCount = this.knots.knots.length;\r\n const newKnots = new Float64Array(currKnotCount + numKnotsToAdd);\r\n for (let i = 0; i < currKnotCount; ++i)\r\n newKnots[i] = this.knots.knots[i];\r\n let currPoleCount = this.numPoles;\r\n const newPackedData = new Float64Array(this.packedData.length + (numKnotsToAdd * this.poleLength));\r\n for (let i = 0; i < this.packedData.length; ++i)\r\n newPackedData[i] = this.packedData[i];\r\n const dataBuf = new Float64Array(this.degree * this.poleLength); // holds degree poles\r\n\r\n // each iteration adds one knot and one pole to the working arrays (cf. Farin 4e)\r\n for (let iter = 0; iter < numKnotsToAdd; ++iter) {\r\n // fill the buffer with new poles obtained from control polygon corner cutting\r\n let iBuf = 0;\r\n const iStart = iLeftKnot - this.degree + 2;\r\n for (let i = iStart; i < iStart + this.degree; ++i) {\r\n const fraction = (knot - newKnots[i - 1]) / (newKnots[i + this.degree - 1] - newKnots[i - 1]);\r\n for (let j = i * this.poleLength; j < (i + 1) * this.poleLength; ++j) {\r\n dataBuf[iBuf++] = Geometry.interpolate(newPackedData[j - this.poleLength], fraction, newPackedData[j]);\r\n }\r\n }\r\n\r\n // overwrite degree-1 poles with degree new poles, shifting tail to the right by one\r\n newPackedData.copyWithin((iStart + this.degree) * this.poleLength, (iStart + this.degree - 1) * this.poleLength, currPoleCount * this.poleLength);\r\n let iData = iStart * this.poleLength;\r\n for (const d of dataBuf)\r\n newPackedData[iData++] = d; // overwrite degree new poles\r\n\r\n // add the knot to newKnots in position, shifting tail to the right by one\r\n newKnots.copyWithin(iLeftKnot + 2, iLeftKnot + 1, currKnotCount);\r\n newKnots[iLeftKnot + 1] = knot;\r\n\r\n ++iLeftKnot;\r\n ++currKnotCount;\r\n ++currPoleCount;\r\n }\r\n this.knots.setKnotsCapture(newKnots);\r\n this.packedData = newPackedData;\r\n return true;\r\n }\r\n}\r\n"]}
@@ -85,15 +85,29 @@ export declare abstract class BSplineCurve3dBase extends CurvePrimitive {
85
85
  get numSpan(): number;
86
86
  /** Return the number of poles */
87
87
  get numPoles(): number;
88
+ /** Return live reference to the packed control point coordinates of the curve. */
89
+ get polesRef(): Float64Array;
90
+ /** Return live reference to the knots of the curve. */
91
+ get knotsRef(): Float64Array;
92
+ /** Number of components per pole.
93
+ * * 3 for conventional (x,y,z) curve
94
+ * * 4 for weighted (wx,wy,wz,w) curve
95
+ */
96
+ get poleDimension(): number;
88
97
  /**
89
- * return a simple array form of the knots. optionally replicate the first and last
90
- * in classic over-clamped manner
91
- */
98
+ * return a simple array form of the knots. optionally replicate the first and last
99
+ * in classic over-clamped manner
100
+ */
92
101
  copyKnots(includeExtraEndKnot: boolean): number[];
93
- /**
94
- * Set the flag indicating the bspline might be suitable for having wrapped "closed" interpretation.
95
- */
102
+ /** Get the flag indicating the curve might be suitable for having wrapped "closed" interpretation. */
103
+ getWrappable(): BSplineWrapMode;
104
+ /** Set the flag indicating the curve might be suitable for having wrapped "closed" interpretation. */
96
105
  setWrappable(value: BSplineWrapMode): void;
106
+ /**
107
+ * Test knots and control points to determine if it is possible to close (aka "wrap") the curve.
108
+ * @returns the manner in which it is possible to close the curve. See `BSplineWrapMode` for particulars of each mode.
109
+ */
110
+ get isClosableCurve(): BSplineWrapMode;
97
111
  /** Evaluate at a position given by fractional position within a span. */
98
112
  abstract evaluatePointInSpan(spanIndex: number, spanFraction: number, result?: Point3d): Point3d;
99
113
  /** Evaluate at a position given by fractional position within a span. */
@@ -237,12 +251,17 @@ export declare class BSplineCurve3d extends BSplineCurve3dBase {
237
251
  * @param options collection of points and end conditions.
238
252
  */
239
253
  static createFromAkimaCurve3dOptions(options: AkimaCurve3dOptions): BSplineCurve3d | undefined;
240
- /** Create a bspline with given knots.
241
- * * Only two knot count conditions are recognized; all others return undefined:
254
+ /**
255
+ * Create a bspline with given knots.
256
+ * * The poles have several variants:
257
+ * * Float64Array(3 * numPoles) in blocks of [x,y,z]
258
+ * * Point3d[]
259
+ * * number[][], with inner dimension 3
260
+ * * Two count conditions are recognized:
242
261
  * * If poleArray.length + order === knotArray.length, the first and last are assumed to be the extraneous knots of classic clamping.
243
262
  * * If poleArray.length + order === knotArray.length + 2, the knots are in modern form.
244
263
  */
245
- static create(poleArray: Float64Array | Point3d[], knotArray: Float64Array | number[], order: number): BSplineCurve3d | undefined;
264
+ static create(poleArray: Float64Array | Point3d[] | number[][], knotArray: Float64Array | number[], order: number): BSplineCurve3d | undefined;
246
265
  /** Return a deep clone */
247
266
  clone(): BSplineCurve3d;
248
267
  /** Evaluate at a position given by fractional position within a span. */
@@ -280,9 +299,8 @@ export declare class BSplineCurve3d extends BSplineCurve3dBase {
280
299
  /** Append strokes to a linestring. */
281
300
  emitStrokes(dest: LineString3d, options?: StrokeOptions): void;
282
301
  /**
283
- * Test knots, control points, and wrappable flag to see if all agree for a possible wrapping.
284
- * @returns the manner of closing. Se BSplineWrapMode for particulars of each mode.
285
- *
302
+ * Test knots and control points to determine if it is possible to close (aka "wrap") the curve.
303
+ * @returns the manner in which it is possible to close the curve. See `BSplineWrapMode` for particulars of each mode.
286
304
  */
287
305
  get isClosable(): BSplineWrapMode;
288
306
  /**
@@ -303,10 +321,6 @@ export declare class BSplineCurve3d extends BSplineCurve3dBase {
303
321
  * @param result optional reusable curve. This will only be reused if it is a BezierCurve3d with matching order.
304
322
  */
305
323
  getSaturatedBezierSpan3dH(spanIndex: number, result?: BezierCurveBase): BezierCurve3dH | undefined;
306
- /**
307
- * Set the flag indicating the bspline might be suitable for having wrapped "closed" interpretation.
308
- */
309
- setWrappable(value: BSplineWrapMode): void;
310
324
  /** Second step of double dispatch: call `handler.handleBSplineCurve3d(this)` */
311
325
  dispatchToGeometryHandler(handler: GeometryHandler): any;
312
326
  /**
@@ -1 +1 @@
1
- {"version":3,"file":"BSplineCurve.d.ts","sourceRoot":"","sources":["../../../src/bspline/BSplineCurve.ts"],"names":[],"mappings":"AAIA;;GAEG;AAEH,OAAO,EAAqB,mBAAmB,EAAE,MAAM,8BAA8B,CAAC;AACtF,OAAO,EAAE,cAAc,EAAE,MAAM,yBAAyB,CAAC;AAGzD,OAAO,EAAE,YAAY,EAAE,MAAM,uBAAuB,CAAC;AACrD,OAAO,EAAE,aAAa,EAAE,MAAM,wBAAwB,CAAC;AACvD,OAAO,EAAE,cAAc,EAAE,MAAM,+BAA+B,CAAC;AAC/D,OAAO,EAAE,aAAa,EAAE,MAAM,wBAAwB,CAAC;AACvD,OAAO,EAAY,sBAAsB,EAAE,MAAM,aAAa,CAAC;AAC/D,OAAO,EAAE,eAAe,EAAE,cAAc,EAAE,MAAM,+BAA+B,CAAC;AAChF,OAAO,EAAE,gBAAgB,EAAE,MAAM,gCAAgC,CAAC;AAClE,OAAO,EAAE,4BAA4B,EAAE,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