@loaders.gl/pointclouds 0.0.0-stage → 5.0.0-beta.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (405) 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 +7 -2
  6. package/THIRD-PARTY-NOTICES.md +27 -0
  7. package/dist/dist.dev.js +30141 -0
  8. package/dist/dist.min.js +54 -0
  9. package/dist/index.cjs +61 -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 +72 -0
  16. package/dist/las/bundled.cjs.map +7 -0
  17. package/dist/las/bundled.d.ts +12 -0
  18. package/dist/las/bundled.d.ts.map +1 -0
  19. package/dist/las/bundled.js +12 -0
  20. package/dist/las/bundled.js.map +1 -0
  21. package/dist/las/index.cjs +78 -0
  22. package/dist/las/index.cjs.map +7 -0
  23. package/dist/las/index.d.ts +17 -0
  24. package/dist/las/index.d.ts.map +1 -0
  25. package/dist/las/index.js +15 -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 +63 -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 +57 -0
  34. package/dist/las/las-copc-loader.cjs.map +7 -0
  35. package/dist/las/las-copc-loader.d.ts +37 -0
  36. package/dist/las/las-copc-loader.d.ts.map +1 -0
  37. package/dist/las/las-copc-loader.js +40 -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 +82 -0
  46. package/dist/las/las-loader-shared.cjs.map +7 -0
  47. package/dist/las/las-loader-shared.d.ts +66 -0
  48. package/dist/las/las-loader-shared.d.ts.map +1 -0
  49. package/dist/las/las-loader-shared.js +58 -0
  50. package/dist/las/las-loader-shared.js.map +1 -0
  51. package/dist/las/las-loader-types.cjs +54 -0
  52. package/dist/las/las-loader-types.cjs.map +7 -0
  53. package/dist/las/las-loader-types.d.ts +104 -0
  54. package/dist/las/las-loader-types.d.ts.map +1 -0
  55. package/dist/las/las-loader-types.js +19 -0
  56. package/dist/las/las-loader-types.js.map +1 -0
  57. package/dist/las/las-loader.cjs +80 -0
  58. package/dist/las/las-loader.cjs.map +7 -0
  59. package/dist/las/las-loader.d.ts +45 -0
  60. package/dist/las/las-loader.d.ts.map +1 -0
  61. package/dist/las/las-loader.js +58 -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 +69 -0
  66. package/dist/las/las-writer.d.ts.map +1 -0
  67. package/dist/las/las-writer.js +994 -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 +65 -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 +272 -0
  76. package/dist/las/laz-rs-loader.cjs.map +7 -0
  77. package/dist/las/laz-rs-loader.d.ts +37 -0
  78. package/dist/las/laz-rs-loader.d.ts.map +1 -0
  79. package/dist/las/laz-rs-loader.js +38 -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 +67 -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 +60 -0
  88. package/dist/las/lazperf-loader.cjs.map +7 -0
  89. package/dist/las/lazperf-loader.d.ts +39 -0
  90. package/dist/las/lazperf-loader.d.ts.map +1 -0
  91. package/dist/las/lazperf-loader.js +44 -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 +62 -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 +46 -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 +223 -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 +195 -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 +270 -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 +307 -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 +270 -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 +307 -0
  152. package/dist/las/lib/laz-rs-wasm/parse-las.js.map +1 -0
  153. package/dist/las/lib/typescript/parse-las.cjs +2767 -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 +2607 -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 +71 -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-worker.js +23058 -0
  184. package/dist/pcd/bundled.cjs +33 -0
  185. package/dist/pcd/bundled.cjs.map +7 -0
  186. package/dist/pcd/bundled.d.ts +3 -0
  187. package/dist/pcd/bundled.d.ts.map +1 -0
  188. package/dist/pcd/bundled.js +5 -0
  189. package/dist/pcd/bundled.js.map +1 -0
  190. package/dist/pcd/index.cjs +40 -0
  191. package/dist/pcd/index.cjs.map +7 -0
  192. package/dist/pcd/index.d.ts +8 -0
  193. package/dist/pcd/index.d.ts.map +1 -0
  194. package/dist/pcd/index.js +10 -0
  195. package/dist/pcd/index.js.map +1 -0
  196. package/dist/pcd/lib/decompress-lzf.cjs +80 -0
  197. package/dist/pcd/lib/decompress-lzf.cjs.map +7 -0
  198. package/dist/pcd/lib/decompress-lzf.d.ts +7 -0
  199. package/dist/pcd/lib/decompress-lzf.d.ts.map +1 -0
  200. package/dist/pcd/lib/decompress-lzf.js +62 -0
  201. package/dist/pcd/lib/decompress-lzf.js.map +1 -0
  202. package/dist/pcd/lib/get-pcd-schema.cjs +70 -0
  203. package/dist/pcd/lib/get-pcd-schema.cjs.map +7 -0
  204. package/dist/pcd/lib/get-pcd-schema.d.ts +10 -0
  205. package/dist/pcd/lib/get-pcd-schema.d.ts.map +1 -0
  206. package/dist/pcd/lib/get-pcd-schema.js +53 -0
  207. package/dist/pcd/lib/get-pcd-schema.js.map +1 -0
  208. package/dist/pcd/lib/parse-pcd.cjs +354 -0
  209. package/dist/pcd/lib/parse-pcd.cjs.map +7 -0
  210. package/dist/pcd/lib/parse-pcd.d.ts +20 -0
  211. package/dist/pcd/lib/parse-pcd.d.ts.map +1 -0
  212. package/dist/pcd/lib/parse-pcd.js +341 -0
  213. package/dist/pcd/lib/parse-pcd.js.map +1 -0
  214. package/dist/pcd/lib/pcd-types.cjs +19 -0
  215. package/dist/pcd/lib/pcd-types.cjs.map +7 -0
  216. package/dist/pcd/lib/pcd-types.d.ts +31 -0
  217. package/dist/pcd/lib/pcd-types.d.ts.map +1 -0
  218. package/dist/pcd/lib/pcd-types.js +5 -0
  219. package/dist/pcd/lib/pcd-types.js.map +1 -0
  220. package/dist/pcd/pcd-format.cjs +42 -0
  221. package/dist/pcd/pcd-format.cjs.map +7 -0
  222. package/dist/pcd/pcd-format.d.ts +16 -0
  223. package/dist/pcd/pcd-format.d.ts.map +1 -0
  224. package/dist/pcd/pcd-format.js +19 -0
  225. package/dist/pcd/pcd-format.js.map +1 -0
  226. package/dist/pcd/pcd-loader-types.cjs +64 -0
  227. package/dist/pcd/pcd-loader-types.cjs.map +7 -0
  228. package/dist/pcd/pcd-loader-types.d.ts +105 -0
  229. package/dist/pcd/pcd-loader-types.d.ts.map +1 -0
  230. package/dist/pcd/pcd-loader-types.js +35 -0
  231. package/dist/pcd/pcd-loader-types.js.map +1 -0
  232. package/dist/pcd/pcd-loader.cjs +144 -0
  233. package/dist/pcd/pcd-loader.cjs.map +7 -0
  234. package/dist/pcd/pcd-loader.d.ts +44 -0
  235. package/dist/pcd/pcd-loader.d.ts.map +1 -0
  236. package/dist/pcd/pcd-loader.js +128 -0
  237. package/dist/pcd/pcd-loader.js.map +1 -0
  238. package/dist/pcd/pcd-writer.cjs +134 -0
  239. package/dist/pcd/pcd-writer.cjs.map +7 -0
  240. package/dist/pcd/pcd-writer.d.ts +37 -0
  241. package/dist/pcd/pcd-writer.d.ts.map +1 -0
  242. package/dist/pcd/pcd-writer.js +115 -0
  243. package/dist/pcd/pcd-writer.js.map +1 -0
  244. package/dist/pcd/unbundled.cjs +33 -0
  245. package/dist/pcd/unbundled.cjs.map +7 -0
  246. package/dist/pcd/unbundled.d.ts +3 -0
  247. package/dist/pcd/unbundled.d.ts.map +1 -0
  248. package/dist/pcd/unbundled.js +5 -0
  249. package/dist/pcd/unbundled.js.map +1 -0
  250. package/dist/pcd/workers/pcd-worker.cjs +23 -0
  251. package/dist/pcd/workers/pcd-worker.cjs.map +7 -0
  252. package/dist/pcd/workers/pcd-worker.d.ts +2 -0
  253. package/dist/pcd/workers/pcd-worker.d.ts.map +1 -0
  254. package/dist/pcd/workers/pcd-worker.js +23 -0
  255. package/dist/pcd/workers/pcd-worker.js.map +1 -0
  256. package/dist/pcd-worker.js +17522 -0
  257. package/dist/ply/bundled.cjs +33 -0
  258. package/dist/ply/bundled.cjs.map +7 -0
  259. package/dist/ply/bundled.d.ts +3 -0
  260. package/dist/ply/bundled.d.ts.map +1 -0
  261. package/dist/ply/bundled.js +5 -0
  262. package/dist/ply/bundled.js.map +1 -0
  263. package/dist/ply/index.cjs +40 -0
  264. package/dist/ply/index.cjs.map +7 -0
  265. package/dist/ply/index.d.ts +8 -0
  266. package/dist/ply/index.d.ts.map +1 -0
  267. package/dist/ply/index.js +11 -0
  268. package/dist/ply/index.js.map +1 -0
  269. package/dist/ply/lib/get-ply-schema.cjs +126 -0
  270. package/dist/ply/lib/get-ply-schema.cjs.map +7 -0
  271. package/dist/ply/lib/get-ply-schema.d.ts +10 -0
  272. package/dist/ply/lib/get-ply-schema.d.ts.map +1 -0
  273. package/dist/ply/lib/get-ply-schema.js +117 -0
  274. package/dist/ply/lib/get-ply-schema.js.map +1 -0
  275. package/dist/ply/lib/normalize-ply.cjs +96 -0
  276. package/dist/ply/lib/normalize-ply.cjs.map +7 -0
  277. package/dist/ply/lib/normalize-ply.d.ts +8 -0
  278. package/dist/ply/lib/normalize-ply.d.ts.map +1 -0
  279. package/dist/ply/lib/normalize-ply.js +89 -0
  280. package/dist/ply/lib/normalize-ply.js.map +1 -0
  281. package/dist/ply/lib/parse-ply-arrow.cjs +552 -0
  282. package/dist/ply/lib/parse-ply-arrow.cjs.map +7 -0
  283. package/dist/ply/lib/parse-ply-arrow.d.ts +25 -0
  284. package/dist/ply/lib/parse-ply-arrow.d.ts.map +1 -0
  285. package/dist/ply/lib/parse-ply-arrow.js +493 -0
  286. package/dist/ply/lib/parse-ply-arrow.js.map +1 -0
  287. package/dist/ply/lib/parse-ply-in-batches.cjs +607 -0
  288. package/dist/ply/lib/parse-ply-in-batches.cjs.map +7 -0
  289. package/dist/ply/lib/parse-ply-in-batches.d.ts +9 -0
  290. package/dist/ply/lib/parse-ply-in-batches.d.ts.map +1 -0
  291. package/dist/ply/lib/parse-ply-in-batches.js +625 -0
  292. package/dist/ply/lib/parse-ply-in-batches.js.map +1 -0
  293. package/dist/ply/lib/parse-ply.cjs +755 -0
  294. package/dist/ply/lib/parse-ply.cjs.map +7 -0
  295. package/dist/ply/lib/parse-ply.d.ts +69 -0
  296. package/dist/ply/lib/parse-ply.d.ts.map +1 -0
  297. package/dist/ply/lib/parse-ply.js +851 -0
  298. package/dist/ply/lib/parse-ply.js.map +1 -0
  299. package/dist/ply/lib/ply-types.cjs +19 -0
  300. package/dist/ply/lib/ply-types.cjs.map +7 -0
  301. package/dist/ply/lib/ply-types.d.ts +37 -0
  302. package/dist/ply/lib/ply-types.d.ts.map +1 -0
  303. package/dist/ply/lib/ply-types.js +2 -0
  304. package/dist/ply/lib/ply-types.js.map +1 -0
  305. package/dist/ply/ply-format.cjs +43 -0
  306. package/dist/ply/ply-format.cjs.map +7 -0
  307. package/dist/ply/ply-format.d.ts +18 -0
  308. package/dist/ply/ply-format.d.ts.map +1 -0
  309. package/dist/ply/ply-format.js +22 -0
  310. package/dist/ply/ply-format.js.map +1 -0
  311. package/dist/ply/ply-loader-types.cjs +65 -0
  312. package/dist/ply/ply-loader-types.cjs.map +7 -0
  313. package/dist/ply/ply-loader-types.d.ts +111 -0
  314. package/dist/ply/ply-loader-types.d.ts.map +1 -0
  315. package/dist/ply/ply-loader-types.js +38 -0
  316. package/dist/ply/ply-loader-types.js.map +1 -0
  317. package/dist/ply/ply-loader.cjs +134 -0
  318. package/dist/ply/ply-loader.cjs.map +7 -0
  319. package/dist/ply/ply-loader.d.ts +44 -0
  320. package/dist/ply/ply-loader.d.ts.map +1 -0
  321. package/dist/ply/ply-loader.js +121 -0
  322. package/dist/ply/ply-loader.js.map +1 -0
  323. package/dist/ply/ply-writer.cjs +175 -0
  324. package/dist/ply/ply-writer.cjs.map +7 -0
  325. package/dist/ply/ply-writer.d.ts +37 -0
  326. package/dist/ply/ply-writer.d.ts.map +1 -0
  327. package/dist/ply/ply-writer.js +140 -0
  328. package/dist/ply/ply-writer.js.map +1 -0
  329. package/dist/ply/unbundled.cjs +33 -0
  330. package/dist/ply/unbundled.cjs.map +7 -0
  331. package/dist/ply/unbundled.d.ts +3 -0
  332. package/dist/ply/unbundled.d.ts.map +1 -0
  333. package/dist/ply/unbundled.js +5 -0
  334. package/dist/ply/unbundled.js.map +1 -0
  335. package/dist/ply/workers/ply-worker.cjs +34 -0
  336. package/dist/ply/workers/ply-worker.cjs.map +7 -0
  337. package/dist/ply/workers/ply-worker.d.ts +2 -0
  338. package/dist/ply/workers/ply-worker.d.ts.map +1 -0
  339. package/dist/ply/workers/ply-worker.js +37 -0
  340. package/dist/ply/workers/ply-worker.js.map +1 -0
  341. package/dist/ply-worker.js +19175 -0
  342. package/package.json +234 -4
  343. package/src/index.ts +19 -0
  344. package/src/las/bundled.ts +39 -0
  345. package/src/las/index.ts +70 -0
  346. package/src/las/las-copc-loader-types.ts +18 -0
  347. package/src/las/las-copc-loader.ts +61 -0
  348. package/src/las/las-format.ts +21 -0
  349. package/src/las/las-loader-shared.ts +124 -0
  350. package/src/las/las-loader-types.ts +27 -0
  351. package/src/las/las-loader.ts +109 -0
  352. package/src/las/las-writer.ts +1473 -0
  353. package/src/las/laz-rs-loader-types.ts +21 -0
  354. package/src/las/laz-rs-loader.ts +53 -0
  355. package/src/las/lazperf-loader-types.ts +22 -0
  356. package/src/las/lazperf-loader.ts +65 -0
  357. package/src/las/lib/LASZIP-LICENSE +202 -0
  358. package/src/las/lib/LASZIP-NOTICE +4 -0
  359. package/src/las/lib/copc/parse-las.ts +265 -0
  360. package/src/las/lib/get-las-schema.ts +50 -0
  361. package/src/las/lib/las-compatibility.ts +178 -0
  362. package/src/las/lib/las-extra-bytes.ts +274 -0
  363. package/src/las/lib/las-types.ts +206 -0
  364. package/src/las/lib/las-waveform.ts +292 -0
  365. package/src/las/lib/laz-perf/laslaz-decoder.ts +443 -0
  366. package/src/las/lib/laz-perf/parse-las.ts +412 -0
  367. package/src/las/lib/laz-rs-wasm/laslaz-decoder.ts +488 -0
  368. package/src/las/lib/laz-rs-wasm/parse-las.ts +412 -0
  369. package/src/las/lib/typescript/parse-las.ts +3730 -0
  370. package/src/las/libs/laz-perf/laz-perf.ts +20615 -0
  371. package/src/las/libs/laz-rs-wasm/laz_rs_wasm.d.ts +89 -0
  372. package/src/las/libs/laz-rs-wasm/laz_rs_wasm.js +497 -0
  373. package/src/las/libs/laz-rs-wasm/laz_rs_wasm_bg.wasm +0 -0
  374. package/src/las/libs/laz-rs-wasm/laz_rs_wasm_bg.wasm.d.ts +38 -0
  375. package/src/las/libs/laz-rs-wasm/package.json +19 -0
  376. package/src/las/unbundled.ts +38 -0
  377. package/src/las/workers/las-worker.ts +24 -0
  378. package/src/pcd/bundled.ts +9 -0
  379. package/src/pcd/index.ts +13 -0
  380. package/src/pcd/lib/decompress-lzf.ts +68 -0
  381. package/src/pcd/lib/get-pcd-schema.ts +66 -0
  382. package/src/pcd/lib/parse-pcd.ts +474 -0
  383. package/src/pcd/lib/pcd-types.ts +34 -0
  384. package/src/pcd/pcd-format.ts +21 -0
  385. package/src/pcd/pcd-loader-types.ts +53 -0
  386. package/src/pcd/pcd-loader.ts +179 -0
  387. package/src/pcd/pcd-writer.ts +152 -0
  388. package/src/pcd/unbundled.ts +6 -0
  389. package/src/pcd/workers/pcd-worker.ts +24 -0
  390. package/src/ply/bundled.ts +9 -0
  391. package/src/ply/index.ts +15 -0
  392. package/src/ply/lib/get-ply-schema.ts +133 -0
  393. package/src/ply/lib/normalize-ply.ts +110 -0
  394. package/src/ply/lib/parse-ply-arrow.ts +676 -0
  395. package/src/ply/lib/parse-ply-in-batches.ts +827 -0
  396. package/src/ply/lib/parse-ply.ts +1081 -0
  397. package/src/ply/lib/ply-types.ts +47 -0
  398. package/src/ply/ply-format.ts +24 -0
  399. package/src/ply/ply-loader-types.ts +61 -0
  400. package/src/ply/ply-loader.ts +185 -0
  401. package/src/ply/ply-writer.ts +215 -0
  402. package/src/ply/unbundled.ts +6 -0
  403. package/src/ply/workers/ply-worker.ts +40 -0
  404. package/third-party-licenses/plasio-LICENSE +21 -0
  405. package/third-party-licenses/three-LICENSE +21 -0
@@ -0,0 +1,607 @@
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-in-batches.ts
31
+ var parse_ply_in_batches_exports = {};
32
+ __export(parse_ply_in_batches_exports, {
33
+ parsePLYInBatches: () => parsePLYInBatches
34
+ });
35
+ module.exports = __toCommonJS(parse_ply_in_batches_exports);
36
+ var import_loader_utils = require("@loaders.gl/core/loader-utils");
37
+ var import_normalize_ply = __toESM(require("./normalize-ply.cjs"), 1);
38
+ var import_parse_ply = require("./parse-ply.cjs");
39
+ var import_parse_ply_arrow = require("./parse-ply-arrow.cjs");
40
+ var DEFAULT_BINARY_BATCH_SIZE = 65536;
41
+ var PLY_END_HEADER = "end_header";
42
+ async function* parsePLYInBatches(iterator, options) {
43
+ if (options?.shape === "arrow-table") {
44
+ yield* parseBinaryPLYToArrowInBatches(iterator, options);
45
+ return;
46
+ }
47
+ const lineIterator = (0, import_loader_utils.makeLineIterator)((0, import_loader_utils.makeTextDecoderIterator)((0, import_loader_utils.toArrayBufferIterator)(iterator)));
48
+ const header = await parseASCIIHeader(lineIterator, options);
49
+ let attributes;
50
+ switch (header.format) {
51
+ case "ascii":
52
+ attributes = await parseASCII(lineIterator, header);
53
+ break;
54
+ default:
55
+ throw new Error("Binary PLY can not yet be parsed in streaming mode");
56
+ }
57
+ yield (0, import_normalize_ply.default)(header, attributes, options);
58
+ }
59
+ async function* parseBinaryPLYToArrowInBatches(iterator, options) {
60
+ const byteIterator = (0, import_loader_utils.toArrayBufferIterator)(iterator)[Symbol.asyncIterator]();
61
+ const { header, initialBodyBytes } = await readPLYHeader(byteIterator, options);
62
+ let tables;
63
+ if (header.format === "ascii") {
64
+ tables = parseASCIIPLYToArrowInBatches(byteIterator, header, initialBodyBytes, options);
65
+ } else {
66
+ const vertexElement = getVertexElement(header, options);
67
+ tables = vertexElement.properties.some((property) => property.type === "list") ? parseBinaryVariableWidthVertexPLYToArrowInBatches(
68
+ byteIterator,
69
+ header,
70
+ initialBodyBytes,
71
+ options
72
+ ) : parseBinaryFixedWidthVertexPLYToArrowInBatches(
73
+ byteIterator,
74
+ header,
75
+ initialBodyBytes,
76
+ options
77
+ );
78
+ }
79
+ for await (const table of tables) {
80
+ yield { ...table, loaderData: header };
81
+ }
82
+ }
83
+ async function* parseBinaryFixedWidthVertexPLYToArrowInBatches(byteIterator, header, initialBodyBytes, options) {
84
+ const vertexElement = getFixedWidthVertexElement(header, options);
85
+ const batchSize = getBatchSize(options);
86
+ const vertexStride = getPLYElementSize(vertexElement);
87
+ const parsePlan = (0, import_parse_ply.getPLYBinaryPointCloudParsePlan)(header, options);
88
+ let remainingVertices = vertexElement.count;
89
+ let pendingBytes = initialBodyBytes;
90
+ while (true) {
91
+ while (remainingVertices > 0 && Math.floor(pendingBytes.length / vertexStride) >= batchSize) {
92
+ const batchVertexCount = Math.min(batchSize, remainingVertices);
93
+ const batch = makeBinaryPLYArrowBatch(
94
+ header,
95
+ pendingBytes,
96
+ batchVertexCount,
97
+ vertexStride,
98
+ options,
99
+ parsePlan
100
+ );
101
+ pendingBytes = pendingBytes.subarray(batchVertexCount * vertexStride);
102
+ remainingVertices -= batchVertexCount;
103
+ yield batch;
104
+ }
105
+ if (options?.pointCloud && remainingVertices <= 0) {
106
+ return;
107
+ }
108
+ const { value: chunk, done } = await byteIterator.next();
109
+ if (done) {
110
+ break;
111
+ }
112
+ pendingBytes = concatenateBytes([pendingBytes, getUint8Array(chunk)]);
113
+ }
114
+ if (remainingVertices > 0) {
115
+ const batchVertexCount = Math.min(
116
+ remainingVertices,
117
+ Math.floor(pendingBytes.length / vertexStride)
118
+ );
119
+ if (batchVertexCount > 0) {
120
+ yield makeBinaryPLYArrowBatch(
121
+ header,
122
+ pendingBytes,
123
+ batchVertexCount,
124
+ vertexStride,
125
+ options,
126
+ parsePlan
127
+ );
128
+ }
129
+ }
130
+ }
131
+ async function* parseASCIIPLYToArrowInBatches(byteIterator, header, initialBodyBytes, options) {
132
+ const vertexElement = getVertexElement(header, options);
133
+ const batchSize = getBatchSize(options);
134
+ const lineIterator = (0, import_loader_utils.makeLineIterator)(
135
+ (0, import_loader_utils.makeTextDecoderIterator)(getByteIteratorWithInitialBytes(byteIterator, initialBodyBytes))
136
+ );
137
+ let batchLines = [];
138
+ let remainingVertices = vertexElement.count;
139
+ for await (const sourceLine of lineIterator) {
140
+ const line = sourceLine.trim();
141
+ if (line === "") {
142
+ continue;
143
+ }
144
+ batchLines.push(line);
145
+ remainingVertices--;
146
+ if (batchLines.length >= batchSize) {
147
+ yield makeASCIIPLYArrowBatch(header, batchLines, options);
148
+ batchLines = [];
149
+ }
150
+ if (remainingVertices <= 0) {
151
+ break;
152
+ }
153
+ }
154
+ if (batchLines.length > 0) {
155
+ yield makeASCIIPLYArrowBatch(header, batchLines, options);
156
+ }
157
+ }
158
+ async function* parseBinaryVariableWidthVertexPLYToArrowInBatches(byteIterator, header, initialBodyBytes, options) {
159
+ const vertexElement = getVertexElement(header, options);
160
+ const batchSize = getBatchSize(options);
161
+ const littleEndian = header.format !== "binary_big_endian";
162
+ let remainingVertices = vertexElement.count;
163
+ let pendingBytes = initialBodyBytes;
164
+ let batchBytes = [];
165
+ let batchByteLength = 0;
166
+ let batchRowCount = 0;
167
+ while (remainingVertices > 0) {
168
+ const rowByteLength = getBinaryElementRowByteLength(pendingBytes, vertexElement, littleEndian);
169
+ if (rowByteLength === null) {
170
+ const { value: chunk, done } = await byteIterator.next();
171
+ if (done) {
172
+ break;
173
+ }
174
+ pendingBytes = concatenateBytes([pendingBytes, getUint8Array(chunk)]);
175
+ continue;
176
+ }
177
+ const rowBytes = pendingBytes.subarray(0, rowByteLength);
178
+ batchBytes.push(rowBytes);
179
+ batchByteLength += rowByteLength;
180
+ batchRowCount++;
181
+ remainingVertices--;
182
+ pendingBytes = pendingBytes.subarray(rowByteLength);
183
+ if (batchRowCount >= batchSize) {
184
+ yield makeBinaryPLYArrowBatchFromRows(
185
+ header,
186
+ batchBytes,
187
+ batchByteLength,
188
+ batchRowCount,
189
+ options
190
+ );
191
+ batchBytes = [];
192
+ batchByteLength = 0;
193
+ batchRowCount = 0;
194
+ }
195
+ }
196
+ if (batchRowCount > 0) {
197
+ yield makeBinaryPLYArrowBatchFromRows(
198
+ header,
199
+ batchBytes,
200
+ batchByteLength,
201
+ batchRowCount,
202
+ options
203
+ );
204
+ }
205
+ }
206
+ async function readPLYHeader(iterator, options) {
207
+ let headerBytes = new Uint8Array(0);
208
+ while (true) {
209
+ const { value, done } = await iterator.next();
210
+ if (done) {
211
+ throw new Error("Incomplete PLY header");
212
+ }
213
+ headerBytes = concatenateBytes([headerBytes, getUint8Array(value)]);
214
+ const headerEnd = findHeaderEnd(headerBytes);
215
+ if (headerEnd === -1) {
216
+ continue;
217
+ }
218
+ const header = (0, import_parse_ply.parsePLYHeader)(getArrayBuffer(headerBytes.subarray(0, headerEnd)), options);
219
+ return { header, initialBodyBytes: headerBytes.subarray(headerEnd) };
220
+ }
221
+ }
222
+ function getVertexElement(header, options) {
223
+ const vertexElement = header.elements[0];
224
+ if (!options?.pointCloud && header.elements.length !== 1 || vertexElement?.name !== "vertex") {
225
+ throw new Error("PLY arrow-table batch parsing requires one vertex element");
226
+ }
227
+ return vertexElement;
228
+ }
229
+ function getFixedWidthVertexElement(header, options) {
230
+ const vertexElement = header.elements[0];
231
+ if (!options?.pointCloud && header.elements.length !== 1 || vertexElement?.name !== "vertex" || vertexElement.properties.some((property) => property.type === "list")) {
232
+ throw new Error("Binary PLY arrow-table batch parsing requires one scalar vertex element");
233
+ }
234
+ return vertexElement;
235
+ }
236
+ function makeBinaryPLYArrowBatch(header, pendingBytes, vertexCount, vertexStride, options, parsePlan) {
237
+ const vertexElement = header.elements[0];
238
+ const batchHeader = {
239
+ ...header,
240
+ headerLength: 0,
241
+ elements: [{ ...vertexElement, count: vertexCount }]
242
+ };
243
+ const byteLength = vertexCount * vertexStride;
244
+ const table = (0, import_parse_ply.parsePLYBinaryPointCloudRecordsToArrowTable)(
245
+ pendingBytes.subarray(0, byteLength),
246
+ batchHeader,
247
+ options,
248
+ parsePlan || void 0
249
+ );
250
+ if (!table) {
251
+ throw new Error("Failed to parse binary PLY Arrow batch");
252
+ }
253
+ return table;
254
+ }
255
+ function makeASCIIPLYArrowBatch(header, lines, options) {
256
+ const batchHeaderText = makePLYHeaderText(header, lines.length, options);
257
+ const elementTables = (0, import_parse_ply_arrow.parsePLYToElementTables)(`${batchHeaderText}${lines.join("\n")}
258
+ `, options);
259
+ return (0, import_parse_ply_arrow.convertPLYElementTablesToMeshArrowTable)(elementTables);
260
+ }
261
+ function makeBinaryPLYArrowBatchFromRows(header, rows, byteLength, vertexCount, options) {
262
+ const batchHeaderText = makePLYHeaderText(header, vertexCount, options);
263
+ const headerBytes = new TextEncoder().encode(batchHeaderText);
264
+ const batchBytes = new Uint8Array(headerBytes.length + byteLength);
265
+ batchBytes.set(headerBytes, 0);
266
+ let byteOffset = headerBytes.length;
267
+ for (const row of rows) {
268
+ batchBytes.set(row, byteOffset);
269
+ byteOffset += row.length;
270
+ }
271
+ const elementTables = (0, import_parse_ply_arrow.parsePLYToElementTables)(getArrayBuffer(batchBytes), options);
272
+ return (0, import_parse_ply_arrow.convertPLYElementTablesToMeshArrowTable)(elementTables);
273
+ }
274
+ function getBinaryElementRowByteLength(bytes, element, littleEndian) {
275
+ const dataView = new DataView(bytes.buffer, bytes.byteOffset, bytes.byteLength);
276
+ let byteOffset = 0;
277
+ for (const property of element.properties) {
278
+ if (property.type === "list") {
279
+ const countSize = getPLYTypeSize(property.countType);
280
+ if (byteOffset + countSize > bytes.length) {
281
+ return null;
282
+ }
283
+ const count = readBinaryScalar(dataView, byteOffset, property.countType, littleEndian);
284
+ byteOffset += countSize;
285
+ const valuesByteLength = count * getPLYTypeSize(property.itemType);
286
+ if (byteOffset + valuesByteLength > bytes.length) {
287
+ return null;
288
+ }
289
+ byteOffset += valuesByteLength;
290
+ } else {
291
+ const propertySize = getPLYTypeSize(property.type);
292
+ if (byteOffset + propertySize > bytes.length) {
293
+ return null;
294
+ }
295
+ byteOffset += propertySize;
296
+ }
297
+ }
298
+ return byteOffset;
299
+ }
300
+ function readBinaryScalar(dataView, byteOffset, type, littleEndian) {
301
+ switch (type) {
302
+ case "int8":
303
+ case "char":
304
+ return dataView.getInt8(byteOffset);
305
+ case "uint8":
306
+ case "uchar":
307
+ return dataView.getUint8(byteOffset);
308
+ case "int16":
309
+ case "short":
310
+ return dataView.getInt16(byteOffset, littleEndian);
311
+ case "uint16":
312
+ case "ushort":
313
+ return dataView.getUint16(byteOffset, littleEndian);
314
+ case "int32":
315
+ case "int":
316
+ return dataView.getInt32(byteOffset, littleEndian);
317
+ case "uint32":
318
+ case "uint":
319
+ return dataView.getUint32(byteOffset, littleEndian);
320
+ case "float32":
321
+ case "float":
322
+ return dataView.getFloat32(byteOffset, littleEndian);
323
+ case "float64":
324
+ case "double":
325
+ return dataView.getFloat64(byteOffset, littleEndian);
326
+ default:
327
+ throw new Error(type);
328
+ }
329
+ }
330
+ function makePLYHeaderText(header, vertexCount, options) {
331
+ const lines = ["ply", `format ${header.format} ${header.version || "1.0"}`];
332
+ const elements = options?.pointCloud ? header.elements.slice(0, 1) : header.elements;
333
+ for (const comment of header.comments) {
334
+ lines.push(`comment ${comment}`);
335
+ }
336
+ for (const element of elements) {
337
+ lines.push(
338
+ `element ${element.name} ${element.name === "vertex" ? vertexCount : element.count}`
339
+ );
340
+ for (const property of element.properties) {
341
+ lines.push(
342
+ property.type === "list" ? `property list ${property.countType} ${property.itemType} ${property.name}` : `property ${property.type} ${property.name}`
343
+ );
344
+ }
345
+ }
346
+ lines.push("end_header");
347
+ return `${lines.join("\n")}
348
+ `;
349
+ }
350
+ async function* getByteIteratorWithInitialBytes(iterator, initialBodyBytes) {
351
+ if (initialBodyBytes.length > 0) {
352
+ yield getArrayBuffer(initialBodyBytes);
353
+ }
354
+ while (true) {
355
+ const { value, done } = await iterator.next();
356
+ if (done) {
357
+ break;
358
+ }
359
+ yield getArrayBuffer(getUint8Array(value));
360
+ }
361
+ }
362
+ function getBatchSize(options) {
363
+ const batchSize = options?.batchSize;
364
+ return typeof batchSize === "number" ? batchSize : DEFAULT_BINARY_BATCH_SIZE;
365
+ }
366
+ function getPLYElementSize(element) {
367
+ return element.properties.reduce((size, property) => size + getPLYTypeSize(property.type), 0);
368
+ }
369
+ function getPLYTypeSize(type) {
370
+ switch (type) {
371
+ case "int8":
372
+ case "uint8":
373
+ case "char":
374
+ case "uchar":
375
+ return 1;
376
+ case "int16":
377
+ case "uint16":
378
+ case "short":
379
+ case "ushort":
380
+ return 2;
381
+ case "int32":
382
+ case "uint32":
383
+ case "int":
384
+ case "uint":
385
+ case "float32":
386
+ case "float":
387
+ return 4;
388
+ case "float64":
389
+ case "double":
390
+ return 8;
391
+ default:
392
+ throw new Error(type);
393
+ }
394
+ }
395
+ function findHeaderEnd(bytes) {
396
+ const pattern = new TextEncoder().encode(PLY_END_HEADER);
397
+ const lastPatternStart = bytes.length - pattern.length;
398
+ for (let byteIndex = 0; byteIndex <= lastPatternStart; byteIndex++) {
399
+ let matches = true;
400
+ for (let patternIndex = 0; patternIndex < pattern.length; patternIndex++) {
401
+ if (bytes[byteIndex + patternIndex] !== pattern[patternIndex]) {
402
+ matches = false;
403
+ break;
404
+ }
405
+ }
406
+ if (matches) {
407
+ let headerEnd = byteIndex + pattern.length;
408
+ if (headerEnd === bytes.length || bytes[headerEnd] === 13 && headerEnd + 1 === bytes.length) {
409
+ return -1;
410
+ }
411
+ if (bytes[headerEnd] === 13 && bytes[headerEnd + 1] === 10) {
412
+ headerEnd += 2;
413
+ } else if (headerEnd < bytes.length && isWhitespaceByte(bytes[headerEnd])) {
414
+ headerEnd += 1;
415
+ }
416
+ return headerEnd;
417
+ }
418
+ }
419
+ return -1;
420
+ }
421
+ function isWhitespaceByte(byte) {
422
+ return byte === 10 || byte === 13 || byte === 9 || byte === 32;
423
+ }
424
+ function getUint8Array(data) {
425
+ return ArrayBuffer.isView(data) ? new Uint8Array(data.buffer, data.byteOffset, data.byteLength) : new Uint8Array(data);
426
+ }
427
+ function getArrayBuffer(bytes) {
428
+ const copy = new Uint8Array(bytes.byteLength);
429
+ copy.set(bytes);
430
+ return copy.buffer;
431
+ }
432
+ function concatenateBytes(chunks) {
433
+ const byteLength = chunks.reduce((length, chunk) => length + chunk.length, 0);
434
+ const bytes = new Uint8Array(byteLength);
435
+ let byteOffset = 0;
436
+ for (const chunk of chunks) {
437
+ bytes.set(chunk, byteOffset);
438
+ byteOffset += chunk.length;
439
+ }
440
+ return bytes;
441
+ }
442
+ async function parseASCIIHeader(lineIterator, options) {
443
+ let currentElement;
444
+ const header = {
445
+ comments: [],
446
+ elements: []
447
+ // headerLength
448
+ };
449
+ await (0, import_loader_utils.forEach)(lineIterator, (line) => {
450
+ line = line.trim();
451
+ if (line === "end_header") {
452
+ return true;
453
+ }
454
+ if (line === "") {
455
+ return false;
456
+ }
457
+ const lineValues = line.split(/\s+/);
458
+ const lineType = lineValues.shift();
459
+ line = lineValues.join(" ");
460
+ switch (lineType) {
461
+ case "ply":
462
+ break;
463
+ case "format":
464
+ header.format = lineValues[0];
465
+ header.version = lineValues[1];
466
+ break;
467
+ case "comment":
468
+ header.comments.push(line);
469
+ break;
470
+ case "element":
471
+ if (currentElement) {
472
+ header.elements.push(currentElement);
473
+ }
474
+ currentElement = {
475
+ name: lineValues[0],
476
+ count: parseInt(lineValues[1], 10),
477
+ properties: []
478
+ };
479
+ break;
480
+ case "property":
481
+ const property = makePLYElementProperty(lineValues, options.propertyNameMapping);
482
+ currentElement?.properties.push(property);
483
+ break;
484
+ default:
485
+ console.log("unhandled", lineType, lineValues);
486
+ }
487
+ return false;
488
+ });
489
+ if (currentElement) {
490
+ header.elements.push(currentElement);
491
+ }
492
+ return header;
493
+ }
494
+ function makePLYElementProperty(propertyValues, propertyNameMapping) {
495
+ const type = propertyValues[0];
496
+ switch (type) {
497
+ case "list":
498
+ return {
499
+ type,
500
+ name: propertyValues[3],
501
+ countType: propertyValues[1],
502
+ itemType: propertyValues[2]
503
+ };
504
+ default:
505
+ return {
506
+ type,
507
+ name: propertyValues[1]
508
+ };
509
+ }
510
+ }
511
+ async function parseASCII(lineIterator, header) {
512
+ const attributes = {
513
+ indices: [],
514
+ vertices: [],
515
+ normals: [],
516
+ uvs: [],
517
+ colors: []
518
+ };
519
+ let currentElement = 0;
520
+ let currentElementCount = 0;
521
+ for await (let line of lineIterator) {
522
+ line = line.trim();
523
+ if (line !== "") {
524
+ if (currentElementCount >= header.elements[currentElement].count) {
525
+ currentElement++;
526
+ currentElementCount = 0;
527
+ }
528
+ const element = parsePLYElement(header.elements[currentElement].properties, line);
529
+ handleElement(attributes, header.elements[currentElement].name, element);
530
+ currentElementCount++;
531
+ }
532
+ }
533
+ return attributes;
534
+ }
535
+ function parseASCIINumber(n, type) {
536
+ switch (type) {
537
+ case "char":
538
+ case "uchar":
539
+ case "short":
540
+ case "ushort":
541
+ case "int":
542
+ case "uint":
543
+ case "int8":
544
+ case "uint8":
545
+ case "int16":
546
+ case "uint16":
547
+ case "int32":
548
+ case "uint32":
549
+ return parseInt(n, 10);
550
+ case "float":
551
+ case "double":
552
+ case "float32":
553
+ case "float64":
554
+ return parseFloat(n);
555
+ default:
556
+ throw new Error(type);
557
+ }
558
+ }
559
+ function parsePLYElement(properties, line) {
560
+ const values = line.split(/\s+/);
561
+ const element = {};
562
+ for (let i = 0; i < properties.length; i++) {
563
+ if (properties[i].type === "list") {
564
+ const list = [];
565
+ const n = parseASCIINumber(values.shift(), properties[i].countType);
566
+ for (let j = 0; j < n; j++) {
567
+ list.push(parseASCIINumber(values.shift(), properties[i].itemType));
568
+ }
569
+ element[properties[i].name] = list;
570
+ } else {
571
+ element[properties[i].name] = parseASCIINumber(values.shift(), properties[i].type);
572
+ }
573
+ }
574
+ return element;
575
+ }
576
+ function handleElement(buffer, elementName, element = {}) {
577
+ switch (elementName) {
578
+ case "vertex":
579
+ buffer.vertices.push(element.x, element.y, element.z);
580
+ if ("nx" in element && "ny" in element && "nz" in element) {
581
+ buffer.normals.push(element.nx, element.ny, element.nz);
582
+ }
583
+ if ("s" in element && "t" in element) {
584
+ buffer.uvs.push(element.s, element.t);
585
+ }
586
+ if ("red" in element && "green" in element && "blue" in element) {
587
+ buffer.colors.push(element.red, element.green, element.blue);
588
+ }
589
+ break;
590
+ case "face":
591
+ const vertexIndices = element.vertex_indices || element.vertex_index;
592
+ if (vertexIndices.length === 3) {
593
+ buffer.indices.push(vertexIndices[0], vertexIndices[1], vertexIndices[2]);
594
+ } else if (vertexIndices.length === 4) {
595
+ buffer.indices.push(vertexIndices[0], vertexIndices[1], vertexIndices[3]);
596
+ buffer.indices.push(vertexIndices[1], vertexIndices[2], vertexIndices[3]);
597
+ }
598
+ break;
599
+ default:
600
+ break;
601
+ }
602
+ }
603
+ // Annotate the CommonJS export names for ESM import in node:
604
+ 0 && (module.exports = {
605
+ parsePLYInBatches
606
+ });
607
+ //# sourceMappingURL=parse-ply-in-batches.cjs.map