@math.gl/geometry 5.0.0-alpha.9 → 5.0.0-beta.10

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 (457) hide show
  1. package/LICENSE +97 -49
  2. package/README.md +77 -1
  3. package/THIRD-PARTY-NOTICES.md +18 -0
  4. package/dist/color/color-lut-types.d.ts +16 -0
  5. package/dist/color/color-lut-types.d.ts.map +1 -0
  6. package/dist/color/color-lut-types.js +5 -0
  7. package/dist/color/color-lut-types.js.map +1 -0
  8. package/dist/color/index.cjs +132 -0
  9. package/dist/color/index.cjs.map +6 -0
  10. package/dist/color/index.d.ts +4 -0
  11. package/dist/color/index.d.ts.map +1 -0
  12. package/dist/color/index.js +5 -0
  13. package/dist/color/index.js.map +1 -0
  14. package/dist/color/sample-lut.d.ts +13 -0
  15. package/dist/color/sample-lut.d.ts.map +1 -0
  16. package/dist/color/sample-lut.js +132 -0
  17. package/dist/color/sample-lut.js.map +1 -0
  18. package/dist/culling/bounds.d.ts +20 -0
  19. package/dist/culling/bounds.d.ts.map +1 -0
  20. package/dist/culling/bounds.js +121 -0
  21. package/dist/culling/bounds.js.map +1 -0
  22. package/dist/culling/constants.d.ts +3 -0
  23. package/dist/culling/constants.d.ts.map +1 -0
  24. package/dist/culling/constants.js +5 -0
  25. package/dist/culling/constants.js.map +1 -0
  26. package/dist/culling/frustum-planes.d.ts +5 -0
  27. package/dist/culling/frustum-planes.d.ts.map +1 -0
  28. package/dist/culling/frustum-planes.js +37 -0
  29. package/dist/culling/frustum-planes.js.map +1 -0
  30. package/dist/culling/geometric-queries.d.ts +34 -0
  31. package/dist/culling/geometric-queries.d.ts.map +1 -0
  32. package/dist/culling/geometric-queries.js +208 -0
  33. package/dist/culling/geometric-queries.js.map +1 -0
  34. package/dist/culling/index.cjs +2560 -0
  35. package/dist/culling/index.cjs.map +6 -0
  36. package/dist/culling/index.d.ts +37 -0
  37. package/dist/culling/index.d.ts.map +1 -0
  38. package/dist/culling/index.js +29 -0
  39. package/dist/culling/index.js.map +1 -0
  40. package/dist/culling/lib/algorithms/bounding-box-from-points.d.ts +15 -0
  41. package/dist/culling/lib/algorithms/bounding-box-from-points.d.ts.map +1 -0
  42. package/dist/culling/lib/algorithms/bounding-box-from-points.js +137 -0
  43. package/dist/culling/lib/algorithms/bounding-box-from-points.js.map +1 -0
  44. package/dist/culling/lib/algorithms/bounding-sphere-from-points.d.ts +14 -0
  45. package/dist/culling/lib/algorithms/bounding-sphere-from-points.d.ts.map +1 -0
  46. package/dist/culling/lib/algorithms/bounding-sphere-from-points.js +146 -0
  47. package/dist/culling/lib/algorithms/bounding-sphere-from-points.js.map +1 -0
  48. package/dist/culling/lib/algorithms/compute-eigen-decomposition.d.ts +37 -0
  49. package/dist/culling/lib/algorithms/compute-eigen-decomposition.d.ts.map +1 -0
  50. package/dist/culling/lib/algorithms/compute-eigen-decomposition.js +137 -0
  51. package/dist/culling/lib/algorithms/compute-eigen-decomposition.js.map +1 -0
  52. package/dist/culling/lib/algorithms/oriented-bounding-box-quaternion.d.ts +7 -0
  53. package/dist/culling/lib/algorithms/oriented-bounding-box-quaternion.d.ts.map +1 -0
  54. package/dist/culling/lib/algorithms/oriented-bounding-box-quaternion.js +26 -0
  55. package/dist/culling/lib/algorithms/oriented-bounding-box-quaternion.js.map +1 -0
  56. package/dist/culling/lib/bounding-volumes/axis-aligned-bounding-box.d.ts +56 -0
  57. package/dist/culling/lib/bounding-volumes/axis-aligned-bounding-box.d.ts.map +1 -0
  58. package/dist/culling/lib/bounding-volumes/axis-aligned-bounding-box.js +133 -0
  59. package/dist/culling/lib/bounding-volumes/axis-aligned-bounding-box.js.map +1 -0
  60. package/dist/culling/lib/bounding-volumes/bounding-sphere.d.ts +40 -0
  61. package/dist/culling/lib/bounding-volumes/bounding-sphere.d.ts.map +1 -0
  62. package/dist/culling/lib/bounding-volumes/bounding-sphere.js +123 -0
  63. package/dist/culling/lib/bounding-volumes/bounding-sphere.js.map +1 -0
  64. package/dist/culling/lib/bounding-volumes/bounding-volume.d.ts +30 -0
  65. package/dist/culling/lib/bounding-volumes/bounding-volume.d.ts.map +1 -0
  66. package/dist/culling/lib/bounding-volumes/bounding-volume.js +7 -0
  67. package/dist/culling/lib/bounding-volumes/bounding-volume.js.map +1 -0
  68. package/dist/culling/lib/bounding-volumes/oriented-bounding-box.d.ts +62 -0
  69. package/dist/culling/lib/bounding-volumes/oriented-bounding-box.d.ts.map +1 -0
  70. package/dist/culling/lib/bounding-volumes/oriented-bounding-box.js +230 -0
  71. package/dist/culling/lib/bounding-volumes/oriented-bounding-box.js.map +1 -0
  72. package/dist/culling/lib/culling-volume.d.ts +49 -0
  73. package/dist/culling/lib/culling-volume.d.ts.map +1 -0
  74. package/dist/culling/lib/culling-volume.js +133 -0
  75. package/dist/culling/lib/culling-volume.js.map +1 -0
  76. package/dist/culling/lib/perspective-frustum.d.ts +153 -0
  77. package/dist/culling/lib/perspective-frustum.d.ts.map +1 -0
  78. package/dist/culling/lib/perspective-frustum.js +191 -0
  79. package/dist/culling/lib/perspective-frustum.js.map +1 -0
  80. package/dist/culling/lib/perspective-off-center-frustum.d.ts +158 -0
  81. package/dist/culling/lib/perspective-off-center-frustum.d.ts.map +1 -0
  82. package/dist/culling/lib/perspective-off-center-frustum.js +276 -0
  83. package/dist/culling/lib/perspective-off-center-frustum.js.map +1 -0
  84. package/dist/culling/lib/plane.d.ts +35 -0
  85. package/dist/culling/lib/plane.d.ts.map +1 -0
  86. package/dist/culling/lib/plane.js +90 -0
  87. package/dist/culling/lib/plane.js.map +1 -0
  88. package/dist/culling/lib/ray.d.ts +18 -0
  89. package/dist/culling/lib/ray.d.ts.map +1 -0
  90. package/dist/culling/lib/ray.js +51 -0
  91. package/dist/culling/lib/ray.js.map +1 -0
  92. package/dist/culling/lib/shapes/box-shape.d.ts +19 -0
  93. package/dist/culling/lib/shapes/box-shape.d.ts.map +1 -0
  94. package/dist/culling/lib/shapes/box-shape.js +69 -0
  95. package/dist/culling/lib/shapes/box-shape.js.map +1 -0
  96. package/dist/culling/lib/shapes/capsule-shape.d.ts +23 -0
  97. package/dist/culling/lib/shapes/capsule-shape.d.ts.map +1 -0
  98. package/dist/culling/lib/shapes/capsule-shape.js +151 -0
  99. package/dist/culling/lib/shapes/capsule-shape.js.map +1 -0
  100. package/dist/culling/lib/shapes/cylinder-shape.d.ts +22 -0
  101. package/dist/culling/lib/shapes/cylinder-shape.d.ts.map +1 -0
  102. package/dist/culling/lib/shapes/cylinder-shape.js +99 -0
  103. package/dist/culling/lib/shapes/cylinder-shape.js.map +1 -0
  104. package/dist/culling/lib/shapes/implicit-shape.d.ts +56 -0
  105. package/dist/culling/lib/shapes/implicit-shape.d.ts.map +1 -0
  106. package/dist/culling/lib/shapes/implicit-shape.js +142 -0
  107. package/dist/culling/lib/shapes/implicit-shape.js.map +1 -0
  108. package/dist/culling/lib/shapes/plane-shape.d.ts +27 -0
  109. package/dist/culling/lib/shapes/plane-shape.d.ts.map +1 -0
  110. package/dist/culling/lib/shapes/plane-shape.js +71 -0
  111. package/dist/culling/lib/shapes/plane-shape.js.map +1 -0
  112. package/dist/culling/lib/shapes/sphere-shape.d.ts +18 -0
  113. package/dist/culling/lib/shapes/sphere-shape.d.ts.map +1 -0
  114. package/dist/culling/lib/shapes/sphere-shape.js +43 -0
  115. package/dist/culling/lib/shapes/sphere-shape.js.map +1 -0
  116. package/dist/culling/oriented-box-2d.d.ts +22 -0
  117. package/dist/culling/oriented-box-2d.d.ts.map +1 -0
  118. package/dist/culling/oriented-box-2d.js +86 -0
  119. package/dist/culling/oriented-box-2d.js.map +1 -0
  120. package/dist/culling/queries.d.ts +44 -0
  121. package/dist/culling/queries.d.ts.map +1 -0
  122. package/dist/culling/queries.js +259 -0
  123. package/dist/culling/queries.js.map +1 -0
  124. package/dist/culling/screen-ray.d.ts +22 -0
  125. package/dist/culling/screen-ray.d.ts.map +1 -0
  126. package/dist/culling/screen-ray.js +55 -0
  127. package/dist/culling/screen-ray.js.map +1 -0
  128. package/dist/curves/adaptive-sampling.d.ts +16 -0
  129. package/dist/curves/adaptive-sampling.d.ts.map +1 -0
  130. package/dist/curves/adaptive-sampling.js +59 -0
  131. package/dist/curves/adaptive-sampling.js.map +1 -0
  132. package/dist/curves/bezier-curves.d.ts +18 -0
  133. package/dist/curves/bezier-curves.d.ts.map +1 -0
  134. package/dist/curves/bezier-curves.js +54 -0
  135. package/dist/curves/bezier-curves.js.map +1 -0
  136. package/dist/curves/catmull-rom-curve.d.ts +15 -0
  137. package/dist/curves/catmull-rom-curve.d.ts.map +1 -0
  138. package/dist/curves/catmull-rom-curve.js +77 -0
  139. package/dist/curves/catmull-rom-curve.js.map +1 -0
  140. package/dist/curves/curve-arc-length.d.ts +17 -0
  141. package/dist/curves/curve-arc-length.d.ts.map +1 -0
  142. package/dist/curves/curve-arc-length.js +58 -0
  143. package/dist/curves/curve-arc-length.js.map +1 -0
  144. package/dist/curves/curve.d.ts +23 -0
  145. package/dist/curves/curve.d.ts.map +1 -0
  146. package/dist/curves/curve.js +77 -0
  147. package/dist/curves/curve.js.map +1 -0
  148. package/dist/curves/hermite-curve.d.ts +9 -0
  149. package/dist/curves/hermite-curve.d.ts.map +1 -0
  150. package/dist/curves/hermite-curve.js +24 -0
  151. package/dist/curves/hermite-curve.js.map +1 -0
  152. package/dist/curves/index.d.ts +12 -0
  153. package/dist/curves/index.d.ts.map +1 -0
  154. package/dist/curves/index.js +11 -0
  155. package/dist/curves/index.js.map +1 -0
  156. package/dist/curves/parallel-transport.d.ts +12 -0
  157. package/dist/curves/parallel-transport.d.ts.map +1 -0
  158. package/dist/curves/parallel-transport.js +83 -0
  159. package/dist/curves/parallel-transport.js.map +1 -0
  160. package/dist/geometries/box-geometry.js +1 -1
  161. package/dist/geometries/box-geometry.js.map +1 -1
  162. package/dist/geometries/capsule-geometry.js +1 -1
  163. package/dist/geometries/capsule-geometry.js.map +1 -1
  164. package/dist/geometries/cylinder-geometry.js +1 -1
  165. package/dist/geometries/cylinder-geometry.js.map +1 -1
  166. package/dist/geometries/geometry-helpers.js +1 -1
  167. package/dist/geometries/geometry-helpers.js.map +1 -1
  168. package/dist/geometries/ico-sphere-geometry.js +1 -1
  169. package/dist/geometries/ico-sphere-geometry.js.map +1 -1
  170. package/dist/geometries/plane-geometry.js +1 -1
  171. package/dist/geometries/plane-geometry.js.map +1 -1
  172. package/dist/geometries/primitive-mesh-builder.d.ts +24 -0
  173. package/dist/geometries/primitive-mesh-builder.d.ts.map +1 -0
  174. package/dist/geometries/primitive-mesh-builder.js +74 -0
  175. package/dist/geometries/primitive-mesh-builder.js.map +1 -0
  176. package/dist/geometries/prism-geometry.d.ts +13 -0
  177. package/dist/geometries/prism-geometry.d.ts.map +1 -0
  178. package/dist/geometries/prism-geometry.js +34 -0
  179. package/dist/geometries/prism-geometry.js.map +1 -0
  180. package/dist/geometries/ring-geometry.d.ts +15 -0
  181. package/dist/geometries/ring-geometry.d.ts.map +1 -0
  182. package/dist/geometries/ring-geometry.js +64 -0
  183. package/dist/geometries/ring-geometry.js.map +1 -0
  184. package/dist/geometries/sphere-geometry.js +1 -1
  185. package/dist/geometries/sphere-geometry.js.map +1 -1
  186. package/dist/geometries/surface-of-revolution.js +1 -1
  187. package/dist/geometries/surface-of-revolution.js.map +1 -1
  188. package/dist/geometries/truncated-cone-geometry.js +1 -1
  189. package/dist/geometries/truncated-cone-geometry.js.map +1 -1
  190. package/dist/index.cjs +6993 -37
  191. package/dist/index.cjs.map +3 -3
  192. package/dist/index.d.ts +35 -0
  193. package/dist/index.d.ts.map +1 -1
  194. package/dist/index.js +20 -1
  195. package/dist/index.js.map +1 -1
  196. package/dist/lib/geometry-utils.js +1 -1
  197. package/dist/lib/geometry-utils.js.map +1 -1
  198. package/dist/lib/geometry.d.ts +1 -1
  199. package/dist/lib/geometry.d.ts.map +1 -1
  200. package/dist/lib/geometry.js +1 -1
  201. package/dist/lib/geometry.js.map +1 -1
  202. package/dist/lib/hinge-tree.d.ts +33 -0
  203. package/dist/lib/hinge-tree.d.ts.map +1 -0
  204. package/dist/lib/hinge-tree.js +144 -0
  205. package/dist/lib/hinge-tree.js.map +1 -0
  206. package/dist/lighting/index.cjs +175 -0
  207. package/dist/lighting/index.cjs.map +6 -0
  208. package/dist/lighting/index.d.ts +4 -0
  209. package/dist/lighting/index.d.ts.map +1 -0
  210. package/dist/lighting/index.js +5 -0
  211. package/dist/lighting/index.js.map +1 -0
  212. package/dist/lighting/lighting-types.d.ts +16 -0
  213. package/dist/lighting/lighting-types.d.ts.map +1 -0
  214. package/dist/lighting/lighting-types.js +5 -0
  215. package/dist/lighting/lighting-types.js.map +1 -0
  216. package/dist/lighting/photometry.d.ts +36 -0
  217. package/dist/lighting/photometry.d.ts.map +1 -0
  218. package/dist/lighting/photometry.js +181 -0
  219. package/dist/lighting/photometry.js.map +1 -0
  220. package/dist/parametric/lathe-geometry.d.ts +14 -0
  221. package/dist/parametric/lathe-geometry.d.ts.map +1 -0
  222. package/dist/parametric/lathe-geometry.js +48 -0
  223. package/dist/parametric/lathe-geometry.js.map +1 -0
  224. package/dist/parametric/parametric-geometry.d.ts +20 -0
  225. package/dist/parametric/parametric-geometry.d.ts.map +1 -0
  226. package/dist/parametric/parametric-geometry.js +88 -0
  227. package/dist/parametric/parametric-geometry.js.map +1 -0
  228. package/dist/parametric/torus-geometry.d.ts +19 -0
  229. package/dist/parametric/torus-geometry.d.ts.map +1 -0
  230. package/dist/parametric/torus-geometry.js +89 -0
  231. package/dist/parametric/torus-geometry.js.map +1 -0
  232. package/dist/parametric.d.ts +7 -0
  233. package/dist/parametric.d.ts.map +1 -0
  234. package/dist/parametric.js +7 -0
  235. package/dist/parametric.js.map +1 -0
  236. package/dist/polygon/clip-triangle-mesh.d.ts +41 -0
  237. package/dist/polygon/clip-triangle-mesh.d.ts.map +1 -0
  238. package/dist/polygon/clip-triangle-mesh.js +155 -0
  239. package/dist/polygon/clip-triangle-mesh.js.map +1 -0
  240. package/dist/polygon/cut-by-grid.d.ts +24 -0
  241. package/dist/polygon/cut-by-grid.d.ts.map +1 -0
  242. package/dist/polygon/cut-by-grid.js +221 -0
  243. package/dist/polygon/cut-by-grid.js.map +1 -0
  244. package/dist/polygon/cut-by-mercator-bounds.d.ts +17 -0
  245. package/dist/polygon/cut-by-mercator-bounds.d.ts.map +1 -0
  246. package/dist/polygon/cut-by-mercator-bounds.js +149 -0
  247. package/dist/polygon/cut-by-mercator-bounds.js.map +1 -0
  248. package/dist/polygon/earcut.d.ts +13 -0
  249. package/dist/polygon/earcut.d.ts.map +1 -0
  250. package/dist/polygon/earcut.js +693 -0
  251. package/dist/polygon/earcut.js.map +1 -0
  252. package/dist/polygon/index.d.ts +16 -0
  253. package/dist/polygon/index.d.ts.map +1 -0
  254. package/dist/polygon/index.js +14 -0
  255. package/dist/polygon/index.js.map +1 -0
  256. package/dist/polygon/lineclip.d.ts +31 -0
  257. package/dist/polygon/lineclip.d.ts.map +1 -0
  258. package/dist/polygon/lineclip.js +184 -0
  259. package/dist/polygon/lineclip.js.map +1 -0
  260. package/dist/polygon/pole-of-inaccessibility.d.ts +21 -0
  261. package/dist/polygon/pole-of-inaccessibility.d.ts.map +1 -0
  262. package/dist/polygon/pole-of-inaccessibility.js +285 -0
  263. package/dist/polygon/pole-of-inaccessibility.js.map +1 -0
  264. package/dist/polygon/polygon-utils.d.ts +103 -0
  265. package/dist/polygon/polygon-utils.d.ts.map +1 -0
  266. package/dist/polygon/polygon-utils.js +155 -0
  267. package/dist/polygon/polygon-utils.js.map +1 -0
  268. package/dist/polygon/polygon.d.ts +41 -0
  269. package/dist/polygon/polygon.d.ts.map +1 -0
  270. package/dist/polygon/polygon.js +76 -0
  271. package/dist/polygon/polygon.js.map +1 -0
  272. package/dist/polygon/subdivide-polyline.d.ts +56 -0
  273. package/dist/polygon/subdivide-polyline.d.ts.map +1 -0
  274. package/dist/polygon/subdivide-polyline.js +141 -0
  275. package/dist/polygon/subdivide-polyline.js.map +1 -0
  276. package/dist/polygon/subdivide-triangle-mesh.d.ts +78 -0
  277. package/dist/polygon/subdivide-triangle-mesh.d.ts.map +1 -0
  278. package/dist/polygon/subdivide-triangle-mesh.js +238 -0
  279. package/dist/polygon/subdivide-triangle-mesh.js.map +1 -0
  280. package/dist/polygon/utils.d.ts +5 -0
  281. package/dist/polygon/utils.d.ts.map +1 -0
  282. package/dist/polygon/utils.js +38 -0
  283. package/dist/polygon/utils.js.map +1 -0
  284. package/dist/spatial-index/box-index.d.ts +86 -0
  285. package/dist/spatial-index/box-index.d.ts.map +1 -0
  286. package/dist/spatial-index/box-index.js +335 -0
  287. package/dist/spatial-index/box-index.js.map +1 -0
  288. package/dist/spatial-index/index.d.ts +7 -0
  289. package/dist/spatial-index/index.d.ts.map +1 -0
  290. package/dist/spatial-index/index.js +6 -0
  291. package/dist/spatial-index/index.js.map +1 -0
  292. package/dist/spatial-index/triangle-bvh.d.ts +74 -0
  293. package/dist/spatial-index/triangle-bvh.d.ts.map +1 -0
  294. package/dist/spatial-index/triangle-bvh.js +221 -0
  295. package/dist/spatial-index/triangle-bvh.js.map +1 -0
  296. package/dist/utils/attribute-compression.d.ts +50 -0
  297. package/dist/utils/attribute-compression.d.ts.map +1 -0
  298. package/dist/utils/attribute-compression.js +186 -0
  299. package/dist/utils/attribute-compression.js.map +1 -0
  300. package/dist/utils/attribute-iterator.d.ts +8 -0
  301. package/dist/utils/attribute-iterator.d.ts.map +1 -0
  302. package/dist/utils/attribute-iterator.js +25 -0
  303. package/dist/utils/attribute-iterator.js.map +1 -0
  304. package/dist/utils/compose-attribute-provenance.d.ts +13 -0
  305. package/dist/utils/compose-attribute-provenance.d.ts.map +1 -0
  306. package/dist/utils/compose-attribute-provenance.js +63 -0
  307. package/dist/utils/compose-attribute-provenance.js.map +1 -0
  308. package/dist/utils/compute-vertex-normals.d.ts +4 -0
  309. package/dist/utils/compute-vertex-normals.d.ts.map +1 -0
  310. package/dist/utils/compute-vertex-normals.js +54 -0
  311. package/dist/utils/compute-vertex-normals.js.map +1 -0
  312. package/dist/utils/constants.d.ts +52 -0
  313. package/dist/utils/constants.d.ts.map +1 -0
  314. package/dist/utils/constants.js +39 -0
  315. package/dist/utils/constants.js.map +1 -0
  316. package/dist/utils/coordinates.d.ts +3 -0
  317. package/dist/utils/coordinates.d.ts.map +1 -0
  318. package/dist/utils/coordinates.js +8 -0
  319. package/dist/utils/coordinates.js.map +1 -0
  320. package/dist/utils/geometry.d.ts +20 -0
  321. package/dist/utils/geometry.d.ts.map +1 -0
  322. package/dist/utils/geometry.js +31 -0
  323. package/dist/utils/geometry.js.map +1 -0
  324. package/dist/utils/gl-type.d.ts +17 -0
  325. package/dist/utils/gl-type.d.ts.map +1 -0
  326. package/dist/utils/gl-type.js +69 -0
  327. package/dist/utils/gl-type.js.map +1 -0
  328. package/dist/utils/index.d.ts +18 -0
  329. package/dist/utils/index.d.ts.map +1 -0
  330. package/dist/utils/index.js +16 -0
  331. package/dist/utils/index.js.map +1 -0
  332. package/dist/utils/interpolate-packed-attributes.d.ts +43 -0
  333. package/dist/utils/interpolate-packed-attributes.d.ts.map +1 -0
  334. package/dist/utils/interpolate-packed-attributes.js +192 -0
  335. package/dist/utils/interpolate-packed-attributes.js.map +1 -0
  336. package/dist/utils/mesh-processing.d.ts +18 -0
  337. package/dist/utils/mesh-processing.d.ts.map +1 -0
  338. package/dist/utils/mesh-processing.js +300 -0
  339. package/dist/utils/mesh-processing.js.map +1 -0
  340. package/dist/utils/primitive-iterator.d.ts +21 -0
  341. package/dist/utils/primitive-iterator.d.ts.map +1 -0
  342. package/dist/utils/primitive-iterator.js +117 -0
  343. package/dist/utils/primitive-iterator.js.map +1 -0
  344. package/dist/utils/project-bounds.d.ts +44 -0
  345. package/dist/utils/project-bounds.d.ts.map +1 -0
  346. package/dist/utils/project-bounds.js +93 -0
  347. package/dist/utils/project-bounds.js.map +1 -0
  348. package/dist/utils/project-texture-coordinates.d.ts +19 -0
  349. package/dist/utils/project-texture-coordinates.d.ts.map +1 -0
  350. package/dist/utils/project-texture-coordinates.js +49 -0
  351. package/dist/utils/project-texture-coordinates.js.map +1 -0
  352. package/dist/utils/qualify-surface-transition.d.ts +21 -0
  353. package/dist/utils/qualify-surface-transition.d.ts.map +1 -0
  354. package/dist/utils/qualify-surface-transition.js +140 -0
  355. package/dist/utils/qualify-surface-transition.js.map +1 -0
  356. package/dist/utils/rgb565.d.ts +5 -0
  357. package/dist/utils/rgb565.d.ts.map +1 -0
  358. package/dist/utils/rgb565.js +24 -0
  359. package/dist/utils/rgb565.js.map +1 -0
  360. package/dist/utils/typed-array-utils.d.ts +3 -0
  361. package/dist/utils/typed-array-utils.d.ts.map +1 -0
  362. package/dist/utils/typed-array-utils.js +16 -0
  363. package/dist/utils/typed-array-utils.js.map +1 -0
  364. package/package.json +24 -4
  365. package/src/color/color-lut-types.ts +19 -0
  366. package/src/color/index.ts +6 -0
  367. package/src/color/sample-lut.ts +175 -0
  368. package/src/culling/bounds.ts +152 -0
  369. package/src/culling/constants.ts +6 -0
  370. package/src/culling/frustum-planes.ts +41 -0
  371. package/src/culling/geometric-queries.ts +299 -0
  372. package/src/culling/index.ts +93 -0
  373. package/src/culling/lib/algorithms/bounding-box-from-points.ts +174 -0
  374. package/src/culling/lib/algorithms/bounding-sphere-from-points.ts +175 -0
  375. package/src/culling/lib/algorithms/compute-eigen-decomposition.ts +171 -0
  376. package/src/culling/lib/algorithms/oriented-bounding-box-quaternion.ts +32 -0
  377. package/src/culling/lib/bounding-volumes/axis-aligned-bounding-box.ts +171 -0
  378. package/src/culling/lib/bounding-volumes/bounding-sphere.ts +154 -0
  379. package/src/culling/lib/bounding-volumes/bounding-volume.ts +38 -0
  380. package/src/culling/lib/bounding-volumes/oriented-bounding-box.ts +320 -0
  381. package/src/culling/lib/culling-volume.ts +171 -0
  382. package/src/culling/lib/perspective-frustum.ts +288 -0
  383. package/src/culling/lib/perspective-off-center-frustum.ts +381 -0
  384. package/src/culling/lib/plane.ts +118 -0
  385. package/src/culling/lib/ray.ts +54 -0
  386. package/src/culling/lib/shapes/box-shape.ts +78 -0
  387. package/src/culling/lib/shapes/capsule-shape.ts +232 -0
  388. package/src/culling/lib/shapes/cylinder-shape.ts +133 -0
  389. package/src/culling/lib/shapes/implicit-shape.ts +209 -0
  390. package/src/culling/lib/shapes/plane-shape.ts +78 -0
  391. package/src/culling/lib/shapes/sphere-shape.ts +60 -0
  392. package/src/culling/oriented-box-2d.ts +165 -0
  393. package/src/culling/queries.ts +332 -0
  394. package/src/culling/screen-ray.ts +75 -0
  395. package/src/curves/adaptive-sampling.ts +85 -0
  396. package/src/curves/bezier-curves.ts +62 -0
  397. package/src/curves/catmull-rom-curve.ts +89 -0
  398. package/src/curves/curve-arc-length.ts +70 -0
  399. package/src/curves/curve.ts +96 -0
  400. package/src/curves/hermite-curve.ts +34 -0
  401. package/src/curves/index.ts +19 -0
  402. package/src/curves/parallel-transport.ts +104 -0
  403. package/src/geometries/box-geometry.ts +1 -1
  404. package/src/geometries/capsule-geometry.ts +1 -1
  405. package/src/geometries/cylinder-geometry.ts +1 -1
  406. package/src/geometries/geometry-helpers.ts +1 -1
  407. package/src/geometries/ico-sphere-geometry.ts +1 -1
  408. package/src/geometries/plane-geometry.ts +1 -1
  409. package/src/geometries/primitive-mesh-builder.ts +84 -0
  410. package/src/geometries/prism-geometry.ts +57 -0
  411. package/src/geometries/ring-geometry.ts +102 -0
  412. package/src/geometries/sphere-geometry.ts +1 -1
  413. package/src/geometries/surface-of-revolution.ts +1 -1
  414. package/src/geometries/truncated-cone-geometry.ts +1 -1
  415. package/src/index.ts +226 -1
  416. package/src/lib/geometry-utils.ts +2 -2
  417. package/src/lib/geometry.ts +2 -2
  418. package/src/lib/hinge-tree.ts +170 -0
  419. package/src/lighting/index.ts +10 -0
  420. package/src/lighting/lighting-types.ts +20 -0
  421. package/src/lighting/photometry.ts +264 -0
  422. package/src/parametric/lathe-geometry.ts +70 -0
  423. package/src/parametric/parametric-geometry.ts +118 -0
  424. package/src/parametric/torus-geometry.ts +118 -0
  425. package/src/parametric.ts +9 -0
  426. package/src/polygon/clip-triangle-mesh.ts +218 -0
  427. package/src/polygon/cut-by-grid.ts +313 -0
  428. package/src/polygon/cut-by-mercator-bounds.ts +204 -0
  429. package/src/polygon/earcut.ts +859 -0
  430. package/src/polygon/index.ts +48 -0
  431. package/src/polygon/lineclip.ts +218 -0
  432. package/src/polygon/pole-of-inaccessibility.ts +330 -0
  433. package/src/polygon/polygon-utils.ts +273 -0
  434. package/src/polygon/polygon.ts +105 -0
  435. package/src/polygon/subdivide-polyline.ts +223 -0
  436. package/src/polygon/subdivide-triangle-mesh.ts +342 -0
  437. package/src/polygon/utils.ts +50 -0
  438. package/src/spatial-index/box-index.ts +452 -0
  439. package/src/spatial-index/index.ts +20 -0
  440. package/src/spatial-index/triangle-bvh.ts +345 -0
  441. package/src/utils/attribute-compression.ts +234 -0
  442. package/src/utils/attribute-iterator.ts +28 -0
  443. package/src/utils/compose-attribute-provenance.ts +74 -0
  444. package/src/utils/compute-vertex-normals.ts +63 -0
  445. package/src/utils/constants.ts +42 -0
  446. package/src/utils/coordinates.ts +8 -0
  447. package/src/utils/geometry.ts +49 -0
  448. package/src/utils/gl-type.ts +87 -0
  449. package/src/utils/index.ts +55 -0
  450. package/src/utils/interpolate-packed-attributes.ts +284 -0
  451. package/src/utils/mesh-processing.ts +377 -0
  452. package/src/utils/primitive-iterator.ts +145 -0
  453. package/src/utils/project-bounds.ts +154 -0
  454. package/src/utils/project-texture-coordinates.ts +67 -0
  455. package/src/utils/qualify-surface-transition.ts +169 -0
  456. package/src/utils/rgb565.ts +26 -0
  457. package/src/utils/typed-array-utils.ts +16 -0
@@ -0,0 +1,342 @@
1
+ // math.gl
2
+ // SPDX-License-Identifier: MIT
3
+ // SPDX-FileCopyrightText: Copyright (c) vis.gl contributors
4
+
5
+ /** A flat, indexed triangle mesh. Vertices at attribute seams must have distinct indices. */
6
+ export type TriangleMesh = {
7
+ /** Flat source positions. */
8
+ positions: ArrayLike<number>;
9
+ /** Three vertex indices per triangle, with consistent winding. */
10
+ indices: ArrayLike<number>;
11
+ };
12
+
13
+ /** Controls adaptive subdivision through an application-supplied coordinate transform. */
14
+ type SubdivisionOptions = {
15
+ /** Deterministic source-to-target conversion. Each invocation receives a fresh source array.
16
+ * Null and nonfinite output reject the mesh; callback exceptions propagate unchanged.
17
+ */
18
+ transform: (position: readonly number[]) => ArrayLike<number> | null;
19
+ /** Source dimension: 2 or 3. Default 2. */
20
+ size?: 2 | 3;
21
+ /** Target dimension: 2 or 3. Defaults to size. */
22
+ targetSize?: 2 | 3;
23
+ /** Maximum global refinement passes, from 0 through 30. Default 10. */
24
+ maxDepth?: number;
25
+ /** Maximum output vertex count, including unused input vertices. Default 65536. */
26
+ maxVertices?: number;
27
+ /** Maximum output triangle count. Default 131072. */
28
+ maxTriangles?: number;
29
+ };
30
+
31
+ /** Select sampled transform error (default), or exclusively limit source-edge length. */
32
+ export type SubdivideTriangleMeshOptions = SubdivisionOptions &
33
+ (
34
+ | {
35
+ /** Sample target-space error, including triangle interiors. This is the default. */
36
+ refinement?: 'transform-error';
37
+ /** Positive, finite sampled error tolerance across target components, in target units. */
38
+ tolerance: number;
39
+ /** Optional application metric in tolerance units. Receives fresh sample arrays.
40
+ * Must return a finite nonnegative value. Exceptions propagate.
41
+ * Does not change output coordinates or provide a continuous error guarantee.
42
+ */
43
+ errorMetric?: (sample: {
44
+ source: readonly number[];
45
+ exact: readonly number[];
46
+ interpolated: readonly number[];
47
+ }) => number;
48
+ /** Positive maximum Euclidean source-edge length. Default Infinity. */
49
+ maxEdgeLength?: number;
50
+ }
51
+ | {
52
+ /** Split only long indexed edges, without evaluating transform-error probes. */
53
+ refinement: 'source-edge';
54
+ /** No target-space tolerance is evaluated in source-edge mode. */
55
+ tolerance?: never;
56
+ errorMetric?: never;
57
+ /** Positive, finite maximum Euclidean edge length across all source components. */
58
+ maxEdgeLength: number;
59
+ }
60
+ );
61
+
62
+ /** Refined geometry with provenance for interpolating UVs and other source vertex attributes. */
63
+ export type SubdividedTriangleMesh = {
64
+ /** Flat source coordinates, including inserted vertices. */
65
+ sourcePositions: Float64Array;
66
+ /** Flat transformed coordinates, suitable for rendering. */
67
+ positions: Float64Array;
68
+ /** Refined triangle indices; input winding is preserved in source space. */
69
+ indices: Uint32Array;
70
+ /** Three original input vertex indices per output vertex. Unused slots use index 0. */
71
+ sourceVertexIndices: Uint32Array;
72
+ /** Three corresponding weights per output vertex, summing to one. */
73
+ sourceVertexWeights: Float64Array;
74
+ /** Original input triangle index for each output triangle. */
75
+ sourceTriangleIndices: Uint32Array;
76
+ };
77
+
78
+ type Vertex = {source: number[]; target: number[]; weights: Map<number, number>};
79
+ type Face = {vertices: [number, number, number]; sourceTriangle: number};
80
+
81
+ const EDGE_FRACTIONS = [0.25, 0.5, 0.75];
82
+ const FACE_WEIGHTS = [
83
+ [1 / 3, 1 / 3, 1 / 3],
84
+ [0.5, 0.25, 0.25],
85
+ [0.25, 0.5, 0.25],
86
+ [0.25, 0.25, 0.5]
87
+ ];
88
+
89
+ /** Refines a conforming triangle mesh to approximate a nonlinear coordinate transform.
90
+ * Checks edge quarter/midpoint samples and four interior barycentric samples. Failing faces
91
+ * split all three edges; neighbors split matching edges so no new T-junctions are introduced.
92
+ * The tolerance is sampled, not a universal error bound. Source interpolation is linear.
93
+ * Clip invalid domains and split projection seams before calling. Attribute seams must use
94
+ * duplicated input vertices; equal coordinates are never welded.
95
+ * Opt-in source-edge refinement skips error probes and transforms each output vertex once.
96
+ * It provides no target-space error bound or interior-domain validation.
97
+ * @throws RangeError For invalid input/options, rejected transform samples, or exhausted limits.
98
+ */
99
+ export function subdivideTriangleMesh(
100
+ mesh: TriangleMesh,
101
+ options: SubdivideTriangleMeshOptions
102
+ ): SubdividedTriangleMesh {
103
+ const {
104
+ transform,
105
+ tolerance,
106
+ errorMetric,
107
+ refinement = 'transform-error',
108
+ size = 2,
109
+ targetSize = size,
110
+ maxEdgeLength = Infinity,
111
+ maxDepth = 10,
112
+ maxVertices = 65536,
113
+ maxTriangles = 131072
114
+ } = options;
115
+ validateOptions();
116
+ const vertices: Vertex[] = [];
117
+ let faces: Face[] = [];
118
+ for (let i = 0; i < mesh.positions.length; i += size) {
119
+ const source = Array.from({length: size}, (_, j) => mesh.positions[i + j]);
120
+ if (!source.every(Number.isFinite)) throw new RangeError('Source positions must be finite');
121
+ vertices.push({source, target: project(source), weights: new Map([[i / size, 1]])});
122
+ }
123
+ for (let i = 0; i < mesh.indices.length; i += 3) {
124
+ const indices = Array.from({length: 3}, (_, j) => mesh.indices[i + j]);
125
+ if (!indices.every(index => Number.isInteger(index) && index >= 0 && index < vertices.length)) {
126
+ throw new RangeError('Triangle indices must reference input vertices');
127
+ }
128
+ faces.push({vertices: indices as [number, number, number], sourceTriangle: i / 3});
129
+ }
130
+
131
+ for (let depth = 0; ; depth++) {
132
+ const splitEdges = new Set<string>();
133
+ for (const face of faces) {
134
+ if (refinement === 'source-edge') {
135
+ for (let edge = 0; edge < 3; edge++) {
136
+ const a = face.vertices[edge];
137
+ const b = face.vertices[(edge + 1) % 3];
138
+ if (sourceEdgeLength(vertices[a], vertices[b]) > maxEdgeLength) {
139
+ splitEdges.add(edgeKey(a, b));
140
+ }
141
+ }
142
+ } else if (needsRefinement(face)) {
143
+ const [a, b, c] = face.vertices;
144
+ splitEdges.add(edgeKey(a, b));
145
+ splitEdges.add(edgeKey(b, c));
146
+ splitEdges.add(edgeKey(c, a));
147
+ }
148
+ }
149
+ if (!splitEdges.size) return buildResult();
150
+ if (depth >= maxDepth) throw new RangeError('Triangle mesh subdivision exceeded maxDepth');
151
+ const midpoints = new Map<string, number>();
152
+ const refined: Face[] = [];
153
+ for (const face of faces) {
154
+ splitFace(face, refined, splitEdges, midpoints);
155
+ }
156
+ faces = refined;
157
+ }
158
+
159
+ function validateOptions(): void {
160
+ if (
161
+ typeof transform !== 'function' ||
162
+ (errorMetric !== undefined && typeof errorMetric !== 'function') ||
163
+ (refinement !== 'transform-error' && refinement !== 'source-edge') ||
164
+ (refinement === 'transform-error' &&
165
+ (tolerance === undefined || !Number.isFinite(tolerance) || tolerance <= 0)) ||
166
+ (refinement === 'source-edge' &&
167
+ (tolerance !== undefined ||
168
+ errorMetric !== undefined ||
169
+ !Number.isFinite(maxEdgeLength))) ||
170
+ (size !== 2 && size !== 3) ||
171
+ (targetSize !== 2 && targetSize !== 3) ||
172
+ !(maxEdgeLength > 0) ||
173
+ (!Number.isFinite(maxEdgeLength) && maxEdgeLength !== Infinity) ||
174
+ !Number.isInteger(maxDepth) ||
175
+ maxDepth < 0 ||
176
+ maxDepth > 30 ||
177
+ !validLimit(maxVertices) ||
178
+ !validLimit(maxTriangles) ||
179
+ !Number.isSafeInteger(mesh.positions.length) ||
180
+ mesh.positions.length < 0 ||
181
+ mesh.positions.length % size !== 0 ||
182
+ !Number.isSafeInteger(mesh.indices.length) ||
183
+ mesh.indices.length < 0 ||
184
+ mesh.indices.length % 3 !== 0
185
+ )
186
+ throw new RangeError('Invalid triangle mesh subdivision options or input lengths');
187
+ if (mesh.positions.length / size > maxVertices || mesh.indices.length / 3 > maxTriangles) {
188
+ throw new RangeError('Input mesh exceeds subdivision limits');
189
+ }
190
+ }
191
+
192
+ function project(source: number[]): number[] {
193
+ const result = transform(source.slice());
194
+ if (!result || result.length !== targetSize) {
195
+ throw new RangeError('Transform must return targetSize components');
196
+ }
197
+ const target = Array.from(result);
198
+ if (!target.every(Number.isFinite))
199
+ throw new RangeError('Transform returned nonfinite coordinates');
200
+ return target;
201
+ }
202
+
203
+ function error(points: Vertex[], weights: number[]): number {
204
+ const source = blend(
205
+ points.map(p => p.source),
206
+ weights
207
+ );
208
+ const linearTarget = blend(
209
+ points.map(p => p.target),
210
+ weights
211
+ );
212
+ const exact = project(source);
213
+ if (!errorMetric) return Math.hypot(...exact.map((value, i) => value - linearTarget[i]));
214
+ const value = errorMetric({source, exact, interpolated: linearTarget});
215
+ if (!Number.isFinite(value) || value < 0) {
216
+ throw new RangeError('errorMetric must return a finite nonnegative value');
217
+ }
218
+ return value;
219
+ }
220
+
221
+ function needsRefinement(face: Face): boolean {
222
+ const points = face.vertices.map(index => vertices[index]);
223
+ let exceedsTolerance = false;
224
+ for (let i = 0; i < 3; i++) {
225
+ const a = points[i];
226
+ const b = points[(i + 1) % 3];
227
+ const length = sourceEdgeLength(a, b);
228
+ if (length > maxEdgeLength) exceedsTolerance = true;
229
+ for (const fraction of EDGE_FRACTIONS) {
230
+ if (error([a, b], [1 - fraction, fraction]) > (tolerance ?? Infinity))
231
+ exceedsTolerance = true;
232
+ }
233
+ }
234
+ for (const weights of FACE_WEIGHTS) {
235
+ if (error(points, weights) > (tolerance ?? Infinity)) exceedsTolerance = true;
236
+ }
237
+ return exceedsTolerance;
238
+ }
239
+
240
+ function midpoint(a: number, b: number, midpoints: Map<string, number>): number {
241
+ const key = edgeKey(a, b);
242
+ const existing = midpoints.get(key);
243
+ if (existing !== undefined) return existing;
244
+ if (vertices.length >= maxVertices)
245
+ throw new RangeError('Triangle mesh subdivision exceeded maxVertices');
246
+ const source = blend([vertices[a].source, vertices[b].source], [0.5, 0.5]);
247
+ const weights = new Map<number, number>();
248
+ for (const vertex of [vertices[a], vertices[b]]) {
249
+ for (const [index, weight] of vertex.weights) {
250
+ weights.set(index, (weights.get(index) || 0) + weight * 0.5);
251
+ }
252
+ }
253
+ // Every leaf lies inside one original face. Shared boundary vertices use only
254
+ // the original edge endpoints, so at most three source vertices contribute.
255
+ if (weights.size > 3) throw new Error('Inconsistent mesh provenance');
256
+ const index = vertices.length;
257
+ vertices.push({source, target: project(source), weights});
258
+ midpoints.set(key, index);
259
+ return index;
260
+ }
261
+
262
+ function splitFace(
263
+ face: Face,
264
+ output: Face[],
265
+ splitEdges: Set<string>,
266
+ midpoints: Map<string, number>
267
+ ): void {
268
+ const [a, b, c] = face.vertices;
269
+ const ab = splitEdges.has(edgeKey(a, b)) ? midpoint(a, b, midpoints) : -1;
270
+ const bc = splitEdges.has(edgeKey(b, c)) ? midpoint(b, c, midpoints) : -1;
271
+ const ca = splitEdges.has(edgeKey(c, a)) ? midpoint(c, a, midpoints) : -1;
272
+ const count = Number(ab >= 0) + Number(bc >= 0) + Number(ca >= 0);
273
+ if (count === 0) emit(a, b, c);
274
+ else if (count === 3) {
275
+ emit(a, ab, ca);
276
+ emit(ab, b, bc);
277
+ emit(ca, bc, c);
278
+ emit(ab, bc, ca);
279
+ } else {
280
+ // Rotate to a canonical one-edge or two-edge template, preserving winding.
281
+ const corners = [a, b, c];
282
+ const edges = [ab, bc, ca];
283
+ const start = count === 1 ? edges.findIndex(v => v >= 0) : edges.findIndex(v => v < 0);
284
+ const rotation = count === 1 ? start : (start + 1) % 3;
285
+ const x = corners[rotation];
286
+ const y = corners[(rotation + 1) % 3];
287
+ const z = corners[(rotation + 2) % 3];
288
+ const xy = edges[rotation];
289
+ if (count === 1) {
290
+ emit(x, xy, z);
291
+ emit(xy, y, z);
292
+ } else {
293
+ const yz = edges[(rotation + 1) % 3];
294
+ emit(y, yz, xy);
295
+ emit(x, xy, z);
296
+ emit(xy, yz, z);
297
+ }
298
+ }
299
+ function emit(x: number, y: number, z: number): void {
300
+ if (output.length >= maxTriangles)
301
+ throw new RangeError('Triangle mesh subdivision exceeded maxTriangles');
302
+ output.push({vertices: [x, y, z], sourceTriangle: face.sourceTriangle});
303
+ }
304
+ }
305
+
306
+ function buildResult(): SubdividedTriangleMesh {
307
+ const sourceVertexIndices = new Uint32Array(vertices.length * 3);
308
+ const sourceVertexWeights = new Float64Array(vertices.length * 3);
309
+ for (let i = 0; i < vertices.length; i++) {
310
+ let slot = 0;
311
+ for (const [index, weight] of vertices[i].weights) {
312
+ sourceVertexIndices[i * 3 + slot] = index;
313
+ sourceVertexWeights[i * 3 + slot++] = weight;
314
+ }
315
+ }
316
+ return {
317
+ sourcePositions: new Float64Array(vertices.flatMap(v => v.source)),
318
+ positions: new Float64Array(vertices.flatMap(v => v.target)),
319
+ indices: new Uint32Array(faces.flatMap(f => f.vertices)),
320
+ sourceVertexIndices,
321
+ sourceVertexWeights,
322
+ sourceTriangleIndices: new Uint32Array(faces.map(f => f.sourceTriangle))
323
+ };
324
+ }
325
+ }
326
+
327
+ /** Measures an indexed edge in source-coordinate units. */
328
+ function sourceEdgeLength(a: Vertex, b: Vertex): number {
329
+ return Math.hypot(...a.source.map((value, component) => value - b.source[component]));
330
+ }
331
+
332
+ function edgeKey(a: number, b: number): string {
333
+ return a <= b ? `${a}:${b}` : `${b}:${a}`;
334
+ }
335
+
336
+ function validLimit(value: number): boolean {
337
+ return Number.isSafeInteger(value) && value > 0 && value <= 0xffffffff;
338
+ }
339
+
340
+ function blend(positions: number[][], weights: number[]): number[] {
341
+ return positions[0].map((_, i) => positions.reduce((sum, p, j) => sum + p[i] * weights[j], 0));
342
+ }
@@ -0,0 +1,50 @@
1
+ // math.gl
2
+ // SPDX-License-Identifier: MIT
3
+ // SPDX-FileCopyrightText: Copyright (c) vis.gl contributors
4
+
5
+ import type {NumericArray} from '@math.gl/core';
6
+
7
+ export function push(target: number[], source: number[]): boolean {
8
+ const size = source.length;
9
+ const startIndex = target.length;
10
+
11
+ // dedupe, if source is the same point as the last vertex
12
+ if (startIndex > 0) {
13
+ let isDuplicate = true;
14
+ for (let i = 0; i < size; i++) {
15
+ if (target[startIndex - size + i] !== source[i]) {
16
+ isDuplicate = false;
17
+ break;
18
+ }
19
+ }
20
+ if (isDuplicate) {
21
+ return false;
22
+ }
23
+ }
24
+
25
+ for (let i = 0; i < size; i++) {
26
+ target[startIndex + i] = source[i];
27
+ }
28
+ return true;
29
+ }
30
+
31
+ export function copy(target: number[], source: Readonly<NumericArray>): void {
32
+ const size = source.length;
33
+ for (let i = 0; i < size; i++) {
34
+ target[i] = source[i];
35
+ }
36
+ }
37
+
38
+ export function getPointAtIndex(
39
+ positions: Readonly<NumericArray>,
40
+ index: number,
41
+ size: number,
42
+ offset: number,
43
+ out: number[] = []
44
+ ): number[] {
45
+ const startI = offset + index * size;
46
+ for (let i = 0; i < size; i++) {
47
+ out[i] = positions[startI + i];
48
+ }
49
+ return out;
50
+ }