@loaders.gl/pointclouds 0.0.0-stage → 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 (511) hide show
  1. package/LAS-README.md +12 -0
  2. package/LICENSE +24 -0
  3. package/PCD-README.md +12 -0
  4. package/PLY-README.md +38 -0
  5. package/README.md +11 -2
  6. package/THIRD-PARTY-NOTICES.md +27 -0
  7. package/dist/dist.dev.js +31514 -0
  8. package/dist/dist.min.js +54 -0
  9. package/dist/index.cjs +55 -0
  10. package/dist/index.cjs.map +7 -0
  11. package/dist/index.d.ts +16 -0
  12. package/dist/index.d.ts.map +1 -0
  13. package/dist/index.js +13 -0
  14. package/dist/index.js.map +1 -0
  15. package/dist/las/bundled.cjs +69 -0
  16. package/dist/las/bundled.cjs.map +7 -0
  17. package/dist/las/bundled.d.ts +11 -0
  18. package/dist/las/bundled.d.ts.map +1 -0
  19. package/dist/las/bundled.js +11 -0
  20. package/dist/las/bundled.js.map +1 -0
  21. package/dist/las/index.cjs +75 -0
  22. package/dist/las/index.cjs.map +7 -0
  23. package/dist/las/index.d.ts +15 -0
  24. package/dist/las/index.d.ts.map +1 -0
  25. package/dist/las/index.js +12 -0
  26. package/dist/las/index.js.map +1 -0
  27. package/dist/las/las-copc-loader-types.cjs +49 -0
  28. package/dist/las/las-copc-loader-types.cjs.map +7 -0
  29. package/dist/las/las-copc-loader-types.d.ts +67 -0
  30. package/dist/las/las-copc-loader-types.d.ts.map +1 -0
  31. package/dist/las/las-copc-loader-types.js +14 -0
  32. package/dist/las/las-copc-loader-types.js.map +1 -0
  33. package/dist/las/las-copc-loader.cjs +60 -0
  34. package/dist/las/las-copc-loader.cjs.map +7 -0
  35. package/dist/las/las-copc-loader.d.ts +39 -0
  36. package/dist/las/las-copc-loader.d.ts.map +1 -0
  37. package/dist/las/las-copc-loader.js +45 -0
  38. package/dist/las/las-copc-loader.js.map +1 -0
  39. package/dist/las/las-format.cjs +44 -0
  40. package/dist/las/las-format.cjs.map +7 -0
  41. package/dist/las/las-format.d.ts +16 -0
  42. package/dist/las/las-format.d.ts.map +1 -0
  43. package/dist/las/las-format.js +19 -0
  44. package/dist/las/las-format.js.map +1 -0
  45. package/dist/las/las-loader-shared.cjs +84 -0
  46. package/dist/las/las-loader-shared.cjs.map +7 -0
  47. package/dist/las/las-loader-shared.d.ts +68 -0
  48. package/dist/las/las-loader-shared.d.ts.map +1 -0
  49. package/dist/las/las-loader-shared.js +60 -0
  50. package/dist/las/las-loader-shared.js.map +1 -0
  51. package/dist/las/las-loader-types.cjs +51 -0
  52. package/dist/las/las-loader-types.cjs.map +7 -0
  53. package/dist/las/las-loader-types.d.ts +77 -0
  54. package/dist/las/las-loader-types.d.ts.map +1 -0
  55. package/dist/las/las-loader-types.js +17 -0
  56. package/dist/las/las-loader-types.js.map +1 -0
  57. package/dist/las/las-loader.cjs +128 -0
  58. package/dist/las/las-loader.cjs.map +7 -0
  59. package/dist/las/las-loader.d.ts +91 -0
  60. package/dist/las/las-loader.d.ts.map +1 -0
  61. package/dist/las/las-loader.js +108 -0
  62. package/dist/las/las-loader.js.map +1 -0
  63. package/dist/las/las-writer.cjs +1054 -0
  64. package/dist/las/las-writer.cjs.map +7 -0
  65. package/dist/las/las-writer.d.ts +70 -0
  66. package/dist/las/las-writer.d.ts.map +1 -0
  67. package/dist/las/las-writer.js +992 -0
  68. package/dist/las/las-writer.js.map +1 -0
  69. package/dist/las/laz-rs-loader-types.cjs +49 -0
  70. package/dist/las/laz-rs-loader-types.cjs.map +7 -0
  71. package/dist/las/laz-rs-loader-types.d.ts +69 -0
  72. package/dist/las/laz-rs-loader-types.d.ts.map +1 -0
  73. package/dist/las/laz-rs-loader-types.js +16 -0
  74. package/dist/las/laz-rs-loader-types.js.map +1 -0
  75. package/dist/las/laz-rs-loader.cjs +275 -0
  76. package/dist/las/laz-rs-loader.cjs.map +7 -0
  77. package/dist/las/laz-rs-loader.d.ts +39 -0
  78. package/dist/las/laz-rs-loader.d.ts.map +1 -0
  79. package/dist/las/laz-rs-loader.js +43 -0
  80. package/dist/las/laz-rs-loader.js.map +1 -0
  81. package/dist/las/lazperf-loader-types.cjs +49 -0
  82. package/dist/las/lazperf-loader-types.cjs.map +7 -0
  83. package/dist/las/lazperf-loader-types.d.ts +71 -0
  84. package/dist/las/lazperf-loader-types.d.ts.map +1 -0
  85. package/dist/las/lazperf-loader-types.js +17 -0
  86. package/dist/las/lazperf-loader-types.js.map +1 -0
  87. package/dist/las/lazperf-loader.cjs +63 -0
  88. package/dist/las/lazperf-loader.cjs.map +7 -0
  89. package/dist/las/lazperf-loader.d.ts +41 -0
  90. package/dist/las/lazperf-loader.d.ts.map +1 -0
  91. package/dist/las/lazperf-loader.js +49 -0
  92. package/dist/las/lazperf-loader.js.map +1 -0
  93. package/dist/las/lib/copc/parse-las.cjs +177 -0
  94. package/dist/las/lib/copc/parse-las.cjs.map +7 -0
  95. package/dist/las/lib/copc/parse-las.d.ts +17 -0
  96. package/dist/las/lib/copc/parse-las.d.ts.map +1 -0
  97. package/dist/las/lib/copc/parse-las.js +215 -0
  98. package/dist/las/lib/copc/parse-las.js.map +1 -0
  99. package/dist/las/lib/get-las-schema.cjs +67 -0
  100. package/dist/las/lib/get-las-schema.cjs.map +7 -0
  101. package/dist/las/lib/get-las-schema.d.ts +16 -0
  102. package/dist/las/lib/get-las-schema.d.ts.map +1 -0
  103. package/dist/las/lib/get-las-schema.js +52 -0
  104. package/dist/las/lib/get-las-schema.js.map +1 -0
  105. package/dist/las/lib/las-compatibility.cjs +110 -0
  106. package/dist/las/lib/las-compatibility.cjs.map +7 -0
  107. package/dist/las/lib/las-compatibility.d.ts +40 -0
  108. package/dist/las/lib/las-compatibility.d.ts.map +1 -0
  109. package/dist/las/lib/las-compatibility.js +115 -0
  110. package/dist/las/lib/las-compatibility.js.map +1 -0
  111. package/dist/las/lib/las-extra-bytes.cjs +228 -0
  112. package/dist/las/lib/las-extra-bytes.cjs.map +7 -0
  113. package/dist/las/lib/las-extra-bytes.d.ts +35 -0
  114. package/dist/las/lib/las-extra-bytes.d.ts.map +1 -0
  115. package/dist/las/lib/las-extra-bytes.js +197 -0
  116. package/dist/las/lib/las-extra-bytes.js.map +1 -0
  117. package/dist/las/lib/las-types.cjs +19 -0
  118. package/dist/las/lib/las-types.cjs.map +7 -0
  119. package/dist/las/lib/las-types.d.ts +194 -0
  120. package/dist/las/lib/las-types.d.ts.map +1 -0
  121. package/dist/las/lib/las-types.js +5 -0
  122. package/dist/las/lib/las-types.js.map +1 -0
  123. package/dist/las/lib/las-waveform.cjs +196 -0
  124. package/dist/las/lib/las-waveform.cjs.map +7 -0
  125. package/dist/las/lib/las-waveform.d.ts +89 -0
  126. package/dist/las/lib/las-waveform.d.ts.map +1 -0
  127. package/dist/las/lib/las-waveform.js +193 -0
  128. package/dist/las/lib/las-waveform.js.map +1 -0
  129. package/dist/las/lib/laz-perf/laslaz-decoder.cjs +382 -0
  130. package/dist/las/lib/laz-perf/laslaz-decoder.cjs.map +7 -0
  131. package/dist/las/lib/laz-perf/laslaz-decoder.d.ts +129 -0
  132. package/dist/las/lib/laz-perf/laslaz-decoder.d.ts.map +1 -0
  133. package/dist/las/lib/laz-perf/laslaz-decoder.js +377 -0
  134. package/dist/las/lib/laz-perf/laslaz-decoder.js.map +1 -0
  135. package/dist/las/lib/laz-perf/parse-las.cjs +271 -0
  136. package/dist/las/lib/laz-perf/parse-las.cjs.map +7 -0
  137. package/dist/las/lib/laz-perf/parse-las.d.ts +24 -0
  138. package/dist/las/lib/laz-perf/parse-las.d.ts.map +1 -0
  139. package/dist/las/lib/laz-perf/parse-las.js +308 -0
  140. package/dist/las/lib/laz-perf/parse-las.js.map +1 -0
  141. package/dist/las/lib/laz-rs-wasm/laslaz-decoder.cjs +631 -0
  142. package/dist/las/lib/laz-rs-wasm/laslaz-decoder.cjs.map +7 -0
  143. package/dist/las/lib/laz-rs-wasm/laslaz-decoder.d.ts +129 -0
  144. package/dist/las/lib/laz-rs-wasm/laslaz-decoder.d.ts.map +1 -0
  145. package/dist/las/lib/laz-rs-wasm/laslaz-decoder.js +414 -0
  146. package/dist/las/lib/laz-rs-wasm/laslaz-decoder.js.map +1 -0
  147. package/dist/las/lib/laz-rs-wasm/parse-las.cjs +271 -0
  148. package/dist/las/lib/laz-rs-wasm/parse-las.cjs.map +7 -0
  149. package/dist/las/lib/laz-rs-wasm/parse-las.d.ts +24 -0
  150. package/dist/las/lib/laz-rs-wasm/parse-las.d.ts.map +1 -0
  151. package/dist/las/lib/laz-rs-wasm/parse-las.js +308 -0
  152. package/dist/las/lib/laz-rs-wasm/parse-las.js.map +1 -0
  153. package/dist/las/lib/typescript/parse-las.cjs +2889 -0
  154. package/dist/las/lib/typescript/parse-las.cjs.map +7 -0
  155. package/dist/las/lib/typescript/parse-las.d.ts +39 -0
  156. package/dist/las/lib/typescript/parse-las.d.ts.map +1 -0
  157. package/dist/las/lib/typescript/parse-las.js +2703 -0
  158. package/dist/las/lib/typescript/parse-las.js.map +1 -0
  159. package/dist/las/libs/laz-perf/laz-perf.cjs +18093 -0
  160. package/dist/las/libs/laz-perf/laz-perf.cjs.map +7 -0
  161. package/dist/las/libs/laz-perf/laz-perf.d.ts +2 -0
  162. package/dist/las/libs/laz-perf/laz-perf.d.ts.map +1 -0
  163. package/dist/las/libs/laz-perf/laz-perf.js +19003 -0
  164. package/dist/las/libs/laz-perf/laz-perf.js.map +1 -0
  165. package/dist/las/libs/laz-rs-wasm/laz_rs_wasm.d.ts +95 -0
  166. package/dist/las/libs/laz-rs-wasm/laz_rs_wasm.d.ts.map +1 -0
  167. package/dist/las/libs/laz-rs-wasm/laz_rs_wasm.js +442 -0
  168. package/dist/las/libs/laz-rs-wasm/laz_rs_wasm.js.map +1 -0
  169. package/dist/las/libs/laz-rs-wasm/laz_rs_wasm_bg.wasm +0 -0
  170. package/dist/las/libs/laz-rs-wasm/laz_rs_wasm_bg.wasm.d.ts +38 -0
  171. package/dist/las/unbundled.cjs +69 -0
  172. package/dist/las/unbundled.cjs.map +7 -0
  173. package/dist/las/unbundled.d.ts +11 -0
  174. package/dist/las/unbundled.d.ts.map +1 -0
  175. package/dist/las/unbundled.js +11 -0
  176. package/dist/las/unbundled.js.map +1 -0
  177. package/dist/las/workers/las-worker.cjs +23 -0
  178. package/dist/las/workers/las-worker.cjs.map +7 -0
  179. package/dist/las/workers/las-worker.d.ts +2 -0
  180. package/dist/las/workers/las-worker.d.ts.map +1 -0
  181. package/dist/las/workers/las-worker.js +23 -0
  182. package/dist/las/workers/las-worker.js.map +1 -0
  183. package/dist/las-copc-loader-types.cjs +51 -0
  184. package/dist/las-copc-loader-types.cjs.map +7 -0
  185. package/dist/las-copc-loader-types.d.ts +2 -0
  186. package/dist/las-copc-loader-types.d.ts.map +1 -0
  187. package/dist/las-copc-loader-types.js +2 -0
  188. package/dist/las-copc-loader-types.js.map +1 -0
  189. package/dist/las-copc-loader.cjs +62 -0
  190. package/dist/las-copc-loader.cjs.map +7 -0
  191. package/dist/las-copc-loader.d.ts +2 -0
  192. package/dist/las-copc-loader.d.ts.map +1 -0
  193. package/dist/las-copc-loader.js +2 -0
  194. package/dist/las-copc-loader.js.map +1 -0
  195. package/dist/las-loader-types.cjs +53 -0
  196. package/dist/las-loader-types.cjs.map +7 -0
  197. package/dist/las-loader-types.d.ts +2 -0
  198. package/dist/las-loader-types.d.ts.map +1 -0
  199. package/dist/las-loader-types.js +2 -0
  200. package/dist/las-loader-types.js.map +1 -0
  201. package/dist/las-loader.cjs +130 -0
  202. package/dist/las-loader.cjs.map +7 -0
  203. package/dist/las-loader.d.ts +2 -0
  204. package/dist/las-loader.d.ts.map +1 -0
  205. package/dist/las-loader.js +2 -0
  206. package/dist/las-loader.js.map +1 -0
  207. package/dist/las-worker.js +24024 -0
  208. package/dist/las-writer.cjs +1056 -0
  209. package/dist/las-writer.cjs.map +7 -0
  210. package/dist/las-writer.d.ts +2 -0
  211. package/dist/las-writer.d.ts.map +1 -0
  212. package/dist/las-writer.js +2 -0
  213. package/dist/las-writer.js.map +1 -0
  214. package/dist/laz-rs-loader-types.cjs +51 -0
  215. package/dist/laz-rs-loader-types.cjs.map +7 -0
  216. package/dist/laz-rs-loader-types.d.ts +2 -0
  217. package/dist/laz-rs-loader-types.d.ts.map +1 -0
  218. package/dist/laz-rs-loader-types.js +2 -0
  219. package/dist/laz-rs-loader-types.js.map +1 -0
  220. package/dist/laz-rs-loader.cjs +277 -0
  221. package/dist/laz-rs-loader.cjs.map +7 -0
  222. package/dist/laz-rs-loader.d.ts +2 -0
  223. package/dist/laz-rs-loader.d.ts.map +1 -0
  224. package/dist/laz-rs-loader.js +2 -0
  225. package/dist/laz-rs-loader.js.map +1 -0
  226. package/dist/lazperf-loader-types.cjs +51 -0
  227. package/dist/lazperf-loader-types.cjs.map +7 -0
  228. package/dist/lazperf-loader-types.d.ts +2 -0
  229. package/dist/lazperf-loader-types.d.ts.map +1 -0
  230. package/dist/lazperf-loader-types.js +2 -0
  231. package/dist/lazperf-loader-types.js.map +1 -0
  232. package/dist/lazperf-loader.cjs +65 -0
  233. package/dist/lazperf-loader.cjs.map +7 -0
  234. package/dist/lazperf-loader.d.ts +2 -0
  235. package/dist/lazperf-loader.d.ts.map +1 -0
  236. package/dist/lazperf-loader.js +2 -0
  237. package/dist/lazperf-loader.js.map +1 -0
  238. package/dist/pcd/bundled.cjs +31 -0
  239. package/dist/pcd/bundled.cjs.map +7 -0
  240. package/dist/pcd/bundled.d.ts +3 -0
  241. package/dist/pcd/bundled.d.ts.map +1 -0
  242. package/dist/pcd/bundled.js +5 -0
  243. package/dist/pcd/bundled.js.map +1 -0
  244. package/dist/pcd/index.cjs +37 -0
  245. package/dist/pcd/index.cjs.map +7 -0
  246. package/dist/pcd/index.d.ts +6 -0
  247. package/dist/pcd/index.d.ts.map +1 -0
  248. package/dist/pcd/index.js +7 -0
  249. package/dist/pcd/index.js.map +1 -0
  250. package/dist/pcd/lib/decompress-lzf.cjs +80 -0
  251. package/dist/pcd/lib/decompress-lzf.cjs.map +7 -0
  252. package/dist/pcd/lib/decompress-lzf.d.ts +7 -0
  253. package/dist/pcd/lib/decompress-lzf.d.ts.map +1 -0
  254. package/dist/pcd/lib/decompress-lzf.js +62 -0
  255. package/dist/pcd/lib/decompress-lzf.js.map +1 -0
  256. package/dist/pcd/lib/get-pcd-schema.cjs +70 -0
  257. package/dist/pcd/lib/get-pcd-schema.cjs.map +7 -0
  258. package/dist/pcd/lib/get-pcd-schema.d.ts +10 -0
  259. package/dist/pcd/lib/get-pcd-schema.d.ts.map +1 -0
  260. package/dist/pcd/lib/get-pcd-schema.js +53 -0
  261. package/dist/pcd/lib/get-pcd-schema.js.map +1 -0
  262. package/dist/pcd/lib/parse-pcd.cjs +354 -0
  263. package/dist/pcd/lib/parse-pcd.cjs.map +7 -0
  264. package/dist/pcd/lib/parse-pcd.d.ts +20 -0
  265. package/dist/pcd/lib/parse-pcd.d.ts.map +1 -0
  266. package/dist/pcd/lib/parse-pcd.js +341 -0
  267. package/dist/pcd/lib/parse-pcd.js.map +1 -0
  268. package/dist/pcd/lib/pcd-types.cjs +19 -0
  269. package/dist/pcd/lib/pcd-types.cjs.map +7 -0
  270. package/dist/pcd/lib/pcd-types.d.ts +31 -0
  271. package/dist/pcd/lib/pcd-types.d.ts.map +1 -0
  272. package/dist/pcd/lib/pcd-types.js +5 -0
  273. package/dist/pcd/lib/pcd-types.js.map +1 -0
  274. package/dist/pcd/pcd-format.cjs +42 -0
  275. package/dist/pcd/pcd-format.cjs.map +7 -0
  276. package/dist/pcd/pcd-format.d.ts +16 -0
  277. package/dist/pcd/pcd-format.d.ts.map +1 -0
  278. package/dist/pcd/pcd-format.js +19 -0
  279. package/dist/pcd/pcd-format.js.map +1 -0
  280. package/dist/pcd/pcd-loader-types.cjs +63 -0
  281. package/dist/pcd/pcd-loader-types.cjs.map +7 -0
  282. package/dist/pcd/pcd-loader-types.d.ts +82 -0
  283. package/dist/pcd/pcd-loader-types.d.ts.map +1 -0
  284. package/dist/pcd/pcd-loader-types.js +35 -0
  285. package/dist/pcd/pcd-loader-types.js.map +1 -0
  286. package/dist/pcd/pcd-loader.cjs +201 -0
  287. package/dist/pcd/pcd-loader.cjs.map +7 -0
  288. package/dist/pcd/pcd-loader.d.ts +80 -0
  289. package/dist/pcd/pcd-loader.d.ts.map +1 -0
  290. package/dist/pcd/pcd-loader.js +179 -0
  291. package/dist/pcd/pcd-loader.js.map +1 -0
  292. package/dist/pcd/pcd-writer.cjs +134 -0
  293. package/dist/pcd/pcd-writer.cjs.map +7 -0
  294. package/dist/pcd/pcd-writer.d.ts +38 -0
  295. package/dist/pcd/pcd-writer.d.ts.map +1 -0
  296. package/dist/pcd/pcd-writer.js +115 -0
  297. package/dist/pcd/pcd-writer.js.map +1 -0
  298. package/dist/pcd/unbundled.cjs +31 -0
  299. package/dist/pcd/unbundled.cjs.map +7 -0
  300. package/dist/pcd/unbundled.d.ts +3 -0
  301. package/dist/pcd/unbundled.d.ts.map +1 -0
  302. package/dist/pcd/unbundled.js +5 -0
  303. package/dist/pcd/unbundled.js.map +1 -0
  304. package/dist/pcd/workers/pcd-worker.cjs +23 -0
  305. package/dist/pcd/workers/pcd-worker.cjs.map +7 -0
  306. package/dist/pcd/workers/pcd-worker.d.ts +2 -0
  307. package/dist/pcd/workers/pcd-worker.d.ts.map +1 -0
  308. package/dist/pcd/workers/pcd-worker.js +23 -0
  309. package/dist/pcd/workers/pcd-worker.js.map +1 -0
  310. package/dist/pcd-loader-types.cjs +65 -0
  311. package/dist/pcd-loader-types.cjs.map +7 -0
  312. package/dist/pcd-loader-types.d.ts +2 -0
  313. package/dist/pcd-loader-types.d.ts.map +1 -0
  314. package/dist/pcd-loader-types.js +2 -0
  315. package/dist/pcd-loader-types.js.map +1 -0
  316. package/dist/pcd-loader.cjs +203 -0
  317. package/dist/pcd-loader.cjs.map +7 -0
  318. package/dist/pcd-loader.d.ts +2 -0
  319. package/dist/pcd-loader.d.ts.map +1 -0
  320. package/dist/pcd-loader.js +2 -0
  321. package/dist/pcd-loader.js.map +1 -0
  322. package/dist/pcd-worker.js +18561 -0
  323. package/dist/pcd-writer.cjs +136 -0
  324. package/dist/pcd-writer.cjs.map +7 -0
  325. package/dist/pcd-writer.d.ts +2 -0
  326. package/dist/pcd-writer.d.ts.map +1 -0
  327. package/dist/pcd-writer.js +2 -0
  328. package/dist/pcd-writer.js.map +1 -0
  329. package/dist/ply/bundled.cjs +31 -0
  330. package/dist/ply/bundled.cjs.map +7 -0
  331. package/dist/ply/bundled.d.ts +3 -0
  332. package/dist/ply/bundled.d.ts.map +1 -0
  333. package/dist/ply/bundled.js +5 -0
  334. package/dist/ply/bundled.js.map +1 -0
  335. package/dist/ply/index.cjs +37 -0
  336. package/dist/ply/index.cjs.map +7 -0
  337. package/dist/ply/index.d.ts +6 -0
  338. package/dist/ply/index.d.ts.map +1 -0
  339. package/dist/ply/index.js +8 -0
  340. package/dist/ply/index.js.map +1 -0
  341. package/dist/ply/lib/get-ply-schema.cjs +128 -0
  342. package/dist/ply/lib/get-ply-schema.cjs.map +7 -0
  343. package/dist/ply/lib/get-ply-schema.d.ts +16 -0
  344. package/dist/ply/lib/get-ply-schema.d.ts.map +1 -0
  345. package/dist/ply/lib/get-ply-schema.js +117 -0
  346. package/dist/ply/lib/get-ply-schema.js.map +1 -0
  347. package/dist/ply/lib/normalize-ply.cjs +96 -0
  348. package/dist/ply/lib/normalize-ply.cjs.map +7 -0
  349. package/dist/ply/lib/normalize-ply.d.ts +8 -0
  350. package/dist/ply/lib/normalize-ply.d.ts.map +1 -0
  351. package/dist/ply/lib/normalize-ply.js +89 -0
  352. package/dist/ply/lib/normalize-ply.js.map +1 -0
  353. package/dist/ply/lib/parse-ply-arrow.cjs +552 -0
  354. package/dist/ply/lib/parse-ply-arrow.cjs.map +7 -0
  355. package/dist/ply/lib/parse-ply-arrow.d.ts +25 -0
  356. package/dist/ply/lib/parse-ply-arrow.d.ts.map +1 -0
  357. package/dist/ply/lib/parse-ply-arrow.js +493 -0
  358. package/dist/ply/lib/parse-ply-arrow.js.map +1 -0
  359. package/dist/ply/lib/parse-ply-in-batches.cjs +613 -0
  360. package/dist/ply/lib/parse-ply-in-batches.cjs.map +7 -0
  361. package/dist/ply/lib/parse-ply-in-batches.d.ts +9 -0
  362. package/dist/ply/lib/parse-ply-in-batches.d.ts.map +1 -0
  363. package/dist/ply/lib/parse-ply-in-batches.js +630 -0
  364. package/dist/ply/lib/parse-ply-in-batches.js.map +1 -0
  365. package/dist/ply/lib/parse-ply.cjs +758 -0
  366. package/dist/ply/lib/parse-ply.cjs.map +7 -0
  367. package/dist/ply/lib/parse-ply.d.ts +69 -0
  368. package/dist/ply/lib/parse-ply.d.ts.map +1 -0
  369. package/dist/ply/lib/parse-ply.js +855 -0
  370. package/dist/ply/lib/parse-ply.js.map +1 -0
  371. package/dist/ply/lib/ply-types.cjs +19 -0
  372. package/dist/ply/lib/ply-types.cjs.map +7 -0
  373. package/dist/ply/lib/ply-types.d.ts +37 -0
  374. package/dist/ply/lib/ply-types.d.ts.map +1 -0
  375. package/dist/ply/lib/ply-types.js +2 -0
  376. package/dist/ply/lib/ply-types.js.map +1 -0
  377. package/dist/ply/ply-format.cjs +43 -0
  378. package/dist/ply/ply-format.cjs.map +7 -0
  379. package/dist/ply/ply-format.d.ts +18 -0
  380. package/dist/ply/ply-format.d.ts.map +1 -0
  381. package/dist/ply/ply-format.js +22 -0
  382. package/dist/ply/ply-format.js.map +1 -0
  383. package/dist/ply/ply-loader-types.cjs +64 -0
  384. package/dist/ply/ply-loader-types.cjs.map +7 -0
  385. package/dist/ply/ply-loader-types.d.ts +88 -0
  386. package/dist/ply/ply-loader-types.d.ts.map +1 -0
  387. package/dist/ply/ply-loader-types.js +38 -0
  388. package/dist/ply/ply-loader-types.js.map +1 -0
  389. package/dist/ply/ply-loader.cjs +192 -0
  390. package/dist/ply/ply-loader.cjs.map +7 -0
  391. package/dist/ply/ply-loader.d.ts +81 -0
  392. package/dist/ply/ply-loader.d.ts.map +1 -0
  393. package/dist/ply/ply-loader.js +173 -0
  394. package/dist/ply/ply-loader.js.map +1 -0
  395. package/dist/ply/ply-writer.cjs +175 -0
  396. package/dist/ply/ply-writer.cjs.map +7 -0
  397. package/dist/ply/ply-writer.d.ts +38 -0
  398. package/dist/ply/ply-writer.d.ts.map +1 -0
  399. package/dist/ply/ply-writer.js +140 -0
  400. package/dist/ply/ply-writer.js.map +1 -0
  401. package/dist/ply/unbundled.cjs +31 -0
  402. package/dist/ply/unbundled.cjs.map +7 -0
  403. package/dist/ply/unbundled.d.ts +3 -0
  404. package/dist/ply/unbundled.d.ts.map +1 -0
  405. package/dist/ply/unbundled.js +5 -0
  406. package/dist/ply/unbundled.js.map +1 -0
  407. package/dist/ply/workers/ply-worker.cjs +34 -0
  408. package/dist/ply/workers/ply-worker.cjs.map +7 -0
  409. package/dist/ply/workers/ply-worker.d.ts +2 -0
  410. package/dist/ply/workers/ply-worker.d.ts.map +1 -0
  411. package/dist/ply/workers/ply-worker.js +37 -0
  412. package/dist/ply/workers/ply-worker.js.map +1 -0
  413. package/dist/ply-loader-types.cjs +66 -0
  414. package/dist/ply-loader-types.cjs.map +7 -0
  415. package/dist/ply-loader-types.d.ts +2 -0
  416. package/dist/ply-loader-types.d.ts.map +1 -0
  417. package/dist/ply-loader-types.js +2 -0
  418. package/dist/ply-loader-types.js.map +1 -0
  419. package/dist/ply-loader.cjs +194 -0
  420. package/dist/ply-loader.cjs.map +7 -0
  421. package/dist/ply-loader.d.ts +2 -0
  422. package/dist/ply-loader.d.ts.map +1 -0
  423. package/dist/ply-loader.js +2 -0
  424. package/dist/ply-loader.js.map +1 -0
  425. package/dist/ply-worker.js +20962 -0
  426. package/dist/ply-writer.cjs +177 -0
  427. package/dist/ply-writer.cjs.map +7 -0
  428. package/dist/ply-writer.d.ts +2 -0
  429. package/dist/ply-writer.d.ts.map +1 -0
  430. package/dist/ply-writer.js +2 -0
  431. package/dist/ply-writer.js.map +1 -0
  432. package/package.json +238 -4
  433. package/src/index.ts +19 -0
  434. package/src/las/bundled.ts +38 -0
  435. package/src/las/index.ts +66 -0
  436. package/src/las/las-copc-loader-types.ts +18 -0
  437. package/src/las/las-copc-loader.ts +61 -0
  438. package/src/las/las-format.ts +21 -0
  439. package/src/las/las-loader-shared.ts +126 -0
  440. package/src/las/las-loader-types.ts +24 -0
  441. package/src/las/las-loader.ts +163 -0
  442. package/src/las/las-writer.ts +1477 -0
  443. package/src/las/laz-rs-loader-types.ts +21 -0
  444. package/src/las/laz-rs-loader.ts +53 -0
  445. package/src/las/lazperf-loader-types.ts +22 -0
  446. package/src/las/lazperf-loader.ts +65 -0
  447. package/src/las/lib/LASZIP-LICENSE +202 -0
  448. package/src/las/lib/LASZIP-NOTICE +4 -0
  449. package/src/las/lib/copc/parse-las.ts +265 -0
  450. package/src/las/lib/get-las-schema.ts +55 -0
  451. package/src/las/lib/las-compatibility.ts +178 -0
  452. package/src/las/lib/las-extra-bytes.ts +276 -0
  453. package/src/las/lib/las-types.ts +206 -0
  454. package/src/las/lib/las-waveform.ts +292 -0
  455. package/src/las/lib/laz-perf/laslaz-decoder.ts +443 -0
  456. package/src/las/lib/laz-perf/parse-las.ts +411 -0
  457. package/src/las/lib/laz-rs-wasm/laslaz-decoder.ts +488 -0
  458. package/src/las/lib/laz-rs-wasm/parse-las.ts +411 -0
  459. package/src/las/lib/typescript/parse-las.ts +3862 -0
  460. package/src/las/libs/laz-perf/laz-perf.ts +20615 -0
  461. package/src/las/libs/laz-rs-wasm/README.md +5 -0
  462. package/src/las/libs/laz-rs-wasm/laz_rs_wasm.d.ts +89 -0
  463. package/src/las/libs/laz-rs-wasm/laz_rs_wasm.js +497 -0
  464. package/src/las/libs/laz-rs-wasm/laz_rs_wasm_bg.wasm +0 -0
  465. package/src/las/libs/laz-rs-wasm/laz_rs_wasm_bg.wasm.d.ts +38 -0
  466. package/src/las/libs/laz-rs-wasm/package.json +25 -0
  467. package/src/las/unbundled.ts +38 -0
  468. package/src/las/workers/las-worker.ts +24 -0
  469. package/src/las-copc-loader-types.ts +1 -0
  470. package/src/las-copc-loader.ts +1 -0
  471. package/src/las-loader-types.ts +1 -0
  472. package/src/las-loader.ts +1 -0
  473. package/src/las-writer.ts +1 -0
  474. package/src/laz-rs-loader-types.ts +1 -0
  475. package/src/laz-rs-loader.ts +1 -0
  476. package/src/lazperf-loader-types.ts +1 -0
  477. package/src/lazperf-loader.ts +1 -0
  478. package/src/pcd/bundled.ts +6 -0
  479. package/src/pcd/index.ts +9 -0
  480. package/src/pcd/lib/decompress-lzf.ts +68 -0
  481. package/src/pcd/lib/get-pcd-schema.ts +66 -0
  482. package/src/pcd/lib/parse-pcd.ts +474 -0
  483. package/src/pcd/lib/pcd-types.ts +34 -0
  484. package/src/pcd/pcd-format.ts +21 -0
  485. package/src/pcd/pcd-loader-types.ts +52 -0
  486. package/src/pcd/pcd-loader.ts +247 -0
  487. package/src/pcd/pcd-writer.ts +156 -0
  488. package/src/pcd/unbundled.ts +6 -0
  489. package/src/pcd/workers/pcd-worker.ts +24 -0
  490. package/src/pcd-loader-types.ts +1 -0
  491. package/src/pcd-loader.ts +1 -0
  492. package/src/pcd-writer.ts +1 -0
  493. package/src/ply/bundled.ts +6 -0
  494. package/src/ply/index.ts +11 -0
  495. package/src/ply/lib/get-ply-schema.ts +133 -0
  496. package/src/ply/lib/normalize-ply.ts +110 -0
  497. package/src/ply/lib/parse-ply-arrow.ts +676 -0
  498. package/src/ply/lib/parse-ply-in-batches.ts +832 -0
  499. package/src/ply/lib/parse-ply.ts +1084 -0
  500. package/src/ply/lib/ply-types.ts +47 -0
  501. package/src/ply/ply-format.ts +24 -0
  502. package/src/ply/ply-loader-types.ts +60 -0
  503. package/src/ply/ply-loader.ts +255 -0
  504. package/src/ply/ply-writer.ts +219 -0
  505. package/src/ply/unbundled.ts +6 -0
  506. package/src/ply/workers/ply-worker.ts +40 -0
  507. package/src/ply-loader-types.ts +1 -0
  508. package/src/ply-loader.ts +1 -0
  509. package/src/ply-writer.ts +1 -0
  510. package/third-party-licenses/plasio-LICENSE +21 -0
  511. package/third-party-licenses/three-LICENSE +21 -0
@@ -0,0 +1,552 @@
1
+ "use strict";
2
+ var __create = Object.create;
3
+ var __defProp = Object.defineProperty;
4
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
+ var __getOwnPropNames = Object.getOwnPropertyNames;
6
+ var __getProtoOf = Object.getPrototypeOf;
7
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
8
+ var __export = (target, all) => {
9
+ for (var name in all)
10
+ __defProp(target, name, { get: all[name], enumerable: true });
11
+ };
12
+ var __copyProps = (to, from, except, desc) => {
13
+ if (from && typeof from === "object" || typeof from === "function") {
14
+ for (let key of __getOwnPropNames(from))
15
+ if (!__hasOwnProp.call(to, key) && key !== except)
16
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
17
+ }
18
+ return to;
19
+ };
20
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
21
+ // If the importer is in node compatibility mode or this is not an ESM
22
+ // file that has been converted to a CommonJS file using a Babel-
23
+ // compatible transform (i.e. "__esModule" has not been set), then set
24
+ // "default" to the CommonJS "module.exports" for node compatibility.
25
+ isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
26
+ mod
27
+ ));
28
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
29
+
30
+ // src/ply/lib/parse-ply-arrow.ts
31
+ var parse_ply_arrow_exports = {};
32
+ __export(parse_ply_arrow_exports, {
33
+ convertPLYElementTablesToMesh: () => convertPLYElementTablesToMesh,
34
+ convertPLYElementTablesToMeshArrowTable: () => convertPLYElementTablesToMeshArrowTable,
35
+ parsePLYToElementTables: () => parsePLYToElementTables
36
+ });
37
+ module.exports = __toCommonJS(parse_ply_arrow_exports);
38
+ var import_schema_utils = require("@loaders.gl/core/schema-utils");
39
+ var arrow = __toESM(require("apache-arrow"), 1);
40
+ var import_parse_ply = require("./parse-ply.cjs");
41
+ var import_get_ply_schema = require("./get-ply-schema.cjs");
42
+ var PLY_END_HEADER_PATTERN = /end_header\s/;
43
+ function parsePLYToElementTables(data, options = {}) {
44
+ const header = (0, import_parse_ply.parsePLYHeader)(data, options);
45
+ const parseHeader = options.pointCloud ? getPointCloudPLYHeader(header) : header;
46
+ if (header.format === "ascii") {
47
+ const text = data instanceof ArrayBuffer ? new TextDecoder().decode(data) : data;
48
+ return parseASCIIPLYToElementTables(text, parseHeader);
49
+ }
50
+ if (!(data instanceof ArrayBuffer)) {
51
+ throw new Error("Binary PLY parsing requires an ArrayBuffer.");
52
+ }
53
+ return parseBinaryPLYToElementTables(data, parseHeader);
54
+ }
55
+ function convertPLYElementTablesToMeshArrowTable(elementTables) {
56
+ const mesh = convertPLYElementTablesToMesh(elementTables);
57
+ return convertPLYMeshToArrowTable(mesh);
58
+ }
59
+ function convertPLYElementTablesToMesh(elementTables) {
60
+ const attributes = getMeshAttributesFromPLYElementTables(elementTables);
61
+ const indices = getMeshIndicesFromPLYElementTables(elementTables);
62
+ const boundingBox = (0, import_schema_utils.getMeshBoundingBox)(attributes);
63
+ const vertexCount = attributes.POSITION?.value.length ? attributes.POSITION.value.length / 3 : 0;
64
+ const isTriangles = Boolean(indices?.value.length);
65
+ const mode = isTriangles ? 4 : 0;
66
+ const topology = isTriangles ? "triangle-list" : "point-list";
67
+ const schema = (0, import_get_ply_schema.getPLYSchema)(elementTables.header, attributes);
68
+ return {
69
+ loader: "ply",
70
+ loaderData: elementTables.header,
71
+ header: {
72
+ vertexCount,
73
+ boundingBox: boundingBox ?? void 0
74
+ },
75
+ schema,
76
+ attributes,
77
+ indices: indices || { value: new Uint32Array(0), size: 0 },
78
+ mode,
79
+ topology
80
+ };
81
+ }
82
+ function parseASCIIPLYToElementTables(data, header) {
83
+ const collector = createElementTablesCollector(header);
84
+ const body = getPLYTextBody(data);
85
+ const lines = body.split("\n");
86
+ let elementIndex = 0;
87
+ let elementRowIndex = 0;
88
+ for (const sourceLine of lines) {
89
+ const line = sourceLine.trim();
90
+ if (line === "") {
91
+ continue;
92
+ }
93
+ while (elementIndex < header.elements.length && elementRowIndex >= header.elements[elementIndex].count) {
94
+ elementIndex++;
95
+ elementRowIndex = 0;
96
+ }
97
+ if (elementIndex >= header.elements.length) {
98
+ break;
99
+ }
100
+ appendASCIIElementRow(collector[elementIndex], line);
101
+ elementRowIndex++;
102
+ }
103
+ return { header, elements: collector.map(makePLYElementTable) };
104
+ }
105
+ function parseBinaryPLYToElementTables(data, header) {
106
+ const collector = createElementTablesCollector(header);
107
+ const dataView = new DataView(data, header.headerLength || 0);
108
+ const littleEndian = header.format !== "binary_big_endian";
109
+ let byteOffset = 0;
110
+ for (let elementIndex = 0; elementIndex < header.elements.length; elementIndex++) {
111
+ const element = header.elements[elementIndex];
112
+ for (let rowIndex = 0; rowIndex < element.count; rowIndex++) {
113
+ byteOffset += appendBinaryElementRow(
114
+ collector[elementIndex],
115
+ dataView,
116
+ byteOffset,
117
+ littleEndian
118
+ );
119
+ }
120
+ }
121
+ return { header, elements: collector.map(makePLYElementTable) };
122
+ }
123
+ function getPointCloudPLYHeader(header) {
124
+ const vertexElement = header.elements[0];
125
+ if (vertexElement?.name !== "vertex") {
126
+ throw new Error("PLY pointCloud parsing requires a leading vertex element");
127
+ }
128
+ return {
129
+ ...header,
130
+ elements: [vertexElement]
131
+ };
132
+ }
133
+ function createElementTablesCollector(header) {
134
+ return header.elements.map((element) => ({
135
+ element,
136
+ properties: element.properties.map((property) => ({
137
+ property,
138
+ values: [],
139
+ offsets: property.type === "list" ? [0] : void 0
140
+ }))
141
+ }));
142
+ }
143
+ function appendASCIIElementRow(collector, line) {
144
+ const values = line.split(/\s+/);
145
+ let valueIndex = 0;
146
+ for (const propertyCollector of collector.properties) {
147
+ const property = propertyCollector.property;
148
+ if (property.type === "list") {
149
+ const count = parseASCIINumber(values[valueIndex++], property.countType);
150
+ for (let listIndex = 0; listIndex < count; listIndex++) {
151
+ propertyCollector.values.push(parseASCIINumber(values[valueIndex++], property.itemType));
152
+ }
153
+ propertyCollector.offsets.push(propertyCollector.values.length);
154
+ } else {
155
+ propertyCollector.values.push(parseASCIINumber(values[valueIndex++], property.type));
156
+ }
157
+ }
158
+ }
159
+ function appendBinaryElementRow(collector, dataView, byteOffset, littleEndian) {
160
+ let localOffset = 0;
161
+ for (const propertyCollector of collector.properties) {
162
+ const property = propertyCollector.property;
163
+ if (property.type === "list") {
164
+ const [count, countByteLength] = readBinaryNumber(
165
+ dataView,
166
+ byteOffset + localOffset,
167
+ property.countType,
168
+ littleEndian
169
+ );
170
+ localOffset += countByteLength;
171
+ for (let listIndex = 0; listIndex < count; listIndex++) {
172
+ const [value, valueByteLength] = readBinaryNumber(
173
+ dataView,
174
+ byteOffset + localOffset,
175
+ property.itemType,
176
+ littleEndian
177
+ );
178
+ propertyCollector.values.push(value);
179
+ localOffset += valueByteLength;
180
+ }
181
+ propertyCollector.offsets.push(propertyCollector.values.length);
182
+ } else {
183
+ const [value, valueByteLength] = readBinaryNumber(
184
+ dataView,
185
+ byteOffset + localOffset,
186
+ property.type,
187
+ littleEndian
188
+ );
189
+ propertyCollector.values.push(value);
190
+ localOffset += valueByteLength;
191
+ }
192
+ }
193
+ return localOffset;
194
+ }
195
+ function makePLYElementTable(collector) {
196
+ const fields = [];
197
+ const columns = {};
198
+ for (const propertyCollector of collector.properties) {
199
+ const column = makePLYPropertyVector(propertyCollector);
200
+ columns[propertyCollector.property.name] = column;
201
+ fields.push(new arrow.Field(propertyCollector.property.name, column.type, false));
202
+ }
203
+ return {
204
+ element: collector.element,
205
+ table: new arrow.Table(new arrow.Schema(fields), columns)
206
+ };
207
+ }
208
+ function makePLYPropertyVector(collector) {
209
+ const property = collector.property;
210
+ if (property.type === "list") {
211
+ return makeListVector(
212
+ property.itemType,
213
+ collector.values,
214
+ Int32Array.from(collector.offsets || [0])
215
+ );
216
+ }
217
+ return arrow.makeVector(getTypedArray(collector.values, property.type));
218
+ }
219
+ function getMeshAttributesFromPLYElementTables(elementTables) {
220
+ const vertexTable = getPLYElementTable(elementTables, "vertex");
221
+ const attributes = {};
222
+ if (!vertexTable) {
223
+ return attributes;
224
+ }
225
+ const position = makeFixedSizeListAttribute(vertexTable.table, ["x", "y", "z"], "float");
226
+ if (position) {
227
+ attributes.POSITION = position;
228
+ }
229
+ const normal = makeFixedSizeListAttribute(vertexTable.table, ["nx", "ny", "nz"], "float");
230
+ if (normal) {
231
+ attributes.NORMAL = normal;
232
+ }
233
+ const textureCoordinates = makeFixedSizeListAttribute(vertexTable.table, ["s", "t"], "float");
234
+ if (textureCoordinates) {
235
+ attributes.TEXCOORD_0 = textureCoordinates;
236
+ }
237
+ const color = makeFixedSizeListAttribute(vertexTable.table, ["red", "green", "blue"], "uchar");
238
+ if (color) {
239
+ attributes.COLOR_0 = { ...color, normalized: true };
240
+ }
241
+ const packedPropertyNames = /* @__PURE__ */ new Set([
242
+ "x",
243
+ "y",
244
+ "z",
245
+ "nx",
246
+ "ny",
247
+ "nz",
248
+ "s",
249
+ "t",
250
+ "red",
251
+ "green",
252
+ "blue"
253
+ ]);
254
+ for (const property of vertexTable.element.properties) {
255
+ if (property.type === "list" || packedPropertyNames.has(property.name)) {
256
+ continue;
257
+ }
258
+ const column = vertexTable.table.getChild(property.name);
259
+ if (column) {
260
+ attributes[property.name] = {
261
+ value: getVectorValues(column),
262
+ size: 1
263
+ };
264
+ }
265
+ }
266
+ return attributes;
267
+ }
268
+ function getMeshIndicesFromPLYElementTables(elementTables) {
269
+ const faceTable = getPLYElementTable(elementTables, "face");
270
+ const indicesColumn = faceTable?.table.getChild("vertex_indices") || faceTable?.table.getChild("vertex_index");
271
+ if (!indicesColumn) {
272
+ return void 0;
273
+ }
274
+ const indices = [];
275
+ for (let rowIndex = 0; rowIndex < indicesColumn.length; rowIndex++) {
276
+ const vertexIndices = indicesColumn.get(rowIndex);
277
+ if (!vertexIndices) {
278
+ continue;
279
+ }
280
+ if (vertexIndices.length === 3) {
281
+ indices.push(
282
+ getArrayLikeValue(vertexIndices, 0),
283
+ getArrayLikeValue(vertexIndices, 1),
284
+ getArrayLikeValue(vertexIndices, 2)
285
+ );
286
+ } else if (vertexIndices.length === 4) {
287
+ indices.push(
288
+ getArrayLikeValue(vertexIndices, 0),
289
+ getArrayLikeValue(vertexIndices, 1),
290
+ getArrayLikeValue(vertexIndices, 3)
291
+ );
292
+ indices.push(
293
+ getArrayLikeValue(vertexIndices, 1),
294
+ getArrayLikeValue(vertexIndices, 2),
295
+ getArrayLikeValue(vertexIndices, 3)
296
+ );
297
+ }
298
+ }
299
+ return indices.length > 0 ? { value: new Uint32Array(indices), size: 1 } : void 0;
300
+ }
301
+ function getArrayLikeValue(values, index) {
302
+ return "get" in values && typeof values.get === "function" ? Number(values.get(index)) : Number(values[index]);
303
+ }
304
+ function convertPLYMeshToArrowTable(mesh) {
305
+ const fields = [];
306
+ const columns = {};
307
+ const attributeNames = getOrderedAttributeNames(mesh.attributes);
308
+ for (const attributeName of attributeNames) {
309
+ const attribute = mesh.attributes[attributeName];
310
+ const column = makeMeshAttributeVector(attribute);
311
+ columns[attributeName] = column;
312
+ fields.push(getMeshAttributeField(mesh, attributeName, column));
313
+ if (attributeName === "POSITION" && mesh.indices?.value.length) {
314
+ const indicesColumn = makeMeshIndicesVector(mesh.indices.value, column.length);
315
+ columns.indices = indicesColumn;
316
+ fields.push(new arrow.Field("indices", indicesColumn.type, true));
317
+ }
318
+ }
319
+ const metadata = getArrowMetadata({
320
+ ...mesh.schema.metadata,
321
+ topology: mesh.topology,
322
+ mode: String(mesh.mode),
323
+ boundingBox: mesh.header?.boundingBox ? JSON.stringify(mesh.header.boundingBox) : void 0
324
+ });
325
+ const arrowSchema = new arrow.Schema(fields, metadata);
326
+ return {
327
+ shape: "arrow-table",
328
+ schema: (0, import_schema_utils.serializeArrowSchema)(arrowSchema),
329
+ data: new arrow.Table(arrowSchema, columns),
330
+ topology: mesh.topology,
331
+ indices: mesh.indices?.value.length ? mesh.indices : void 0
332
+ };
333
+ }
334
+ function makeMeshAttributeVector(attribute) {
335
+ const { value, size } = attribute;
336
+ if (size === 1) {
337
+ return arrow.makeVector(value);
338
+ }
339
+ const values = arrow.makeVector(value);
340
+ const child = values.data[0];
341
+ const type = new arrow.FixedSizeList(size, new arrow.Field("value", child.type, false));
342
+ const data = new arrow.Data(type, 0, value.length / size, 0, {}, [child]);
343
+ return new arrow.Vector([data]);
344
+ }
345
+ function getMeshAttributeField(mesh, attributeName, column) {
346
+ const field = mesh.schema.fields.find((schemaField) => schemaField.name === attributeName);
347
+ return new arrow.Field(attributeName, column.type, false, getArrowMetadata(field?.metadata));
348
+ }
349
+ function makeMeshIndicesVector(indices, vertexCount) {
350
+ const values = indices instanceof Uint32Array ? indices : Uint32Array.from(indices);
351
+ const valueOffsets = new Int32Array(vertexCount + 1);
352
+ if (vertexCount > 0) {
353
+ valueOffsets.fill(values.length, 1);
354
+ }
355
+ const nullBitmap = new Uint8Array(Math.ceil(vertexCount / 8));
356
+ if (vertexCount > 0) {
357
+ nullBitmap[0] = 1;
358
+ }
359
+ const type = new arrow.List(new arrow.Field("item", new arrow.Uint32(), false));
360
+ const valuesData = new arrow.Data(type.children[0].type, 0, values.length, 0, {
361
+ [arrow.BufferType.DATA]: values
362
+ });
363
+ const indicesData = new arrow.Data(
364
+ type,
365
+ 0,
366
+ vertexCount,
367
+ Math.max(0, vertexCount - 1),
368
+ {
369
+ [arrow.BufferType.OFFSET]: valueOffsets,
370
+ [arrow.BufferType.VALIDITY]: nullBitmap
371
+ },
372
+ [valuesData]
373
+ );
374
+ return new arrow.Vector([indicesData]);
375
+ }
376
+ function makeFixedSizeListAttribute(table, columnNames, preferredType) {
377
+ const columns = columnNames.map((columnName) => table.getChild(columnName));
378
+ if (columns.some((column) => !column)) {
379
+ return null;
380
+ }
381
+ const rowCount = table.numRows;
382
+ const values = preferredType === "uchar" ? new Uint8Array(rowCount * columnNames.length) : new Float32Array(rowCount * columnNames.length);
383
+ for (let rowIndex = 0; rowIndex < rowCount; rowIndex++) {
384
+ for (let componentIndex = 0; componentIndex < columns.length; componentIndex++) {
385
+ values[rowIndex * columns.length + componentIndex] = Number(
386
+ columns[componentIndex].get(rowIndex) ?? 0
387
+ );
388
+ }
389
+ }
390
+ return { value: values, size: columnNames.length };
391
+ }
392
+ function getPLYElementTable(elementTables, elementName) {
393
+ return elementTables.elements.find((elementTable) => elementTable.element.name === elementName);
394
+ }
395
+ function getOrderedAttributeNames(attributes) {
396
+ const firstNames = ["POSITION", "indices"];
397
+ return [
398
+ ...firstNames.filter((attributeName) => attributeName in attributes),
399
+ ...Object.keys(attributes).filter((attributeName) => !firstNames.includes(attributeName))
400
+ ];
401
+ }
402
+ function getVectorValues(vector) {
403
+ const data = vector.data[0];
404
+ return data.values;
405
+ }
406
+ function getPLYTextBody(data) {
407
+ const match = PLY_END_HEADER_PATTERN.exec(data);
408
+ return match ? data.slice(match.index + match[0].length) : "";
409
+ }
410
+ function makeListVector(typeName, values, valueOffsets) {
411
+ const childType = getArrowType(typeName);
412
+ const type = new arrow.List(new arrow.Field("item", childType, false));
413
+ const typedValues = getTypedArray(values, typeName);
414
+ const valuesData = new arrow.Data(childType, 0, typedValues.length, 0, {
415
+ [arrow.BufferType.DATA]: typedValues
416
+ });
417
+ const listData = new arrow.Data(
418
+ type,
419
+ 0,
420
+ valueOffsets.length - 1,
421
+ 0,
422
+ { [arrow.BufferType.OFFSET]: valueOffsets },
423
+ [valuesData]
424
+ );
425
+ return new arrow.Vector([listData]);
426
+ }
427
+ function getTypedArray(values, type) {
428
+ switch (type) {
429
+ case "int8":
430
+ case "char":
431
+ return Int8Array.from(values);
432
+ case "uint8":
433
+ case "uchar":
434
+ return Uint8Array.from(values);
435
+ case "int16":
436
+ case "short":
437
+ return Int16Array.from(values);
438
+ case "uint16":
439
+ case "ushort":
440
+ return Uint16Array.from(values);
441
+ case "int32":
442
+ case "int":
443
+ return Int32Array.from(values);
444
+ case "uint32":
445
+ case "uint":
446
+ return Uint32Array.from(values);
447
+ case "float64":
448
+ case "double":
449
+ return Float64Array.from(values);
450
+ case "float32":
451
+ case "float":
452
+ default:
453
+ return Float32Array.from(values);
454
+ }
455
+ }
456
+ function getArrowType(type) {
457
+ switch (type) {
458
+ case "int8":
459
+ case "char":
460
+ return new arrow.Int8();
461
+ case "uint8":
462
+ case "uchar":
463
+ return new arrow.Uint8();
464
+ case "int16":
465
+ case "short":
466
+ return new arrow.Int16();
467
+ case "uint16":
468
+ case "ushort":
469
+ return new arrow.Uint16();
470
+ case "int32":
471
+ case "int":
472
+ return new arrow.Int32();
473
+ case "uint32":
474
+ case "uint":
475
+ return new arrow.Uint32();
476
+ case "float64":
477
+ case "double":
478
+ return new arrow.Float64();
479
+ case "float32":
480
+ case "float":
481
+ default:
482
+ return new arrow.Float32();
483
+ }
484
+ }
485
+ function parseASCIINumber(value, type) {
486
+ switch (type) {
487
+ case "char":
488
+ case "uchar":
489
+ case "short":
490
+ case "ushort":
491
+ case "int":
492
+ case "uint":
493
+ case "int8":
494
+ case "uint8":
495
+ case "int16":
496
+ case "uint16":
497
+ case "int32":
498
+ case "uint32":
499
+ return parseInt(value, 10);
500
+ case "float":
501
+ case "double":
502
+ case "float32":
503
+ case "float64":
504
+ return parseFloat(value);
505
+ default:
506
+ throw new Error(type);
507
+ }
508
+ }
509
+ function readBinaryNumber(dataView, byteOffset, type, littleEndian) {
510
+ switch (type) {
511
+ case "int8":
512
+ case "char":
513
+ return [dataView.getInt8(byteOffset), 1];
514
+ case "uint8":
515
+ case "uchar":
516
+ return [dataView.getUint8(byteOffset), 1];
517
+ case "int16":
518
+ case "short":
519
+ return [dataView.getInt16(byteOffset, littleEndian), 2];
520
+ case "uint16":
521
+ case "ushort":
522
+ return [dataView.getUint16(byteOffset, littleEndian), 2];
523
+ case "int32":
524
+ case "int":
525
+ return [dataView.getInt32(byteOffset, littleEndian), 4];
526
+ case "uint32":
527
+ case "uint":
528
+ return [dataView.getUint32(byteOffset, littleEndian), 4];
529
+ case "float32":
530
+ case "float":
531
+ return [dataView.getFloat32(byteOffset, littleEndian), 4];
532
+ case "float64":
533
+ case "double":
534
+ return [dataView.getFloat64(byteOffset, littleEndian), 8];
535
+ default:
536
+ throw new Error(type);
537
+ }
538
+ }
539
+ function getArrowMetadata(metadata) {
540
+ return new Map(
541
+ Object.entries(metadata || {}).filter(
542
+ (entry) => entry[1] !== void 0
543
+ )
544
+ );
545
+ }
546
+ // Annotate the CommonJS export names for ESM import in node:
547
+ 0 && (module.exports = {
548
+ convertPLYElementTablesToMesh,
549
+ convertPLYElementTablesToMeshArrowTable,
550
+ parsePLYToElementTables
551
+ });
552
+ //# sourceMappingURL=parse-ply-arrow.cjs.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../../src/ply/lib/parse-ply-arrow.ts"],
4
+ "sourcesContent": ["// loaders.gl\n// SPDX-License-Identifier: MIT\n// Copyright (c) vis.gl contributors\n\nimport type {\n Mesh,\n MeshAttribute,\n MeshAttributes,\n MeshArrowTable,\n TypedArray\n} from '@loaders.gl/core/schema';\nimport {getMeshBoundingBox, serializeArrowSchema} from '@loaders.gl/core/schema-utils';\nimport * as arrow from 'apache-arrow';\nimport type {ParsePLYOptions} from './parse-ply';\nimport {parsePLYHeader} from './parse-ply';\nimport {getPLYSchema} from './get-ply-schema';\nimport type {PLYElement, PLYHeader, PLYMesh, PLYProperty} from './ply-types';\n\nconst PLY_END_HEADER_PATTERN = /end_header\\s/;\n\n/** Internal Arrow representation preserving one table per PLY element. */\nexport type PLYElementTables = {\n /** Parsed PLY header. */\n header: PLYHeader;\n /** Raw Arrow tables keyed by PLY element order. */\n elements: PLYElementTable[];\n};\n\n/** Raw Arrow table for one PLY element. */\nexport type PLYElementTable = {\n /** PLY element definition. */\n element: PLYElement;\n /** Raw property table for the element. */\n table: arrow.Table;\n};\n\ntype PropertyCollector = {\n property: PLYProperty;\n values: number[];\n offsets?: number[];\n};\n\ntype ElementCollector = {\n element: PLYElement;\n properties: PropertyCollector[];\n};\n\n/** Parse a full PLY payload into raw Arrow element tables. */\nexport function parsePLYToElementTables(\n data: ArrayBuffer | string,\n options: ParsePLYOptions = {}\n): PLYElementTables {\n const header = parsePLYHeader(data, options);\n const parseHeader = options.pointCloud ? getPointCloudPLYHeader(header) : header;\n if (header.format === 'ascii') {\n const text = data instanceof ArrayBuffer ? new TextDecoder().decode(data) : data;\n return parseASCIIPLYToElementTables(text, parseHeader);\n }\n\n if (!(data instanceof ArrayBuffer)) {\n throw new Error('Binary PLY parsing requires an ArrayBuffer.');\n }\n return parseBinaryPLYToElementTables(data, parseHeader);\n}\n\n/** Convert raw PLY element tables into the public Mesh Arrow table shape. */\nexport function convertPLYElementTablesToMeshArrowTable(\n elementTables: PLYElementTables\n): MeshArrowTable {\n const mesh = convertPLYElementTablesToMesh(elementTables);\n return convertPLYMeshToArrowTable(mesh);\n}\n\n/** Convert raw PLY element tables into the legacy Mesh shape. */\nexport function convertPLYElementTablesToMesh(elementTables: PLYElementTables): PLYMesh {\n const attributes = getMeshAttributesFromPLYElementTables(elementTables);\n const indices = getMeshIndicesFromPLYElementTables(elementTables);\n const boundingBox = getMeshBoundingBox(attributes);\n const vertexCount = attributes.POSITION?.value.length ? attributes.POSITION.value.length / 3 : 0;\n const isTriangles = Boolean(indices?.value.length);\n const mode = isTriangles ? 4 : 0;\n const topology = isTriangles ? 'triangle-list' : 'point-list';\n const schema = getPLYSchema(elementTables.header, attributes);\n\n return {\n loader: 'ply',\n loaderData: elementTables.header,\n header: {\n vertexCount,\n boundingBox: boundingBox ?? undefined\n },\n schema,\n attributes,\n indices: indices || {value: new Uint32Array(0), size: 0},\n mode,\n topology\n };\n}\n\n/** Parse an ASCII PLY payload into raw Arrow element tables. */\nfunction parseASCIIPLYToElementTables(data: string, header: PLYHeader): PLYElementTables {\n const collector = createElementTablesCollector(header);\n const body = getPLYTextBody(data);\n const lines = body.split('\\n');\n let elementIndex = 0;\n let elementRowIndex = 0;\n\n for (const sourceLine of lines) {\n const line = sourceLine.trim();\n if (line === '') {\n continue;\n }\n while (\n elementIndex < header.elements.length &&\n elementRowIndex >= header.elements[elementIndex].count\n ) {\n elementIndex++;\n elementRowIndex = 0;\n }\n if (elementIndex >= header.elements.length) {\n break;\n }\n appendASCIIElementRow(collector[elementIndex], line);\n elementRowIndex++;\n }\n\n return {header, elements: collector.map(makePLYElementTable)};\n}\n\n/** Parse a binary PLY payload into raw Arrow element tables. */\nfunction parseBinaryPLYToElementTables(data: ArrayBuffer, header: PLYHeader): PLYElementTables {\n const collector = createElementTablesCollector(header);\n const dataView = new DataView(data, header.headerLength || 0);\n const littleEndian = header.format !== 'binary_big_endian';\n let byteOffset = 0;\n\n for (let elementIndex = 0; elementIndex < header.elements.length; elementIndex++) {\n const element = header.elements[elementIndex];\n for (let rowIndex = 0; rowIndex < element.count; rowIndex++) {\n byteOffset += appendBinaryElementRow(\n collector[elementIndex],\n dataView,\n byteOffset,\n littleEndian\n );\n }\n }\n\n return {header, elements: collector.map(makePLYElementTable)};\n}\n\n/** Return a vertex-only PLY header for point-cloud parsing. */\nfunction getPointCloudPLYHeader(header: PLYHeader): PLYHeader {\n const vertexElement = header.elements[0];\n if (vertexElement?.name !== 'vertex') {\n throw new Error('PLY pointCloud parsing requires a leading vertex element');\n }\n\n return {\n ...header,\n elements: [vertexElement]\n };\n}\n\n/** Create mutable collectors for all PLY element properties. */\nfunction createElementTablesCollector(header: PLYHeader): ElementCollector[] {\n return header.elements.map(element => ({\n element,\n properties: element.properties.map(property => ({\n property,\n values: [],\n offsets: property.type === 'list' ? [0] : undefined\n }))\n }));\n}\n\n/** Append one ASCII row to an element collector. */\nfunction appendASCIIElementRow(collector: ElementCollector, line: string): void {\n const values = line.split(/\\s+/);\n let valueIndex = 0;\n\n for (const propertyCollector of collector.properties) {\n const property = propertyCollector.property;\n if (property.type === 'list') {\n const count = parseASCIINumber(values[valueIndex++], property.countType!);\n for (let listIndex = 0; listIndex < count; listIndex++) {\n propertyCollector.values.push(parseASCIINumber(values[valueIndex++], property.itemType!));\n }\n propertyCollector.offsets!.push(propertyCollector.values.length);\n } else {\n propertyCollector.values.push(parseASCIINumber(values[valueIndex++], property.type));\n }\n }\n}\n\n/** Append one binary row to an element collector and return consumed bytes. */\nfunction appendBinaryElementRow(\n collector: ElementCollector,\n dataView: DataView,\n byteOffset: number,\n littleEndian: boolean\n): number {\n let localOffset = 0;\n\n for (const propertyCollector of collector.properties) {\n const property = propertyCollector.property;\n if (property.type === 'list') {\n const [count, countByteLength] = readBinaryNumber(\n dataView,\n byteOffset + localOffset,\n property.countType!,\n littleEndian\n );\n localOffset += countByteLength;\n for (let listIndex = 0; listIndex < count; listIndex++) {\n const [value, valueByteLength] = readBinaryNumber(\n dataView,\n byteOffset + localOffset,\n property.itemType!,\n littleEndian\n );\n propertyCollector.values.push(value);\n localOffset += valueByteLength;\n }\n propertyCollector.offsets!.push(propertyCollector.values.length);\n } else {\n const [value, valueByteLength] = readBinaryNumber(\n dataView,\n byteOffset + localOffset,\n property.type,\n littleEndian\n );\n propertyCollector.values.push(value);\n localOffset += valueByteLength;\n }\n }\n\n return localOffset;\n}\n\n/** Convert one element collector into an Arrow table. */\nfunction makePLYElementTable(collector: ElementCollector): PLYElementTable {\n const fields: arrow.Field[] = [];\n const columns: Record<string, arrow.Vector> = {};\n\n for (const propertyCollector of collector.properties) {\n const column = makePLYPropertyVector(propertyCollector);\n columns[propertyCollector.property.name] = column;\n fields.push(new arrow.Field(propertyCollector.property.name, column.type, false));\n }\n\n return {\n element: collector.element,\n table: new arrow.Table(new arrow.Schema(fields), columns)\n };\n}\n\n/** Return a raw Arrow vector for one PLY property. */\nfunction makePLYPropertyVector(collector: PropertyCollector): arrow.Vector {\n const property = collector.property;\n if (property.type === 'list') {\n return makeListVector(\n property.itemType!,\n collector.values,\n Int32Array.from(collector.offsets || [0])\n );\n }\n return arrow.makeVector(getTypedArray(collector.values, property.type) as any);\n}\n\n/** Return the Mesh attributes represented by the PLY vertex table. */\nfunction getMeshAttributesFromPLYElementTables(elementTables: PLYElementTables): MeshAttributes {\n const vertexTable = getPLYElementTable(elementTables, 'vertex');\n const attributes: MeshAttributes = {};\n if (!vertexTable) {\n return attributes;\n }\n\n const position = makeFixedSizeListAttribute(vertexTable.table, ['x', 'y', 'z'], 'float');\n if (position) {\n attributes.POSITION = position;\n }\n const normal = makeFixedSizeListAttribute(vertexTable.table, ['nx', 'ny', 'nz'], 'float');\n if (normal) {\n attributes.NORMAL = normal;\n }\n const textureCoordinates = makeFixedSizeListAttribute(vertexTable.table, ['s', 't'], 'float');\n if (textureCoordinates) {\n attributes.TEXCOORD_0 = textureCoordinates;\n }\n const color = makeFixedSizeListAttribute(vertexTable.table, ['red', 'green', 'blue'], 'uchar');\n if (color) {\n attributes.COLOR_0 = {...color, normalized: true};\n }\n\n const packedPropertyNames = new Set([\n 'x',\n 'y',\n 'z',\n 'nx',\n 'ny',\n 'nz',\n 's',\n 't',\n 'red',\n 'green',\n 'blue'\n ]);\n for (const property of vertexTable.element.properties) {\n if (property.type === 'list' || packedPropertyNames.has(property.name)) {\n continue;\n }\n const column = vertexTable.table.getChild(property.name);\n if (column) {\n attributes[property.name] = {\n value: getVectorValues(column) as TypedArray,\n size: 1\n };\n }\n }\n\n return attributes;\n}\n\n/** Return triangulated mesh indices represented by the face table. */\nfunction getMeshIndicesFromPLYElementTables(\n elementTables: PLYElementTables\n): MeshAttribute | undefined {\n const faceTable = getPLYElementTable(elementTables, 'face');\n const indicesColumn =\n faceTable?.table.getChild('vertex_indices') || faceTable?.table.getChild('vertex_index');\n if (!indicesColumn) {\n return undefined;\n }\n\n const indices: number[] = [];\n for (let rowIndex = 0; rowIndex < indicesColumn.length; rowIndex++) {\n const vertexIndices = indicesColumn.get(rowIndex) as ArrayLike<number> | null;\n if (!vertexIndices) {\n continue;\n }\n if (vertexIndices.length === 3) {\n indices.push(\n getArrayLikeValue(vertexIndices, 0),\n getArrayLikeValue(vertexIndices, 1),\n getArrayLikeValue(vertexIndices, 2)\n );\n } else if (vertexIndices.length === 4) {\n indices.push(\n getArrayLikeValue(vertexIndices, 0),\n getArrayLikeValue(vertexIndices, 1),\n getArrayLikeValue(vertexIndices, 3)\n );\n indices.push(\n getArrayLikeValue(vertexIndices, 1),\n getArrayLikeValue(vertexIndices, 2),\n getArrayLikeValue(vertexIndices, 3)\n );\n }\n }\n\n return indices.length > 0 ? {value: new Uint32Array(indices), size: 1} : undefined;\n}\n\n/** Return one value from an Array-like object or Arrow vector. */\nfunction getArrayLikeValue(values: ArrayLike<number>, index: number): number {\n return 'get' in values && typeof values.get === 'function'\n ? Number(values.get(index))\n : Number(values[index]);\n}\n\n/** Convert a Mesh into the public Mesh Arrow table shape. */\nfunction convertPLYMeshToArrowTable(mesh: Mesh): MeshArrowTable {\n const fields: arrow.Field[] = [];\n const columns: Record<string, arrow.Vector> = {};\n const attributeNames = getOrderedAttributeNames(mesh.attributes);\n\n for (const attributeName of attributeNames) {\n const attribute = mesh.attributes[attributeName];\n const column = makeMeshAttributeVector(attribute);\n columns[attributeName] = column;\n fields.push(getMeshAttributeField(mesh, attributeName, column));\n\n if (attributeName === 'POSITION' && mesh.indices?.value.length) {\n const indicesColumn = makeMeshIndicesVector(mesh.indices.value, column.length);\n columns.indices = indicesColumn;\n fields.push(new arrow.Field('indices', indicesColumn.type, true));\n }\n }\n\n const metadata = getArrowMetadata({\n ...mesh.schema.metadata,\n topology: mesh.topology,\n mode: String(mesh.mode),\n boundingBox: mesh.header?.boundingBox ? JSON.stringify(mesh.header.boundingBox) : undefined\n });\n const arrowSchema = new arrow.Schema(fields, metadata);\n\n return {\n shape: 'arrow-table',\n schema: serializeArrowSchema(arrowSchema),\n data: new arrow.Table(arrowSchema, columns),\n topology: mesh.topology,\n indices: mesh.indices?.value.length ? mesh.indices : undefined\n };\n}\n\n/** Return a mesh attribute vector. */\nfunction makeMeshAttributeVector(attribute: MeshAttribute): arrow.Vector {\n const {value, size} = attribute;\n if (size === 1) {\n return arrow.makeVector(value as any);\n }\n\n const values = arrow.makeVector(value as any);\n const child = values.data[0];\n const type = new arrow.FixedSizeList(size, new arrow.Field('value', child.type, false));\n const data = new arrow.Data(type, 0, value.length / size, 0, {}, [child]);\n return new arrow.Vector([data]);\n}\n\n/** Return a Mesh Arrow field, preserving PLY schema field metadata where available. */\nfunction getMeshAttributeField(\n mesh: Mesh,\n attributeName: string,\n column: arrow.Vector\n): arrow.Field {\n const field = mesh.schema.fields.find(schemaField => schemaField.name === attributeName);\n return new arrow.Field(attributeName, column.type, false, getArrowMetadata(field?.metadata));\n}\n\n/** Return an IndexedMesh indices column with the full index list stored in row 0. */\nfunction makeMeshIndicesVector(indices: MeshAttribute['value'], vertexCount: number): arrow.Vector {\n const values = indices instanceof Uint32Array ? indices : Uint32Array.from(indices);\n const valueOffsets = new Int32Array(vertexCount + 1);\n if (vertexCount > 0) {\n valueOffsets.fill(values.length, 1);\n }\n\n const nullBitmap = new Uint8Array(Math.ceil(vertexCount / 8));\n if (vertexCount > 0) {\n nullBitmap[0] = 1;\n }\n\n const type = new arrow.List(new arrow.Field('item', new arrow.Uint32(), false));\n const valuesData = new arrow.Data<arrow.Uint32>(type.children[0].type, 0, values.length, 0, {\n [arrow.BufferType.DATA]: values\n });\n const indicesData = new arrow.Data<arrow.List<arrow.Uint32>>(\n type,\n 0,\n vertexCount,\n Math.max(0, vertexCount - 1),\n {\n [arrow.BufferType.OFFSET]: valueOffsets,\n [arrow.BufferType.VALIDITY]: nullBitmap\n },\n [valuesData]\n );\n return new arrow.Vector([indicesData]);\n}\n\n/** Return a fixed-size list mesh attribute from separate scalar PLY columns. */\nfunction makeFixedSizeListAttribute(\n table: arrow.Table,\n columnNames: string[],\n preferredType: string\n): MeshAttribute | null {\n const columns = columnNames.map(columnName => table.getChild(columnName));\n if (columns.some(column => !column)) {\n return null;\n }\n\n const rowCount = table.numRows;\n const values =\n preferredType === 'uchar'\n ? new Uint8Array(rowCount * columnNames.length)\n : new Float32Array(rowCount * columnNames.length);\n for (let rowIndex = 0; rowIndex < rowCount; rowIndex++) {\n for (let componentIndex = 0; componentIndex < columns.length; componentIndex++) {\n values[rowIndex * columns.length + componentIndex] = Number(\n columns[componentIndex]!.get(rowIndex) ?? 0\n );\n }\n }\n\n return {value: values, size: columnNames.length};\n}\n\n/** Return a PLY element table by name. */\nfunction getPLYElementTable(\n elementTables: PLYElementTables,\n elementName: string\n): PLYElementTable | undefined {\n return elementTables.elements.find(elementTable => elementTable.element.name === elementName);\n}\n\n/** Return mesh attributes in stable public order. */\nfunction getOrderedAttributeNames(attributes: MeshAttributes): string[] {\n const firstNames = ['POSITION', 'indices'];\n return [\n ...firstNames.filter(attributeName => attributeName in attributes),\n ...Object.keys(attributes).filter(attributeName => !firstNames.includes(attributeName))\n ];\n}\n\n/** Return a vector's backing values. */\nfunction getVectorValues(vector: arrow.Vector): TypedArray {\n const data = vector.data[0];\n return data.values as TypedArray;\n}\n\n/** Return a PLY text body after the header terminator. */\nfunction getPLYTextBody(data: string): string {\n const match = PLY_END_HEADER_PATTERN.exec(data);\n return match ? data.slice(match.index + match[0].length) : '';\n}\n\n/** Return an Arrow list vector from value offsets and child values. */\nfunction makeListVector(\n typeName: string,\n values: number[],\n valueOffsets: Int32Array\n): arrow.Vector {\n const childType = getArrowType(typeName);\n const type = new arrow.List(new arrow.Field('item', childType, false));\n const typedValues = getTypedArray(values, typeName);\n const valuesData = new arrow.Data(childType, 0, typedValues.length, 0, {\n [arrow.BufferType.DATA]: typedValues\n });\n const listData = new arrow.Data(\n type,\n 0,\n valueOffsets.length - 1,\n 0,\n {[arrow.BufferType.OFFSET]: valueOffsets},\n [valuesData]\n );\n return new arrow.Vector([listData]);\n}\n\n/** Return a typed array for one PLY scalar type. */\nfunction getTypedArray(values: number[], type: string): TypedArray {\n switch (type) {\n case 'int8':\n case 'char':\n return Int8Array.from(values);\n case 'uint8':\n case 'uchar':\n return Uint8Array.from(values);\n case 'int16':\n case 'short':\n return Int16Array.from(values);\n case 'uint16':\n case 'ushort':\n return Uint16Array.from(values);\n case 'int32':\n case 'int':\n return Int32Array.from(values);\n case 'uint32':\n case 'uint':\n return Uint32Array.from(values);\n case 'float64':\n case 'double':\n return Float64Array.from(values);\n case 'float32':\n case 'float':\n default:\n return Float32Array.from(values);\n }\n}\n\n/** Return an Arrow scalar type for one PLY scalar type. */\nfunction getArrowType(type: string): arrow.DataType {\n switch (type) {\n case 'int8':\n case 'char':\n return new arrow.Int8();\n case 'uint8':\n case 'uchar':\n return new arrow.Uint8();\n case 'int16':\n case 'short':\n return new arrow.Int16();\n case 'uint16':\n case 'ushort':\n return new arrow.Uint16();\n case 'int32':\n case 'int':\n return new arrow.Int32();\n case 'uint32':\n case 'uint':\n return new arrow.Uint32();\n case 'float64':\n case 'double':\n return new arrow.Float64();\n case 'float32':\n case 'float':\n default:\n return new arrow.Float32();\n }\n}\n\n/** Parse one ASCII scalar value. */\nfunction parseASCIINumber(value: string, type: string): number {\n switch (type) {\n case 'char':\n case 'uchar':\n case 'short':\n case 'ushort':\n case 'int':\n case 'uint':\n case 'int8':\n case 'uint8':\n case 'int16':\n case 'uint16':\n case 'int32':\n case 'uint32':\n return parseInt(value, 10);\n case 'float':\n case 'double':\n case 'float32':\n case 'float64':\n return parseFloat(value);\n default:\n throw new Error(type);\n }\n}\n\n/** Read one binary scalar value and its byte length. */\nfunction readBinaryNumber(\n dataView: DataView,\n byteOffset: number,\n type: string,\n littleEndian: boolean\n): [number, number] {\n switch (type) {\n case 'int8':\n case 'char':\n return [dataView.getInt8(byteOffset), 1];\n case 'uint8':\n case 'uchar':\n return [dataView.getUint8(byteOffset), 1];\n case 'int16':\n case 'short':\n return [dataView.getInt16(byteOffset, littleEndian), 2];\n case 'uint16':\n case 'ushort':\n return [dataView.getUint16(byteOffset, littleEndian), 2];\n case 'int32':\n case 'int':\n return [dataView.getInt32(byteOffset, littleEndian), 4];\n case 'uint32':\n case 'uint':\n return [dataView.getUint32(byteOffset, littleEndian), 4];\n case 'float32':\n case 'float':\n return [dataView.getFloat32(byteOffset, littleEndian), 4];\n case 'float64':\n case 'double':\n return [dataView.getFloat64(byteOffset, littleEndian), 8];\n default:\n throw new Error(type);\n }\n}\n\n/** Convert optional metadata to Arrow metadata. */\nfunction getArrowMetadata(\n metadata: Record<string, string | undefined> | undefined\n): Map<string, string> {\n return new Map(\n Object.entries(metadata || {}).filter(\n (entry): entry is [string, string] => entry[1] !== undefined\n )\n );\n}\n"],
5
+ "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAWA,0BAAuD;AACvD,YAAuB;AAEvB,uBAA6B;AAC7B,4BAA2B;AAG3B,IAAM,yBAAyB;AA8BxB,SAAS,wBACd,MACA,UAA2B,CAAC,GACV;AAClB,QAAM,aAAS,iCAAe,MAAM,OAAO;AAC3C,QAAM,cAAc,QAAQ,aAAa,uBAAuB,MAAM,IAAI;AAC1E,MAAI,OAAO,WAAW,SAAS;AAC7B,UAAM,OAAO,gBAAgB,cAAc,IAAI,YAAY,EAAE,OAAO,IAAI,IAAI;AAC5E,WAAO,6BAA6B,MAAM,WAAW;AAAA,EACvD;AAEA,MAAI,EAAE,gBAAgB,cAAc;AAClC,UAAM,IAAI,MAAM,6CAA6C;AAAA,EAC/D;AACA,SAAO,8BAA8B,MAAM,WAAW;AACxD;AAGO,SAAS,wCACd,eACgB;AAChB,QAAM,OAAO,8BAA8B,aAAa;AACxD,SAAO,2BAA2B,IAAI;AACxC;AAGO,SAAS,8BAA8B,eAA0C;AACtF,QAAM,aAAa,sCAAsC,aAAa;AACtE,QAAM,UAAU,mCAAmC,aAAa;AAChE,QAAM,kBAAc,wCAAmB,UAAU;AACjD,QAAM,cAAc,WAAW,UAAU,MAAM,SAAS,WAAW,SAAS,MAAM,SAAS,IAAI;AAC/F,QAAM,cAAc,QAAQ,SAAS,MAAM,MAAM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YAAY,GAAG,CAAC;AAAA,IAC1D;AACE,YAAM,IAAI,MAAM,IAAI;AAAA,EACxB;AACF;AAGA,SAAS,iBACP,UACqB;AACrB,SAAO,IAAI;AAAA,IACT,OAAO,QAAQ,YAAY,CAAC,CAAC,EAAE;AAAA,MAC7B,CAAC,UAAqC,MAAM,CAAC,MAAM;AAAA,IACrD;AAAA,EACF;AACF;",
6
+ "names": []
7
+ }
@@ -0,0 +1,25 @@
1
+ import type { MeshArrowTable } from '@loaders.gl/core/schema';
2
+ import * as arrow from 'apache-arrow';
3
+ import type { ParsePLYOptions } from "./parse-ply.js";
4
+ import type { PLYElement, PLYHeader, PLYMesh } from "./ply-types.js";
5
+ /** Internal Arrow representation preserving one table per PLY element. */
6
+ export type PLYElementTables = {
7
+ /** Parsed PLY header. */
8
+ header: PLYHeader;
9
+ /** Raw Arrow tables keyed by PLY element order. */
10
+ elements: PLYElementTable[];
11
+ };
12
+ /** Raw Arrow table for one PLY element. */
13
+ export type PLYElementTable = {
14
+ /** PLY element definition. */
15
+ element: PLYElement;
16
+ /** Raw property table for the element. */
17
+ table: arrow.Table;
18
+ };
19
+ /** Parse a full PLY payload into raw Arrow element tables. */
20
+ export declare function parsePLYToElementTables(data: ArrayBuffer | string, options?: ParsePLYOptions): PLYElementTables;
21
+ /** Convert raw PLY element tables into the public Mesh Arrow table shape. */
22
+ export declare function convertPLYElementTablesToMeshArrowTable(elementTables: PLYElementTables): MeshArrowTable;
23
+ /** Convert raw PLY element tables into the legacy Mesh shape. */
24
+ export declare function convertPLYElementTablesToMesh(elementTables: PLYElementTables): PLYMesh;
25
+ //# sourceMappingURL=parse-ply-arrow.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"parse-ply-arrow.d.ts","sourceRoot":"","sources":["../../../src/ply/lib/parse-ply-arrow.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAIV,cAAc,EAEf,MAAM,yBAAyB,CAAC;AAEjC,OAAO,KAAK,KAAK,MAAM,cAAc,CAAC;AACtC,OAAO,KAAK,EAAC,eAAe,EAAC,uBAAoB;AAGjD,OAAO,KAAK,EAAC,UAAU,EAAE,SAAS,EAAE,OAAO,EAAc,uBAAoB;AAI7E,0EAA0E;AAC1E,MAAM,MAAM,gBAAgB,GAAG;IAC7B,yBAAyB;IACzB,MAAM,EAAE,SAAS,CAAC;IAClB,mDAAmD;IACnD,QAAQ,EAAE,eAAe,EAAE,CAAC;CAC7B,CAAC;AAEF,2CAA2C;AAC3C,MAAM,MAAM,eAAe,GAAG;IAC5B,8BAA8B;IAC9B,OAAO,EAAE,UAAU,CAAC;IACpB,0CAA0C;IAC1C,KAAK,EAAE,KAAK,CAAC,KAAK,CAAC;CACpB,CAAC;AAaF,8DAA8D;AAC9D,wBAAgB,uBAAuB,CACrC,IAAI,EAAE,WAAW,GAAG,MAAM,EAC1B,OAAO,GAAE,eAAoB,GAC5B,gBAAgB,CAYlB;AAED,6EAA6E;AAC7E,wBAAgB,uCAAuC,CACrD,aAAa,EAAE,gBAAgB,GAC9B,cAAc,CAGhB;AAED,iEAAiE;AACjE,wBAAgB,6BAA6B,CAAC,aAAa,EAAE,gBAAgB,GAAG,OAAO,CAuBtF"}