@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,758 @@
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.ts
31
+ var parse_ply_exports = {};
32
+ __export(parse_ply_exports, {
33
+ getPLYBinaryPointCloudParsePlan: () => getPLYBinaryPointCloudParsePlan,
34
+ parsePLY: () => parsePLY,
35
+ parsePLYBinaryPointCloudRecordsToArrowTable: () => parsePLYBinaryPointCloudRecordsToArrowTable,
36
+ parsePLYBinaryPointCloudToArrowTable: () => parsePLYBinaryPointCloudToArrowTable,
37
+ parsePLYHeader: () => parsePLYHeader,
38
+ parsePLYToArrowTable: () => parsePLYToArrowTable
39
+ });
40
+ module.exports = __toCommonJS(parse_ply_exports);
41
+ var arrow = __toESM(require("apache-arrow"), 1);
42
+ var import_schema_utils = require("@loaders.gl/core/schema-utils");
43
+ var import_normalize_ply = __toESM(require("./normalize-ply.cjs"), 1);
44
+ var import_get_ply_schema = require("./get-ply-schema.cjs");
45
+ var PLY_END_HEADER = "end_header";
46
+ function parsePLY(data, options = {}) {
47
+ let header;
48
+ let attributes;
49
+ if (data instanceof ArrayBuffer) {
50
+ header = parsePLYHeader(data, options);
51
+ attributes = header.format === "ascii" ? parseASCII(new TextDecoder().decode(data), header) : parseBinary(data, header, options);
52
+ } else {
53
+ header = parsePLYHeader(data, options);
54
+ attributes = parseASCII(data, header);
55
+ }
56
+ return (0, import_normalize_ply.default)(header, attributes);
57
+ }
58
+ function parsePLYToArrowTable(data, options = {}) {
59
+ if (!(data instanceof ArrayBuffer)) {
60
+ return null;
61
+ }
62
+ const header = parsePLYHeader(data, options);
63
+ if (header.format === "ascii") {
64
+ return null;
65
+ }
66
+ const attributes = parseBinaryPointCloud(data, header, options);
67
+ if (!attributes) {
68
+ return null;
69
+ }
70
+ return makePLYArrowTable(header, attributes);
71
+ }
72
+ function parsePLYBinaryPointCloudToArrowTable(data, header, options = {}) {
73
+ const attributes = parseBinaryPointCloud(data, header, options);
74
+ return attributes ? makePLYArrowTable(header, attributes) : null;
75
+ }
76
+ function parsePLYBinaryPointCloudRecordsToArrowTable(records, header, options = {}, plan) {
77
+ const attributes = parseBinaryPointCloudRecords(records, header, options, plan);
78
+ return attributes ? makePLYArrowTable(header, attributes) : null;
79
+ }
80
+ function parsePLYHeader(data, options) {
81
+ const { headerText, headerLength } = data instanceof ArrayBuffer ? getBinaryHeader(data) : getTextHeader(data);
82
+ const headerStart = headerText.indexOf("ply");
83
+ const headerEndMarker = headerText.lastIndexOf("end_header");
84
+ const headerEnd = headerEndMarker + "end_header".length;
85
+ if (headerStart >= 0 && headerEndMarker >= headerStart + 3 && headerEnd < headerText.length && /\s/.test(headerText[headerEnd])) {
86
+ const lines = headerText.slice(headerStart + 3, headerEndMarker).split("\n");
87
+ const header = parseHeaderLines(lines, headerLength || headerEnd + 1 - headerStart, options);
88
+ return header;
89
+ }
90
+ return parseHeaderLines([], headerLength, options);
91
+ }
92
+ function getBinaryHeader(data) {
93
+ const bytes = new Uint8Array(data);
94
+ const headerEnd = findHeaderEnd(bytes);
95
+ return {
96
+ headerText: new TextDecoder().decode(bytes.subarray(0, headerEnd)),
97
+ headerLength: headerEnd
98
+ };
99
+ }
100
+ function getTextHeader(data) {
101
+ const headerEnd = data.indexOf(PLY_END_HEADER);
102
+ if (headerEnd === -1) {
103
+ return { headerText: "", headerLength: 0 };
104
+ }
105
+ let headerLength = headerEnd + PLY_END_HEADER.length;
106
+ if (data[headerLength] === "\r" && data[headerLength + 1] === "\n") {
107
+ headerLength += 2;
108
+ } else if (headerLength < data.length && /\s/.test(data[headerLength])) {
109
+ headerLength += 1;
110
+ }
111
+ return { headerText: data.slice(0, headerLength), headerLength };
112
+ }
113
+ function findHeaderEnd(bytes) {
114
+ const pattern = new TextEncoder().encode(PLY_END_HEADER);
115
+ const lastPatternStart = bytes.length - pattern.length;
116
+ for (let byteIndex = 0; byteIndex <= lastPatternStart; byteIndex++) {
117
+ let matches = true;
118
+ for (let patternIndex = 0; patternIndex < pattern.length; patternIndex++) {
119
+ if (bytes[byteIndex + patternIndex] !== pattern[patternIndex]) {
120
+ matches = false;
121
+ break;
122
+ }
123
+ }
124
+ if (matches) {
125
+ let headerEnd = byteIndex + pattern.length;
126
+ if (bytes[headerEnd] === 13 && bytes[headerEnd + 1] === 10) {
127
+ headerEnd += 2;
128
+ } else if (headerEnd < bytes.length && isWhitespaceByte(bytes[headerEnd])) {
129
+ headerEnd += 1;
130
+ }
131
+ return headerEnd;
132
+ }
133
+ }
134
+ return bytes.length;
135
+ }
136
+ function isWhitespaceByte(byte) {
137
+ return byte === 10 || byte === 13 || byte === 9 || byte === 32;
138
+ }
139
+ function parseHeaderLines(lines, headerLength, options) {
140
+ const header = {
141
+ comments: [],
142
+ elements: [],
143
+ headerLength
144
+ };
145
+ let lineType;
146
+ let lineValues;
147
+ let currentElement = null;
148
+ for (let i = 0; i < lines.length; i++) {
149
+ let line = lines[i];
150
+ line = line.trim();
151
+ if (line === "") {
152
+ continue;
153
+ }
154
+ lineValues = line.split(/\s+/);
155
+ lineType = lineValues.shift();
156
+ line = lineValues.join(" ");
157
+ switch (lineType) {
158
+ case "format":
159
+ header.format = lineValues[0];
160
+ header.version = lineValues[1];
161
+ break;
162
+ case "comment":
163
+ header.comments.push(line);
164
+ break;
165
+ case "element":
166
+ if (currentElement) {
167
+ header.elements.push(currentElement);
168
+ }
169
+ currentElement = {
170
+ name: lineValues[0],
171
+ count: parseInt(lineValues[1], 10),
172
+ properties: []
173
+ };
174
+ break;
175
+ case "property":
176
+ if (currentElement) {
177
+ const property = makePLYElementProperty(lineValues);
178
+ if (options?.propertyNameMapping && property.name in options?.propertyNameMapping) {
179
+ property.name = options?.propertyNameMapping[property.name];
180
+ }
181
+ currentElement.properties.push(property);
182
+ }
183
+ break;
184
+ default:
185
+ }
186
+ }
187
+ if (currentElement) {
188
+ header.elements.push(currentElement);
189
+ }
190
+ return header;
191
+ }
192
+ function getPLYAttributes(header) {
193
+ const attributes = {
194
+ indices: [],
195
+ vertices: [],
196
+ normals: [],
197
+ uvs: [],
198
+ colors: []
199
+ };
200
+ for (const element of header.elements) {
201
+ if (element.name === "vertex") {
202
+ for (const property of element.properties) {
203
+ switch (property.name) {
204
+ case "x":
205
+ case "y":
206
+ case "z":
207
+ case "nx":
208
+ case "ny":
209
+ case "nz":
210
+ case "s":
211
+ case "t":
212
+ case "red":
213
+ case "green":
214
+ case "blue":
215
+ break;
216
+ default:
217
+ attributes[property.name] = [];
218
+ break;
219
+ }
220
+ }
221
+ }
222
+ }
223
+ return attributes;
224
+ }
225
+ function makePLYElementProperty(propertyValues) {
226
+ const type = propertyValues[0];
227
+ switch (type) {
228
+ case "list":
229
+ return {
230
+ type,
231
+ name: propertyValues[3],
232
+ countType: propertyValues[1],
233
+ itemType: propertyValues[2]
234
+ };
235
+ default:
236
+ return {
237
+ type,
238
+ name: propertyValues[1]
239
+ };
240
+ }
241
+ }
242
+ function parseASCIINumber(n, type) {
243
+ switch (type) {
244
+ case "char":
245
+ case "uchar":
246
+ case "short":
247
+ case "ushort":
248
+ case "int":
249
+ case "uint":
250
+ case "int8":
251
+ case "uint8":
252
+ case "int16":
253
+ case "uint16":
254
+ case "int32":
255
+ case "uint32":
256
+ return parseInt(n, 10);
257
+ case "float":
258
+ case "double":
259
+ case "float32":
260
+ case "float64":
261
+ return parseFloat(n);
262
+ default:
263
+ throw new Error(type);
264
+ }
265
+ }
266
+ function parsePLYElement(properties, line) {
267
+ const values = line.split(/\s+/);
268
+ const element = {};
269
+ for (let i = 0; i < properties.length; i++) {
270
+ if (properties[i].type === "list") {
271
+ const list = [];
272
+ const n = parseASCIINumber(values.shift(), properties[i].countType);
273
+ for (let j = 0; j < n; j++) {
274
+ list.push(parseASCIINumber(values.shift(), properties[i].itemType));
275
+ }
276
+ element[properties[i].name] = list;
277
+ } else {
278
+ element[properties[i].name] = parseASCIINumber(values.shift(), properties[i].type);
279
+ }
280
+ }
281
+ return element;
282
+ }
283
+ function parseASCII(data, header) {
284
+ const attributes = getPLYAttributes(header);
285
+ const patternBody = /end_header\s([\s\S]*)$/;
286
+ let body = "";
287
+ const result = patternBody.exec(data);
288
+ if (result !== null) {
289
+ body = result[1];
290
+ }
291
+ const lines = body.split("\n");
292
+ let currentElement = 0;
293
+ let currentElementCount = 0;
294
+ for (let i = 0; i < lines.length; i++) {
295
+ let line = lines[i];
296
+ line = line.trim();
297
+ if (line !== "") {
298
+ if (currentElementCount >= header.elements[currentElement].count) {
299
+ currentElement++;
300
+ currentElementCount = 0;
301
+ }
302
+ const element = parsePLYElement(header.elements[currentElement].properties, line);
303
+ handleElement(attributes, header.elements[currentElement].name, element);
304
+ currentElementCount++;
305
+ }
306
+ }
307
+ return attributes;
308
+ }
309
+ function handleElement(buffer, elementName, element = {}) {
310
+ if (elementName === "vertex") {
311
+ for (const propertyName of Object.keys(element)) {
312
+ switch (propertyName) {
313
+ case "x":
314
+ buffer.vertices.push(element.x, element.y, element.z);
315
+ break;
316
+ case "y":
317
+ case "z":
318
+ break;
319
+ case "nx":
320
+ if ("nx" in element && "ny" in element && "nz" in element) {
321
+ buffer.normals.push(element.nx, element.ny, element.nz);
322
+ }
323
+ break;
324
+ case "ny":
325
+ case "nz":
326
+ break;
327
+ case "s":
328
+ if ("s" in element && "t" in element) {
329
+ buffer.uvs.push(element.s, element.t);
330
+ }
331
+ break;
332
+ case "t":
333
+ break;
334
+ case "red":
335
+ if ("red" in element && "green" in element && "blue" in element) {
336
+ buffer.colors.push(element.red, element.green, element.blue);
337
+ }
338
+ break;
339
+ case "green":
340
+ case "blue":
341
+ break;
342
+ default:
343
+ buffer[propertyName].push(element[propertyName]);
344
+ }
345
+ }
346
+ } else if (elementName === "face") {
347
+ const vertexIndices = element.vertex_indices || element.vertex_index;
348
+ if (vertexIndices.length === 3) {
349
+ buffer.indices.push(vertexIndices[0], vertexIndices[1], vertexIndices[2]);
350
+ } else if (vertexIndices.length === 4) {
351
+ buffer.indices.push(vertexIndices[0], vertexIndices[1], vertexIndices[3]);
352
+ buffer.indices.push(vertexIndices[1], vertexIndices[2], vertexIndices[3]);
353
+ }
354
+ }
355
+ }
356
+ function binaryRead(dataview, at, type, littleEndian) {
357
+ switch (type) {
358
+ // corespondences for non-specific length types here match rply:
359
+ case "int8":
360
+ case "char":
361
+ return [dataview.getInt8(at), 1];
362
+ case "uint8":
363
+ case "uchar":
364
+ return [dataview.getUint8(at), 1];
365
+ case "int16":
366
+ case "short":
367
+ return [dataview.getInt16(at, littleEndian), 2];
368
+ case "uint16":
369
+ case "ushort":
370
+ return [dataview.getUint16(at, littleEndian), 2];
371
+ case "int32":
372
+ case "int":
373
+ return [dataview.getInt32(at, littleEndian), 4];
374
+ case "uint32":
375
+ case "uint":
376
+ return [dataview.getUint32(at, littleEndian), 4];
377
+ case "float32":
378
+ case "float":
379
+ return [dataview.getFloat32(at, littleEndian), 4];
380
+ case "float64":
381
+ case "double":
382
+ return [dataview.getFloat64(at, littleEndian), 8];
383
+ default:
384
+ throw new Error(type);
385
+ }
386
+ }
387
+ function binaryReadElement(dataview, at, properties, littleEndian) {
388
+ const element = {};
389
+ let result;
390
+ let read = 0;
391
+ for (let i = 0; i < properties.length; i++) {
392
+ if (properties[i].type === "list") {
393
+ const list = [];
394
+ result = binaryRead(dataview, at + read, properties[i].countType, littleEndian);
395
+ const n = result[0];
396
+ read += result[1];
397
+ for (let j = 0; j < n; j++) {
398
+ result = binaryRead(dataview, at + read, properties[i].itemType, littleEndian);
399
+ list.push(result[0]);
400
+ read += result[1];
401
+ }
402
+ element[properties[i].name] = list;
403
+ } else {
404
+ result = binaryRead(dataview, at + read, properties[i].type, littleEndian);
405
+ element[properties[i].name] = result[0];
406
+ read += result[1];
407
+ }
408
+ }
409
+ return [element, read];
410
+ }
411
+ function makePLYArrowTable(header, attributes) {
412
+ const meshAttributes = getPLYMeshAttributes(attributes);
413
+ const schema = (0, import_get_ply_schema.getPLYSchema)(header, meshAttributes);
414
+ schema.metadata.topology = "point-list";
415
+ schema.metadata.mode = "0";
416
+ const boundingBox = (0, import_schema_utils.getMeshBoundingBox)(meshAttributes);
417
+ if (boundingBox) schema.metadata.boundingBox = JSON.stringify(boundingBox);
418
+ const columns = {};
419
+ const fields = [];
420
+ for (const field of schema.fields) {
421
+ const attribute = meshAttributes[field.name];
422
+ if (!attribute) {
423
+ continue;
424
+ }
425
+ const column = getPLYArrowVector(attribute);
426
+ columns[field.name] = column;
427
+ fields.push(new arrow.Field(field.name, column.type, false, getArrowMetadata(field.metadata)));
428
+ }
429
+ const arrowSchema = new arrow.Schema(fields, getArrowMetadata(schema.metadata));
430
+ return {
431
+ shape: "arrow-table",
432
+ schema,
433
+ data: new arrow.Table(arrowSchema, columns),
434
+ topology: "point-list"
435
+ };
436
+ }
437
+ function getPLYMeshAttributes(attributes) {
438
+ const meshAttributes = {};
439
+ for (const attributeName of Object.keys(attributes)) {
440
+ switch (attributeName) {
441
+ case "vertices":
442
+ if (attributes.vertices.length > 0) {
443
+ meshAttributes.POSITION = { value: getFloat32Array(attributes.vertices), size: 3 };
444
+ }
445
+ break;
446
+ case "normals":
447
+ if (attributes.normals.length > 0) {
448
+ meshAttributes.NORMAL = { value: getFloat32Array(attributes.normals), size: 3 };
449
+ }
450
+ break;
451
+ case "uvs":
452
+ if (attributes.uvs.length > 0) {
453
+ meshAttributes.TEXCOORD_0 = { value: getFloat32Array(attributes.uvs), size: 2 };
454
+ }
455
+ break;
456
+ case "colors":
457
+ if (attributes.colors.length > 0) {
458
+ meshAttributes.COLOR_0 = {
459
+ value: getUint8Array(attributes.colors),
460
+ size: 3,
461
+ normalized: true
462
+ };
463
+ }
464
+ break;
465
+ case "indices":
466
+ break;
467
+ default:
468
+ if (attributes[attributeName].length > 0) {
469
+ meshAttributes[attributeName] = {
470
+ value: getFloat32Array(attributes[attributeName]),
471
+ size: 1
472
+ };
473
+ }
474
+ break;
475
+ }
476
+ }
477
+ return meshAttributes;
478
+ }
479
+ function getPLYArrowVector(attribute) {
480
+ const { value, size } = attribute;
481
+ if (size === 1) {
482
+ return arrow.makeVector(value);
483
+ }
484
+ const values = arrow.makeVector(value);
485
+ const child = values.data[0];
486
+ const type = new arrow.FixedSizeList(size, new arrow.Field("value", child.type, false));
487
+ const data = new arrow.Data(type, 0, value.length / size, 0, {}, [child]);
488
+ return new arrow.Vector([data]);
489
+ }
490
+ function getArrowMetadata(metadata) {
491
+ return new Map(Object.entries(metadata || {}));
492
+ }
493
+ function getFloat32Array(attribute) {
494
+ return attribute instanceof Float32Array ? attribute : new Float32Array(attribute);
495
+ }
496
+ function getUint8Array(attribute) {
497
+ return attribute instanceof Uint8Array ? attribute : new Uint8Array(attribute);
498
+ }
499
+ function parseBinary(data, header, options) {
500
+ const directAttributes = parseBinaryPointCloud(data, header, options);
501
+ if (directAttributes) {
502
+ return directAttributes;
503
+ }
504
+ const attributes = getPLYAttributes(header);
505
+ const littleEndian = header.format === "binary_little_endian";
506
+ const body = new DataView(data, header.headerLength);
507
+ let result;
508
+ let loc = 0;
509
+ for (let currentElement = 0; currentElement < header.elements.length; currentElement++) {
510
+ const count = header.elements[currentElement].count;
511
+ for (let currentElementCount = 0; currentElementCount < count; currentElementCount++) {
512
+ result = binaryReadElement(
513
+ body,
514
+ loc,
515
+ header.elements[currentElement].properties,
516
+ littleEndian
517
+ );
518
+ loc += result[1];
519
+ const element = result[0];
520
+ handleElement(attributes, header.elements[currentElement].name, element);
521
+ }
522
+ }
523
+ return attributes;
524
+ }
525
+ function parseBinaryPointCloud(data, header, options) {
526
+ const records = new Uint8Array(data, header.headerLength || 0);
527
+ return parseBinaryPointCloudRecords(records, header, options);
528
+ }
529
+ function parseBinaryPointCloudRecords(records, header, options, parsePlan) {
530
+ const vertexElement = header.elements[0];
531
+ if (!parsePlan && (options?._useLegacyBinaryPointCloudParser || !options?.pointCloud && header.elements.length !== 1 || vertexElement?.name !== "vertex" || vertexElement.properties.some((property) => property.type === "list"))) {
532
+ return null;
533
+ }
534
+ const plan = parsePlan || getPLYBinaryPointCloudParsePlan(header, options);
535
+ if (!plan || !vertexElement) {
536
+ return null;
537
+ }
538
+ const attributes = getBinaryPointCloudAttributes(vertexElement);
539
+ const dataView = new DataView(records.buffer, records.byteOffset, records.byteLength);
540
+ let vertexOffset = 0;
541
+ for (let vertexIndex = 0; vertexIndex < vertexElement.count; vertexIndex++) {
542
+ for (const property of plan.properties) {
543
+ const value = property.read(dataView, vertexOffset + property.offset, plan.littleEndian);
544
+ writeBinaryPointCloudProperty(attributes, property.name, value, vertexIndex);
545
+ }
546
+ vertexOffset += plan.vertexStride;
547
+ }
548
+ return attributes;
549
+ }
550
+ function getPLYBinaryPointCloudParsePlan(header, options) {
551
+ const vertexElement = header.elements[0];
552
+ if (options?._useLegacyBinaryPointCloudParser || !options?.pointCloud && header.elements.length !== 1 || vertexElement?.name !== "vertex" || vertexElement.properties.some((property) => property.type === "list")) {
553
+ return null;
554
+ }
555
+ const properties = getBinaryPointCloudProperties(vertexElement);
556
+ return {
557
+ properties,
558
+ vertexStride: getPLYElementSize(properties),
559
+ littleEndian: header.format === "binary_little_endian"
560
+ };
561
+ }
562
+ function getBinaryPointCloudAttributes(vertexElement) {
563
+ const attributes = {
564
+ indices: [],
565
+ vertices: [],
566
+ normals: [],
567
+ uvs: [],
568
+ colors: []
569
+ };
570
+ const propertyNames = new Set(vertexElement.properties.map((property) => property.name));
571
+ const vertexCount = vertexElement.count;
572
+ if (propertyNames.has("x") && propertyNames.has("y") && propertyNames.has("z")) {
573
+ attributes.vertices = new Float32Array(vertexCount * 3);
574
+ }
575
+ if (propertyNames.has("nx") && propertyNames.has("ny") && propertyNames.has("nz")) {
576
+ attributes.normals = new Float32Array(vertexCount * 3);
577
+ }
578
+ if (propertyNames.has("s") && propertyNames.has("t")) {
579
+ attributes.uvs = new Float32Array(vertexCount * 2);
580
+ }
581
+ if (propertyNames.has("red") && propertyNames.has("green") && propertyNames.has("blue")) {
582
+ attributes.colors = new Uint8Array(vertexCount * 3);
583
+ }
584
+ for (const property of vertexElement.properties) {
585
+ if (!isNormalizedPLYAttributeProperty(property.name)) {
586
+ attributes[property.name] = new Float32Array(vertexCount);
587
+ }
588
+ }
589
+ return attributes;
590
+ }
591
+ function isNormalizedPLYAttributeProperty(propertyName) {
592
+ switch (propertyName) {
593
+ case "x":
594
+ case "y":
595
+ case "z":
596
+ case "nx":
597
+ case "ny":
598
+ case "nz":
599
+ case "s":
600
+ case "t":
601
+ case "red":
602
+ case "green":
603
+ case "blue":
604
+ return true;
605
+ default:
606
+ return false;
607
+ }
608
+ }
609
+ function writeBinaryPointCloudProperty(attributes, propertyName, value, vertexIndex) {
610
+ switch (propertyName) {
611
+ case "x":
612
+ attributes.vertices[vertexIndex * 3] = value;
613
+ break;
614
+ case "y":
615
+ attributes.vertices[vertexIndex * 3 + 1] = value;
616
+ break;
617
+ case "z":
618
+ attributes.vertices[vertexIndex * 3 + 2] = value;
619
+ break;
620
+ case "nx":
621
+ attributes.normals[vertexIndex * 3] = value;
622
+ break;
623
+ case "ny":
624
+ attributes.normals[vertexIndex * 3 + 1] = value;
625
+ break;
626
+ case "nz":
627
+ attributes.normals[vertexIndex * 3 + 2] = value;
628
+ break;
629
+ case "s":
630
+ attributes.uvs[vertexIndex * 2] = value;
631
+ break;
632
+ case "t":
633
+ attributes.uvs[vertexIndex * 2 + 1] = value;
634
+ break;
635
+ case "red":
636
+ attributes.colors[vertexIndex * 3] = value;
637
+ break;
638
+ case "green":
639
+ attributes.colors[vertexIndex * 3 + 1] = value;
640
+ break;
641
+ case "blue":
642
+ attributes.colors[vertexIndex * 3 + 2] = value;
643
+ break;
644
+ default:
645
+ attributes[propertyName][vertexIndex] = value;
646
+ }
647
+ }
648
+ function getBinaryPointCloudProperties(element) {
649
+ const properties = [];
650
+ let offset = 0;
651
+ for (const property of element.properties) {
652
+ properties.push({
653
+ name: property.name,
654
+ offset,
655
+ read: getBinaryScalarReader(property.type),
656
+ size: getPLYTypeSize(property.type)
657
+ });
658
+ offset += properties[properties.length - 1].size;
659
+ }
660
+ return properties;
661
+ }
662
+ function getPLYElementSize(properties) {
663
+ if (properties.length === 0) {
664
+ return 0;
665
+ }
666
+ const lastProperty = properties[properties.length - 1];
667
+ return lastProperty.offset + lastProperty.size;
668
+ }
669
+ function getPLYTypeSize(type) {
670
+ switch (type) {
671
+ case "int8":
672
+ case "uint8":
673
+ case "char":
674
+ case "uchar":
675
+ return 1;
676
+ case "int16":
677
+ case "uint16":
678
+ case "short":
679
+ case "ushort":
680
+ return 2;
681
+ case "int32":
682
+ case "uint32":
683
+ case "int":
684
+ case "uint":
685
+ case "float32":
686
+ case "float":
687
+ return 4;
688
+ case "float64":
689
+ case "double":
690
+ return 8;
691
+ default:
692
+ throw new Error(type);
693
+ }
694
+ }
695
+ function getBinaryScalarReader(type) {
696
+ switch (type) {
697
+ case "int8":
698
+ case "char":
699
+ return readInt8;
700
+ case "uint8":
701
+ case "uchar":
702
+ return readUint8;
703
+ case "int16":
704
+ case "short":
705
+ return readInt16;
706
+ case "uint16":
707
+ case "ushort":
708
+ return readUint16;
709
+ case "int32":
710
+ case "int":
711
+ return readInt32;
712
+ case "uint32":
713
+ case "uint":
714
+ return readUint32;
715
+ case "float32":
716
+ case "float":
717
+ return readFloat32;
718
+ case "float64":
719
+ case "double":
720
+ return readFloat64;
721
+ default:
722
+ throw new Error(type);
723
+ }
724
+ }
725
+ function readInt8(dataView, at) {
726
+ return dataView.getInt8(at);
727
+ }
728
+ function readUint8(dataView, at) {
729
+ return dataView.getUint8(at);
730
+ }
731
+ function readInt16(dataView, at, littleEndian) {
732
+ return dataView.getInt16(at, littleEndian);
733
+ }
734
+ function readUint16(dataView, at, littleEndian) {
735
+ return dataView.getUint16(at, littleEndian);
736
+ }
737
+ function readInt32(dataView, at, littleEndian) {
738
+ return dataView.getInt32(at, littleEndian);
739
+ }
740
+ function readUint32(dataView, at, littleEndian) {
741
+ return dataView.getUint32(at, littleEndian);
742
+ }
743
+ function readFloat32(dataView, at, littleEndian) {
744
+ return dataView.getFloat32(at, littleEndian);
745
+ }
746
+ function readFloat64(dataView, at, littleEndian) {
747
+ return dataView.getFloat64(at, littleEndian);
748
+ }
749
+ // Annotate the CommonJS export names for ESM import in node:
750
+ 0 && (module.exports = {
751
+ getPLYBinaryPointCloudParsePlan,
752
+ parsePLY,
753
+ parsePLYBinaryPointCloudRecordsToArrowTable,
754
+ parsePLYBinaryPointCloudToArrowTable,
755
+ parsePLYHeader,
756
+ parsePLYToArrowTable
757
+ });
758
+ //# sourceMappingURL=parse-ply.cjs.map