@itwin/core-geometry 4.3.0-dev.9 → 4.4.0-dev.1

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 (336) hide show
  1. package/CHANGELOG.md +38 -1
  2. package/lib/cjs/Geometry.d.ts +14 -2
  3. package/lib/cjs/Geometry.d.ts.map +1 -1
  4. package/lib/cjs/Geometry.js +20 -9
  5. package/lib/cjs/Geometry.js.map +1 -1
  6. package/lib/cjs/bspline/BSpline1dNd.d.ts +12 -2
  7. package/lib/cjs/bspline/BSpline1dNd.d.ts.map +1 -1
  8. package/lib/cjs/bspline/BSpline1dNd.js +27 -17
  9. package/lib/cjs/bspline/BSpline1dNd.js.map +1 -1
  10. package/lib/cjs/bspline/BSplineCurve.d.ts +30 -16
  11. package/lib/cjs/bspline/BSplineCurve.d.ts.map +1 -1
  12. package/lib/cjs/bspline/BSplineCurve.js +68 -44
  13. package/lib/cjs/bspline/BSplineCurve.js.map +1 -1
  14. package/lib/cjs/bspline/BSplineCurve3dH.d.ts +27 -20
  15. package/lib/cjs/bspline/BSplineCurve3dH.d.ts.map +1 -1
  16. package/lib/cjs/bspline/BSplineCurve3dH.js +136 -87
  17. package/lib/cjs/bspline/BSplineCurve3dH.js.map +1 -1
  18. package/lib/cjs/bspline/BSplineSurface.d.ts +138 -74
  19. package/lib/cjs/bspline/BSplineSurface.d.ts.map +1 -1
  20. package/lib/cjs/bspline/BSplineSurface.js +242 -119
  21. package/lib/cjs/bspline/BSplineSurface.js.map +1 -1
  22. package/lib/cjs/bspline/Bezier1dNd.d.ts +18 -4
  23. package/lib/cjs/bspline/Bezier1dNd.d.ts.map +1 -1
  24. package/lib/cjs/bspline/Bezier1dNd.js +19 -5
  25. package/lib/cjs/bspline/Bezier1dNd.js.map +1 -1
  26. package/lib/cjs/bspline/BezierCurve3dH.d.ts.map +1 -1
  27. package/lib/cjs/bspline/BezierCurve3dH.js +2 -1
  28. package/lib/cjs/bspline/BezierCurve3dH.js.map +1 -1
  29. package/lib/cjs/bspline/KnotVector.d.ts +30 -33
  30. package/lib/cjs/bspline/KnotVector.d.ts.map +1 -1
  31. package/lib/cjs/bspline/KnotVector.js +76 -69
  32. package/lib/cjs/bspline/KnotVector.js.map +1 -1
  33. package/lib/cjs/clipping/ClipUtils.d.ts +32 -5
  34. package/lib/cjs/clipping/ClipUtils.d.ts.map +1 -1
  35. package/lib/cjs/clipping/ClipUtils.js +92 -11
  36. package/lib/cjs/clipping/ClipUtils.js.map +1 -1
  37. package/lib/cjs/core-geometry.d.ts +0 -2
  38. package/lib/cjs/core-geometry.d.ts.map +1 -1
  39. package/lib/cjs/core-geometry.js +0 -2
  40. package/lib/cjs/core-geometry.js.map +1 -1
  41. package/lib/cjs/curve/Arc3d.d.ts.map +1 -1
  42. package/lib/cjs/curve/Arc3d.js +5 -5
  43. package/lib/cjs/curve/Arc3d.js.map +1 -1
  44. package/lib/cjs/curve/CurveLocationDetail.d.ts +1 -4
  45. package/lib/cjs/curve/CurveLocationDetail.d.ts.map +1 -1
  46. package/lib/cjs/curve/CurveLocationDetail.js +4 -10
  47. package/lib/cjs/curve/CurveLocationDetail.js.map +1 -1
  48. package/lib/cjs/curve/CurveOps.d.ts +4 -5
  49. package/lib/cjs/curve/CurveOps.d.ts.map +1 -1
  50. package/lib/cjs/curve/CurveOps.js +1 -1
  51. package/lib/cjs/curve/CurveOps.js.map +1 -1
  52. package/lib/cjs/curve/CurveTypes.d.ts +14 -2
  53. package/lib/cjs/curve/CurveTypes.d.ts.map +1 -1
  54. package/lib/cjs/curve/CurveTypes.js.map +1 -1
  55. package/lib/cjs/curve/LineString3d.d.ts +3 -2
  56. package/lib/cjs/curve/LineString3d.d.ts.map +1 -1
  57. package/lib/cjs/curve/LineString3d.js +1 -0
  58. package/lib/cjs/curve/LineString3d.js.map +1 -1
  59. package/lib/cjs/curve/PointString3d.d.ts +2 -1
  60. package/lib/cjs/curve/PointString3d.d.ts.map +1 -1
  61. package/lib/cjs/curve/PointString3d.js.map +1 -1
  62. package/lib/cjs/curve/RegionOps.d.ts +5 -11
  63. package/lib/cjs/curve/RegionOps.d.ts.map +1 -1
  64. package/lib/cjs/curve/RegionOps.js.map +1 -1
  65. package/lib/cjs/curve/internalContexts/CurveCurveCloseApproachXY.d.ts +15 -9
  66. package/lib/cjs/curve/internalContexts/CurveCurveCloseApproachXY.d.ts.map +1 -1
  67. package/lib/cjs/curve/internalContexts/CurveCurveCloseApproachXY.js +68 -56
  68. package/lib/cjs/curve/internalContexts/CurveCurveCloseApproachXY.js.map +1 -1
  69. package/lib/cjs/curve/internalContexts/CurveCurveIntersectXY.d.ts +14 -16
  70. package/lib/cjs/curve/internalContexts/CurveCurveIntersectXY.d.ts.map +1 -1
  71. package/lib/cjs/curve/internalContexts/CurveCurveIntersectXY.js +51 -69
  72. package/lib/cjs/curve/internalContexts/CurveCurveIntersectXY.js.map +1 -1
  73. package/lib/cjs/curve/internalContexts/CurveCurveIntersectXYZ.d.ts.map +1 -1
  74. package/lib/cjs/curve/internalContexts/CurveCurveIntersectXYZ.js +3 -2
  75. package/lib/cjs/curve/internalContexts/CurveCurveIntersectXYZ.js.map +1 -1
  76. package/lib/cjs/curve/internalContexts/MultiChainCollector.d.ts +2 -3
  77. package/lib/cjs/curve/internalContexts/MultiChainCollector.d.ts.map +1 -1
  78. package/lib/cjs/curve/internalContexts/MultiChainCollector.js.map +1 -1
  79. package/lib/cjs/curve/internalContexts/PolygonOffsetContext.d.ts +4 -4
  80. package/lib/cjs/curve/internalContexts/PolygonOffsetContext.d.ts.map +1 -1
  81. package/lib/cjs/curve/internalContexts/PolygonOffsetContext.js +38 -36
  82. package/lib/cjs/curve/internalContexts/PolygonOffsetContext.js.map +1 -1
  83. package/lib/cjs/geometry3d/Angle.d.ts +0 -1
  84. package/lib/cjs/geometry3d/Angle.d.ts.map +1 -1
  85. package/lib/cjs/geometry3d/Angle.js +0 -1
  86. package/lib/cjs/geometry3d/Angle.js.map +1 -1
  87. package/lib/cjs/geometry3d/CoincidentGeometryOps.d.ts +21 -5
  88. package/lib/cjs/geometry3d/CoincidentGeometryOps.d.ts.map +1 -1
  89. package/lib/cjs/geometry3d/CoincidentGeometryOps.js +71 -45
  90. package/lib/cjs/geometry3d/CoincidentGeometryOps.js.map +1 -1
  91. package/lib/cjs/geometry3d/Matrix3d.d.ts +20 -13
  92. package/lib/cjs/geometry3d/Matrix3d.d.ts.map +1 -1
  93. package/lib/cjs/geometry3d/Matrix3d.js +28 -21
  94. package/lib/cjs/geometry3d/Matrix3d.js.map +1 -1
  95. package/lib/cjs/geometry3d/Point3dVector3d.d.ts +11 -2
  96. package/lib/cjs/geometry3d/Point3dVector3d.d.ts.map +1 -1
  97. package/lib/cjs/geometry3d/Point3dVector3d.js +16 -5
  98. package/lib/cjs/geometry3d/Point3dVector3d.js.map +1 -1
  99. package/lib/cjs/geometry3d/PointHelpers.d.ts +58 -20
  100. package/lib/cjs/geometry3d/PointHelpers.d.ts.map +1 -1
  101. package/lib/cjs/geometry3d/PointHelpers.js +213 -62
  102. package/lib/cjs/geometry3d/PointHelpers.js.map +1 -1
  103. package/lib/cjs/geometry3d/Segment1d.d.ts +5 -1
  104. package/lib/cjs/geometry3d/Segment1d.d.ts.map +1 -1
  105. package/lib/cjs/geometry3d/Segment1d.js +11 -7
  106. package/lib/cjs/geometry3d/Segment1d.js.map +1 -1
  107. package/lib/cjs/geometry3d/Transform.d.ts +4 -5
  108. package/lib/cjs/geometry3d/Transform.d.ts.map +1 -1
  109. package/lib/cjs/geometry3d/Transform.js +4 -5
  110. package/lib/cjs/geometry3d/Transform.js.map +1 -1
  111. package/lib/cjs/geometry4d/Point4d.d.ts +13 -0
  112. package/lib/cjs/geometry4d/Point4d.d.ts.map +1 -1
  113. package/lib/cjs/geometry4d/Point4d.js +21 -0
  114. package/lib/cjs/geometry4d/Point4d.js.map +1 -1
  115. package/lib/cjs/numerics/BezierPolynomials.d.ts +88 -64
  116. package/lib/cjs/numerics/BezierPolynomials.d.ts.map +1 -1
  117. package/lib/cjs/numerics/BezierPolynomials.js +92 -73
  118. package/lib/cjs/numerics/BezierPolynomials.js.map +1 -1
  119. package/lib/cjs/numerics/Newton.d.ts +143 -61
  120. package/lib/cjs/numerics/Newton.d.ts.map +1 -1
  121. package/lib/cjs/numerics/Newton.js +233 -66
  122. package/lib/cjs/numerics/Newton.js.map +1 -1
  123. package/lib/cjs/numerics/PascalCoefficients.d.ts +8 -12
  124. package/lib/cjs/numerics/PascalCoefficients.d.ts.map +1 -1
  125. package/lib/cjs/numerics/PascalCoefficients.js +10 -12
  126. package/lib/cjs/numerics/PascalCoefficients.js.map +1 -1
  127. package/lib/cjs/numerics/Polynomials.d.ts +6 -10
  128. package/lib/cjs/numerics/Polynomials.d.ts.map +1 -1
  129. package/lib/cjs/numerics/Polynomials.js +6 -10
  130. package/lib/cjs/numerics/Polynomials.js.map +1 -1
  131. package/lib/cjs/polyface/PolyfaceBuilder.d.ts +3 -0
  132. package/lib/cjs/polyface/PolyfaceBuilder.d.ts.map +1 -1
  133. package/lib/cjs/polyface/PolyfaceBuilder.js +13 -2
  134. package/lib/cjs/polyface/PolyfaceBuilder.js.map +1 -1
  135. package/lib/cjs/polyface/PolyfaceData.d.ts +1 -1
  136. package/lib/cjs/polyface/PolyfaceData.js +1 -1
  137. package/lib/cjs/polyface/PolyfaceData.js.map +1 -1
  138. package/lib/cjs/polyface/PolyfaceQuery.d.ts +38 -11
  139. package/lib/cjs/polyface/PolyfaceQuery.d.ts.map +1 -1
  140. package/lib/cjs/polyface/PolyfaceQuery.js +93 -16
  141. package/lib/cjs/polyface/PolyfaceQuery.js.map +1 -1
  142. package/lib/cjs/serialization/BGFBReader.d.ts +10 -10
  143. package/lib/cjs/serialization/BGFBReader.d.ts.map +1 -1
  144. package/lib/cjs/serialization/BGFBReader.js +69 -42
  145. package/lib/cjs/serialization/BGFBReader.js.map +1 -1
  146. package/lib/cjs/serialization/BGFBWriter.d.ts +8 -8
  147. package/lib/cjs/serialization/BGFBWriter.d.ts.map +1 -1
  148. package/lib/cjs/serialization/BGFBWriter.js +80 -55
  149. package/lib/cjs/serialization/BGFBWriter.js.map +1 -1
  150. package/lib/cjs/serialization/GeometrySamples.d.ts.map +1 -1
  151. package/lib/cjs/serialization/GeometrySamples.js +6 -8
  152. package/lib/cjs/serialization/GeometrySamples.js.map +1 -1
  153. package/lib/cjs/serialization/IModelJsonSchema.d.ts +8 -14
  154. package/lib/cjs/serialization/IModelJsonSchema.d.ts.map +1 -1
  155. package/lib/cjs/serialization/IModelJsonSchema.js +85 -259
  156. package/lib/cjs/serialization/IModelJsonSchema.js.map +1 -1
  157. package/lib/cjs/serialization/SerializationHelpers.d.ts +109 -0
  158. package/lib/cjs/serialization/SerializationHelpers.d.ts.map +1 -0
  159. package/lib/cjs/serialization/SerializationHelpers.js +591 -0
  160. package/lib/cjs/serialization/SerializationHelpers.js.map +1 -0
  161. package/lib/cjs/topology/Graph.d.ts +399 -366
  162. package/lib/cjs/topology/Graph.d.ts.map +1 -1
  163. package/lib/cjs/topology/Graph.js +531 -464
  164. package/lib/cjs/topology/Graph.js.map +1 -1
  165. package/lib/cjs/topology/MaskManager.d.ts +8 -9
  166. package/lib/cjs/topology/MaskManager.d.ts.map +1 -1
  167. package/lib/cjs/topology/MaskManager.js +11 -12
  168. package/lib/cjs/topology/MaskManager.js.map +1 -1
  169. package/lib/esm/Geometry.d.ts +14 -2
  170. package/lib/esm/Geometry.d.ts.map +1 -1
  171. package/lib/esm/Geometry.js +20 -9
  172. package/lib/esm/Geometry.js.map +1 -1
  173. package/lib/esm/bspline/BSpline1dNd.d.ts +12 -2
  174. package/lib/esm/bspline/BSpline1dNd.d.ts.map +1 -1
  175. package/lib/esm/bspline/BSpline1dNd.js +27 -17
  176. package/lib/esm/bspline/BSpline1dNd.js.map +1 -1
  177. package/lib/esm/bspline/BSplineCurve.d.ts +30 -16
  178. package/lib/esm/bspline/BSplineCurve.d.ts.map +1 -1
  179. package/lib/esm/bspline/BSplineCurve.js +68 -44
  180. package/lib/esm/bspline/BSplineCurve.js.map +1 -1
  181. package/lib/esm/bspline/BSplineCurve3dH.d.ts +27 -20
  182. package/lib/esm/bspline/BSplineCurve3dH.d.ts.map +1 -1
  183. package/lib/esm/bspline/BSplineCurve3dH.js +137 -88
  184. package/lib/esm/bspline/BSplineCurve3dH.js.map +1 -1
  185. package/lib/esm/bspline/BSplineSurface.d.ts +138 -74
  186. package/lib/esm/bspline/BSplineSurface.d.ts.map +1 -1
  187. package/lib/esm/bspline/BSplineSurface.js +242 -119
  188. package/lib/esm/bspline/BSplineSurface.js.map +1 -1
  189. package/lib/esm/bspline/Bezier1dNd.d.ts +18 -4
  190. package/lib/esm/bspline/Bezier1dNd.d.ts.map +1 -1
  191. package/lib/esm/bspline/Bezier1dNd.js +19 -5
  192. package/lib/esm/bspline/Bezier1dNd.js.map +1 -1
  193. package/lib/esm/bspline/BezierCurve3dH.d.ts.map +1 -1
  194. package/lib/esm/bspline/BezierCurve3dH.js +2 -1
  195. package/lib/esm/bspline/BezierCurve3dH.js.map +1 -1
  196. package/lib/esm/bspline/KnotVector.d.ts +30 -33
  197. package/lib/esm/bspline/KnotVector.d.ts.map +1 -1
  198. package/lib/esm/bspline/KnotVector.js +76 -69
  199. package/lib/esm/bspline/KnotVector.js.map +1 -1
  200. package/lib/esm/clipping/ClipUtils.d.ts +32 -5
  201. package/lib/esm/clipping/ClipUtils.d.ts.map +1 -1
  202. package/lib/esm/clipping/ClipUtils.js +92 -11
  203. package/lib/esm/clipping/ClipUtils.js.map +1 -1
  204. package/lib/esm/core-geometry.d.ts +0 -2
  205. package/lib/esm/core-geometry.d.ts.map +1 -1
  206. package/lib/esm/core-geometry.js +0 -2
  207. package/lib/esm/core-geometry.js.map +1 -1
  208. package/lib/esm/curve/Arc3d.d.ts.map +1 -1
  209. package/lib/esm/curve/Arc3d.js +5 -5
  210. package/lib/esm/curve/Arc3d.js.map +1 -1
  211. package/lib/esm/curve/CurveLocationDetail.d.ts +1 -4
  212. package/lib/esm/curve/CurveLocationDetail.d.ts.map +1 -1
  213. package/lib/esm/curve/CurveLocationDetail.js +4 -10
  214. package/lib/esm/curve/CurveLocationDetail.js.map +1 -1
  215. package/lib/esm/curve/CurveOps.d.ts +4 -5
  216. package/lib/esm/curve/CurveOps.d.ts.map +1 -1
  217. package/lib/esm/curve/CurveOps.js +1 -1
  218. package/lib/esm/curve/CurveOps.js.map +1 -1
  219. package/lib/esm/curve/CurveTypes.d.ts +14 -2
  220. package/lib/esm/curve/CurveTypes.d.ts.map +1 -1
  221. package/lib/esm/curve/CurveTypes.js.map +1 -1
  222. package/lib/esm/curve/LineString3d.d.ts +3 -2
  223. package/lib/esm/curve/LineString3d.d.ts.map +1 -1
  224. package/lib/esm/curve/LineString3d.js +1 -0
  225. package/lib/esm/curve/LineString3d.js.map +1 -1
  226. package/lib/esm/curve/PointString3d.d.ts +2 -1
  227. package/lib/esm/curve/PointString3d.d.ts.map +1 -1
  228. package/lib/esm/curve/PointString3d.js.map +1 -1
  229. package/lib/esm/curve/RegionOps.d.ts +5 -11
  230. package/lib/esm/curve/RegionOps.d.ts.map +1 -1
  231. package/lib/esm/curve/RegionOps.js.map +1 -1
  232. package/lib/esm/curve/internalContexts/CurveCurveCloseApproachXY.d.ts +15 -9
  233. package/lib/esm/curve/internalContexts/CurveCurveCloseApproachXY.d.ts.map +1 -1
  234. package/lib/esm/curve/internalContexts/CurveCurveCloseApproachXY.js +69 -57
  235. package/lib/esm/curve/internalContexts/CurveCurveCloseApproachXY.js.map +1 -1
  236. package/lib/esm/curve/internalContexts/CurveCurveIntersectXY.d.ts +14 -16
  237. package/lib/esm/curve/internalContexts/CurveCurveIntersectXY.d.ts.map +1 -1
  238. package/lib/esm/curve/internalContexts/CurveCurveIntersectXY.js +51 -68
  239. package/lib/esm/curve/internalContexts/CurveCurveIntersectXY.js.map +1 -1
  240. package/lib/esm/curve/internalContexts/CurveCurveIntersectXYZ.d.ts.map +1 -1
  241. package/lib/esm/curve/internalContexts/CurveCurveIntersectXYZ.js +3 -2
  242. package/lib/esm/curve/internalContexts/CurveCurveIntersectXYZ.js.map +1 -1
  243. package/lib/esm/curve/internalContexts/MultiChainCollector.d.ts +2 -3
  244. package/lib/esm/curve/internalContexts/MultiChainCollector.d.ts.map +1 -1
  245. package/lib/esm/curve/internalContexts/MultiChainCollector.js.map +1 -1
  246. package/lib/esm/curve/internalContexts/PolygonOffsetContext.d.ts +4 -4
  247. package/lib/esm/curve/internalContexts/PolygonOffsetContext.d.ts.map +1 -1
  248. package/lib/esm/curve/internalContexts/PolygonOffsetContext.js +38 -36
  249. package/lib/esm/curve/internalContexts/PolygonOffsetContext.js.map +1 -1
  250. package/lib/esm/geometry3d/Angle.d.ts +0 -1
  251. package/lib/esm/geometry3d/Angle.d.ts.map +1 -1
  252. package/lib/esm/geometry3d/Angle.js +0 -1
  253. package/lib/esm/geometry3d/Angle.js.map +1 -1
  254. package/lib/esm/geometry3d/CoincidentGeometryOps.d.ts +21 -5
  255. package/lib/esm/geometry3d/CoincidentGeometryOps.d.ts.map +1 -1
  256. package/lib/esm/geometry3d/CoincidentGeometryOps.js +71 -45
  257. package/lib/esm/geometry3d/CoincidentGeometryOps.js.map +1 -1
  258. package/lib/esm/geometry3d/Matrix3d.d.ts +20 -13
  259. package/lib/esm/geometry3d/Matrix3d.d.ts.map +1 -1
  260. package/lib/esm/geometry3d/Matrix3d.js +28 -21
  261. package/lib/esm/geometry3d/Matrix3d.js.map +1 -1
  262. package/lib/esm/geometry3d/Point3dVector3d.d.ts +11 -2
  263. package/lib/esm/geometry3d/Point3dVector3d.d.ts.map +1 -1
  264. package/lib/esm/geometry3d/Point3dVector3d.js +16 -5
  265. package/lib/esm/geometry3d/Point3dVector3d.js.map +1 -1
  266. package/lib/esm/geometry3d/PointHelpers.d.ts +58 -20
  267. package/lib/esm/geometry3d/PointHelpers.d.ts.map +1 -1
  268. package/lib/esm/geometry3d/PointHelpers.js +213 -62
  269. package/lib/esm/geometry3d/PointHelpers.js.map +1 -1
  270. package/lib/esm/geometry3d/Segment1d.d.ts +5 -1
  271. package/lib/esm/geometry3d/Segment1d.d.ts.map +1 -1
  272. package/lib/esm/geometry3d/Segment1d.js +11 -7
  273. package/lib/esm/geometry3d/Segment1d.js.map +1 -1
  274. package/lib/esm/geometry3d/Transform.d.ts +4 -5
  275. package/lib/esm/geometry3d/Transform.d.ts.map +1 -1
  276. package/lib/esm/geometry3d/Transform.js +4 -5
  277. package/lib/esm/geometry3d/Transform.js.map +1 -1
  278. package/lib/esm/geometry4d/Point4d.d.ts +13 -0
  279. package/lib/esm/geometry4d/Point4d.d.ts.map +1 -1
  280. package/lib/esm/geometry4d/Point4d.js +21 -0
  281. package/lib/esm/geometry4d/Point4d.js.map +1 -1
  282. package/lib/esm/numerics/BezierPolynomials.d.ts +88 -64
  283. package/lib/esm/numerics/BezierPolynomials.d.ts.map +1 -1
  284. package/lib/esm/numerics/BezierPolynomials.js +92 -73
  285. package/lib/esm/numerics/BezierPolynomials.js.map +1 -1
  286. package/lib/esm/numerics/Newton.d.ts +143 -61
  287. package/lib/esm/numerics/Newton.d.ts.map +1 -1
  288. package/lib/esm/numerics/Newton.js +229 -65
  289. package/lib/esm/numerics/Newton.js.map +1 -1
  290. package/lib/esm/numerics/PascalCoefficients.d.ts +8 -12
  291. package/lib/esm/numerics/PascalCoefficients.d.ts.map +1 -1
  292. package/lib/esm/numerics/PascalCoefficients.js +10 -12
  293. package/lib/esm/numerics/PascalCoefficients.js.map +1 -1
  294. package/lib/esm/numerics/Polynomials.d.ts +6 -10
  295. package/lib/esm/numerics/Polynomials.d.ts.map +1 -1
  296. package/lib/esm/numerics/Polynomials.js +6 -10
  297. package/lib/esm/numerics/Polynomials.js.map +1 -1
  298. package/lib/esm/polyface/PolyfaceBuilder.d.ts +3 -0
  299. package/lib/esm/polyface/PolyfaceBuilder.d.ts.map +1 -1
  300. package/lib/esm/polyface/PolyfaceBuilder.js +13 -2
  301. package/lib/esm/polyface/PolyfaceBuilder.js.map +1 -1
  302. package/lib/esm/polyface/PolyfaceData.d.ts +1 -1
  303. package/lib/esm/polyface/PolyfaceData.js +1 -1
  304. package/lib/esm/polyface/PolyfaceData.js.map +1 -1
  305. package/lib/esm/polyface/PolyfaceQuery.d.ts +38 -11
  306. package/lib/esm/polyface/PolyfaceQuery.d.ts.map +1 -1
  307. package/lib/esm/polyface/PolyfaceQuery.js +93 -16
  308. package/lib/esm/polyface/PolyfaceQuery.js.map +1 -1
  309. package/lib/esm/serialization/BGFBReader.d.ts +10 -10
  310. package/lib/esm/serialization/BGFBReader.d.ts.map +1 -1
  311. package/lib/esm/serialization/BGFBReader.js +69 -42
  312. package/lib/esm/serialization/BGFBReader.js.map +1 -1
  313. package/lib/esm/serialization/BGFBWriter.d.ts +8 -8
  314. package/lib/esm/serialization/BGFBWriter.d.ts.map +1 -1
  315. package/lib/esm/serialization/BGFBWriter.js +80 -55
  316. package/lib/esm/serialization/BGFBWriter.js.map +1 -1
  317. package/lib/esm/serialization/GeometrySamples.d.ts.map +1 -1
  318. package/lib/esm/serialization/GeometrySamples.js +7 -9
  319. package/lib/esm/serialization/GeometrySamples.js.map +1 -1
  320. package/lib/esm/serialization/IModelJsonSchema.d.ts +8 -14
  321. package/lib/esm/serialization/IModelJsonSchema.d.ts.map +1 -1
  322. package/lib/esm/serialization/IModelJsonSchema.js +86 -260
  323. package/lib/esm/serialization/IModelJsonSchema.js.map +1 -1
  324. package/lib/esm/serialization/SerializationHelpers.d.ts +109 -0
  325. package/lib/esm/serialization/SerializationHelpers.d.ts.map +1 -0
  326. package/lib/esm/serialization/SerializationHelpers.js +588 -0
  327. package/lib/esm/serialization/SerializationHelpers.js.map +1 -0
  328. package/lib/esm/topology/Graph.d.ts +399 -366
  329. package/lib/esm/topology/Graph.d.ts.map +1 -1
  330. package/lib/esm/topology/Graph.js +531 -464
  331. package/lib/esm/topology/Graph.js.map +1 -1
  332. package/lib/esm/topology/MaskManager.d.ts +8 -9
  333. package/lib/esm/topology/MaskManager.d.ts.map +1 -1
  334. package/lib/esm/topology/MaskManager.js +11 -12
  335. package/lib/esm/topology/MaskManager.js.map +1 -1
  336. package/package.json +3 -4
@@ -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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G,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,IAA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,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 /**\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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IAe/G,sCAAsC;IAC/B,WAAW,CAAC,IAAI,EAAE,YAAY,EAAE,OAAO,CAAC,EAAE,aAAa,GAAG,IAAI;IASrE;;;OAGG;IACF,IAAW,UAAU,IAAI,eAAe,CAExC;IACD;;;;OAIG;IACI,6BAA6B,CAAC,SAAS,EAAE,MAAM,EAAE,SAAS,EAAE,OAAO,EAAE,MAAM,CAAC,EAAE,eAAe,GAAG,eAAe,GAAG,SAAS;IAMlI;;;;OAIG;IACI,wBAAwB,CAAC,SAAS,EAAE,MAAM,EAAE,MAAM,CAAC,EAAE,eAAe,GAAG,eAAe,GAAG,SAAS;IAazG;;;;OAIG;IACI,yBAAyB,CAAC,SAAS,EAAE,MAAM,EAAE,MAAM,CAAC,EAAE,eAAe,GAAG,cAAc,GAAG,SAAS;IAczG,iFAAiF;IAC1E,yBAAyB,CAAC,OAAO,EAAE,eAAe,GAAG,GAAG;IAG/D;;;;;OAKG;IACI,WAAW,CAAC,aAAa,EAAE,OAAO,EAAE,SAAS,CAAC,EAAE,SAAS,GAAG,IAAI;CAYxE"}
@@ -88,17 +88,42 @@ export class BSplineCurve3dBase extends CurvePrimitive {
88
88
  get numSpan() { return this._bcurve.numSpan; }
89
89
  /** Return the number of poles */
90
90
  get numPoles() { return this._bcurve.numPoles; }
91
+ /** Return live reference to the packed control point coordinates of the curve. */
92
+ get polesRef() { return this._bcurve.packedData; }
93
+ /** Return live reference to the knots of the curve. */
94
+ get knotsRef() { return this._bcurve.knots.knots; }
95
+ /** Number of components per pole.
96
+ * * 3 for conventional (x,y,z) curve
97
+ * * 4 for weighted (wx,wy,wz,w) curve
98
+ */
99
+ get poleDimension() { return this._bcurve.poleLength; }
91
100
  /**
92
- * return a simple array form of the knots. optionally replicate the first and last
93
- * in classic over-clamped manner
94
- */
101
+ * return a simple array form of the knots. optionally replicate the first and last
102
+ * in classic over-clamped manner
103
+ */
95
104
  copyKnots(includeExtraEndKnot) { return this._bcurve.knots.copyKnots(includeExtraEndKnot); }
96
- /**
97
- * Set the flag indicating the bspline might be suitable for having wrapped "closed" interpretation.
98
- */
105
+ /** Get the flag indicating the curve might be suitable for having wrapped "closed" interpretation. */
106
+ getWrappable() {
107
+ return this._bcurve.knots.wrappable;
108
+ }
109
+ /** Set the flag indicating the curve might be suitable for having wrapped "closed" interpretation. */
99
110
  setWrappable(value) {
100
111
  this._bcurve.knots.wrappable = value;
101
112
  }
113
+ /**
114
+ * Test knots and control points to determine if it is possible to close (aka "wrap") the curve.
115
+ * @returns the manner in which it is possible to close the curve. See `BSplineWrapMode` for particulars of each mode.
116
+ */
117
+ get isClosableCurve() {
118
+ const mode = this._bcurve.knots.wrappable;
119
+ if (mode === BSplineWrapMode.None)
120
+ return BSplineWrapMode.None;
121
+ if (!this._bcurve.knots.testClosable(mode))
122
+ return BSplineWrapMode.None;
123
+ if (!this._bcurve.testClosablePolygon(mode))
124
+ return BSplineWrapMode.None;
125
+ return mode;
126
+ }
102
127
  /** Evaluate the curve point at `fraction` */
103
128
  fractionToPoint(fraction, result) {
104
129
  return this.knotToPoint(this._bcurve.knots.fractionToKnot(fraction), result);
@@ -386,6 +411,8 @@ export class BSplineCurve3d extends BSplineCurve3dBase {
386
411
  if (order < 2)
387
412
  return undefined;
388
413
  let numPoles = poles instanceof Float64Array ? poles.length / 3 : poles.length;
414
+ if (numPoles < 2)
415
+ return undefined;
389
416
  const startPoint = Point3d.createZero();
390
417
  const endPoint = Point3d.createZero();
391
418
  let hasClosurePoint = false;
@@ -395,8 +422,8 @@ export class BSplineCurve3d extends BSplineCurve3dBase {
395
422
  endPoint.set(poles[3 * numPoles - 3], poles[3 * numPoles - 2], poles[3 * numPoles - 1]);
396
423
  }
397
424
  else if (poles instanceof GrowableXYZArray) {
398
- startPoint.set(poles.float64Data()[0], poles.float64Data()[1], poles.float64Data()[2]);
399
- endPoint.set(poles.float64Data()[3 * numPoles - 3], poles.float64Data()[3 * numPoles - 2], poles.float64Data()[3 * numPoles - 1]);
425
+ poles.getPoint3dAtUncheckedPointIndex(0, startPoint);
426
+ poles.getPoint3dAtUncheckedPointIndex(numPoles - 1, endPoint);
400
427
  }
401
428
  else {
402
429
  startPoint.setFromPoint3d(poles[0]);
@@ -414,15 +441,18 @@ export class BSplineCurve3d extends BSplineCurve3dBase {
414
441
  // append degree wraparound poles
415
442
  const curve = new BSplineCurve3d(numPoles + degree, order, knots);
416
443
  if (poles instanceof Float64Array) {
417
- for (let i = 0; i < 3 * numPoles; i++)
418
- curve._bcurve.packedData[i] = poles[i];
419
- for (let i = 0; i < 3 * degree; i++)
420
- curve._bcurve.packedData[3 * numPoles + i] = poles[i];
444
+ let i = 0;
445
+ for (let j = 0; j < 3 * numPoles; j++)
446
+ curve._bcurve.packedData[i++] = poles[j];
447
+ for (let j = 0; j < 3 * degree; j++)
448
+ curve._bcurve.packedData[i++] = poles[j];
421
449
  }
422
450
  else if (poles instanceof GrowableXYZArray) {
423
- curve._bcurve.packedData = poles.float64Data().slice(0, 3 * numPoles);
424
- for (let i = 0; i < 3 * degree; i++)
425
- curve._bcurve.packedData[3 * numPoles + i] = poles.float64Data()[i];
451
+ let i = 0;
452
+ for (let j = 0; j < 3 * numPoles; j++)
453
+ curve._bcurve.packedData[i++] = poles.float64Data()[j];
454
+ for (let j = 0; j < 3 * degree; j++)
455
+ curve._bcurve.packedData[i++] = poles.float64Data()[j];
426
456
  }
427
457
  else {
428
458
  let i = 0;
@@ -453,8 +483,13 @@ export class BSplineCurve3d extends BSplineCurve3dBase {
453
483
  static createFromAkimaCurve3dOptions(options) {
454
484
  return BSplineCurveOps.createThroughPoints(options.fitPoints, 4); // temporary
455
485
  }
456
- /** Create a bspline with given knots.
457
- * * Only two knot count conditions are recognized; all others return undefined:
486
+ /**
487
+ * Create a bspline with given knots.
488
+ * * The poles have several variants:
489
+ * * Float64Array(3 * numPoles) in blocks of [x,y,z]
490
+ * * Point3d[]
491
+ * * number[][], with inner dimension 3
492
+ * * Two count conditions are recognized:
458
493
  * * If poleArray.length + order === knotArray.length, the first and last are assumed to be the extraneous knots of classic clamping.
459
494
  * * If poleArray.length + order === knotArray.length + 2, the knots are in modern form.
460
495
  */
@@ -462,18 +497,13 @@ export class BSplineCurve3d extends BSplineCurve3dBase {
462
497
  if (order < 2)
463
498
  return undefined;
464
499
  let numPoles = poleArray.length;
465
- if (poleArray instanceof Float64Array) {
466
- numPoles /= 3; // blocked as xyz
467
- }
500
+ if (poleArray instanceof Float64Array)
501
+ numPoles = Math.floor(numPoles / 3); // blocked as xyz
468
502
  if (numPoles < order)
469
503
  return undefined;
470
504
  const numKnots = knotArray.length;
471
- let skipFirstAndLast;
472
- if (numPoles + order === numKnots)
473
- skipFirstAndLast = true; // classic (first/last knots extraneous)
474
- else if (numPoles + order === numKnots + 2)
475
- skipFirstAndLast = false; // modern
476
- else
505
+ const skipFirstAndLast = (numPoles + order === numKnots); // classic over-clamped input knots
506
+ if (!skipFirstAndLast && numPoles + order !== numKnots + 2) // modern knots
477
507
  return undefined;
478
508
  const knots = KnotVector.create(knotArray, order - 1, skipFirstAndLast);
479
509
  const curve = new BSplineCurve3d(numPoles, order, knots);
@@ -482,13 +512,21 @@ export class BSplineCurve3d extends BSplineCurve3dBase {
482
512
  for (const coordinate of poleArray)
483
513
  curve._bcurve.packedData[i++] = coordinate;
484
514
  }
485
- else {
515
+ else if (poleArray[0] instanceof Point3d) {
486
516
  for (const p of poleArray) {
487
517
  curve._bcurve.packedData[i++] = p.x;
488
518
  curve._bcurve.packedData[i++] = p.y;
489
519
  curve._bcurve.packedData[i++] = p.z;
490
520
  }
491
521
  }
522
+ else if (Array.isArray(poleArray[0]) && poleArray[0].length === 3) {
523
+ for (const point of poleArray)
524
+ for (const coord of point)
525
+ curve._bcurve.packedData[i++] = coord;
526
+ }
527
+ else {
528
+ return undefined; // unexpected poleArray type
529
+ }
492
530
  return curve;
493
531
  }
494
532
  /** Return a deep clone */
@@ -608,19 +646,11 @@ export class BSplineCurve3d extends BSplineCurve3dBase {
608
646
  }
609
647
  }
610
648
  /**
611
- * Test knots, control points, and wrappable flag to see if all agree for a possible wrapping.
612
- * @returns the manner of closing. Se BSplineWrapMode for particulars of each mode.
613
- *
649
+ * Test knots and control points to determine if it is possible to close (aka "wrap") the curve.
650
+ * @returns the manner in which it is possible to close the curve. See `BSplineWrapMode` for particulars of each mode.
614
651
  */
615
652
  get isClosable() {
616
- const mode = this._bcurve.knots.wrappable;
617
- if (mode === BSplineWrapMode.None)
618
- return BSplineWrapMode.None;
619
- if (!this._bcurve.knots.testClosable(mode))
620
- return BSplineWrapMode.None;
621
- if (!this._bcurve.testCloseablePolygon(mode))
622
- return BSplineWrapMode.None;
623
- return mode;
653
+ return this.isClosableCurve;
624
654
  }
625
655
  /**
626
656
  * Return a BezierCurveBase for this curve. The concrete return type may be BezierCurve3d or BezierCurve3dH according to this type.
@@ -666,12 +696,6 @@ export class BSplineCurve3d extends BSplineCurve3dBase {
666
696
  return bezier;
667
697
  return undefined;
668
698
  }
669
- /**
670
- * Set the flag indicating the bspline might be suitable for having wrapped "closed" interpretation.
671
- */
672
- setWrappable(value) {
673
- this._bcurve.knots.wrappable = value;
674
- }
675
699
  /** Second step of double dispatch: call `handler.handleBSplineCurve3d(this)` */
676
700
  dispatchToGeometryHandler(handler) {
677
701
  return handler.handleBSplineCurve3d(this);