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

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 +52 -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
@@ -22,14 +22,19 @@ export var UVSelect;
22
22
  (function (UVSelect) {
23
23
  /** index of u direction */
24
24
  UVSelect[UVSelect["uDirection"] = 0] = "uDirection";
25
- /** index of v direction */
25
+ /**
26
+ * index of v direction
27
+ * @deprecated in 4.x. Use vDirection instead.
28
+ */
26
29
  UVSelect[UVSelect["VDirection"] = 1] = "VDirection";
30
+ /** index of v direction */
31
+ UVSelect[UVSelect["vDirection"] = 1] = "vDirection";
27
32
  })(UVSelect || (UVSelect = {}));
28
33
  /**
29
34
  * Enumeration of how weights are carried
30
35
  * * UnWeighted (0) -- there are no weights
31
- * * WeightsAlreadyAppliedToCoordinates (1) -- for real point (x,y,z) the homogeneous point has weight applied throughout as (wx,wy,wz,w)
32
- * * WeightsSeparateFromCoordinates (2) -- for real point (x,y,z) the homogeneous point is (x,y,z,w)
36
+ * * WeightsAlreadyAppliedToCoordinates (1) -- for real point (x,y,z) the homogeneous point (wx,wy,wx,w) is stored as (wx,wy,wz,w)
37
+ * * WeightsSeparateFromCoordinates (2) -- for real point (x,y,z) the homogeneous point (wx,wy,wx,w) is stored as (x,y,z,w)
33
38
  * * Note that "internal" computations never use WeightsSeparateFromCoordinates.
34
39
  * * WeightsSeparateFromCoordinates is only useful as input or output state in serializer.
35
40
  * @public
@@ -39,13 +44,13 @@ export var WeightStyle;
39
44
  /** There are no weights. */
40
45
  WeightStyle[WeightStyle["UnWeighted"] = 0] = "UnWeighted";
41
46
  /**
42
- * * Data is weighted
43
- * * point with normalized coordinate `[x,y,z]` and weight `w` has weights already multiplied in as `[x*w,y*w,z*w,w]`
47
+ * * Data is weighted.
48
+ * * The point with normalized coordinate `[x,y,z]` and weight `w` is stored as `[x*w,y*w,z*w,w]`
44
49
  * */
45
50
  WeightStyle[WeightStyle["WeightsAlreadyAppliedToCoordinates"] = 1] = "WeightsAlreadyAppliedToCoordinates";
46
51
  /**
47
- * * Data is weighted
48
- * * point with normalized coordinate `[x,y,z]` and weight `w` has is `[x,y,z,w]`
52
+ * * Data is weighted.
53
+ * * The point with normalized coordinate `[x,y,z]` and weight `w` is stored as `[x,y,z,w]`
49
54
  * */
50
55
  WeightStyle[WeightStyle["WeightsSeparateFromCoordinates"] = 2] = "WeightsSeparateFromCoordinates";
51
56
  })(WeightStyle || (WeightStyle = {}));
@@ -76,18 +81,30 @@ export class BSpline2dNd extends GeometryQuery {
76
81
  return false;
77
82
  return true;
78
83
  }
79
- /** Get the Point3d by row and column.
84
+ /** Get the indexed Point3d.
80
85
  * * (IMPORTANT) This assumes this is an xyz surface. Data will be incorrect if this is an xyzw surface.
86
+ * @param i index in [0, numPolesU)
87
+ * @param j index in [0, numPolesV)
81
88
  */
82
89
  getPoint3dPole(i, j, result) {
83
90
  return Point3d.createFromPacked(this.coffs, i + j * this._numPoles[0], result);
84
91
  }
85
- /** Get the Point3d by row and column, projecting the weight away to get to xyz
92
+ /** Get the indexed Point3d, projecting the weight away to get to xyz.
86
93
  * * (IMPORTANT) This assumes this is an xyzw surface. Data will be incorrect if this is an xyz surface.
94
+ * @param i index in [0, numPolesU)
95
+ * @param j index in [0, numPolesV)
87
96
  */
88
97
  getPoint3dPoleXYZW(i, j, result) {
89
98
  return Point3d.createFromPackedXYZW(this.coffs, i + j * this._numPoles[0], result);
90
99
  }
100
+ /** Get the indexed Point4d.
101
+ * * (IMPORTANT) This assumes this is an xyzw surface. Data will be incorrect if this is an xyz surface.
102
+ * @param i index in [0, numPolesU)
103
+ * @param j index in [0, numPolesV)
104
+ */
105
+ getPoint4dPole(i, j, result) {
106
+ return Point4d.createFromPacked(this.coffs, (i + j * this._numPoles[0]) * 4, result);
107
+ }
91
108
  /**
92
109
  * Return 0 for 0 input, 1 for any nonzero input.
93
110
  * @param value numeric value to convert to strict 0 or 1.
@@ -181,6 +198,7 @@ export class BSpline2dNd extends GeometryQuery {
181
198
  * * choice of u or v
182
199
  * * span index
183
200
  * * local fraction within the span.
201
+ * @returns true if and only if output arrays are sufficiently sized
184
202
  */
185
203
  spanFractionsToBasisFunctions(select, spanIndex, spanFraction, f, df) {
186
204
  spanIndex = Geometry.clampToStartEnd(spanIndex, 0, this.numSpanUV(select));
@@ -210,9 +228,15 @@ export class BSpline2dNd extends GeometryQuery {
210
228
  kU += stepV;
211
229
  }
212
230
  }
213
- // cSpell:word sumpole
214
- /** sum derivatives by the weights in the basisBuffer, using poles for given span */
231
+ /**
232
+ * sum poles by the weights in the basisBuffer, using poles for given span
233
+ * @deprecated in 4.x. Use sumPoleBufferDerivativesForSpan instead.
234
+ */
215
235
  sumpoleBufferDerivativesForSpan(spanIndexU, spanIndexV) {
236
+ return this.sumPoleBufferDerivativesForSpan(spanIndexU, spanIndexV);
237
+ }
238
+ /** sum derivatives by the weights in the basisBuffer, using poles for given span */
239
+ sumPoleBufferDerivativesForSpan(spanIndexU, spanIndexV) {
216
240
  const poleBuffer1U = this._poleBuffer1UV[0];
217
241
  const poleBuffer1V = this._poleBuffer1UV[1];
218
242
  poleBuffer1U.fill(0);
@@ -266,7 +290,7 @@ export class BSpline2dNd extends GeometryQuery {
266
290
  this.knots[0].evaluateBasisFunctions1(knotIndex0U, u, this._basisBufferUV[0], this._basisBuffer1UV[0]);
267
291
  this.knots[1].evaluateBasisFunctions1(knotIndex0V, v, this._basisBufferUV[1], this._basisBuffer1UV[1]);
268
292
  this.sumPoleBufferForSpan(poleIndex0U, poleIndex0V);
269
- this.sumpoleBufferDerivativesForSpan(poleIndex0U, poleIndex0V);
293
+ this.sumPoleBufferDerivativesForSpan(poleIndex0U, poleIndex0V);
270
294
  }
271
295
  }
272
296
  // Swap numSwap entries in coffs, starting at i0 and i1 (absolute indices -- not blocks)
@@ -305,31 +329,33 @@ export class BSpline2dNd extends GeometryQuery {
305
329
  this.knots[select].reflectKnots();
306
330
  }
307
331
  /**
308
- * Set the flag indicating the bspline might be suitable for having wrapped "closed" interpretation.
332
+ * Get the flag indicating the surface might be suitable for having wrapped "closed" interpretation.
333
+ */
334
+ getWrappable(select) {
335
+ return this.knots[select].wrappable;
336
+ }
337
+ /**
338
+ * Set the flag indicating the surface might be suitable for having wrapped "closed" interpretation.
309
339
  */
310
340
  setWrappable(select, value) {
311
341
  this.knots[select].wrappable = value;
312
342
  }
313
343
  /**
314
- * 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.
315
- * @param select select U or V direction
316
- * @returns true if coordinates matched.
344
+ * Test if leading and trailing blocks of points match in a given direction.
345
+ * @param data packed array of points in row-major order (numRows x numColumns x dimension numbers)
346
+ * @param numRows number of rows of points in the array
347
+ * @param numColumns number of columns of points in the array (equal to the number of points in each row)
348
+ * @param dimension point dimension (e.g., 2,3,4)
349
+ * @param blockLength number of leading/trailing points to check
350
+ * @param select 0 to test first/last columns of points; 1 to test first/last rows of points
351
+ * @returns true if coordinates matched
317
352
  */
318
- isClosable(select) {
319
- if (this.knots[select].wrappable === BSplineWrapMode.None)
320
- return false;
321
- if (!this.knots[select].testClosable())
322
- return false;
323
- const numU = this.numPolesUV(0);
324
- const numV = this.numPolesUV(1);
325
- const blockSize = this.poleDimension;
326
- const rowToRowStep = numU * blockSize;
327
- const degreeU = this.degreeUV(0);
328
- const degreeV = this.degreeUV(1);
329
- const data = this.coffs;
330
- if (select === 0) {
331
- const numTest = blockSize * degreeU; // degreeU contiguous poles.
332
- for (let row = 0; row < numV; row++) {
353
+ static isWrappedGrid(data, numRows, numColumns, dimension, blockLength, select) {
354
+ const rowToRowStep = numColumns * dimension;
355
+ if (UVSelect.uDirection === select) {
356
+ // Test the contiguous block at the start/end of each row
357
+ const numTest = dimension * blockLength;
358
+ for (let row = 0; row < numRows; row++) {
333
359
  const i0 = row * rowToRowStep;
334
360
  const i1 = i0 + rowToRowStep - numTest;
335
361
  for (let i = 0; i < numTest; i++) {
@@ -339,9 +365,9 @@ export class BSpline2dNd extends GeometryQuery {
339
365
  }
340
366
  }
341
367
  else {
342
- // Test the entire multi-row contiguous block in one loop . ..
343
- const numTest = degreeV * rowToRowStep;
344
- const i1 = blockSize * numU * numV - numTest;
368
+ // Test the entire multi-row contiguous block at the start/end of the array
369
+ const numTest = blockLength * rowToRowStep;
370
+ const i1 = numRows * numColumns * dimension - numTest;
345
371
  for (let i = 0; i < numTest; i++) {
346
372
  if (!Geometry.isSameCoordinate(data[i], data[i1 + i]))
347
373
  return false;
@@ -349,6 +375,43 @@ export class BSpline2dNd extends GeometryQuery {
349
375
  }
350
376
  return true;
351
377
  }
378
+ /**
379
+ * 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.
380
+ * @param select select U or V direction
381
+ * @returns true if coordinates matched.
382
+ */
383
+ testClosableGrid(select, mode) {
384
+ if (mode === undefined)
385
+ mode = this.knots[select].wrappable;
386
+ if (mode === BSplineWrapMode.OpenByAddingControlPoints) // the last degree poles equal the first degree poles
387
+ return BSpline2dNd.isWrappedGrid(this.coffs, this.numPolesUV(UVSelect.vDirection), this.numPolesUV(UVSelect.uDirection), this.poleDimension, this.degreeUV(select), select);
388
+ if (mode === BSplineWrapMode.OpenByRemovingKnots) // the last pole equals the first pole
389
+ return BSpline2dNd.isWrappedGrid(this.coffs, this.numPolesUV(UVSelect.vDirection), this.numPolesUV(UVSelect.uDirection), this.poleDimension, 1, select);
390
+ return false;
391
+ }
392
+ /**
393
+ * Test knots and control points to determine if it is possible to close (aka "wrap") the surface in the selected parametric direction.
394
+ * @param select select U or V direction
395
+ * @return whether the surface can be wrapped in the given parametric direction.
396
+ */
397
+ isClosable(select) {
398
+ return BSplineWrapMode.None !== this.isClosableSurface(select);
399
+ }
400
+ /**
401
+ * Test knots and control points to determine if it is possible to close (aka "wrap") the surface in the selected parametric direction.
402
+ * @param select select U or V direction
403
+ * @return the manner of closing. See `BSplineWrapMode` for particulars of each mode.
404
+ */
405
+ isClosableSurface(select) {
406
+ const mode = this.knots[select].wrappable;
407
+ if (mode === BSplineWrapMode.None)
408
+ return BSplineWrapMode.None;
409
+ if (!this.knots[select].testClosable(mode))
410
+ return BSplineWrapMode.None;
411
+ if (!this.testClosableGrid(select, mode))
412
+ return BSplineWrapMode.None;
413
+ return mode;
414
+ }
352
415
  }
353
416
  /** BSplineSurface3d is a parametric surface in xyz space.
354
417
  * * This (BSplineSurface3d) is an unweighted surface. Use the separate class BSplineSurface3dH for a weighted surface.
@@ -389,7 +452,8 @@ export class BSplineSurface3d extends BSpline2dNd {
389
452
  getPointGridJSON() {
390
453
  const result = {
391
454
  points: Point3dArray.unpackNumbersToNestedArraysIJK(this.coffs, 3, this.numPolesUV(0)),
392
- weighStyle: WeightStyle.UnWeighted,
455
+ weighStyle: WeightStyle.WeightsAlreadyAppliedToCoordinates,
456
+ weightStyle: WeightStyle.UnWeighted,
393
457
  numCartesianDimensions: 3,
394
458
  };
395
459
  return result;
@@ -401,23 +465,24 @@ export class BSplineSurface3d extends BSpline2dNd {
401
465
  * in classic over-clamped manner
402
466
  */
403
467
  copyKnots(select, includeExtraEndKnot) { return this.knots[select].copyKnots(includeExtraEndKnot); }
404
- /** Create a bspline surface.
468
+ /**
469
+ * Create a bspline surface.
405
470
  * * This `create` variant takes control points in a "flattened" array, with
406
471
  * points from succeeding U rows packed together in one array. Use `createGrid` if the points are in
407
472
  * a row-by-row grid structure
408
473
  * * knotArrayU and knotArrayV are optional -- uniform knots are implied if they are omitted (undefined).
409
- * * When knots are given, two knot count conditions are recognized:
410
- * * + If poleArray.length + order == knotArray.length, the first and last are assumed to be the
474
+ * * When knots are given, two knot count conditions are recognized:
475
+ * * If poleArray.length + order == knotArray.length, the first and last are assumed to be the
411
476
  * extraneous knots of classic clamping.
412
- * * + If poleArray.length + order == knotArray.length + 2, the knots are in modern form that does not have
477
+ * * If poleArray.length + order == knotArray.length + 2, the knots are in modern form that does not have
413
478
  * the classic unused first and last knot.
414
479
  * @param controlPointArray Array of points, ordered along the U direction.
415
- * @param numPoleU number of poles in each row in the U direction.
480
+ * @param numPoleU number of poles in each row
416
481
  * @param orderU order for the U direction polynomial (`order` is one more than the `degree`. "cubic" polynomial is order 4.)
417
- * @param KnotArrayU knots for the V direction. See note above about knot counts.
418
- * @param numPoleV number of poles in each row in the U direction.
482
+ * @param knotArrayU knots for the V direction. See note above about knot counts.
483
+ * @param numPoleV number of rows of poles
419
484
  * @param orderV order for the V direction polynomial (`order` is one more than the `degree`. "cubic" polynomial is order 4.)
420
- * @param KnotArrayV knots for the V direction. See note above about knot counts.
485
+ * @param knotArrayV knots for the V direction. See note above about knot counts.
421
486
  */
422
487
  static create(controlPointArray, numPolesU, orderU, knotArrayU, numPolesV, orderV, knotArrayV) {
423
488
  let numPoles = controlPointArray.length;
@@ -454,40 +519,41 @@ export class BSplineSurface3d extends BSpline2dNd {
454
519
  const surface = new BSplineSurface3d(numPolesU, numPolesV, knotsU, knotsV, coffs);
455
520
  return surface;
456
521
  }
457
- /** Create a bspline surface.
522
+ /**
523
+ * Create a bspline surface.
458
524
  * * This `create` variant takes control points in a "grid" array, with the points from
459
- * each grid row `[rowIndex]` being an independent array `points[rowIndex][indexAlongRow][x,y,z]`
525
+ * each grid row `[rowIndex]` being an independent array `points[rowIndex][indexAlongRow][x,y,z]`
460
526
  * * knotArrayU and knotArrayV are optional -- uniform knots are implied if they are omitted (undefined).
461
- * * When knots are given, two knot count conditions are recognized:
462
- * * + If poleArray.length + order == knotArray.length, the first and last are assumed to be the
527
+ * * When knots are given, two knot count conditions are recognized in each direction:
528
+ * * If poleArray.length + order == knotArray.length, the first and last are assumed to be the
463
529
  * extraneous knots of classic clamping.
464
- * * + If poleArray.length + order == knotArray.length + 2, the knots are in modern form that does not have
530
+ * * If poleArray.length + order == knotArray.length + 2, the knots are in modern form that does not have
465
531
  * the classic unused first and last knot.
466
- * @param controlPointArray Array of points, ordered along the U direction.
467
- * @param numPoleU number of poles in each row in the U direction.
532
+ * @param points Array of points, ordered along the U direction.
468
533
  * @param orderU order for the U direction polynomial (`order` is one more than the `degree`. "cubic" polynomial is order 4.)
469
- * @param KnotArrayU knots for the V direction. See note above about knot counts.
470
- * @param numPoleV number of poles in each row in the U direction.
534
+ * @param knotArrayU knots for the V direction. See note above about knot counts.
471
535
  * @param orderV order for the V direction polynomial (`order` is one more than the `degree`. "cubic" polynomial is order 4.)
472
- * @param KnotArrayV knots for the V direction. See note above about knot counts.
536
+ * @param knotArrayV knots for the V direction. See note above about knot counts.
473
537
  */
474
538
  static createGrid(points, orderU, knotArrayU, orderV, knotArrayV) {
475
539
  const numPolesV = points.length;
476
540
  const numPolesU = points[0].length;
477
541
  const numPoles = numPolesU * numPolesV;
542
+ if (3 !== points[0][0].length)
543
+ return undefined;
544
+ if (!this.validOrderAndPoleCounts(orderU, numPolesU, orderV, numPolesV, numPoles))
545
+ return undefined;
478
546
  // shift knots-of-interest limits for overclamped case ...
479
547
  const numKnotsU = knotArrayU ? knotArrayU.length : numPolesU + orderU - 2;
480
548
  const numKnotsV = knotArrayV ? knotArrayV.length : numPolesV + orderV - 2;
481
549
  const skipFirstAndLastU = (numPolesU + orderU === numKnotsU);
482
550
  const skipFirstAndLastV = (numPolesV + orderV === numKnotsV);
483
- if (!this.validOrderAndPoleCounts(orderU, numPolesU, orderV, numPolesV, numPoles))
484
- return undefined;
485
551
  const knotsU = knotArrayU ?
486
552
  KnotVector.create(knotArrayU, orderU - 1, skipFirstAndLastU) :
487
553
  KnotVector.createUniformClamped(numPolesU, orderU - 1, 0.0, 1.0);
488
554
  const knotsV = knotArrayV ?
489
555
  KnotVector.create(knotArrayV, orderV - 1, skipFirstAndLastV) :
490
- KnotVector.createUniformClamped(numPolesU, orderU - 1, 0.0, 1.0);
556
+ KnotVector.createUniformClamped(numPolesV, orderV - 1, 0.0, 1.0);
491
557
  const coffs = new Float64Array(3 * numPolesU * numPolesV);
492
558
  let i = 0;
493
559
  for (const row of points) {
@@ -497,8 +563,7 @@ export class BSplineSurface3d extends BSpline2dNd {
497
563
  coffs[i++] = xyz[2];
498
564
  }
499
565
  }
500
- const surface = new BSplineSurface3d(numPolesU, numPolesV, knotsU, knotsV, coffs);
501
- return surface;
566
+ return new BSplineSurface3d(numPolesU, numPolesV, knotsU, knotsV, coffs);
502
567
  }
503
568
  /**
504
569
  * Return a complete copy of the bspline surface.
@@ -553,6 +618,14 @@ export class BSplineSurface3d extends BSpline2dNd {
553
618
  const knotV = this.knots[1].fractionToKnot(fractionV);
554
619
  return this.knotToPointAndDerivatives(knotU, knotV, result);
555
620
  }
621
+ /** Implementation of the UVSurface interface; allows `PolyfaceBuilder.addUVGridBody` to facet this B-spline surface. */
622
+ uvFractionToPoint(u, v) {
623
+ return this.fractionToPoint(u, v);
624
+ }
625
+ /** Implementation of the UVSurface interface; allows `PolyfaceBuilder.addUVGridBody` to facet this B-spline surface. */
626
+ uvFractionToPointAndTangents(u, v, result) {
627
+ return this.fractionToPointAndDerivatives(u, v, result);
628
+ }
556
629
  /** test for identical counts and near-equal coordinates */
557
630
  isAlmostEqual(other) {
558
631
  if (other instanceof BSplineSurface3d) {
@@ -595,13 +668,20 @@ export class BSplineSurface3dH extends BSpline2dNd {
595
668
  constructor(numPolesU, numPolesV, knotsU, knotsV, coffs) {
596
669
  super(numPolesU, numPolesV, 4, knotsU, knotsV, coffs);
597
670
  }
598
- /** Return a simple array of the control points. */
671
+ /** Unpack the control points to a Point4d array of form [wx,wy,wz,w]. */
599
672
  copyPoints4d() { return Point4dArray.unpackToPoint4dArray(this.coffs); }
600
- /** Return a simple array of the control points. */
673
+ /**
674
+ * Unpack the control points to a Point3d array and an array of weights.
675
+ * @param points output xyz, weighted by default formatter
676
+ * @param weights output weights
677
+ * @param formatter optional xyz formatter. By default, returns a Point3d of form [wx,wy,wz].
678
+ */
601
679
  copyPointsAndWeights(points, weights, formatter = (x, y, z) => Point3d.create(x, y, z)) {
602
680
  Point4dArray.unpackFloat64ArrayToPointsAndWeights(this.coffs, points, weights, formatter);
603
681
  }
604
- /** unpack from xyzw xyzw ... to packed xyz, optionally unweighted
682
+ /**
683
+ * Copy the control points to a packed 3D array.
684
+ * @param unweight if true, output array has form x,y,z; if false, output array has form wx,wy,wz.
605
685
  */
606
686
  copyXYZToFloat64Array(unweight) {
607
687
  const numPoints = Math.floor(this.coffs.length / 4);
@@ -623,7 +703,7 @@ export class BSplineSurface3dH extends BSpline2dNd {
623
703
  }
624
704
  return result;
625
705
  }
626
- /** unpack from xyzw xyzw ... to packed xyz, optionally unweighted
706
+ /** unpack from xyzw xyzw ... to packed weights
627
707
  */
628
708
  copyWeightsToFloat64Array() {
629
709
  const numPoints = Math.floor(this.coffs.length / 4);
@@ -640,24 +720,23 @@ export class BSplineSurface3dH extends BSpline2dNd {
640
720
  * in classic over-clamped manner
641
721
  */
642
722
  copyKnots(select, includeExtraEndKnot) { return this.knots[select].copyKnots(includeExtraEndKnot); }
643
- /** 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.
644
- * * This `create` variant takes control points in a "flattened" array, with
645
- * points from succeeding U rows packed together in one array. Use `createGrid` if the points are in
646
- * a deeper grid array structure.
723
+ /**
724
+ * Create a weighted bspline surface, with control points and weights each organized as flattened arrays continuing from one U row to the next.
725
+ * * Use `createGrid` if the control points are in a deeper grid array structure.
647
726
  * * knotArrayU and knotArrayV are optional -- uniform knots are implied if they are omitted (undefined).
648
- * * When knots are given, two knot count conditions are recognized:
649
- * * * If poleArray.length + order == knotArray.length, the first and last are assumed to be the
727
+ * * When knots are given, two knot count conditions are recognized:
728
+ * * If poleArray.length + order == knotArray.length, the first and last are assumed to be the
650
729
  * extraneous knots of classic clamping.
651
- * * * If poleArray.length + order == knotArray.length + 2, the knots are in modern form that does not have
730
+ * * If poleArray.length + order == knotArray.length + 2, the knots are in modern form that does not have
652
731
  * the classic unused first and last knot.
653
- * @param controlPointArray Array of points, ordered along the U direction.
654
- * @param weightArray array of weights, ordered along the U direction.
655
- * @param numPoleU number of poles in each row in the U direction.
732
+ * @param controlPointArray Array of [wx,wy,wz] points, ordered along the U direction.
733
+ * @param weightArray array of weights, ordered along the U direction. If undefined, unit weights are installed.
734
+ * @param numPolesU number of poles in each row in the U direction.
656
735
  * @param orderU order for the U direction polynomial (`order` is one more than the `degree`. "cubic" polynomial is order 4.)
657
- * @param KnotArrayU optional knots for the V direction. See note above about knot counts.
658
- * @param numPoleV number of poles in each row in the U direction.
736
+ * @param knotArrayU optional knots for the V direction. See note above about knot counts.
737
+ * @param numPolesV number of poles in each column in the V direction (the number of rows).
659
738
  * @param orderV order for the V direction polynomial (`order` is one more than the `degree`. "cubic" polynomial is order 4.)
660
- * @param KnotArrayV optional knots for the V direction. See note above about knot counts.
739
+ * @param knotArrayV optional knots for the V direction. See note above about knot counts.
661
740
  */
662
741
  static create(controlPointArray, weightArray, numPolesU, orderU, knotArrayU, numPolesV, orderV, knotArrayV) {
663
742
  const numPoles = numPolesU * numPolesV;
@@ -673,62 +752,95 @@ export class BSplineSurface3dH extends BSpline2dNd {
673
752
  const knotsV = knotArrayV ?
674
753
  KnotVector.create(knotArrayV, orderV - 1, skipFirstAndLastV) :
675
754
  KnotVector.createUniformClamped(numPolesV, orderV - 1, 0.0, 1.0);
755
+ if (undefined === weightArray)
756
+ weightArray = Array(numPoles).fill(1.0); // unit weights
676
757
  const coffs = Point4dArray.packPointsAndWeightsToFloat64Array(controlPointArray, weightArray);
677
758
  if (coffs === undefined || coffs.length !== 4 * numPolesU * numPolesV)
678
759
  return undefined;
679
760
  const surface = new BSplineSurface3dH(numPolesU, numPolesV, knotsU, knotsV, coffs);
680
761
  return surface;
681
762
  }
682
- /** Create a bspline with given knots.
683
- *
684
- * Two count conditions are recognized in each direction:
685
- *
686
- * ** If poleArray.length + order == knotArray.length, the first and last are assumed to be the
763
+ /**
764
+ * Create a bspline surface with given knots.
765
+ * * This `create` variant takes control points in a "grid" array, with the points from
766
+ * each grid row `[rowIndex]` being an independent array `points[rowIndex][indexAlongRow][x,y,z,w]`
767
+ * * knotArrayU and knotArrayV are optional -- uniform knots are implied if they are omitted (undefined).
768
+ * * When knots are given, two count conditions are recognized in each direction:
769
+ * * If poleArray.length + order == knotArray.length, the first and last are assumed to be the
687
770
  * extraneous knots of classic clamping.
688
- * ** If poleArray.length + order == knotArray.length + 2, the knots are in modern form.
689
- *
771
+ * * If poleArray.length + order == knotArray.length + 2, the knots are in modern form that does not have
772
+ * the classic unused first and last knot.
773
+ * @param xyzwGrid Array of points, ordered along the U direction.
774
+ * @param weightStyle how the points are weighted
775
+ * @param orderU order for the U direction polynomial (`order` is one more than the `degree`. "cubic" polynomial is order 4.)
776
+ * @param knotArrayU knots for the V direction. See note above about knot counts.
777
+ * @param orderV order for the V direction polynomial (`order` is one more than the `degree`. "cubic" polynomial is order 4.)
778
+ * @param knotArrayV knots for the V direction. See note above about knot counts.
690
779
  */
691
780
  static createGrid(xyzwGrid, weightStyle, orderU, knotArrayU, orderV, knotArrayV) {
692
781
  const numPolesV = xyzwGrid.length;
693
782
  const numPolesU = xyzwGrid[0].length;
694
783
  const numPoles = numPolesU * numPolesV;
784
+ if (4 !== xyzwGrid[0][0].length)
785
+ return undefined;
695
786
  if (!this.validOrderAndPoleCounts(orderU, numPolesU, orderV, numPolesV, numPoles))
696
787
  return undefined;
697
- // const numPoles = numPolesU * numPolesV;
698
- // shift knots-of-interest limits for overclamped case ...
699
- const numKnotsU = knotArrayU.length;
700
- const numKnotsV = knotArrayV.length;
701
- const skipFirstAndLastU = (numPolesU + orderU === numKnotsU);
702
- const skipFirstAndLastV = (numPolesV + orderV === numKnotsV);
703
- const knotsU = KnotVector.create(knotArrayU, orderU - 1, skipFirstAndLastU);
704
- const knotsV = KnotVector.create(knotArrayV, orderV - 1, skipFirstAndLastV);
788
+ // validate knot counts
789
+ const numKnotsU = knotArrayU ? knotArrayU.length : numPolesU + orderU - 2;
790
+ const numKnotsV = knotArrayV ? knotArrayV.length : numPolesV + orderV - 2;
791
+ const skipFirstAndLastU = (numPolesU + orderU === numKnotsU); // classic over-clamped input knots
792
+ if (!skipFirstAndLastU && numPolesU + orderU !== numKnotsU + 2) // modern knots
793
+ return undefined;
794
+ const skipFirstAndLastV = (numPolesV + orderV === numKnotsV); // classic
795
+ if (!skipFirstAndLastV && numPolesV + orderV !== numKnotsV + 2) // modern
796
+ return undefined;
797
+ const knotsU = knotArrayU ?
798
+ KnotVector.create(knotArrayU, orderU - 1, skipFirstAndLastU) :
799
+ KnotVector.createUniformClamped(numPolesU, orderU - 1, 0.0, 1.0);
800
+ const knotsV = knotArrayV ?
801
+ KnotVector.create(knotArrayV, orderV - 1, skipFirstAndLastV) :
802
+ KnotVector.createUniformClamped(numPolesV, orderV - 1, 0.0, 1.0);
705
803
  const coffs = new Float64Array(4 * numPoles);
706
- if (weightStyle === WeightStyle.WeightsSeparateFromCoordinates) {
707
- let i = 0;
708
- for (const row of xyzwGrid) {
709
- for (const point of row) {
710
- const w = point[3];
711
- coffs[i++] = point[0] * w;
712
- coffs[i++] = point[1] * w;
713
- coffs[i++] = point[2] * w;
714
- coffs[i++] = point[3];
804
+ let i = 0;
805
+ switch (weightStyle) {
806
+ case WeightStyle.WeightsSeparateFromCoordinates: {
807
+ for (const row of xyzwGrid) {
808
+ for (const point of row) {
809
+ const w = point[3];
810
+ coffs[i++] = point[0] * w;
811
+ coffs[i++] = point[1] * w;
812
+ coffs[i++] = point[2] * w;
813
+ coffs[i++] = point[3];
814
+ }
715
815
  }
816
+ break;
716
817
  }
717
- }
718
- else {
719
- // implicit WeightStyle.WeightsAlreadyAppliedToCoordinates
720
- let i = 0;
721
- for (const row of xyzwGrid) {
722
- for (const point of row) {
723
- coffs[i++] = point[0];
724
- coffs[i++] = point[1];
725
- coffs[i++] = point[2];
726
- coffs[i++] = point[3];
818
+ case WeightStyle.WeightsAlreadyAppliedToCoordinates: {
819
+ for (const row of xyzwGrid) {
820
+ for (const point of row) {
821
+ coffs[i++] = point[0];
822
+ coffs[i++] = point[1];
823
+ coffs[i++] = point[2];
824
+ coffs[i++] = point[3];
825
+ }
826
+ }
827
+ break;
828
+ }
829
+ case WeightStyle.UnWeighted: {
830
+ for (const row of xyzwGrid) {
831
+ for (const point of row) {
832
+ coffs[i++] = point[0];
833
+ coffs[i++] = point[1];
834
+ coffs[i++] = point[2];
835
+ coffs[i++] = 1.0;
836
+ }
727
837
  }
838
+ break;
728
839
  }
840
+ default:
841
+ return undefined; // unrecognized WeightStyle
729
842
  }
730
- const surface = new BSplineSurface3dH(numPolesU, numPolesV, knotsU, knotsV, coffs);
731
- return surface;
843
+ return new BSplineSurface3dH(numPolesU, numPolesV, knotsU, knotsV, coffs);
732
844
  }
733
845
  /** Return a deep clone */
734
846
  clone() {
@@ -753,27 +865,30 @@ export class BSplineSurface3dH extends BSpline2dNd {
753
865
  const result = {
754
866
  points: Point3dArray.unpackNumbersToNestedArraysIJK(this.coffs, 4, this.numPolesUV(0)),
755
867
  numCartesianDimensions: 3,
868
+ weighStyle: WeightStyle.WeightsAlreadyAppliedToCoordinates,
756
869
  weightStyle: WeightStyle.WeightsAlreadyAppliedToCoordinates,
757
870
  };
758
871
  return result;
759
872
  }
760
- /** Evaluate at a position given by a knot value. */
761
- knotToPoint4d(u, v) {
873
+ /** Evaluate at a position given by a knot value. If deweight fails, returns 000. */
874
+ knotToPoint4d(u, v, result) {
762
875
  this.evaluateBuffersAtKnot(u, v);
763
- return Point4d.createFromPackedXYZW(this._poleBuffer, 0);
876
+ result = Point4d.createFromPacked(this._poleBuffer, 0, result);
877
+ return result ? result : Point4d.createZero();
764
878
  }
765
879
  /** Evaluate at a position given by a knot value. */
766
880
  knotToPointAndDerivatives(u, v, result) {
767
881
  this.evaluateBuffersAtKnot(u, v, 1);
768
882
  return Plane3dByOriginAndVectors.createOriginAndVectorsWeightedArrays(this._poleBuffer, this._poleBuffer1UV[0], this._poleBuffer1UV[1], result);
769
883
  }
770
- /** Evaluate the Point4d (leaving weights in the point) at given fractional coordinates. */
771
- fractionToPoint4d(fractionU, fractionV) {
772
- return this.knotToPoint4d(this.knots[0].fractionToKnot(fractionU), this.knots[1].fractionToKnot(fractionV));
884
+ /** Evaluate the Point4d (leaving weights in the point) at given fractional coordinates. If deweight fails, returns 000. */
885
+ fractionToPoint4d(fractionU, fractionV, result) {
886
+ result = this.knotToPoint4d(this.knots[0].fractionToKnot(fractionU), this.knots[1].fractionToKnot(fractionV), result);
887
+ return result ? result : Point4d.createZero();
773
888
  }
774
889
  /**
775
- * * evaluate the surface and return the cartesian (weight = 1) point.
776
- * * if the surface XYZW point has weight0, returns point3d at 000.
890
+ * Evaluate the surface and return the Cartesian point (weight = 1).
891
+ * * If the surface XYZW point has weight 0, returns 000.
777
892
  * @param fractionU u direction fraction
778
893
  * @param fractionV v direction fraction
779
894
  * @param result optional result
@@ -806,6 +921,14 @@ export class BSplineSurface3dH extends BSpline2dNd {
806
921
  const knotV = this.knots[1].fractionToKnot(fractionV);
807
922
  return this.knotToPointAndDerivatives(knotU, knotV, result);
808
923
  }
924
+ /** Implementation of the UVSurface interface; allows `PolyfaceBuilder.addUVGridBody` to facet this B-spline surface. */
925
+ uvFractionToPoint(u, v) {
926
+ return this.fractionToPoint(u, v);
927
+ }
928
+ /** Implementation of the UVSurface interface; allows `PolyfaceBuilder.addUVGridBody` to facet this B-spline surface. */
929
+ uvFractionToPointAndTangents(u, v, result) {
930
+ return this.fractionToPointAndDerivatives(u, v, result);
931
+ }
809
932
  /** test for identical counts and near-equal coordinates */
810
933
  isAlmostEqual(other) {
811
934
  if (other instanceof BSplineSurface3dH) {