@itwin/core-geometry 4.3.0-dev.2 → 4.3.0-dev.21

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 (350) hide show
  1. package/CHANGELOG.md +41 -1
  2. package/lib/cjs/Geometry.d.ts.map +1 -1
  3. package/lib/cjs/Geometry.js +2 -4
  4. package/lib/cjs/Geometry.js.map +1 -1
  5. package/lib/cjs/bspline/BSpline1dNd.d.ts +12 -2
  6. package/lib/cjs/bspline/BSpline1dNd.d.ts.map +1 -1
  7. package/lib/cjs/bspline/BSpline1dNd.js +27 -17
  8. package/lib/cjs/bspline/BSpline1dNd.js.map +1 -1
  9. package/lib/cjs/bspline/BSplineCurve.d.ts +30 -16
  10. package/lib/cjs/bspline/BSplineCurve.d.ts.map +1 -1
  11. package/lib/cjs/bspline/BSplineCurve.js +68 -44
  12. package/lib/cjs/bspline/BSplineCurve.js.map +1 -1
  13. package/lib/cjs/bspline/BSplineCurve3dH.d.ts +27 -20
  14. package/lib/cjs/bspline/BSplineCurve3dH.d.ts.map +1 -1
  15. package/lib/cjs/bspline/BSplineCurve3dH.js +136 -87
  16. package/lib/cjs/bspline/BSplineCurve3dH.js.map +1 -1
  17. package/lib/cjs/bspline/BSplineSurface.d.ts +138 -74
  18. package/lib/cjs/bspline/BSplineSurface.d.ts.map +1 -1
  19. package/lib/cjs/bspline/BSplineSurface.js +242 -119
  20. package/lib/cjs/bspline/BSplineSurface.js.map +1 -1
  21. package/lib/cjs/bspline/Bezier1dNd.d.ts +18 -4
  22. package/lib/cjs/bspline/Bezier1dNd.d.ts.map +1 -1
  23. package/lib/cjs/bspline/Bezier1dNd.js +19 -5
  24. package/lib/cjs/bspline/Bezier1dNd.js.map +1 -1
  25. package/lib/cjs/bspline/BezierCurve3dH.d.ts.map +1 -1
  26. package/lib/cjs/bspline/BezierCurve3dH.js +2 -1
  27. package/lib/cjs/bspline/BezierCurve3dH.js.map +1 -1
  28. package/lib/cjs/bspline/KnotVector.d.ts +30 -33
  29. package/lib/cjs/bspline/KnotVector.d.ts.map +1 -1
  30. package/lib/cjs/bspline/KnotVector.js +76 -69
  31. package/lib/cjs/bspline/KnotVector.js.map +1 -1
  32. package/lib/cjs/clipping/AlternatingConvexClipTree.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/curve/CurveChainWithDistanceIndex.d.ts +18 -1
  38. package/lib/cjs/curve/CurveChainWithDistanceIndex.d.ts.map +1 -1
  39. package/lib/cjs/curve/CurveChainWithDistanceIndex.js +47 -0
  40. package/lib/cjs/curve/CurveChainWithDistanceIndex.js.map +1 -1
  41. package/lib/cjs/curve/CurveCollection.d.ts +9 -9
  42. package/lib/cjs/curve/CurveCollection.d.ts.map +1 -1
  43. package/lib/cjs/curve/CurveCollection.js +7 -10
  44. package/lib/cjs/curve/CurveCollection.js.map +1 -1
  45. package/lib/cjs/curve/CurveCurve.d.ts +2 -2
  46. package/lib/cjs/curve/CurveCurve.d.ts.map +1 -1
  47. package/lib/cjs/curve/CurveCurve.js +3 -16
  48. package/lib/cjs/curve/CurveCurve.js.map +1 -1
  49. package/lib/cjs/curve/CurveLocationDetail.d.ts +17 -4
  50. package/lib/cjs/curve/CurveLocationDetail.d.ts.map +1 -1
  51. package/lib/cjs/curve/CurveLocationDetail.js +32 -10
  52. package/lib/cjs/curve/CurveLocationDetail.js.map +1 -1
  53. package/lib/cjs/curve/CurveOps.d.ts +4 -5
  54. package/lib/cjs/curve/CurveOps.d.ts.map +1 -1
  55. package/lib/cjs/curve/CurveOps.js +1 -1
  56. package/lib/cjs/curve/CurveOps.js.map +1 -1
  57. package/lib/cjs/curve/CurveTypes.d.ts +14 -2
  58. package/lib/cjs/curve/CurveTypes.d.ts.map +1 -1
  59. package/lib/cjs/curve/CurveTypes.js.map +1 -1
  60. package/lib/cjs/curve/CurveWireMomentsXYZ.d.ts.map +1 -1
  61. package/lib/cjs/curve/CurveWireMomentsXYZ.js +2 -4
  62. package/lib/cjs/curve/CurveWireMomentsXYZ.js.map +1 -1
  63. package/lib/cjs/curve/LineString3d.d.ts +3 -6
  64. package/lib/cjs/curve/LineString3d.d.ts.map +1 -1
  65. package/lib/cjs/curve/LineString3d.js +1 -4
  66. package/lib/cjs/curve/LineString3d.js.map +1 -1
  67. package/lib/cjs/curve/PointString3d.d.ts +2 -1
  68. package/lib/cjs/curve/PointString3d.d.ts.map +1 -1
  69. package/lib/cjs/curve/PointString3d.js.map +1 -1
  70. package/lib/cjs/curve/RegionOps.d.ts +7 -12
  71. package/lib/cjs/curve/RegionOps.d.ts.map +1 -1
  72. package/lib/cjs/curve/RegionOps.js +2 -1
  73. package/lib/cjs/curve/RegionOps.js.map +1 -1
  74. package/lib/cjs/curve/internalContexts/CurveCurveCloseApproachXY.d.ts +0 -9
  75. package/lib/cjs/curve/internalContexts/CurveCurveCloseApproachXY.d.ts.map +1 -1
  76. package/lib/cjs/curve/internalContexts/CurveCurveCloseApproachXY.js +16 -35
  77. package/lib/cjs/curve/internalContexts/CurveCurveCloseApproachXY.js.map +1 -1
  78. package/lib/cjs/curve/internalContexts/CurveCurveIntersectXY.d.ts +12 -6
  79. package/lib/cjs/curve/internalContexts/CurveCurveIntersectXY.d.ts.map +1 -1
  80. package/lib/cjs/curve/internalContexts/CurveCurveIntersectXY.js +80 -18
  81. package/lib/cjs/curve/internalContexts/CurveCurveIntersectXY.js.map +1 -1
  82. package/lib/cjs/curve/internalContexts/CurveCurveIntersectXYZ.d.ts +11 -5
  83. package/lib/cjs/curve/internalContexts/CurveCurveIntersectXYZ.d.ts.map +1 -1
  84. package/lib/cjs/curve/internalContexts/CurveCurveIntersectXYZ.js +73 -8
  85. package/lib/cjs/curve/internalContexts/CurveCurveIntersectXYZ.js.map +1 -1
  86. package/lib/cjs/curve/internalContexts/MultiChainCollector.d.ts +2 -3
  87. package/lib/cjs/curve/internalContexts/MultiChainCollector.d.ts.map +1 -1
  88. package/lib/cjs/curve/internalContexts/MultiChainCollector.js +2 -3
  89. package/lib/cjs/curve/internalContexts/MultiChainCollector.js.map +1 -1
  90. package/lib/cjs/curve/internalContexts/PolygonOffsetContext.d.ts +4 -4
  91. package/lib/cjs/curve/internalContexts/PolygonOffsetContext.d.ts.map +1 -1
  92. package/lib/cjs/curve/internalContexts/PolygonOffsetContext.js +38 -36
  93. package/lib/cjs/curve/internalContexts/PolygonOffsetContext.js.map +1 -1
  94. package/lib/cjs/geometry3d/CoincidentGeometryOps.d.ts +21 -5
  95. package/lib/cjs/geometry3d/CoincidentGeometryOps.d.ts.map +1 -1
  96. package/lib/cjs/geometry3d/CoincidentGeometryOps.js +71 -45
  97. package/lib/cjs/geometry3d/CoincidentGeometryOps.js.map +1 -1
  98. package/lib/cjs/geometry3d/Matrix3d.d.ts +20 -13
  99. package/lib/cjs/geometry3d/Matrix3d.d.ts.map +1 -1
  100. package/lib/cjs/geometry3d/Matrix3d.js +28 -21
  101. package/lib/cjs/geometry3d/Matrix3d.js.map +1 -1
  102. package/lib/cjs/geometry3d/Point3dVector3d.d.ts +11 -2
  103. package/lib/cjs/geometry3d/Point3dVector3d.d.ts.map +1 -1
  104. package/lib/cjs/geometry3d/Point3dVector3d.js +16 -5
  105. package/lib/cjs/geometry3d/Point3dVector3d.js.map +1 -1
  106. package/lib/cjs/geometry3d/PointHelpers.d.ts +58 -20
  107. package/lib/cjs/geometry3d/PointHelpers.d.ts.map +1 -1
  108. package/lib/cjs/geometry3d/PointHelpers.js +213 -62
  109. package/lib/cjs/geometry3d/PointHelpers.js.map +1 -1
  110. package/lib/cjs/geometry3d/Segment1d.d.ts +5 -1
  111. package/lib/cjs/geometry3d/Segment1d.d.ts.map +1 -1
  112. package/lib/cjs/geometry3d/Segment1d.js +11 -7
  113. package/lib/cjs/geometry3d/Segment1d.js.map +1 -1
  114. package/lib/cjs/geometry3d/Transform.d.ts +2 -3
  115. package/lib/cjs/geometry3d/Transform.d.ts.map +1 -1
  116. package/lib/cjs/geometry3d/Transform.js +2 -3
  117. package/lib/cjs/geometry3d/Transform.js.map +1 -1
  118. package/lib/cjs/geometry4d/Point4d.d.ts +14 -1
  119. package/lib/cjs/geometry4d/Point4d.d.ts.map +1 -1
  120. package/lib/cjs/geometry4d/Point4d.js +22 -1
  121. package/lib/cjs/geometry4d/Point4d.js.map +1 -1
  122. package/lib/cjs/numerics/BezierPolynomials.d.ts +91 -68
  123. package/lib/cjs/numerics/BezierPolynomials.d.ts.map +1 -1
  124. package/lib/cjs/numerics/BezierPolynomials.js +100 -79
  125. package/lib/cjs/numerics/BezierPolynomials.js.map +1 -1
  126. package/lib/cjs/numerics/Newton.d.ts +115 -60
  127. package/lib/cjs/numerics/Newton.d.ts.map +1 -1
  128. package/lib/cjs/numerics/Newton.js +120 -62
  129. package/lib/cjs/numerics/Newton.js.map +1 -1
  130. package/lib/cjs/numerics/PascalCoefficients.d.ts +8 -12
  131. package/lib/cjs/numerics/PascalCoefficients.d.ts.map +1 -1
  132. package/lib/cjs/numerics/PascalCoefficients.js +10 -12
  133. package/lib/cjs/numerics/PascalCoefficients.js.map +1 -1
  134. package/lib/cjs/numerics/Polynomials.d.ts +2 -2
  135. package/lib/cjs/numerics/Polynomials.d.ts.map +1 -1
  136. package/lib/cjs/numerics/Polynomials.js +2 -2
  137. package/lib/cjs/numerics/Polynomials.js.map +1 -1
  138. package/lib/cjs/polyface/PolyfaceBuilder.d.ts +3 -0
  139. package/lib/cjs/polyface/PolyfaceBuilder.d.ts.map +1 -1
  140. package/lib/cjs/polyface/PolyfaceBuilder.js +13 -2
  141. package/lib/cjs/polyface/PolyfaceBuilder.js.map +1 -1
  142. package/lib/cjs/polyface/PolyfaceClip.d.ts +1 -1
  143. package/lib/cjs/polyface/PolyfaceClip.d.ts.map +1 -1
  144. package/lib/cjs/polyface/PolyfaceClip.js +6 -3
  145. package/lib/cjs/polyface/PolyfaceClip.js.map +1 -1
  146. package/lib/cjs/polyface/PolyfaceData.d.ts +1 -1
  147. package/lib/cjs/polyface/PolyfaceData.js +1 -1
  148. package/lib/cjs/polyface/PolyfaceData.js.map +1 -1
  149. package/lib/cjs/polyface/PolyfaceQuery.d.ts +39 -12
  150. package/lib/cjs/polyface/PolyfaceQuery.d.ts.map +1 -1
  151. package/lib/cjs/polyface/PolyfaceQuery.js +94 -17
  152. package/lib/cjs/polyface/PolyfaceQuery.js.map +1 -1
  153. package/lib/cjs/serialization/BGFBReader.d.ts +10 -10
  154. package/lib/cjs/serialization/BGFBReader.d.ts.map +1 -1
  155. package/lib/cjs/serialization/BGFBReader.js +69 -42
  156. package/lib/cjs/serialization/BGFBReader.js.map +1 -1
  157. package/lib/cjs/serialization/BGFBWriter.d.ts +8 -8
  158. package/lib/cjs/serialization/BGFBWriter.d.ts.map +1 -1
  159. package/lib/cjs/serialization/BGFBWriter.js +80 -55
  160. package/lib/cjs/serialization/BGFBWriter.js.map +1 -1
  161. package/lib/cjs/serialization/GeometrySamples.d.ts.map +1 -1
  162. package/lib/cjs/serialization/GeometrySamples.js +6 -8
  163. package/lib/cjs/serialization/GeometrySamples.js.map +1 -1
  164. package/lib/cjs/serialization/IModelJsonSchema.d.ts +8 -14
  165. package/lib/cjs/serialization/IModelJsonSchema.d.ts.map +1 -1
  166. package/lib/cjs/serialization/IModelJsonSchema.js +85 -259
  167. package/lib/cjs/serialization/IModelJsonSchema.js.map +1 -1
  168. package/lib/cjs/serialization/SerializationHelpers.d.ts +109 -0
  169. package/lib/cjs/serialization/SerializationHelpers.d.ts.map +1 -0
  170. package/lib/cjs/serialization/SerializationHelpers.js +591 -0
  171. package/lib/cjs/serialization/SerializationHelpers.js.map +1 -0
  172. package/lib/cjs/solid/SweepContour.d.ts +4 -2
  173. package/lib/cjs/solid/SweepContour.d.ts.map +1 -1
  174. package/lib/cjs/solid/SweepContour.js +4 -2
  175. package/lib/cjs/solid/SweepContour.js.map +1 -1
  176. package/lib/esm/Geometry.d.ts.map +1 -1
  177. package/lib/esm/Geometry.js +2 -4
  178. package/lib/esm/Geometry.js.map +1 -1
  179. package/lib/esm/bspline/BSpline1dNd.d.ts +12 -2
  180. package/lib/esm/bspline/BSpline1dNd.d.ts.map +1 -1
  181. package/lib/esm/bspline/BSpline1dNd.js +27 -17
  182. package/lib/esm/bspline/BSpline1dNd.js.map +1 -1
  183. package/lib/esm/bspline/BSplineCurve.d.ts +30 -16
  184. package/lib/esm/bspline/BSplineCurve.d.ts.map +1 -1
  185. package/lib/esm/bspline/BSplineCurve.js +68 -44
  186. package/lib/esm/bspline/BSplineCurve.js.map +1 -1
  187. package/lib/esm/bspline/BSplineCurve3dH.d.ts +27 -20
  188. package/lib/esm/bspline/BSplineCurve3dH.d.ts.map +1 -1
  189. package/lib/esm/bspline/BSplineCurve3dH.js +137 -88
  190. package/lib/esm/bspline/BSplineCurve3dH.js.map +1 -1
  191. package/lib/esm/bspline/BSplineSurface.d.ts +138 -74
  192. package/lib/esm/bspline/BSplineSurface.d.ts.map +1 -1
  193. package/lib/esm/bspline/BSplineSurface.js +242 -119
  194. package/lib/esm/bspline/BSplineSurface.js.map +1 -1
  195. package/lib/esm/bspline/Bezier1dNd.d.ts +18 -4
  196. package/lib/esm/bspline/Bezier1dNd.d.ts.map +1 -1
  197. package/lib/esm/bspline/Bezier1dNd.js +19 -5
  198. package/lib/esm/bspline/Bezier1dNd.js.map +1 -1
  199. package/lib/esm/bspline/BezierCurve3dH.d.ts.map +1 -1
  200. package/lib/esm/bspline/BezierCurve3dH.js +2 -1
  201. package/lib/esm/bspline/BezierCurve3dH.js.map +1 -1
  202. package/lib/esm/bspline/KnotVector.d.ts +30 -33
  203. package/lib/esm/bspline/KnotVector.d.ts.map +1 -1
  204. package/lib/esm/bspline/KnotVector.js +76 -69
  205. package/lib/esm/bspline/KnotVector.js.map +1 -1
  206. package/lib/esm/clipping/AlternatingConvexClipTree.js.map +1 -1
  207. package/lib/esm/clipping/ClipUtils.d.ts +32 -5
  208. package/lib/esm/clipping/ClipUtils.d.ts.map +1 -1
  209. package/lib/esm/clipping/ClipUtils.js +92 -11
  210. package/lib/esm/clipping/ClipUtils.js.map +1 -1
  211. package/lib/esm/curve/CurveChainWithDistanceIndex.d.ts +18 -1
  212. package/lib/esm/curve/CurveChainWithDistanceIndex.d.ts.map +1 -1
  213. package/lib/esm/curve/CurveChainWithDistanceIndex.js +48 -1
  214. package/lib/esm/curve/CurveChainWithDistanceIndex.js.map +1 -1
  215. package/lib/esm/curve/CurveCollection.d.ts +9 -9
  216. package/lib/esm/curve/CurveCollection.d.ts.map +1 -1
  217. package/lib/esm/curve/CurveCollection.js +7 -10
  218. package/lib/esm/curve/CurveCollection.js.map +1 -1
  219. package/lib/esm/curve/CurveCurve.d.ts +2 -2
  220. package/lib/esm/curve/CurveCurve.d.ts.map +1 -1
  221. package/lib/esm/curve/CurveCurve.js +3 -16
  222. package/lib/esm/curve/CurveCurve.js.map +1 -1
  223. package/lib/esm/curve/CurveLocationDetail.d.ts +17 -4
  224. package/lib/esm/curve/CurveLocationDetail.d.ts.map +1 -1
  225. package/lib/esm/curve/CurveLocationDetail.js +32 -10
  226. package/lib/esm/curve/CurveLocationDetail.js.map +1 -1
  227. package/lib/esm/curve/CurveOps.d.ts +4 -5
  228. package/lib/esm/curve/CurveOps.d.ts.map +1 -1
  229. package/lib/esm/curve/CurveOps.js +1 -1
  230. package/lib/esm/curve/CurveOps.js.map +1 -1
  231. package/lib/esm/curve/CurveTypes.d.ts +14 -2
  232. package/lib/esm/curve/CurveTypes.d.ts.map +1 -1
  233. package/lib/esm/curve/CurveTypes.js.map +1 -1
  234. package/lib/esm/curve/CurveWireMomentsXYZ.d.ts.map +1 -1
  235. package/lib/esm/curve/CurveWireMomentsXYZ.js +2 -4
  236. package/lib/esm/curve/CurveWireMomentsXYZ.js.map +1 -1
  237. package/lib/esm/curve/LineString3d.d.ts +3 -6
  238. package/lib/esm/curve/LineString3d.d.ts.map +1 -1
  239. package/lib/esm/curve/LineString3d.js +1 -4
  240. package/lib/esm/curve/LineString3d.js.map +1 -1
  241. package/lib/esm/curve/PointString3d.d.ts +2 -1
  242. package/lib/esm/curve/PointString3d.d.ts.map +1 -1
  243. package/lib/esm/curve/PointString3d.js.map +1 -1
  244. package/lib/esm/curve/RegionOps.d.ts +7 -12
  245. package/lib/esm/curve/RegionOps.d.ts.map +1 -1
  246. package/lib/esm/curve/RegionOps.js +2 -1
  247. package/lib/esm/curve/RegionOps.js.map +1 -1
  248. package/lib/esm/curve/internalContexts/CurveCurveCloseApproachXY.d.ts +0 -9
  249. package/lib/esm/curve/internalContexts/CurveCurveCloseApproachXY.d.ts.map +1 -1
  250. package/lib/esm/curve/internalContexts/CurveCurveCloseApproachXY.js +16 -35
  251. package/lib/esm/curve/internalContexts/CurveCurveCloseApproachXY.js.map +1 -1
  252. package/lib/esm/curve/internalContexts/CurveCurveIntersectXY.d.ts +12 -6
  253. package/lib/esm/curve/internalContexts/CurveCurveIntersectXY.d.ts.map +1 -1
  254. package/lib/esm/curve/internalContexts/CurveCurveIntersectXY.js +81 -19
  255. package/lib/esm/curve/internalContexts/CurveCurveIntersectXY.js.map +1 -1
  256. package/lib/esm/curve/internalContexts/CurveCurveIntersectXYZ.d.ts +11 -5
  257. package/lib/esm/curve/internalContexts/CurveCurveIntersectXYZ.d.ts.map +1 -1
  258. package/lib/esm/curve/internalContexts/CurveCurveIntersectXYZ.js +74 -9
  259. package/lib/esm/curve/internalContexts/CurveCurveIntersectXYZ.js.map +1 -1
  260. package/lib/esm/curve/internalContexts/MultiChainCollector.d.ts +2 -3
  261. package/lib/esm/curve/internalContexts/MultiChainCollector.d.ts.map +1 -1
  262. package/lib/esm/curve/internalContexts/MultiChainCollector.js +2 -3
  263. package/lib/esm/curve/internalContexts/MultiChainCollector.js.map +1 -1
  264. package/lib/esm/curve/internalContexts/PolygonOffsetContext.d.ts +4 -4
  265. package/lib/esm/curve/internalContexts/PolygonOffsetContext.d.ts.map +1 -1
  266. package/lib/esm/curve/internalContexts/PolygonOffsetContext.js +38 -36
  267. package/lib/esm/curve/internalContexts/PolygonOffsetContext.js.map +1 -1
  268. package/lib/esm/geometry3d/CoincidentGeometryOps.d.ts +21 -5
  269. package/lib/esm/geometry3d/CoincidentGeometryOps.d.ts.map +1 -1
  270. package/lib/esm/geometry3d/CoincidentGeometryOps.js +71 -45
  271. package/lib/esm/geometry3d/CoincidentGeometryOps.js.map +1 -1
  272. package/lib/esm/geometry3d/Matrix3d.d.ts +20 -13
  273. package/lib/esm/geometry3d/Matrix3d.d.ts.map +1 -1
  274. package/lib/esm/geometry3d/Matrix3d.js +28 -21
  275. package/lib/esm/geometry3d/Matrix3d.js.map +1 -1
  276. package/lib/esm/geometry3d/Point3dVector3d.d.ts +11 -2
  277. package/lib/esm/geometry3d/Point3dVector3d.d.ts.map +1 -1
  278. package/lib/esm/geometry3d/Point3dVector3d.js +16 -5
  279. package/lib/esm/geometry3d/Point3dVector3d.js.map +1 -1
  280. package/lib/esm/geometry3d/PointHelpers.d.ts +58 -20
  281. package/lib/esm/geometry3d/PointHelpers.d.ts.map +1 -1
  282. package/lib/esm/geometry3d/PointHelpers.js +213 -62
  283. package/lib/esm/geometry3d/PointHelpers.js.map +1 -1
  284. package/lib/esm/geometry3d/Segment1d.d.ts +5 -1
  285. package/lib/esm/geometry3d/Segment1d.d.ts.map +1 -1
  286. package/lib/esm/geometry3d/Segment1d.js +11 -7
  287. package/lib/esm/geometry3d/Segment1d.js.map +1 -1
  288. package/lib/esm/geometry3d/Transform.d.ts +2 -3
  289. package/lib/esm/geometry3d/Transform.d.ts.map +1 -1
  290. package/lib/esm/geometry3d/Transform.js +2 -3
  291. package/lib/esm/geometry3d/Transform.js.map +1 -1
  292. package/lib/esm/geometry4d/Point4d.d.ts +14 -1
  293. package/lib/esm/geometry4d/Point4d.d.ts.map +1 -1
  294. package/lib/esm/geometry4d/Point4d.js +22 -1
  295. package/lib/esm/geometry4d/Point4d.js.map +1 -1
  296. package/lib/esm/numerics/BezierPolynomials.d.ts +91 -68
  297. package/lib/esm/numerics/BezierPolynomials.d.ts.map +1 -1
  298. package/lib/esm/numerics/BezierPolynomials.js +100 -79
  299. package/lib/esm/numerics/BezierPolynomials.js.map +1 -1
  300. package/lib/esm/numerics/Newton.d.ts +115 -60
  301. package/lib/esm/numerics/Newton.d.ts.map +1 -1
  302. package/lib/esm/numerics/Newton.js +120 -62
  303. package/lib/esm/numerics/Newton.js.map +1 -1
  304. package/lib/esm/numerics/PascalCoefficients.d.ts +8 -12
  305. package/lib/esm/numerics/PascalCoefficients.d.ts.map +1 -1
  306. package/lib/esm/numerics/PascalCoefficients.js +10 -12
  307. package/lib/esm/numerics/PascalCoefficients.js.map +1 -1
  308. package/lib/esm/numerics/Polynomials.d.ts +2 -2
  309. package/lib/esm/numerics/Polynomials.d.ts.map +1 -1
  310. package/lib/esm/numerics/Polynomials.js +2 -2
  311. package/lib/esm/numerics/Polynomials.js.map +1 -1
  312. package/lib/esm/polyface/PolyfaceBuilder.d.ts +3 -0
  313. package/lib/esm/polyface/PolyfaceBuilder.d.ts.map +1 -1
  314. package/lib/esm/polyface/PolyfaceBuilder.js +13 -2
  315. package/lib/esm/polyface/PolyfaceBuilder.js.map +1 -1
  316. package/lib/esm/polyface/PolyfaceClip.d.ts +1 -1
  317. package/lib/esm/polyface/PolyfaceClip.d.ts.map +1 -1
  318. package/lib/esm/polyface/PolyfaceClip.js +6 -3
  319. package/lib/esm/polyface/PolyfaceClip.js.map +1 -1
  320. package/lib/esm/polyface/PolyfaceData.d.ts +1 -1
  321. package/lib/esm/polyface/PolyfaceData.js +1 -1
  322. package/lib/esm/polyface/PolyfaceData.js.map +1 -1
  323. package/lib/esm/polyface/PolyfaceQuery.d.ts +39 -12
  324. package/lib/esm/polyface/PolyfaceQuery.d.ts.map +1 -1
  325. package/lib/esm/polyface/PolyfaceQuery.js +94 -17
  326. package/lib/esm/polyface/PolyfaceQuery.js.map +1 -1
  327. package/lib/esm/serialization/BGFBReader.d.ts +10 -10
  328. package/lib/esm/serialization/BGFBReader.d.ts.map +1 -1
  329. package/lib/esm/serialization/BGFBReader.js +69 -42
  330. package/lib/esm/serialization/BGFBReader.js.map +1 -1
  331. package/lib/esm/serialization/BGFBWriter.d.ts +8 -8
  332. package/lib/esm/serialization/BGFBWriter.d.ts.map +1 -1
  333. package/lib/esm/serialization/BGFBWriter.js +80 -55
  334. package/lib/esm/serialization/BGFBWriter.js.map +1 -1
  335. package/lib/esm/serialization/GeometrySamples.d.ts.map +1 -1
  336. package/lib/esm/serialization/GeometrySamples.js +7 -9
  337. package/lib/esm/serialization/GeometrySamples.js.map +1 -1
  338. package/lib/esm/serialization/IModelJsonSchema.d.ts +8 -14
  339. package/lib/esm/serialization/IModelJsonSchema.d.ts.map +1 -1
  340. package/lib/esm/serialization/IModelJsonSchema.js +86 -260
  341. package/lib/esm/serialization/IModelJsonSchema.js.map +1 -1
  342. package/lib/esm/serialization/SerializationHelpers.d.ts +109 -0
  343. package/lib/esm/serialization/SerializationHelpers.d.ts.map +1 -0
  344. package/lib/esm/serialization/SerializationHelpers.js +588 -0
  345. package/lib/esm/serialization/SerializationHelpers.js.map +1 -0
  346. package/lib/esm/solid/SweepContour.d.ts +4 -2
  347. package/lib/esm/solid/SweepContour.d.ts.map +1 -1
  348. package/lib/esm/solid/SweepContour.js +4 -2
  349. package/lib/esm/solid/SweepContour.js.map +1 -1
  350. package/package.json +3 -3
@@ -25,14 +25,19 @@ var UVSelect;
25
25
  (function (UVSelect) {
26
26
  /** index of u direction */
27
27
  UVSelect[UVSelect["uDirection"] = 0] = "uDirection";
28
- /** index of v direction */
28
+ /**
29
+ * index of v direction
30
+ * @deprecated in 4.x. Use vDirection instead.
31
+ */
29
32
  UVSelect[UVSelect["VDirection"] = 1] = "VDirection";
33
+ /** index of v direction */
34
+ UVSelect[UVSelect["vDirection"] = 1] = "vDirection";
30
35
  })(UVSelect = exports.UVSelect || (exports.UVSelect = {}));
31
36
  /**
32
37
  * Enumeration of how weights are carried
33
38
  * * UnWeighted (0) -- there are no weights
34
- * * WeightsAlreadyAppliedToCoordinates (1) -- for real point (x,y,z) the homogeneous point has weight applied throughout as (wx,wy,wz,w)
35
- * * WeightsSeparateFromCoordinates (2) -- for real point (x,y,z) the homogeneous point is (x,y,z,w)
39
+ * * WeightsAlreadyAppliedToCoordinates (1) -- for real point (x,y,z) the homogeneous point (wx,wy,wx,w) is stored as (wx,wy,wz,w)
40
+ * * WeightsSeparateFromCoordinates (2) -- for real point (x,y,z) the homogeneous point (wx,wy,wx,w) is stored as (x,y,z,w)
36
41
  * * Note that "internal" computations never use WeightsSeparateFromCoordinates.
37
42
  * * WeightsSeparateFromCoordinates is only useful as input or output state in serializer.
38
43
  * @public
@@ -42,13 +47,13 @@ var WeightStyle;
42
47
  /** There are no weights. */
43
48
  WeightStyle[WeightStyle["UnWeighted"] = 0] = "UnWeighted";
44
49
  /**
45
- * * Data is weighted
46
- * * point with normalized coordinate `[x,y,z]` and weight `w` has weights already multiplied in as `[x*w,y*w,z*w,w]`
50
+ * * Data is weighted.
51
+ * * The point with normalized coordinate `[x,y,z]` and weight `w` is stored as `[x*w,y*w,z*w,w]`
47
52
  * */
48
53
  WeightStyle[WeightStyle["WeightsAlreadyAppliedToCoordinates"] = 1] = "WeightsAlreadyAppliedToCoordinates";
49
54
  /**
50
- * * Data is weighted
51
- * * point with normalized coordinate `[x,y,z]` and weight `w` has is `[x,y,z,w]`
55
+ * * Data is weighted.
56
+ * * The point with normalized coordinate `[x,y,z]` and weight `w` is stored as `[x,y,z,w]`
52
57
  * */
53
58
  WeightStyle[WeightStyle["WeightsSeparateFromCoordinates"] = 2] = "WeightsSeparateFromCoordinates";
54
59
  })(WeightStyle = exports.WeightStyle || (exports.WeightStyle = {}));
@@ -79,18 +84,30 @@ class BSpline2dNd extends GeometryQuery_1.GeometryQuery {
79
84
  return false;
80
85
  return true;
81
86
  }
82
- /** Get the Point3d by row and column.
87
+ /** Get the indexed Point3d.
83
88
  * * (IMPORTANT) This assumes this is an xyz surface. Data will be incorrect if this is an xyzw surface.
89
+ * @param i index in [0, numPolesU)
90
+ * @param j index in [0, numPolesV)
84
91
  */
85
92
  getPoint3dPole(i, j, result) {
86
93
  return Point3dVector3d_1.Point3d.createFromPacked(this.coffs, i + j * this._numPoles[0], result);
87
94
  }
88
- /** Get the Point3d by row and column, projecting the weight away to get to xyz
95
+ /** Get the indexed Point3d, projecting the weight away to get to xyz.
89
96
  * * (IMPORTANT) This assumes this is an xyzw surface. Data will be incorrect if this is an xyz surface.
97
+ * @param i index in [0, numPolesU)
98
+ * @param j index in [0, numPolesV)
90
99
  */
91
100
  getPoint3dPoleXYZW(i, j, result) {
92
101
  return Point3dVector3d_1.Point3d.createFromPackedXYZW(this.coffs, i + j * this._numPoles[0], result);
93
102
  }
103
+ /** Get the indexed Point4d.
104
+ * * (IMPORTANT) This assumes this is an xyzw surface. Data will be incorrect if this is an xyz surface.
105
+ * @param i index in [0, numPolesU)
106
+ * @param j index in [0, numPolesV)
107
+ */
108
+ getPoint4dPole(i, j, result) {
109
+ return Point4d_1.Point4d.createFromPacked(this.coffs, (i + j * this._numPoles[0]) * 4, result);
110
+ }
94
111
  /**
95
112
  * Return 0 for 0 input, 1 for any nonzero input.
96
113
  * @param value numeric value to convert to strict 0 or 1.
@@ -184,6 +201,7 @@ class BSpline2dNd extends GeometryQuery_1.GeometryQuery {
184
201
  * * choice of u or v
185
202
  * * span index
186
203
  * * local fraction within the span.
204
+ * @returns true if and only if output arrays are sufficiently sized
187
205
  */
188
206
  spanFractionsToBasisFunctions(select, spanIndex, spanFraction, f, df) {
189
207
  spanIndex = Geometry_1.Geometry.clampToStartEnd(spanIndex, 0, this.numSpanUV(select));
@@ -213,9 +231,15 @@ class BSpline2dNd extends GeometryQuery_1.GeometryQuery {
213
231
  kU += stepV;
214
232
  }
215
233
  }
216
- // cSpell:word sumpole
217
- /** sum derivatives by the weights in the basisBuffer, using poles for given span */
234
+ /**
235
+ * sum poles by the weights in the basisBuffer, using poles for given span
236
+ * @deprecated in 4.x. Use sumPoleBufferDerivativesForSpan instead.
237
+ */
218
238
  sumpoleBufferDerivativesForSpan(spanIndexU, spanIndexV) {
239
+ return this.sumPoleBufferDerivativesForSpan(spanIndexU, spanIndexV);
240
+ }
241
+ /** sum derivatives by the weights in the basisBuffer, using poles for given span */
242
+ sumPoleBufferDerivativesForSpan(spanIndexU, spanIndexV) {
219
243
  const poleBuffer1U = this._poleBuffer1UV[0];
220
244
  const poleBuffer1V = this._poleBuffer1UV[1];
221
245
  poleBuffer1U.fill(0);
@@ -269,7 +293,7 @@ class BSpline2dNd extends GeometryQuery_1.GeometryQuery {
269
293
  this.knots[0].evaluateBasisFunctions1(knotIndex0U, u, this._basisBufferUV[0], this._basisBuffer1UV[0]);
270
294
  this.knots[1].evaluateBasisFunctions1(knotIndex0V, v, this._basisBufferUV[1], this._basisBuffer1UV[1]);
271
295
  this.sumPoleBufferForSpan(poleIndex0U, poleIndex0V);
272
- this.sumpoleBufferDerivativesForSpan(poleIndex0U, poleIndex0V);
296
+ this.sumPoleBufferDerivativesForSpan(poleIndex0U, poleIndex0V);
273
297
  }
274
298
  }
275
299
  // Swap numSwap entries in coffs, starting at i0 and i1 (absolute indices -- not blocks)
@@ -308,31 +332,33 @@ class BSpline2dNd extends GeometryQuery_1.GeometryQuery {
308
332
  this.knots[select].reflectKnots();
309
333
  }
310
334
  /**
311
- * Set the flag indicating the bspline might be suitable for having wrapped "closed" interpretation.
335
+ * Get the flag indicating the surface might be suitable for having wrapped "closed" interpretation.
336
+ */
337
+ getWrappable(select) {
338
+ return this.knots[select].wrappable;
339
+ }
340
+ /**
341
+ * Set the flag indicating the surface might be suitable for having wrapped "closed" interpretation.
312
342
  */
313
343
  setWrappable(select, value) {
314
344
  this.knots[select].wrappable = value;
315
345
  }
316
346
  /**
317
- * Test if `degree` leading and trailing (one of U or V) blocks match, as if the data is an unwrapped closed spline in the selected direction.
318
- * @param select select U or V direction
319
- * @returns true if coordinates matched.
347
+ * Test if leading and trailing blocks of points match in a given direction.
348
+ * @param data packed array of points in row-major order (numRows x numColumns x dimension numbers)
349
+ * @param numRows number of rows of points in the array
350
+ * @param numColumns number of columns of points in the array (equal to the number of points in each row)
351
+ * @param dimension point dimension (e.g., 2,3,4)
352
+ * @param blockLength number of leading/trailing points to check
353
+ * @param select 0 to test first/last columns of points; 1 to test first/last rows of points
354
+ * @returns true if coordinates matched
320
355
  */
321
- isClosable(select) {
322
- if (this.knots[select].wrappable === KnotVector_1.BSplineWrapMode.None)
323
- return false;
324
- if (!this.knots[select].testClosable())
325
- return false;
326
- const numU = this.numPolesUV(0);
327
- const numV = this.numPolesUV(1);
328
- const blockSize = this.poleDimension;
329
- const rowToRowStep = numU * blockSize;
330
- const degreeU = this.degreeUV(0);
331
- const degreeV = this.degreeUV(1);
332
- const data = this.coffs;
333
- if (select === 0) {
334
- const numTest = blockSize * degreeU; // degreeU contiguous poles.
335
- for (let row = 0; row < numV; row++) {
356
+ static isWrappedGrid(data, numRows, numColumns, dimension, blockLength, select) {
357
+ const rowToRowStep = numColumns * dimension;
358
+ if (UVSelect.uDirection === select) {
359
+ // Test the contiguous block at the start/end of each row
360
+ const numTest = dimension * blockLength;
361
+ for (let row = 0; row < numRows; row++) {
336
362
  const i0 = row * rowToRowStep;
337
363
  const i1 = i0 + rowToRowStep - numTest;
338
364
  for (let i = 0; i < numTest; i++) {
@@ -342,9 +368,9 @@ class BSpline2dNd extends GeometryQuery_1.GeometryQuery {
342
368
  }
343
369
  }
344
370
  else {
345
- // Test the entire multi-row contiguous block in one loop . ..
346
- const numTest = degreeV * rowToRowStep;
347
- const i1 = blockSize * numU * numV - numTest;
371
+ // Test the entire multi-row contiguous block at the start/end of the array
372
+ const numTest = blockLength * rowToRowStep;
373
+ const i1 = numRows * numColumns * dimension - numTest;
348
374
  for (let i = 0; i < numTest; i++) {
349
375
  if (!Geometry_1.Geometry.isSameCoordinate(data[i], data[i1 + i]))
350
376
  return false;
@@ -352,6 +378,43 @@ class BSpline2dNd extends GeometryQuery_1.GeometryQuery {
352
378
  }
353
379
  return true;
354
380
  }
381
+ /**
382
+ * Test if `degree` leading and trailing (one of U or V) blocks match, as if the data is a non-periodic physically closed spline in the selected direction.
383
+ * @param select select U or V direction
384
+ * @returns true if coordinates matched.
385
+ */
386
+ testClosableGrid(select, mode) {
387
+ if (mode === undefined)
388
+ mode = this.knots[select].wrappable;
389
+ if (mode === KnotVector_1.BSplineWrapMode.OpenByAddingControlPoints) // the last degree poles equal the first degree poles
390
+ return BSpline2dNd.isWrappedGrid(this.coffs, this.numPolesUV(UVSelect.vDirection), this.numPolesUV(UVSelect.uDirection), this.poleDimension, this.degreeUV(select), select);
391
+ if (mode === KnotVector_1.BSplineWrapMode.OpenByRemovingKnots) // the last pole equals the first pole
392
+ return BSpline2dNd.isWrappedGrid(this.coffs, this.numPolesUV(UVSelect.vDirection), this.numPolesUV(UVSelect.uDirection), this.poleDimension, 1, select);
393
+ return false;
394
+ }
395
+ /**
396
+ * Test knots and control points to determine if it is possible to close (aka "wrap") the surface in the selected parametric direction.
397
+ * @param select select U or V direction
398
+ * @return whether the surface can be wrapped in the given parametric direction.
399
+ */
400
+ isClosable(select) {
401
+ return KnotVector_1.BSplineWrapMode.None !== this.isClosableSurface(select);
402
+ }
403
+ /**
404
+ * Test knots and control points to determine if it is possible to close (aka "wrap") the surface in the selected parametric direction.
405
+ * @param select select U or V direction
406
+ * @return the manner of closing. See `BSplineWrapMode` for particulars of each mode.
407
+ */
408
+ isClosableSurface(select) {
409
+ const mode = this.knots[select].wrappable;
410
+ if (mode === KnotVector_1.BSplineWrapMode.None)
411
+ return KnotVector_1.BSplineWrapMode.None;
412
+ if (!this.knots[select].testClosable(mode))
413
+ return KnotVector_1.BSplineWrapMode.None;
414
+ if (!this.testClosableGrid(select, mode))
415
+ return KnotVector_1.BSplineWrapMode.None;
416
+ return mode;
417
+ }
355
418
  }
356
419
  exports.BSpline2dNd = BSpline2dNd;
357
420
  /** BSplineSurface3d is a parametric surface in xyz space.
@@ -393,7 +456,8 @@ class BSplineSurface3d extends BSpline2dNd {
393
456
  getPointGridJSON() {
394
457
  const result = {
395
458
  points: PointHelpers_1.Point3dArray.unpackNumbersToNestedArraysIJK(this.coffs, 3, this.numPolesUV(0)),
396
- weighStyle: WeightStyle.UnWeighted,
459
+ weighStyle: WeightStyle.WeightsAlreadyAppliedToCoordinates,
460
+ weightStyle: WeightStyle.UnWeighted,
397
461
  numCartesianDimensions: 3,
398
462
  };
399
463
  return result;
@@ -405,23 +469,24 @@ class BSplineSurface3d extends BSpline2dNd {
405
469
  * in classic over-clamped manner
406
470
  */
407
471
  copyKnots(select, includeExtraEndKnot) { return this.knots[select].copyKnots(includeExtraEndKnot); }
408
- /** Create a bspline surface.
472
+ /**
473
+ * Create a bspline surface.
409
474
  * * This `create` variant takes control points in a "flattened" array, with
410
475
  * points from succeeding U rows packed together in one array. Use `createGrid` if the points are in
411
476
  * a row-by-row grid structure
412
477
  * * knotArrayU and knotArrayV are optional -- uniform knots are implied if they are omitted (undefined).
413
- * * When knots are given, two knot count conditions are recognized:
414
- * * + If poleArray.length + order == knotArray.length, the first and last are assumed to be the
478
+ * * When knots are given, two knot count conditions are recognized:
479
+ * * If poleArray.length + order == knotArray.length, the first and last are assumed to be the
415
480
  * extraneous knots of classic clamping.
416
- * * + If poleArray.length + order == knotArray.length + 2, the knots are in modern form that does not have
481
+ * * If poleArray.length + order == knotArray.length + 2, the knots are in modern form that does not have
417
482
  * the classic unused first and last knot.
418
483
  * @param controlPointArray Array of points, ordered along the U direction.
419
- * @param numPoleU number of poles in each row in the U direction.
484
+ * @param numPoleU number of poles in each row
420
485
  * @param orderU order for the U direction polynomial (`order` is one more than the `degree`. "cubic" polynomial is order 4.)
421
- * @param KnotArrayU knots for the V direction. See note above about knot counts.
422
- * @param numPoleV number of poles in each row in the U direction.
486
+ * @param knotArrayU knots for the V direction. See note above about knot counts.
487
+ * @param numPoleV number of rows of poles
423
488
  * @param orderV order for the V direction polynomial (`order` is one more than the `degree`. "cubic" polynomial is order 4.)
424
- * @param KnotArrayV knots for the V direction. See note above about knot counts.
489
+ * @param knotArrayV knots for the V direction. See note above about knot counts.
425
490
  */
426
491
  static create(controlPointArray, numPolesU, orderU, knotArrayU, numPolesV, orderV, knotArrayV) {
427
492
  let numPoles = controlPointArray.length;
@@ -458,40 +523,41 @@ class BSplineSurface3d extends BSpline2dNd {
458
523
  const surface = new BSplineSurface3d(numPolesU, numPolesV, knotsU, knotsV, coffs);
459
524
  return surface;
460
525
  }
461
- /** Create a bspline surface.
526
+ /**
527
+ * Create a bspline surface.
462
528
  * * This `create` variant takes control points in a "grid" array, with the points from
463
- * each grid row `[rowIndex]` being an independent array `points[rowIndex][indexAlongRow][x,y,z]`
529
+ * each grid row `[rowIndex]` being an independent array `points[rowIndex][indexAlongRow][x,y,z]`
464
530
  * * knotArrayU and knotArrayV are optional -- uniform knots are implied if they are omitted (undefined).
465
- * * When knots are given, two knot count conditions are recognized:
466
- * * + If poleArray.length + order == knotArray.length, the first and last are assumed to be the
531
+ * * When knots are given, two knot count conditions are recognized in each direction:
532
+ * * If poleArray.length + order == knotArray.length, the first and last are assumed to be the
467
533
  * extraneous knots of classic clamping.
468
- * * + If poleArray.length + order == knotArray.length + 2, the knots are in modern form that does not have
534
+ * * If poleArray.length + order == knotArray.length + 2, the knots are in modern form that does not have
469
535
  * the classic unused first and last knot.
470
- * @param controlPointArray Array of points, ordered along the U direction.
471
- * @param numPoleU number of poles in each row in the U direction.
536
+ * @param points Array of points, ordered along the U direction.
472
537
  * @param orderU order for the U direction polynomial (`order` is one more than the `degree`. "cubic" polynomial is order 4.)
473
- * @param KnotArrayU knots for the V direction. See note above about knot counts.
474
- * @param numPoleV number of poles in each row in the U direction.
538
+ * @param knotArrayU knots for the V direction. See note above about knot counts.
475
539
  * @param orderV order for the V direction polynomial (`order` is one more than the `degree`. "cubic" polynomial is order 4.)
476
- * @param KnotArrayV knots for the V direction. See note above about knot counts.
540
+ * @param knotArrayV knots for the V direction. See note above about knot counts.
477
541
  */
478
542
  static createGrid(points, orderU, knotArrayU, orderV, knotArrayV) {
479
543
  const numPolesV = points.length;
480
544
  const numPolesU = points[0].length;
481
545
  const numPoles = numPolesU * numPolesV;
546
+ if (3 !== points[0][0].length)
547
+ return undefined;
548
+ if (!this.validOrderAndPoleCounts(orderU, numPolesU, orderV, numPolesV, numPoles))
549
+ return undefined;
482
550
  // shift knots-of-interest limits for overclamped case ...
483
551
  const numKnotsU = knotArrayU ? knotArrayU.length : numPolesU + orderU - 2;
484
552
  const numKnotsV = knotArrayV ? knotArrayV.length : numPolesV + orderV - 2;
485
553
  const skipFirstAndLastU = (numPolesU + orderU === numKnotsU);
486
554
  const skipFirstAndLastV = (numPolesV + orderV === numKnotsV);
487
- if (!this.validOrderAndPoleCounts(orderU, numPolesU, orderV, numPolesV, numPoles))
488
- return undefined;
489
555
  const knotsU = knotArrayU ?
490
556
  KnotVector_1.KnotVector.create(knotArrayU, orderU - 1, skipFirstAndLastU) :
491
557
  KnotVector_1.KnotVector.createUniformClamped(numPolesU, orderU - 1, 0.0, 1.0);
492
558
  const knotsV = knotArrayV ?
493
559
  KnotVector_1.KnotVector.create(knotArrayV, orderV - 1, skipFirstAndLastV) :
494
- KnotVector_1.KnotVector.createUniformClamped(numPolesU, orderU - 1, 0.0, 1.0);
560
+ KnotVector_1.KnotVector.createUniformClamped(numPolesV, orderV - 1, 0.0, 1.0);
495
561
  const coffs = new Float64Array(3 * numPolesU * numPolesV);
496
562
  let i = 0;
497
563
  for (const row of points) {
@@ -501,8 +567,7 @@ class BSplineSurface3d extends BSpline2dNd {
501
567
  coffs[i++] = xyz[2];
502
568
  }
503
569
  }
504
- const surface = new BSplineSurface3d(numPolesU, numPolesV, knotsU, knotsV, coffs);
505
- return surface;
570
+ return new BSplineSurface3d(numPolesU, numPolesV, knotsU, knotsV, coffs);
506
571
  }
507
572
  /**
508
573
  * Return a complete copy of the bspline surface.
@@ -557,6 +622,14 @@ class BSplineSurface3d extends BSpline2dNd {
557
622
  const knotV = this.knots[1].fractionToKnot(fractionV);
558
623
  return this.knotToPointAndDerivatives(knotU, knotV, result);
559
624
  }
625
+ /** Implementation of the UVSurface interface; allows `PolyfaceBuilder.addUVGridBody` to facet this B-spline surface. */
626
+ uvFractionToPoint(u, v) {
627
+ return this.fractionToPoint(u, v);
628
+ }
629
+ /** Implementation of the UVSurface interface; allows `PolyfaceBuilder.addUVGridBody` to facet this B-spline surface. */
630
+ uvFractionToPointAndTangents(u, v, result) {
631
+ return this.fractionToPointAndDerivatives(u, v, result);
632
+ }
560
633
  /** test for identical counts and near-equal coordinates */
561
634
  isAlmostEqual(other) {
562
635
  if (other instanceof BSplineSurface3d) {
@@ -600,13 +673,20 @@ class BSplineSurface3dH extends BSpline2dNd {
600
673
  constructor(numPolesU, numPolesV, knotsU, knotsV, coffs) {
601
674
  super(numPolesU, numPolesV, 4, knotsU, knotsV, coffs);
602
675
  }
603
- /** Return a simple array of the control points. */
676
+ /** Unpack the control points to a Point4d array of form [wx,wy,wz,w]. */
604
677
  copyPoints4d() { return PointHelpers_1.Point4dArray.unpackToPoint4dArray(this.coffs); }
605
- /** Return a simple array of the control points. */
678
+ /**
679
+ * Unpack the control points to a Point3d array and an array of weights.
680
+ * @param points output xyz, weighted by default formatter
681
+ * @param weights output weights
682
+ * @param formatter optional xyz formatter. By default, returns a Point3d of form [wx,wy,wz].
683
+ */
606
684
  copyPointsAndWeights(points, weights, formatter = (x, y, z) => Point3dVector3d_1.Point3d.create(x, y, z)) {
607
685
  PointHelpers_1.Point4dArray.unpackFloat64ArrayToPointsAndWeights(this.coffs, points, weights, formatter);
608
686
  }
609
- /** unpack from xyzw xyzw ... to packed xyz, optionally unweighted
687
+ /**
688
+ * Copy the control points to a packed 3D array.
689
+ * @param unweight if true, output array has form x,y,z; if false, output array has form wx,wy,wz.
610
690
  */
611
691
  copyXYZToFloat64Array(unweight) {
612
692
  const numPoints = Math.floor(this.coffs.length / 4);
@@ -628,7 +708,7 @@ class BSplineSurface3dH extends BSpline2dNd {
628
708
  }
629
709
  return result;
630
710
  }
631
- /** unpack from xyzw xyzw ... to packed xyz, optionally unweighted
711
+ /** unpack from xyzw xyzw ... to packed weights
632
712
  */
633
713
  copyWeightsToFloat64Array() {
634
714
  const numPoints = Math.floor(this.coffs.length / 4);
@@ -645,24 +725,23 @@ class BSplineSurface3dH extends BSpline2dNd {
645
725
  * in classic over-clamped manner
646
726
  */
647
727
  copyKnots(select, includeExtraEndKnot) { return this.knots[select].copyKnots(includeExtraEndKnot); }
648
- /** Create a weighted bspline surface, with control points and weights each organized as flattened array of points continuing from one U row to the next.
649
- * * This `create` variant takes control points in a "flattened" array, with
650
- * points from succeeding U rows packed together in one array. Use `createGrid` if the points are in
651
- * a deeper grid array structure.
728
+ /**
729
+ * Create a weighted bspline surface, with control points and weights each organized as flattened arrays continuing from one U row to the next.
730
+ * * Use `createGrid` if the control points are in a deeper grid array structure.
652
731
  * * knotArrayU and knotArrayV are optional -- uniform knots are implied if they are omitted (undefined).
653
- * * When knots are given, two knot count conditions are recognized:
654
- * * * If poleArray.length + order == knotArray.length, the first and last are assumed to be the
732
+ * * When knots are given, two knot count conditions are recognized:
733
+ * * If poleArray.length + order == knotArray.length, the first and last are assumed to be the
655
734
  * extraneous knots of classic clamping.
656
- * * * If poleArray.length + order == knotArray.length + 2, the knots are in modern form that does not have
735
+ * * If poleArray.length + order == knotArray.length + 2, the knots are in modern form that does not have
657
736
  * the classic unused first and last knot.
658
- * @param controlPointArray Array of points, ordered along the U direction.
659
- * @param weightArray array of weights, ordered along the U direction.
660
- * @param numPoleU number of poles in each row in the U direction.
737
+ * @param controlPointArray Array of [wx,wy,wz] points, ordered along the U direction.
738
+ * @param weightArray array of weights, ordered along the U direction. If undefined, unit weights are installed.
739
+ * @param numPolesU number of poles in each row in the U direction.
661
740
  * @param orderU order for the U direction polynomial (`order` is one more than the `degree`. "cubic" polynomial is order 4.)
662
- * @param KnotArrayU optional knots for the V direction. See note above about knot counts.
663
- * @param numPoleV number of poles in each row in the U direction.
741
+ * @param knotArrayU optional knots for the V direction. See note above about knot counts.
742
+ * @param numPolesV number of poles in each column in the V direction (the number of rows).
664
743
  * @param orderV order for the V direction polynomial (`order` is one more than the `degree`. "cubic" polynomial is order 4.)
665
- * @param KnotArrayV optional knots for the V direction. See note above about knot counts.
744
+ * @param knotArrayV optional knots for the V direction. See note above about knot counts.
666
745
  */
667
746
  static create(controlPointArray, weightArray, numPolesU, orderU, knotArrayU, numPolesV, orderV, knotArrayV) {
668
747
  const numPoles = numPolesU * numPolesV;
@@ -678,62 +757,95 @@ class BSplineSurface3dH extends BSpline2dNd {
678
757
  const knotsV = knotArrayV ?
679
758
  KnotVector_1.KnotVector.create(knotArrayV, orderV - 1, skipFirstAndLastV) :
680
759
  KnotVector_1.KnotVector.createUniformClamped(numPolesV, orderV - 1, 0.0, 1.0);
760
+ if (undefined === weightArray)
761
+ weightArray = Array(numPoles).fill(1.0); // unit weights
681
762
  const coffs = PointHelpers_1.Point4dArray.packPointsAndWeightsToFloat64Array(controlPointArray, weightArray);
682
763
  if (coffs === undefined || coffs.length !== 4 * numPolesU * numPolesV)
683
764
  return undefined;
684
765
  const surface = new BSplineSurface3dH(numPolesU, numPolesV, knotsU, knotsV, coffs);
685
766
  return surface;
686
767
  }
687
- /** Create a bspline with given knots.
688
- *
689
- * Two count conditions are recognized in each direction:
690
- *
691
- * ** If poleArray.length + order == knotArray.length, the first and last are assumed to be the
768
+ /**
769
+ * Create a bspline surface with given knots.
770
+ * * This `create` variant takes control points in a "grid" array, with the points from
771
+ * each grid row `[rowIndex]` being an independent array `points[rowIndex][indexAlongRow][x,y,z,w]`
772
+ * * knotArrayU and knotArrayV are optional -- uniform knots are implied if they are omitted (undefined).
773
+ * * When knots are given, two count conditions are recognized in each direction:
774
+ * * If poleArray.length + order == knotArray.length, the first and last are assumed to be the
692
775
  * extraneous knots of classic clamping.
693
- * ** If poleArray.length + order == knotArray.length + 2, the knots are in modern form.
694
- *
776
+ * * If poleArray.length + order == knotArray.length + 2, the knots are in modern form that does not have
777
+ * the classic unused first and last knot.
778
+ * @param xyzwGrid Array of points, ordered along the U direction.
779
+ * @param weightStyle how the points are weighted
780
+ * @param orderU order for the U direction polynomial (`order` is one more than the `degree`. "cubic" polynomial is order 4.)
781
+ * @param knotArrayU knots for the V direction. See note above about knot counts.
782
+ * @param orderV order for the V direction polynomial (`order` is one more than the `degree`. "cubic" polynomial is order 4.)
783
+ * @param knotArrayV knots for the V direction. See note above about knot counts.
695
784
  */
696
785
  static createGrid(xyzwGrid, weightStyle, orderU, knotArrayU, orderV, knotArrayV) {
697
786
  const numPolesV = xyzwGrid.length;
698
787
  const numPolesU = xyzwGrid[0].length;
699
788
  const numPoles = numPolesU * numPolesV;
789
+ if (4 !== xyzwGrid[0][0].length)
790
+ return undefined;
700
791
  if (!this.validOrderAndPoleCounts(orderU, numPolesU, orderV, numPolesV, numPoles))
701
792
  return undefined;
702
- // const numPoles = numPolesU * numPolesV;
703
- // shift knots-of-interest limits for overclamped case ...
704
- const numKnotsU = knotArrayU.length;
705
- const numKnotsV = knotArrayV.length;
706
- const skipFirstAndLastU = (numPolesU + orderU === numKnotsU);
707
- const skipFirstAndLastV = (numPolesV + orderV === numKnotsV);
708
- const knotsU = KnotVector_1.KnotVector.create(knotArrayU, orderU - 1, skipFirstAndLastU);
709
- const knotsV = KnotVector_1.KnotVector.create(knotArrayV, orderV - 1, skipFirstAndLastV);
793
+ // validate knot counts
794
+ const numKnotsU = knotArrayU ? knotArrayU.length : numPolesU + orderU - 2;
795
+ const numKnotsV = knotArrayV ? knotArrayV.length : numPolesV + orderV - 2;
796
+ const skipFirstAndLastU = (numPolesU + orderU === numKnotsU); // classic over-clamped input knots
797
+ if (!skipFirstAndLastU && numPolesU + orderU !== numKnotsU + 2) // modern knots
798
+ return undefined;
799
+ const skipFirstAndLastV = (numPolesV + orderV === numKnotsV); // classic
800
+ if (!skipFirstAndLastV && numPolesV + orderV !== numKnotsV + 2) // modern
801
+ return undefined;
802
+ const knotsU = knotArrayU ?
803
+ KnotVector_1.KnotVector.create(knotArrayU, orderU - 1, skipFirstAndLastU) :
804
+ KnotVector_1.KnotVector.createUniformClamped(numPolesU, orderU - 1, 0.0, 1.0);
805
+ const knotsV = knotArrayV ?
806
+ KnotVector_1.KnotVector.create(knotArrayV, orderV - 1, skipFirstAndLastV) :
807
+ KnotVector_1.KnotVector.createUniformClamped(numPolesV, orderV - 1, 0.0, 1.0);
710
808
  const coffs = new Float64Array(4 * numPoles);
711
- if (weightStyle === WeightStyle.WeightsSeparateFromCoordinates) {
712
- let i = 0;
713
- for (const row of xyzwGrid) {
714
- for (const point of row) {
715
- const w = point[3];
716
- coffs[i++] = point[0] * w;
717
- coffs[i++] = point[1] * w;
718
- coffs[i++] = point[2] * w;
719
- coffs[i++] = point[3];
809
+ let i = 0;
810
+ switch (weightStyle) {
811
+ case WeightStyle.WeightsSeparateFromCoordinates: {
812
+ for (const row of xyzwGrid) {
813
+ for (const point of row) {
814
+ const w = point[3];
815
+ coffs[i++] = point[0] * w;
816
+ coffs[i++] = point[1] * w;
817
+ coffs[i++] = point[2] * w;
818
+ coffs[i++] = point[3];
819
+ }
720
820
  }
821
+ break;
721
822
  }
722
- }
723
- else {
724
- // implicit WeightStyle.WeightsAlreadyAppliedToCoordinates
725
- let i = 0;
726
- for (const row of xyzwGrid) {
727
- for (const point of row) {
728
- coffs[i++] = point[0];
729
- coffs[i++] = point[1];
730
- coffs[i++] = point[2];
731
- coffs[i++] = point[3];
823
+ case WeightStyle.WeightsAlreadyAppliedToCoordinates: {
824
+ for (const row of xyzwGrid) {
825
+ for (const point of row) {
826
+ coffs[i++] = point[0];
827
+ coffs[i++] = point[1];
828
+ coffs[i++] = point[2];
829
+ coffs[i++] = point[3];
830
+ }
831
+ }
832
+ break;
833
+ }
834
+ case WeightStyle.UnWeighted: {
835
+ for (const row of xyzwGrid) {
836
+ for (const point of row) {
837
+ coffs[i++] = point[0];
838
+ coffs[i++] = point[1];
839
+ coffs[i++] = point[2];
840
+ coffs[i++] = 1.0;
841
+ }
732
842
  }
843
+ break;
733
844
  }
845
+ default:
846
+ return undefined; // unrecognized WeightStyle
734
847
  }
735
- const surface = new BSplineSurface3dH(numPolesU, numPolesV, knotsU, knotsV, coffs);
736
- return surface;
848
+ return new BSplineSurface3dH(numPolesU, numPolesV, knotsU, knotsV, coffs);
737
849
  }
738
850
  /** Return a deep clone */
739
851
  clone() {
@@ -758,27 +870,30 @@ class BSplineSurface3dH extends BSpline2dNd {
758
870
  const result = {
759
871
  points: PointHelpers_1.Point3dArray.unpackNumbersToNestedArraysIJK(this.coffs, 4, this.numPolesUV(0)),
760
872
  numCartesianDimensions: 3,
873
+ weighStyle: WeightStyle.WeightsAlreadyAppliedToCoordinates,
761
874
  weightStyle: WeightStyle.WeightsAlreadyAppliedToCoordinates,
762
875
  };
763
876
  return result;
764
877
  }
765
- /** Evaluate at a position given by a knot value. */
766
- knotToPoint4d(u, v) {
878
+ /** Evaluate at a position given by a knot value. If deweight fails, returns 000. */
879
+ knotToPoint4d(u, v, result) {
767
880
  this.evaluateBuffersAtKnot(u, v);
768
- return Point4d_1.Point4d.createFromPackedXYZW(this._poleBuffer, 0);
881
+ result = Point4d_1.Point4d.createFromPacked(this._poleBuffer, 0, result);
882
+ return result ? result : Point4d_1.Point4d.createZero();
769
883
  }
770
884
  /** Evaluate at a position given by a knot value. */
771
885
  knotToPointAndDerivatives(u, v, result) {
772
886
  this.evaluateBuffersAtKnot(u, v, 1);
773
887
  return Plane3dByOriginAndVectors_1.Plane3dByOriginAndVectors.createOriginAndVectorsWeightedArrays(this._poleBuffer, this._poleBuffer1UV[0], this._poleBuffer1UV[1], result);
774
888
  }
775
- /** Evaluate the Point4d (leaving weights in the point) at given fractional coordinates. */
776
- fractionToPoint4d(fractionU, fractionV) {
777
- return this.knotToPoint4d(this.knots[0].fractionToKnot(fractionU), this.knots[1].fractionToKnot(fractionV));
889
+ /** Evaluate the Point4d (leaving weights in the point) at given fractional coordinates. If deweight fails, returns 000. */
890
+ fractionToPoint4d(fractionU, fractionV, result) {
891
+ result = this.knotToPoint4d(this.knots[0].fractionToKnot(fractionU), this.knots[1].fractionToKnot(fractionV), result);
892
+ return result ? result : Point4d_1.Point4d.createZero();
778
893
  }
779
894
  /**
780
- * * evaluate the surface and return the cartesian (weight = 1) point.
781
- * * if the surface XYZW point has weight0, returns point3d at 000.
895
+ * Evaluate the surface and return the Cartesian point (weight = 1).
896
+ * * If the surface XYZW point has weight 0, returns 000.
782
897
  * @param fractionU u direction fraction
783
898
  * @param fractionV v direction fraction
784
899
  * @param result optional result
@@ -811,6 +926,14 @@ class BSplineSurface3dH extends BSpline2dNd {
811
926
  const knotV = this.knots[1].fractionToKnot(fractionV);
812
927
  return this.knotToPointAndDerivatives(knotU, knotV, result);
813
928
  }
929
+ /** Implementation of the UVSurface interface; allows `PolyfaceBuilder.addUVGridBody` to facet this B-spline surface. */
930
+ uvFractionToPoint(u, v) {
931
+ return this.fractionToPoint(u, v);
932
+ }
933
+ /** Implementation of the UVSurface interface; allows `PolyfaceBuilder.addUVGridBody` to facet this B-spline surface. */
934
+ uvFractionToPointAndTangents(u, v, result) {
935
+ return this.fractionToPointAndDerivatives(u, v, result);
936
+ }
814
937
  /** test for identical counts and near-equal coordinates */
815
938
  isAlmostEqual(other) {
816
939
  if (other instanceof BSplineSurface3dH) {