@math.gl/geometry 5.0.0-alpha.2 → 5.0.0-alpha.20

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 (381) hide show
  1. package/LICENSE +97 -49
  2. package/README.md +16 -1
  3. package/THIRD-PARTY-NOTICES.md +18 -0
  4. package/dist/culling/constants.d.ts +3 -0
  5. package/dist/culling/constants.d.ts.map +1 -0
  6. package/dist/culling/constants.js +5 -0
  7. package/dist/culling/constants.js.map +1 -0
  8. package/dist/culling/index.cjs +2014 -0
  9. package/dist/culling/index.cjs.map +6 -0
  10. package/dist/culling/index.d.ts +29 -0
  11. package/dist/culling/index.d.ts.map +1 -0
  12. package/dist/culling/index.js +23 -0
  13. package/dist/culling/index.js.map +1 -0
  14. package/dist/culling/lib/algorithms/bounding-box-from-points.d.ts +15 -0
  15. package/dist/culling/lib/algorithms/bounding-box-from-points.d.ts.map +1 -0
  16. package/dist/culling/lib/algorithms/bounding-box-from-points.js +137 -0
  17. package/dist/culling/lib/algorithms/bounding-box-from-points.js.map +1 -0
  18. package/dist/culling/lib/algorithms/bounding-sphere-from-points.d.ts +14 -0
  19. package/dist/culling/lib/algorithms/bounding-sphere-from-points.d.ts.map +1 -0
  20. package/dist/culling/lib/algorithms/bounding-sphere-from-points.js +146 -0
  21. package/dist/culling/lib/algorithms/bounding-sphere-from-points.js.map +1 -0
  22. package/dist/culling/lib/algorithms/compute-eigen-decomposition.d.ts +37 -0
  23. package/dist/culling/lib/algorithms/compute-eigen-decomposition.d.ts.map +1 -0
  24. package/dist/culling/lib/algorithms/compute-eigen-decomposition.js +137 -0
  25. package/dist/culling/lib/algorithms/compute-eigen-decomposition.js.map +1 -0
  26. package/dist/culling/lib/algorithms/oriented-bounding-box-quaternion.d.ts +7 -0
  27. package/dist/culling/lib/algorithms/oriented-bounding-box-quaternion.d.ts.map +1 -0
  28. package/dist/culling/lib/algorithms/oriented-bounding-box-quaternion.js +26 -0
  29. package/dist/culling/lib/algorithms/oriented-bounding-box-quaternion.js.map +1 -0
  30. package/dist/culling/lib/bounding-volumes/axis-aligned-bounding-box.d.ts +56 -0
  31. package/dist/culling/lib/bounding-volumes/axis-aligned-bounding-box.d.ts.map +1 -0
  32. package/dist/culling/lib/bounding-volumes/axis-aligned-bounding-box.js +116 -0
  33. package/dist/culling/lib/bounding-volumes/axis-aligned-bounding-box.js.map +1 -0
  34. package/dist/culling/lib/bounding-volumes/bounding-sphere.d.ts +40 -0
  35. package/dist/culling/lib/bounding-volumes/bounding-sphere.d.ts.map +1 -0
  36. package/dist/culling/lib/bounding-volumes/bounding-sphere.js +123 -0
  37. package/dist/culling/lib/bounding-volumes/bounding-sphere.js.map +1 -0
  38. package/dist/culling/lib/bounding-volumes/bounding-volume.d.ts +30 -0
  39. package/dist/culling/lib/bounding-volumes/bounding-volume.d.ts.map +1 -0
  40. package/dist/culling/lib/bounding-volumes/bounding-volume.js +7 -0
  41. package/dist/culling/lib/bounding-volumes/bounding-volume.js.map +1 -0
  42. package/dist/culling/lib/bounding-volumes/oriented-bounding-box.d.ts +62 -0
  43. package/dist/culling/lib/bounding-volumes/oriented-bounding-box.d.ts.map +1 -0
  44. package/dist/culling/lib/bounding-volumes/oriented-bounding-box.js +230 -0
  45. package/dist/culling/lib/bounding-volumes/oriented-bounding-box.js.map +1 -0
  46. package/dist/culling/lib/culling-volume.d.ts +46 -0
  47. package/dist/culling/lib/culling-volume.d.ts.map +1 -0
  48. package/dist/culling/lib/culling-volume.js +126 -0
  49. package/dist/culling/lib/culling-volume.js.map +1 -0
  50. package/dist/culling/lib/perspective-frustum.d.ts +153 -0
  51. package/dist/culling/lib/perspective-frustum.d.ts.map +1 -0
  52. package/dist/culling/lib/perspective-frustum.js +191 -0
  53. package/dist/culling/lib/perspective-frustum.js.map +1 -0
  54. package/dist/culling/lib/perspective-off-center-frustum.d.ts +158 -0
  55. package/dist/culling/lib/perspective-off-center-frustum.d.ts.map +1 -0
  56. package/dist/culling/lib/perspective-off-center-frustum.js +276 -0
  57. package/dist/culling/lib/perspective-off-center-frustum.js.map +1 -0
  58. package/dist/culling/lib/plane.d.ts +35 -0
  59. package/dist/culling/lib/plane.d.ts.map +1 -0
  60. package/dist/culling/lib/plane.js +90 -0
  61. package/dist/culling/lib/plane.js.map +1 -0
  62. package/dist/culling/lib/ray.d.ts +13 -0
  63. package/dist/culling/lib/ray.d.ts.map +1 -0
  64. package/dist/culling/lib/ray.js +30 -0
  65. package/dist/culling/lib/ray.js.map +1 -0
  66. package/dist/culling/lib/shapes/box-shape.d.ts +19 -0
  67. package/dist/culling/lib/shapes/box-shape.d.ts.map +1 -0
  68. package/dist/culling/lib/shapes/box-shape.js +69 -0
  69. package/dist/culling/lib/shapes/box-shape.js.map +1 -0
  70. package/dist/culling/lib/shapes/capsule-shape.d.ts +23 -0
  71. package/dist/culling/lib/shapes/capsule-shape.d.ts.map +1 -0
  72. package/dist/culling/lib/shapes/capsule-shape.js +151 -0
  73. package/dist/culling/lib/shapes/capsule-shape.js.map +1 -0
  74. package/dist/culling/lib/shapes/cylinder-shape.d.ts +22 -0
  75. package/dist/culling/lib/shapes/cylinder-shape.d.ts.map +1 -0
  76. package/dist/culling/lib/shapes/cylinder-shape.js +99 -0
  77. package/dist/culling/lib/shapes/cylinder-shape.js.map +1 -0
  78. package/dist/culling/lib/shapes/implicit-shape.d.ts +56 -0
  79. package/dist/culling/lib/shapes/implicit-shape.d.ts.map +1 -0
  80. package/dist/culling/lib/shapes/implicit-shape.js +142 -0
  81. package/dist/culling/lib/shapes/implicit-shape.js.map +1 -0
  82. package/dist/culling/lib/shapes/plane-shape.d.ts +27 -0
  83. package/dist/culling/lib/shapes/plane-shape.d.ts.map +1 -0
  84. package/dist/culling/lib/shapes/plane-shape.js +71 -0
  85. package/dist/culling/lib/shapes/plane-shape.js.map +1 -0
  86. package/dist/culling/lib/shapes/sphere-shape.d.ts +18 -0
  87. package/dist/culling/lib/shapes/sphere-shape.d.ts.map +1 -0
  88. package/dist/culling/lib/shapes/sphere-shape.js +43 -0
  89. package/dist/culling/lib/shapes/sphere-shape.js.map +1 -0
  90. package/dist/culling/oriented-box-2d.cjs +73 -0
  91. package/dist/culling/oriented-box-2d.cjs.map +6 -0
  92. package/dist/culling/oriented-box-2d.d.ts +22 -0
  93. package/dist/culling/oriented-box-2d.d.ts.map +1 -0
  94. package/dist/culling/oriented-box-2d.js +86 -0
  95. package/dist/culling/oriented-box-2d.js.map +1 -0
  96. package/dist/culling/queries.cjs +161 -0
  97. package/dist/culling/queries.cjs.map +6 -0
  98. package/dist/culling/queries.d.ts +20 -0
  99. package/dist/culling/queries.d.ts.map +1 -0
  100. package/dist/culling/queries.js +139 -0
  101. package/dist/culling/queries.js.map +1 -0
  102. package/dist/curves/bezier-curves.d.ts +18 -0
  103. package/dist/curves/bezier-curves.d.ts.map +1 -0
  104. package/dist/curves/bezier-curves.js +54 -0
  105. package/dist/curves/bezier-curves.js.map +1 -0
  106. package/dist/curves/catmull-rom-curve.d.ts +15 -0
  107. package/dist/curves/catmull-rom-curve.d.ts.map +1 -0
  108. package/dist/curves/catmull-rom-curve.js +77 -0
  109. package/dist/curves/catmull-rom-curve.js.map +1 -0
  110. package/dist/curves/curve-arc-length.d.ts +17 -0
  111. package/dist/curves/curve-arc-length.d.ts.map +1 -0
  112. package/dist/curves/curve-arc-length.js +58 -0
  113. package/dist/curves/curve-arc-length.js.map +1 -0
  114. package/dist/curves/curve.d.ts +23 -0
  115. package/dist/curves/curve.d.ts.map +1 -0
  116. package/dist/curves/curve.js +77 -0
  117. package/dist/curves/curve.js.map +1 -0
  118. package/dist/curves/hermite-curve.d.ts +9 -0
  119. package/dist/curves/hermite-curve.d.ts.map +1 -0
  120. package/dist/curves/hermite-curve.js +24 -0
  121. package/dist/curves/hermite-curve.js.map +1 -0
  122. package/dist/curves/index.cjs +293 -0
  123. package/dist/curves/index.cjs.map +6 -0
  124. package/dist/curves/index.d.ts +8 -0
  125. package/dist/curves/index.d.ts.map +1 -0
  126. package/dist/curves/index.js +9 -0
  127. package/dist/curves/index.js.map +1 -0
  128. package/dist/geometries/box-geometry.js +1 -1
  129. package/dist/geometries/box-geometry.js.map +1 -1
  130. package/dist/geometries/capsule-geometry.js +1 -1
  131. package/dist/geometries/capsule-geometry.js.map +1 -1
  132. package/dist/geometries/cylinder-geometry.js +1 -1
  133. package/dist/geometries/cylinder-geometry.js.map +1 -1
  134. package/dist/geometries/geometry-helpers.js +1 -1
  135. package/dist/geometries/geometry-helpers.js.map +1 -1
  136. package/dist/geometries/ico-sphere-geometry.js +1 -1
  137. package/dist/geometries/ico-sphere-geometry.js.map +1 -1
  138. package/dist/geometries/plane-geometry.js +1 -1
  139. package/dist/geometries/plane-geometry.js.map +1 -1
  140. package/dist/geometries/primitive-mesh-builder.d.ts +24 -0
  141. package/dist/geometries/primitive-mesh-builder.d.ts.map +1 -0
  142. package/dist/geometries/primitive-mesh-builder.js +74 -0
  143. package/dist/geometries/primitive-mesh-builder.js.map +1 -0
  144. package/dist/geometries/prism-geometry.d.ts +13 -0
  145. package/dist/geometries/prism-geometry.d.ts.map +1 -0
  146. package/dist/geometries/prism-geometry.js +34 -0
  147. package/dist/geometries/prism-geometry.js.map +1 -0
  148. package/dist/geometries/ring-geometry.d.ts +15 -0
  149. package/dist/geometries/ring-geometry.d.ts.map +1 -0
  150. package/dist/geometries/ring-geometry.js +64 -0
  151. package/dist/geometries/ring-geometry.js.map +1 -0
  152. package/dist/geometries/sphere-geometry.js +1 -1
  153. package/dist/geometries/sphere-geometry.js.map +1 -1
  154. package/dist/geometries/surface-of-revolution.js +1 -1
  155. package/dist/geometries/surface-of-revolution.js.map +1 -1
  156. package/dist/geometries/truncated-cone-geometry.js +1 -1
  157. package/dist/geometries/truncated-cone-geometry.js.map +1 -1
  158. package/dist/index.cjs +290 -9
  159. package/dist/index.cjs.map +3 -3
  160. package/dist/index.d.ts +6 -0
  161. package/dist/index.d.ts.map +1 -1
  162. package/dist/index.js +4 -1
  163. package/dist/index.js.map +1 -1
  164. package/dist/lib/geometry-utils.js +1 -1
  165. package/dist/lib/geometry-utils.js.map +1 -1
  166. package/dist/lib/geometry.d.ts +1 -1
  167. package/dist/lib/geometry.d.ts.map +1 -1
  168. package/dist/lib/geometry.js +1 -1
  169. package/dist/lib/geometry.js.map +1 -1
  170. package/dist/lib/hinge-tree.d.ts +33 -0
  171. package/dist/lib/hinge-tree.d.ts.map +1 -0
  172. package/dist/lib/hinge-tree.js +144 -0
  173. package/dist/lib/hinge-tree.js.map +1 -0
  174. package/dist/parametric/lathe-geometry.d.ts +14 -0
  175. package/dist/parametric/lathe-geometry.d.ts.map +1 -0
  176. package/dist/parametric/lathe-geometry.js +48 -0
  177. package/dist/parametric/lathe-geometry.js.map +1 -0
  178. package/dist/parametric/parametric-geometry.d.ts +20 -0
  179. package/dist/parametric/parametric-geometry.d.ts.map +1 -0
  180. package/dist/parametric/parametric-geometry.js +88 -0
  181. package/dist/parametric/parametric-geometry.js.map +1 -0
  182. package/dist/parametric/torus-geometry.d.ts +19 -0
  183. package/dist/parametric/torus-geometry.d.ts.map +1 -0
  184. package/dist/parametric/torus-geometry.js +89 -0
  185. package/dist/parametric/torus-geometry.js.map +1 -0
  186. package/dist/parametric.cjs +328 -0
  187. package/dist/parametric.cjs.map +6 -0
  188. package/dist/parametric.d.ts +7 -0
  189. package/dist/parametric.d.ts.map +1 -0
  190. package/dist/parametric.js +7 -0
  191. package/dist/parametric.js.map +1 -0
  192. package/dist/polygon/cut-by-grid.d.ts +24 -0
  193. package/dist/polygon/cut-by-grid.d.ts.map +1 -0
  194. package/dist/polygon/cut-by-grid.js +221 -0
  195. package/dist/polygon/cut-by-grid.js.map +1 -0
  196. package/dist/polygon/cut-by-mercator-bounds.d.ts +17 -0
  197. package/dist/polygon/cut-by-mercator-bounds.d.ts.map +1 -0
  198. package/dist/polygon/cut-by-mercator-bounds.js +149 -0
  199. package/dist/polygon/cut-by-mercator-bounds.js.map +1 -0
  200. package/dist/polygon/earcut.d.ts +13 -0
  201. package/dist/polygon/earcut.d.ts.map +1 -0
  202. package/dist/polygon/earcut.js +627 -0
  203. package/dist/polygon/earcut.js.map +1 -0
  204. package/dist/polygon/index.cjs +1437 -0
  205. package/dist/polygon/index.cjs.map +6 -0
  206. package/dist/polygon/index.d.ts +12 -0
  207. package/dist/polygon/index.d.ts.map +1 -0
  208. package/dist/polygon/index.js +12 -0
  209. package/dist/polygon/index.js.map +1 -0
  210. package/dist/polygon/lineclip.d.ts +31 -0
  211. package/dist/polygon/lineclip.d.ts.map +1 -0
  212. package/dist/polygon/lineclip.js +184 -0
  213. package/dist/polygon/lineclip.js.map +1 -0
  214. package/dist/polygon/polygon-utils.d.ts +103 -0
  215. package/dist/polygon/polygon-utils.d.ts.map +1 -0
  216. package/dist/polygon/polygon-utils.js +155 -0
  217. package/dist/polygon/polygon-utils.js.map +1 -0
  218. package/dist/polygon/polygon.d.ts +41 -0
  219. package/dist/polygon/polygon.d.ts.map +1 -0
  220. package/dist/polygon/polygon.js +76 -0
  221. package/dist/polygon/polygon.js.map +1 -0
  222. package/dist/polygon/subdivide-polyline.d.ts +56 -0
  223. package/dist/polygon/subdivide-polyline.d.ts.map +1 -0
  224. package/dist/polygon/subdivide-polyline.js +141 -0
  225. package/dist/polygon/subdivide-polyline.js.map +1 -0
  226. package/dist/polygon/subdivide-triangle-mesh.d.ts +68 -0
  227. package/dist/polygon/subdivide-triangle-mesh.d.ts.map +1 -0
  228. package/dist/polygon/subdivide-triangle-mesh.js +228 -0
  229. package/dist/polygon/subdivide-triangle-mesh.js.map +1 -0
  230. package/dist/polygon/utils.d.ts +5 -0
  231. package/dist/polygon/utils.d.ts.map +1 -0
  232. package/dist/polygon/utils.js +38 -0
  233. package/dist/polygon/utils.js.map +1 -0
  234. package/dist/spatial-index/box-index.cjs +328 -0
  235. package/dist/spatial-index/box-index.cjs.map +6 -0
  236. package/dist/spatial-index/box-index.d.ts +65 -0
  237. package/dist/spatial-index/box-index.d.ts.map +1 -0
  238. package/dist/spatial-index/box-index.js +263 -0
  239. package/dist/spatial-index/box-index.js.map +1 -0
  240. package/dist/spatial-index/index.cjs +494 -0
  241. package/dist/spatial-index/index.cjs.map +6 -0
  242. package/dist/spatial-index/index.d.ts +5 -0
  243. package/dist/spatial-index/index.d.ts.map +1 -0
  244. package/dist/spatial-index/index.js +6 -0
  245. package/dist/spatial-index/index.js.map +1 -0
  246. package/dist/spatial-index/triangle-bvh.d.ts +53 -0
  247. package/dist/spatial-index/triangle-bvh.d.ts.map +1 -0
  248. package/dist/spatial-index/triangle-bvh.js +102 -0
  249. package/dist/spatial-index/triangle-bvh.js.map +1 -0
  250. package/dist/utils/attribute-compression.d.ts +50 -0
  251. package/dist/utils/attribute-compression.d.ts.map +1 -0
  252. package/dist/utils/attribute-compression.js +186 -0
  253. package/dist/utils/attribute-compression.js.map +1 -0
  254. package/dist/utils/attribute-iterator.d.ts +8 -0
  255. package/dist/utils/attribute-iterator.d.ts.map +1 -0
  256. package/dist/utils/attribute-iterator.js +25 -0
  257. package/dist/utils/attribute-iterator.js.map +1 -0
  258. package/dist/utils/compute-vertex-normals.d.ts +4 -0
  259. package/dist/utils/compute-vertex-normals.d.ts.map +1 -0
  260. package/dist/utils/compute-vertex-normals.js +54 -0
  261. package/dist/utils/compute-vertex-normals.js.map +1 -0
  262. package/dist/utils/constants.d.ts +52 -0
  263. package/dist/utils/constants.d.ts.map +1 -0
  264. package/dist/utils/constants.js +39 -0
  265. package/dist/utils/constants.js.map +1 -0
  266. package/dist/utils/coordinates.d.ts +3 -0
  267. package/dist/utils/coordinates.d.ts.map +1 -0
  268. package/dist/utils/coordinates.js +8 -0
  269. package/dist/utils/coordinates.js.map +1 -0
  270. package/dist/utils/geometry.d.ts +20 -0
  271. package/dist/utils/geometry.d.ts.map +1 -0
  272. package/dist/utils/geometry.js +31 -0
  273. package/dist/utils/geometry.js.map +1 -0
  274. package/dist/utils/gl-type.d.ts +17 -0
  275. package/dist/utils/gl-type.d.ts.map +1 -0
  276. package/dist/utils/gl-type.js +69 -0
  277. package/dist/utils/gl-type.js.map +1 -0
  278. package/dist/utils/index.cjs +965 -0
  279. package/dist/utils/index.cjs.map +6 -0
  280. package/dist/utils/index.d.ts +18 -0
  281. package/dist/utils/index.d.ts.map +1 -0
  282. package/dist/utils/index.js +16 -0
  283. package/dist/utils/index.js.map +1 -0
  284. package/dist/utils/interpolate-packed-attributes.cjs +176 -0
  285. package/dist/utils/interpolate-packed-attributes.cjs.map +6 -0
  286. package/dist/utils/interpolate-packed-attributes.d.ts +43 -0
  287. package/dist/utils/interpolate-packed-attributes.d.ts.map +1 -0
  288. package/dist/utils/interpolate-packed-attributes.js +192 -0
  289. package/dist/utils/interpolate-packed-attributes.js.map +1 -0
  290. package/dist/utils/mesh-processing.d.ts +18 -0
  291. package/dist/utils/mesh-processing.d.ts.map +1 -0
  292. package/dist/utils/mesh-processing.js +300 -0
  293. package/dist/utils/mesh-processing.js.map +1 -0
  294. package/dist/utils/primitive-iterator.d.ts +21 -0
  295. package/dist/utils/primitive-iterator.d.ts.map +1 -0
  296. package/dist/utils/primitive-iterator.js +117 -0
  297. package/dist/utils/primitive-iterator.js.map +1 -0
  298. package/dist/utils/rgb565.d.ts +5 -0
  299. package/dist/utils/rgb565.d.ts.map +1 -0
  300. package/dist/utils/rgb565.js +24 -0
  301. package/dist/utils/rgb565.js.map +1 -0
  302. package/dist/utils/typed-array-utils.d.ts +3 -0
  303. package/dist/utils/typed-array-utils.d.ts.map +1 -0
  304. package/dist/utils/typed-array-utils.js +16 -0
  305. package/dist/utils/typed-array-utils.js.map +1 -0
  306. package/package.json +57 -4
  307. package/src/culling/constants.ts +6 -0
  308. package/src/culling/index.ts +45 -0
  309. package/src/culling/lib/algorithms/bounding-box-from-points.ts +174 -0
  310. package/src/culling/lib/algorithms/bounding-sphere-from-points.ts +175 -0
  311. package/src/culling/lib/algorithms/compute-eigen-decomposition.ts +171 -0
  312. package/src/culling/lib/algorithms/oriented-bounding-box-quaternion.ts +32 -0
  313. package/src/culling/lib/bounding-volumes/axis-aligned-bounding-box.ts +153 -0
  314. package/src/culling/lib/bounding-volumes/bounding-sphere.ts +154 -0
  315. package/src/culling/lib/bounding-volumes/bounding-volume.ts +38 -0
  316. package/src/culling/lib/bounding-volumes/oriented-bounding-box.ts +320 -0
  317. package/src/culling/lib/culling-volume.ts +163 -0
  318. package/src/culling/lib/perspective-frustum.ts +288 -0
  319. package/src/culling/lib/perspective-off-center-frustum.ts +381 -0
  320. package/src/culling/lib/plane.ts +118 -0
  321. package/src/culling/lib/ray.ts +33 -0
  322. package/src/culling/lib/shapes/box-shape.ts +78 -0
  323. package/src/culling/lib/shapes/capsule-shape.ts +232 -0
  324. package/src/culling/lib/shapes/cylinder-shape.ts +133 -0
  325. package/src/culling/lib/shapes/implicit-shape.ts +209 -0
  326. package/src/culling/lib/shapes/plane-shape.ts +78 -0
  327. package/src/culling/lib/shapes/sphere-shape.ts +60 -0
  328. package/src/culling/oriented-box-2d.ts +165 -0
  329. package/src/culling/queries.ts +155 -0
  330. package/src/curves/bezier-curves.ts +62 -0
  331. package/src/curves/catmull-rom-curve.ts +89 -0
  332. package/src/curves/curve-arc-length.ts +70 -0
  333. package/src/curves/curve.ts +96 -0
  334. package/src/curves/hermite-curve.ts +34 -0
  335. package/src/curves/index.ts +15 -0
  336. package/src/geometries/box-geometry.ts +1 -1
  337. package/src/geometries/capsule-geometry.ts +1 -1
  338. package/src/geometries/cylinder-geometry.ts +1 -1
  339. package/src/geometries/geometry-helpers.ts +1 -1
  340. package/src/geometries/ico-sphere-geometry.ts +1 -1
  341. package/src/geometries/plane-geometry.ts +1 -1
  342. package/src/geometries/primitive-mesh-builder.ts +84 -0
  343. package/src/geometries/prism-geometry.ts +57 -0
  344. package/src/geometries/ring-geometry.ts +102 -0
  345. package/src/geometries/sphere-geometry.ts +1 -1
  346. package/src/geometries/surface-of-revolution.ts +1 -1
  347. package/src/geometries/truncated-cone-geometry.ts +1 -1
  348. package/src/index.ts +10 -1
  349. package/src/lib/geometry-utils.ts +2 -2
  350. package/src/lib/geometry.ts +2 -2
  351. package/src/lib/hinge-tree.ts +170 -0
  352. package/src/parametric/lathe-geometry.ts +70 -0
  353. package/src/parametric/parametric-geometry.ts +118 -0
  354. package/src/parametric/torus-geometry.ts +118 -0
  355. package/src/parametric.ts +9 -0
  356. package/src/polygon/cut-by-grid.ts +313 -0
  357. package/src/polygon/cut-by-mercator-bounds.ts +204 -0
  358. package/src/polygon/earcut.ts +798 -0
  359. package/src/polygon/index.ts +35 -0
  360. package/src/polygon/lineclip.ts +218 -0
  361. package/src/polygon/polygon-utils.ts +273 -0
  362. package/src/polygon/polygon.ts +105 -0
  363. package/src/polygon/subdivide-polyline.ts +223 -0
  364. package/src/polygon/subdivide-triangle-mesh.ts +322 -0
  365. package/src/polygon/utils.ts +50 -0
  366. package/src/spatial-index/box-index.ts +343 -0
  367. package/src/spatial-index/index.ts +18 -0
  368. package/src/spatial-index/triangle-bvh.ts +162 -0
  369. package/src/utils/attribute-compression.ts +234 -0
  370. package/src/utils/attribute-iterator.ts +28 -0
  371. package/src/utils/compute-vertex-normals.ts +63 -0
  372. package/src/utils/constants.ts +42 -0
  373. package/src/utils/coordinates.ts +8 -0
  374. package/src/utils/geometry.ts +49 -0
  375. package/src/utils/gl-type.ts +87 -0
  376. package/src/utils/index.ts +55 -0
  377. package/src/utils/interpolate-packed-attributes.ts +284 -0
  378. package/src/utils/mesh-processing.ts +377 -0
  379. package/src/utils/primitive-iterator.ts +145 -0
  380. package/src/utils/rgb565.ts +26 -0
  381. package/src/utils/typed-array-utils.ts +16 -0
@@ -0,0 +1,102 @@
1
+ // math.gl
2
+ // SPDX-License-Identifier: MIT
3
+ // SPDX-FileCopyrightText: Copyright (c) vis.gl contributors
4
+ import { getClosestPointOnTriangle, intersectRayTriangle, normalizeQueryDirection, validateQueryPoint } from "../culling/queries.js";
5
+ import { BoxIndex } from "./box-index.js";
6
+ /** Static triangle-list BVH. index is the original triangle number, not a vertex index. */
7
+ export class TriangleBVH {
8
+ constructor(options) {
9
+ if (options.positions.length % 3)
10
+ throw new RangeError('Positions must be packed xyz');
11
+ this.positions = Float64Array.from(options.positions);
12
+ for (const value of this.positions) {
13
+ if (!Number.isFinite(value))
14
+ throw new RangeError('Positions must be finite');
15
+ }
16
+ const source = options.indices ?? Array.from({ length: this.positions.length / 3 }, (_, i) => i);
17
+ if (source.length % 3)
18
+ throw new RangeError('Indices must form triangles');
19
+ this.indices = new Uint32Array(source.length);
20
+ for (let i = 0; i < source.length; i++) {
21
+ if (!Number.isSafeInteger(source[i]) ||
22
+ source[i] < 0 ||
23
+ source[i] >= this.positions.length / 3 ||
24
+ source[i] > 0xffffffff) {
25
+ throw new RangeError('Triangle index is out of bounds');
26
+ }
27
+ this.indices[i] = source[i];
28
+ }
29
+ this.size = this.indices.length / 3;
30
+ const bounds = new Float64Array(this.size * 6);
31
+ for (let i = 0; i < this.size; i++) {
32
+ const [a, b, c] = this.triangle(i);
33
+ for (let axis = 0; axis < 3; axis++) {
34
+ bounds[i * 6 + axis] = Math.min(a[axis], b[axis], c[axis]);
35
+ bounds[i * 6 + axis + 3] = Math.max(a[axis], b[axis], c[axis]);
36
+ }
37
+ }
38
+ this.boxes = new BoxIndex({ bounds, dimension: 3, leafSize: options.leafSize });
39
+ }
40
+ /** Bounds candidates only; does not imply exact triangle/box overlap. */
41
+ search(minimum, maximum) {
42
+ return this.boxes.search(minimum, maximum);
43
+ }
44
+ /** Nearest accepted exact hit; application rejection never clips away later candidates. */
45
+ intersectRay(origin, direction, options = {}) {
46
+ validateQueryPoint(origin, 3);
47
+ const unit = normalizeQueryDirection(direction, 3);
48
+ let result = null;
49
+ this.boxes.intersectRay(origin, direction, {
50
+ maxDistance: options.maxDistance,
51
+ filter: options.filter,
52
+ intersectItem: (index, maximum) => {
53
+ const [a, b, c] = this.triangle(index);
54
+ const hit = intersectRayTriangle(origin, unit, a, b, c, {
55
+ backfaceCulling: options.backfaceCulling,
56
+ maxT: maximum
57
+ });
58
+ if (hit &&
59
+ (!result ||
60
+ hit.t < result.distance ||
61
+ (hit.t === result.distance && index < result.index))) {
62
+ const candidateHit = {
63
+ index,
64
+ distance: hit.t,
65
+ point: [
66
+ origin[0] + hit.t * unit[0],
67
+ origin[1] + hit.t * unit[1],
68
+ origin[2] + hit.t * unit[2]
69
+ ],
70
+ barycentric: hit.barycentric
71
+ };
72
+ if (!options.acceptHit || options.acceptHit(candidateHit)) {
73
+ result = candidateHit;
74
+ return hit.t;
75
+ }
76
+ }
77
+ return null;
78
+ }
79
+ });
80
+ return result;
81
+ }
82
+ nearest(point, options = {}) {
83
+ const result = this.boxes.nearest(point, {
84
+ ...options,
85
+ distanceToItem: index => {
86
+ const closest = getClosestPointOnTriangle(point, ...this.triangle(index));
87
+ return Math.hypot(point[0] - closest[0], point[1] - closest[1], point[2] - closest[2]);
88
+ }
89
+ });
90
+ return result
91
+ ? { ...result, point: getClosestPointOnTriangle(point, ...this.triangle(result.index)) }
92
+ : null;
93
+ }
94
+ triangle(index) {
95
+ const vertex = (i) => {
96
+ const start = this.indices[index * 3 + i] * 3;
97
+ return this.positions.subarray(start, start + 3);
98
+ };
99
+ return [vertex(0), vertex(1), vertex(2)];
100
+ }
101
+ }
102
+ //# sourceMappingURL=triangle-bvh.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"triangle-bvh.js","sourceRoot":"","sources":["../../src/spatial-index/triangle-bvh.ts"],"names":[],"mappings":"AAAA,UAAU;AACV,+BAA+B;AAC/B,4DAA4D;AAE5D,OAAO,EACL,yBAAyB,EACzB,oBAAoB,EACpB,uBAAuB,EACvB,kBAAkB,EAEnB,8BAA2B;AAC5B,OAAO,EAAC,QAAQ,EAAC,uBAAoB;AAsCrC,2FAA2F;AAC3F,MAAM,OAAO,WAAW;IAMtB,YAAY,OAA2B;QACrC,IAAI,OAAO,CAAC,SAAS,CAAC,MAAM,GAAG,CAAC;YAAE,MAAM,IAAI,UAAU,CAAC,8BAA8B,CAAC,CAAC;Q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,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,MAAM,CAAC,CAAC,CAAC,EAAE,MAAM,CAAC,CAAC,CAAC,CAAC,CAAC;IAC3C,CAAC;CACF"}
@@ -0,0 +1,50 @@
1
+ import { Vector2, Vector3 } from '@math.gl/core';
2
+ type Vector4 = {
3
+ x: number;
4
+ y: number;
5
+ z: number;
6
+ w: number;
7
+ };
8
+ /**
9
+ * Encodes a normalized vector into two SNORM values following octahedral encoding.
10
+ *
11
+ * @param vector Normalized vector to encode.
12
+ * @param rangeMaximum Maximum value of the SNORM range.
13
+ * @param result Target for the two encoded components.
14
+ */
15
+ export declare function octEncodeInRange(vector: Vector3, rangeMaximum: number, result: Vector2): Vector2;
16
+ /** Encodes a normalized vector into two 8-bit octahedral components. */
17
+ export declare function octEncode(vector: Vector3, result: Vector2): Vector2;
18
+ /** Encodes a normalized vector into four 8-bit octahedral components. */
19
+ export declare function octEncodeToVector4(vector: Vector3, result: Vector4): Vector4;
20
+ /**
21
+ * Decodes two SNORM octahedral components into a normalized vector.
22
+ *
23
+ * @param x First encoded component.
24
+ * @param y Second encoded component.
25
+ * @param rangeMaximum Maximum value of the SNORM range.
26
+ * @param result Target for the decoded vector.
27
+ */
28
+ export declare function octDecodeInRange(x: number, y: number, rangeMaximum: number, result: Vector3): Vector3;
29
+ /** Decodes two 8-bit octahedral components into a normalized vector. */
30
+ export declare function octDecode(x: number, y: number, result: Vector3): Vector3;
31
+ /** Decodes four 8-bit octahedral components into a normalized vector. */
32
+ export declare function octDecodeFromVector4(encoded: Vector4, result: Vector3): Vector3;
33
+ /** Packs an octahedrally encoded two-component vector into one number. */
34
+ export declare function octPackFloat(encoded: Vector2): number;
35
+ /** Encodes a normalized vector into an octahedral representation packed into one number. */
36
+ export declare function octEncodeFloat(vector: Vector3): number;
37
+ /** Decodes an octahedral representation packed into one number. */
38
+ export declare function octDecodeFloat(value: number, result: Vector3): Vector3;
39
+ /** Packs three normalized vectors into two numeric octahedral values. */
40
+ export declare function octPack(vector1: Vector3, vector2: Vector3, vector3: Vector3, result: Vector2): Vector2;
41
+ /** Decodes three normalized vectors packed by {@link octPack}. */
42
+ export declare function octUnpack(packed: Vector2, vector1: Vector3, vector2: Vector3, vector3: Vector3): void;
43
+ /** Packs two normalized texture coordinates into one number with 12 bits per component. */
44
+ export declare function compressTextureCoordinates(textureCoordinates: Vector2): number;
45
+ /** Decompresses texture coordinates packed by {@link compressTextureCoordinates}. */
46
+ export declare function decompressTextureCoordinates(compressed: number, result: Vector2): Vector2;
47
+ /** Decodes delta- and ZigZag-encoded vertex buffers in place. */
48
+ export declare function zigZagDeltaDecode(uBuffer: Uint16Array, vBuffer: Uint16Array, heightBuffer?: Uint16Array | number[]): void;
49
+ export {};
50
+ //# sourceMappingURL=attribute-compression.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"attribute-compression.d.ts","sourceRoot":"","sources":["../../src/utils/attribute-compression.ts"],"names":[],"mappings":"AASA,OAAO,EAAC,OAAO,EAAE,OAAO,EAA4B,MAAM,eAAe,CAAC;AAE1E,KAAK,OAAO,GAAG;IAAC,CAAC,EAAE,MAAM,CAAC;IAAC,CAAC,EAAE,MAAM,CAAC;IAAC,CAAC,EAAE,MAAM,CAAC;IAAC,CAAC,EAAE,MAAM,CAAA;CAAC,CAAC;AA2B5D;;;;;;GAMG;AACH,wBAAgB,gBAAgB,CAAC,MAAM,EAAE,OAAO,EAAE,YAAY,EAAE,MAAM,EAAE,MAAM,EAAE,OAAO,GAAG,OAAO,CAoBhG;AAED,wEAAwE;AACxE,wBAAgB,SAAS,CAAC,MAAM,EAAE,OAAO,EAAE,MAAM,EAAE,OAAO,GAAG,OAAO,CAEnE;AAED,yEAAyE;AACzE,wBAAgB,kBAAkB,CAAC,MAAM,EAAE,OAAO,EAAE,MAAM,EAAE,OAAO,GAAG,OAAO,CAO5E;AAED;;;;;;;GAOG;AACH,wBAAgB,gBAAgB,CAC9B,CAAC,EAAE,MAAM,EACT,CAAC,EAAE,M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-License-Identifier: MIT AND Apache-2.0
3
+ // SPDX-FileCopyrightText: Copyright (c) vis.gl contributors
4
+ // SPDX-FileCopyrightText: Copyright 2011-2018 CesiumJS Contributors
5
+ // SPDX-FileComment: Derived from Cesium. See the repository LICENSE for upstream attribution and Apache-2.0 terms.
6
+ // Derived from Cesium under the Apache 2.0 license.
7
+ // https://github.com/CesiumGS/cesium/blob/main/LICENSE.md
8
+ import { Vector2, Vector3, assert, clamp, _MathUtils } from '@math.gl/core';
9
+ const RIGHT_SHIFT = 1 / 256;
10
+ const LEFT_SHIFT = 256;
11
+ const scratchVector2 = new Vector2();
12
+ const scratchVector3 = new Vector3();
13
+ const scratchEncodeVector2 = new Vector2();
14
+ const octEncodeScratch = new Vector2();
15
+ const uint8ForceArray = new Uint8Array(1);
16
+ function forceUint8(value) {
17
+ uint8ForceArray[0] = value;
18
+ return uint8ForceArray[0];
19
+ }
20
+ function fromSNorm(value, rangeMaximum = 255) {
21
+ return (clamp(value, 0, rangeMaximum) / rangeMaximum) * 2 - 1;
22
+ }
23
+ function toSNorm(value, rangeMaximum = 255) {
24
+ return Math.round((clamp(value, -1, 1) * 0.5 + 0.5) * rangeMaximum);
25
+ }
26
+ function signNotZero(value) {
27
+ return value < 0 ? -1 : 1;
28
+ }
29
+ /**
30
+ * Encodes a normalized vector into two SNORM values following octahedral encoding.
31
+ *
32
+ * @param vector Normalized vector to encode.
33
+ * @param rangeMaximum Maximum value of the SNORM range.
34
+ * @param result Target for the two encoded components.
35
+ */
36
+ export function octEncodeInRange(vector, rangeMaximum, result) {
37
+ assert(vector);
38
+ assert(result);
39
+ scratchVector3.from(vector);
40
+ assert(Math.abs(scratchVector3.magnitudeSquared() - 1) <= _MathUtils.EPSILON6);
41
+ const denominator = Math.abs(vector.x) + Math.abs(vector.y) + Math.abs(vector.z);
42
+ result.x = vector.x / denominator;
43
+ result.y = vector.y / denominator;
44
+ if (vector.z < 0) {
45
+ const x = result.x;
46
+ const y = result.y;
47
+ result.x = (1 - Math.abs(y)) * signNotZero(x);
48
+ result.y = (1 - Math.abs(x)) * signNotZero(y);
49
+ }
50
+ result.x = toSNorm(result.x, rangeMaximum);
51
+ result.y = toSNorm(result.y, rangeMaximum);
52
+ return result;
53
+ }
54
+ /** Encodes a normalized vector into two 8-bit octahedral components. */
55
+ export function octEncode(vector, result) {
56
+ return octEncodeInRange(vector, 255, result);
57
+ }
58
+ /** Encodes a normalized vector into four 8-bit octahedral components. */
59
+ export function octEncodeToVector4(vector, result) {
60
+ octEncodeInRange(vector, 65535, octEncodeScratch);
61
+ result.x = forceUint8(octEncodeScratch.x * RIGHT_SHIFT);
62
+ result.y = forceUint8(octEncodeScratch.x);
63
+ result.z = forceUint8(octEncodeScratch.y * RIGHT_SHIFT);
64
+ result.w = forceUint8(octEncodeScratch.y);
65
+ return result;
66
+ }
67
+ /**
68
+ * Decodes two SNORM octahedral components into a normalized vector.
69
+ *
70
+ * @param x First encoded component.
71
+ * @param y Second encoded component.
72
+ * @param rangeMaximum Maximum value of the SNORM range.
73
+ * @param result Target for the decoded vector.
74
+ */
75
+ export function octDecodeInRange(x, y, rangeMaximum, result) {
76
+ assert(result);
77
+ if (x < 0 || x > rangeMaximum || y < 0 || y > rangeMaximum) {
78
+ throw new Error(`x and y must be unsigned normalized integers between 0 and ${rangeMaximum}`);
79
+ }
80
+ result.x = fromSNorm(x, rangeMaximum);
81
+ result.y = fromSNorm(y, rangeMaximum);
82
+ result.z = 1 - (Math.abs(result.x) + Math.abs(result.y));
83
+ if (result.z < 0) {
84
+ const oldX = result.x;
85
+ result.x = (1 - Math.abs(result.y)) * signNotZero(oldX);
86
+ result.y = (1 - Math.abs(oldX)) * signNotZero(result.y);
87
+ }
88
+ return result.normalize();
89
+ }
90
+ /** Decodes two 8-bit octahedral components into a normalized vector. */
91
+ export function octDecode(x, y, result) {
92
+ return octDecodeInRange(x, y, 255, result);
93
+ }
94
+ /** Decodes four 8-bit octahedral components into a normalized vector. */
95
+ export function octDecodeFromVector4(encoded, result) {
96
+ assert(encoded);
97
+ assert(result);
98
+ const { x, y, z, w } = encoded;
99
+ if (x < 0 || x > 255 || y < 0 || y > 255 || z < 0 || z > 255 || w < 0 || w > 255) {
100
+ throw new Error('x, y, z, and w must be unsigned normalized integers between 0 and 255');
101
+ }
102
+ return octDecodeInRange(x * LEFT_SHIFT + y, z * LEFT_SHIFT + w, 65535, result);
103
+ }
104
+ /** Packs an octahedrally encoded two-component vector into one number. */
105
+ export function octPackFloat(encoded) {
106
+ scratchVector2.from(encoded);
107
+ return 256 * scratchVector2.x + scratchVector2.y;
108
+ }
109
+ /** Encodes a normalized vector into an octahedral representation packed into one number. */
110
+ export function octEncodeFloat(vector) {
111
+ octEncode(vector, scratchEncodeVector2);
112
+ return octPackFloat(scratchEncodeVector2);
113
+ }
114
+ /** Decodes an octahedral representation packed into one number. */
115
+ export function octDecodeFloat(value, result) {
116
+ assert(Number.isFinite(value));
117
+ const temporary = value / 256;
118
+ const x = Math.floor(temporary);
119
+ const y = (temporary - x) * 256;
120
+ return octDecode(x, y, result);
121
+ }
122
+ /** Packs three normalized vectors into two numeric octahedral values. */
123
+ export function octPack(vector1, vector2, vector3, result) {
124
+ assert(vector1);
125
+ assert(vector2);
126
+ assert(vector3);
127
+ assert(result);
128
+ const encoded1 = octEncodeFloat(vector1);
129
+ const encoded2 = octEncodeFloat(vector2);
130
+ const encoded3 = octEncode(vector3, scratchEncodeVector2);
131
+ result.x = 65536 * encoded3.x + encoded1;
132
+ result.y = 65536 * encoded3.y + encoded2;
133
+ return result;
134
+ }
135
+ /** Decodes three normalized vectors packed by {@link octPack}. */
136
+ export function octUnpack(packed, vector1, vector2, vector3) {
137
+ let temporary = packed.x / 65536;
138
+ const x = Math.floor(temporary);
139
+ const encodedFloat1 = (temporary - x) * 65536;
140
+ temporary = packed.y / 65536;
141
+ const y = Math.floor(temporary);
142
+ const encodedFloat2 = (temporary - y) * 65536;
143
+ octDecodeFloat(encodedFloat1, vector1);
144
+ octDecodeFloat(encodedFloat2, vector2);
145
+ octDecode(x, y, vector3);
146
+ }
147
+ /** Packs two normalized texture coordinates into one number with 12 bits per component. */
148
+ export function compressTextureCoordinates(textureCoordinates) {
149
+ const x = (textureCoordinates.x * 4095) | 0;
150
+ const y = (textureCoordinates.y * 4095) | 0;
151
+ return 4096 * x + y;
152
+ }
153
+ /** Decompresses texture coordinates packed by {@link compressTextureCoordinates}. */
154
+ export function decompressTextureCoordinates(compressed, result) {
155
+ const temporary = compressed / 4096;
156
+ const x = Math.floor(temporary);
157
+ result.x = x / 4095;
158
+ result.y = (compressed - x * 4096) / 4095;
159
+ return result;
160
+ }
161
+ /** Decodes delta- and ZigZag-encoded vertex buffers in place. */
162
+ export function zigZagDeltaDecode(uBuffer, vBuffer, heightBuffer) {
163
+ assert(uBuffer);
164
+ assert(vBuffer);
165
+ assert(uBuffer.length === vBuffer.length);
166
+ if (heightBuffer) {
167
+ assert(uBuffer.length === heightBuffer.length);
168
+ }
169
+ let u = 0;
170
+ let v = 0;
171
+ let height = 0;
172
+ for (let index = 0; index < uBuffer.length; index++) {
173
+ u += zigZagDecode(uBuffer[index]);
174
+ v += zigZagDecode(vBuffer[index]);
175
+ uBuffer[index] = u;
176
+ vBuffer[index] = v;
177
+ if (heightBuffer) {
178
+ height += zigZagDecode(heightBuffer[index]);
179
+ heightBuffer[index] = height;
180
+ }
181
+ }
182
+ }
183
+ function zigZagDecode(value) {
184
+ return (value >> 1) ^ -(value & 1);
185
+ }
186
+ //# sourceMappingURL=attribute-compression.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"attribute-compression.js","sourceRoot":"","sources":["../../src/utils/attribute-compression.ts"],"names":[],"mappings":"AAAA,UAAU;AACV,8CAA8C;AAC9C,4DAA4D;AAC5D,oEAAoE;AACpE,mHAAmH;AAEnH,oDAAoD;AACpD,0DAA0D;AAE1D,OAAO,EAAC,OAAO,EAAE,OAAO,EAAE,MAAM,EAAE,KAAK,EAAE,UAAU,EAAC,MAAM,eAAe,CAAC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 *
5
+ * For performance, each iteration reuses the same typed-array view-sized value.
6
+ */
7
+ export declare function makeAttributeIterator(values: TypedArray, size: number): Iterable<TypedArray>;
8
+ //# sourceMappingURL=attribute-iterator.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"attribute-iterator.d.ts","sourceRoot":"","sources":["../../src/utils/attribute-iterator.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAC,UAAU,EAAwB,MAAM,qBAAqB,CAAC;AAE3E;;;;GAIG;AACH,wBAAiB,qBAAqB,CAAC,MAAM,EAAE,UAAU,EAAE,IAAI,EAAE,MAAM,GAAG,QAAQ,CAAC,UAAU,CAAC,CAgB7F"}
@@ -0,0 +1,25 @@
1
+ // math.gl
2
+ // SPDX-License-Identifier: MIT
3
+ // SPDX-FileCopyrightText: Copyright (c) vis.gl contributors
4
+ /**
5
+ * Iterates over the fixed-size elements of a typed array.
6
+ *
7
+ * For performance, each iteration reuses the same typed-array view-sized value.
8
+ */
9
+ export function* makeAttributeIterator(values, size) {
10
+ if (!Number.isInteger(size) || size <= 0) {
11
+ throw new Error('Attribute size must be a positive integer');
12
+ }
13
+ if (values.length % size !== 0) {
14
+ throw new Error('Attribute length must be divisible by its size');
15
+ }
16
+ const ArrayType = values.constructor;
17
+ const element = new ArrayType(size);
18
+ for (let index = 0; index < values.length; index += size) {
19
+ for (let componentIndex = 0; componentIndex < size; componentIndex++) {
20
+ element[componentIndex] = values[index + componentIndex];
21
+ }
22
+ yield element;
23
+ }
24
+ }
25
+ //# sourceMappingURL=attribute-iterator.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"attribute-iterator.js","sourceRoot":"","sources":["../../src/utils/attribute-iterator.ts"],"names":[],"mappings":"AAAA,UAAU;AACV,+BAA+B;AAC/B,4DAA4D;AAI5D;;;;GAIG;AACH,MAAM,SAAS,CAAC,CAAC,qBAAqB,CAAC,MAAkB,EAAE,IAAY;IACrE,IAAI,CAAC,MAAM,CAAC,SAAS,CAAC,IAAI,CAAC,IAAI,IAAI,IAAI,CAAC,EAAE,CAAC;QACzC,MAAM,IAAI,KAAK,CAAC,2CAA2C,CAAC,CAAC;IAC/D,CAAC;IACD,IAAI,MAAM,CAAC,MAAM,GAAG,IAAI,KAAK,CAAC,EAAE,CAAC;QAC/B,MAAM,IAAI,KAAK,CAAC,gDAAgD,CAAC,CAAC;IACpE,CAAC;IAED,MAAM,SAAS,GAAG,MAAM,CAAC,WAAoC,CAAC;IAC9D,MAAM,OAAO,GAAG,IAAI,SAAS,CAAC,IAAI,CAAC,CAAC;IACpC,KAAK,IAAI,KAAK,GAAG,CAAC,EAAE,KAAK,GAAG,MAAM,CAAC,MAAM,EAAE,KAAK,IAAI,IAAI,EAAE,CAAC;QACzD,KAAK,IAAI,cAAc,GAAG,CAAC,EAAE,cAAc,GAAG,IAAI,EAAE,cAAc,EAAE,EAAE,CAAC;YACrE,OAAO,CAAC,cAAc,CAAC,GAAG,MAAM,CAAC,KAAK,GAAG,cAAc,CAAE,CAAC;QAC5D,CAAC;QACD,MAAM,OAAO,CAAC;IAChB,CAAC;AACH,CAAC"}
@@ -0,0 +1,4 @@
1
+ import type { Geometry } from "./geometry.js";
2
+ /** Computes smooth, area-weighted vertex normals for a triangle geometry. */
3
+ export declare function computeVertexNormals(geometry: Geometry): Float32Array;
4
+ //# sourceMappingURL=compute-vertex-normals.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"compute-vertex-normals.d.ts","sourceRoot":"","sources":["../../src/utils/compute-vertex-normals.ts"],"names":[],"mappings":"AAMA,OAAO,KAAK,EAAC,QAAQ,EAAC,sBAAmB;AAIzC,6EAA6E;AAC7E,wBAAgB,oBAAoB,CAAC,QAAQ,EAAE,QAAQ,GAAG,YAAY,CAmDrE"}
@@ -0,0 +1,54 @@
1
+ // math.gl
2
+ // SPDX-License-Identifier: MIT
3
+ // SPDX-FileCopyrightText: Copyright (c) vis.gl contributors
4
+ import { Vector3 } from '@math.gl/core';
5
+ import { GL } from "./constants.js";
6
+ import { getAttributeValues, getPositionAttribute } from "./geometry.js";
7
+ import { makePrimitiveIterator } from "./primitive-iterator.js";
8
+ /** Computes smooth, area-weighted vertex normals for a triangle geometry. */
9
+ export function computeVertexNormals(geometry) {
10
+ if (geometry.mode !== GL.TRIANGLES &&
11
+ geometry.mode !== GL.TRIANGLE_STRIP &&
12
+ geometry.mode !== GL.TRIANGLE_FAN) {
13
+ throw new Error('Triangle geometry is required');
14
+ }
15
+ const position = getPositionAttribute(geometry);
16
+ const positions = getAttributeValues(position);
17
+ const positionSize = position.size || 3;
18
+ if (positionSize < 3) {
19
+ throw new Error('Position attributes must have at least three components');
20
+ }
21
+ const vertexCount = positions.length / positionSize;
22
+ const normals = new Float32Array(vertexCount * 3);
23
+ const vectorA = new Vector3();
24
+ const vectorB = new Vector3();
25
+ const vectorC = new Vector3();
26
+ const edgeCB = new Vector3();
27
+ const edgeAB = new Vector3();
28
+ for (const primitive of makePrimitiveIterator(geometry)) {
29
+ const { i1, i2, i3 } = primitive;
30
+ if (i2 === undefined || i3 === undefined) {
31
+ continue;
32
+ }
33
+ vectorA.fromArray(positions, i1 * positionSize);
34
+ vectorB.fromArray(positions, i2 * positionSize);
35
+ vectorC.fromArray(positions, i3 * positionSize);
36
+ const faceNormal = edgeCB
37
+ .subVectors(vectorC, vectorB)
38
+ .cross(edgeAB.subVectors(vectorA, vectorB));
39
+ for (const vertexIndex of [i1, i2, i3]) {
40
+ normals[vertexIndex * 3] += faceNormal.x;
41
+ normals[vertexIndex * 3 + 1] += faceNormal.y;
42
+ normals[vertexIndex * 3 + 2] += faceNormal.z;
43
+ }
44
+ }
45
+ const normal = new Vector3();
46
+ for (let vertexIndex = 0; vertexIndex < vertexCount; vertexIndex++) {
47
+ normal.fromArray(normals, vertexIndex * 3);
48
+ if (normal.magnitudeSquared() > 0) {
49
+ normal.normalize().toArray(normals, vertexIndex * 3);
50
+ }
51
+ }
52
+ return normals;
53
+ }
54
+ //# sourceMappingURL=compute-vertex-normals.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,gBAAgB,EAAE,GAAG,CAAC,EAAE,CAAC;YAClC,MAAM,CAAC,SAAS,EAAE,CAAC,OAAO,CAAC,OAAO,EAAE,WAAW,GAAG,CAAC,CAAC,CAAC;QACvD,CAAC;IACH,CAAC;IACD,OAAO,OAAO,CAAC;AACjB,CAAC"}
@@ -0,0 +1,52 @@
1
+ /** Portable point, line, and triangle primitive types. */
2
+ export declare const GL_PRIMITIVE: {
3
+ readonly POINTS: 0;
4
+ readonly LINES: 1;
5
+ readonly TRIANGLES: 4;
6
+ };
7
+ /** WebGL-compatible primitive topology constants. */
8
+ export declare const GL_PRIMITIVE_MODE: {
9
+ readonly POINTS: 0;
10
+ readonly LINES: 1;
11
+ readonly LINE_LOOP: 2;
12
+ readonly LINE_STRIP: 3;
13
+ readonly TRIANGLES: 4;
14
+ readonly TRIANGLE_STRIP: 5;
15
+ readonly TRIANGLE_FAN: 6;
16
+ };
17
+ /** WebGL-compatible vertex component type constants. */
18
+ export declare const GL_TYPE: {
19
+ readonly BYTE: 5120;
20
+ readonly UNSIGNED_BYTE: 5121;
21
+ readonly SHORT: 5122;
22
+ readonly UNSIGNED_SHORT: 5123;
23
+ readonly INT: 5124;
24
+ readonly UNSIGNED_INT: 5125;
25
+ readonly FLOAT: 5126;
26
+ readonly DOUBLE: 5130;
27
+ readonly UNSIGNED_SHORT_4_4_4_4: 32819;
28
+ readonly UNSIGNED_SHORT_5_5_5_1: 32820;
29
+ readonly UNSIGNED_SHORT_5_6_5: 33635;
30
+ };
31
+ /** WebGL-compatible constants used by geometry utilities. */
32
+ export declare const GL: {
33
+ readonly BYTE: 5120;
34
+ readonly UNSIGNED_BYTE: 5121;
35
+ readonly SHORT: 5122;
36
+ readonly UNSIGNED_SHORT: 5123;
37
+ readonly INT: 5124;
38
+ readonly UNSIGNED_INT: 5125;
39
+ readonly FLOAT: 5126;
40
+ readonly DOUBLE: 5130;
41
+ readonly UNSIGNED_SHORT_4_4_4_4: 32819;
42
+ readonly UNSIGNED_SHORT_5_5_5_1: 32820;
43
+ readonly UNSIGNED_SHORT_5_6_5: 33635;
44
+ readonly POINTS: 0;
45
+ readonly LINES: 1;
46
+ readonly LINE_LOOP: 2;
47
+ readonly LINE_STRIP: 3;
48
+ readonly TRIANGLES: 4;
49
+ readonly TRIANGLE_STRIP: 5;
50
+ readonly TRIANGLE_FAN: 6;
51
+ };
52
+ //# sourceMappingURL=constants.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../../src/utils/constants.ts"],"names":[],"mappings":"AAIA,0DAA0D;AAC1D,eAAO,MAAM,YAAY;;;;CAIf,CAAC;AAEX,qDAAqD;AACrD,eAAO,MAAM,iBAAiB;;;;;;;;CAQpB,CAAC;AAEX,wDAAwD;AACxD,eAAO,MAAM,OAAO;;;;;;;;;;;;CAYV,CAAC;AAEX,6DAA6D;AAC7D,eAAO,MAAM,EAAE;;;;;;;;;;;;;;;;;;;CAGL,CAAC"}
@@ -0,0 +1,39 @@
1
+ // math.gl
2
+ // SPDX-License-Identifier: MIT
3
+ // SPDX-FileCopyrightText: Copyright (c) vis.gl contributors
4
+ /** Portable point, line, and triangle primitive types. */
5
+ export const GL_PRIMITIVE = {
6
+ POINTS: 0x0000,
7
+ LINES: 0x0001,
8
+ TRIANGLES: 0x0004
9
+ };
10
+ /** WebGL-compatible primitive topology constants. */
11
+ export const GL_PRIMITIVE_MODE = {
12
+ POINTS: 0x0000,
13
+ LINES: 0x0001,
14
+ LINE_LOOP: 0x0002,
15
+ LINE_STRIP: 0x0003,
16
+ TRIANGLES: 0x0004,
17
+ TRIANGLE_STRIP: 0x0005,
18
+ TRIANGLE_FAN: 0x0006
19
+ };
20
+ /** WebGL-compatible vertex component type constants. */
21
+ export const GL_TYPE = {
22
+ BYTE: 5120,
23
+ UNSIGNED_BYTE: 5121,
24
+ SHORT: 5122,
25
+ UNSIGNED_SHORT: 5123,
26
+ INT: 5124,
27
+ UNSIGNED_INT: 5125,
28
+ FLOAT: 5126,
29
+ DOUBLE: 5130,
30
+ UNSIGNED_SHORT_4_4_4_4: 32819,
31
+ UNSIGNED_SHORT_5_5_5_1: 32820,
32
+ UNSIGNED_SHORT_5_6_5: 33635
33
+ };
34
+ /** WebGL-compatible constants used by geometry utilities. */
35
+ export const GL = {
36
+ ...GL_PRIMITIVE_MODE,
37
+ ...GL_TYPE
38
+ };
39
+ //# sourceMappingURL=constants.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"constants.js","sourceRoot":"","sources":["../../src/utils/constants.ts"],"names":[],"mappings":"AAAA,UAAU;AACV,+BAA+B;AAC/B,4DAA4D;AAE5D,0DAA0D;AAC1D,MAAM,CAAC,MAAM,YAAY,GAAG;IAC1B,MAAM,EAAE,MAAM;IACd,KAAK,EAAE,MAAM;IACb,SAAS,EAAE,MAAM;CACT,CAAC;AAEX,qDAAqD;AACrD,MAAM,CAAC,MAAM,iBAAiB,GAAG;IAC/B,MAAM,EAAE,MAAM;IACd,KAAK,EAAE,MAAM;IACb,SAAS,EAAE,MAAM;IACjB,UAAU,EAAE,MAAM;IAClB,SAAS,EAAE,MAAM;IACjB,cAAc,EAAE,MAAM;IACtB,YAAY,EAAE,MAAM;CACZ,CAAC;AAEX,wDAAwD;AACxD,MAAM,CAAC,MAAM,OAAO,GAAG;IACrB,IAAI,EAAE,IAAI;IACV,aAAa,EAAE,IAAI;IACnB,KAAK,EAAE,IAAI;IACX,cAAc,EAAE,IAAI;IACpB,GAAG,EAAE,IAAI;IACT,YAAY,EAAE,IAAI;IAClB,KAAK,EAAE,IAAI;IACX,MAAM,EAAE,IAAI;IACZ,sBAAsB,EAAE,KAAK;IAC7B,sBAAsB,EAAE,KAAK;IAC7B,oBAAoB,EAAE,KAAK;CACnB,CAAC;AAEX,6DAA6D;AAC7D,MAAM,CAAC,MAAM,EAAE,GAAG;IAChB,GAAG,iBAAiB;IACpB,GAAG,OAAO;CACF,CAAC"}
@@ -0,0 +1,3 @@
1
+ /** Wraps a number into the half-open range `[0, 1)`. */
2
+ export declare function emod(value: number): number;
3
+ //# sourceMappingURL=coordinates.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"coordinates.d.ts","sourceRoot":"","sources":["../../src/utils/coordinates.ts"],"names":[],"mappings":"AAIA,wDAAwD;AACxD,wBAAgB,IAAI,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,CAE1C"}
@@ -0,0 +1,8 @@
1
+ // math.gl
2
+ // SPDX-License-Identifier: MIT
3
+ // SPDX-FileCopyrightText: Copyright (c) vis.gl contributors
4
+ /** Wraps a number into the half-open range `[0, 1)`. */
5
+ export function emod(value) {
6
+ return ((value % 1) + 1) % 1;
7
+ }
8
+ //# sourceMappingURL=coordinates.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"coordinates.js","sourceRoot":"","sources":["../../src/utils/coordinates.ts"],"names":[],"mappings":"AAAA,UAAU;AACV,+BAA+B;AAC/B,4DAA4D;AAE5D,wDAAwD;AACxD,MAAM,UAAU,IAAI,CAAC,KAAa;IAChC,OAAO,CAAC,CAAC,KAAK,GAAG,CAAC,CAAC,GAAG,CAAC,CAAC,GAAG,CAAC,CAAC;AAC/B,CAAC"}
@@ -0,0 +1,20 @@
1
+ import type { TypedArray } from '@math.gl/core/types';
2
+ /** A typed geometry attribute with either loaders.gl-style `value` or legacy `values` storage. */
3
+ export type GeometryAttribute = {
4
+ value?: TypedArray;
5
+ values?: TypedArray;
6
+ size?: number;
7
+ };
8
+ /** Minimal geometry shape understood by the geometry utilities. */
9
+ export type Geometry = {
10
+ mode: number;
11
+ indices?: GeometryAttribute | TypedArray;
12
+ attributes: Record<string, GeometryAttribute>;
13
+ };
14
+ /** Returns whether a value has the minimal geometry shape. */
15
+ export declare function isGeometry(value: unknown): value is Geometry;
16
+ /** Returns the typed array stored in a geometry attribute. */
17
+ export declare function getAttributeValues(attribute: GeometryAttribute | TypedArray): TypedArray;
18
+ /** Returns a geometry's position attribute. */
19
+ export declare function getPositionAttribute(geometry: Geometry): GeometryAttribute;
20
+ //# sourceMappingURL=geometry.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"geometry.d.ts","sourceRoot":"","sources":["../../src/utils/geometry.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAC,UAAU,EAAC,MAAM,qBAAqB,CAAC;AAEpD,kGAAkG;AAClG,MAAM,MAAM,iBAAiB,GAAG;IAC9B,KAAK,CAAC,EAAE,UAAU,CAAC;IACnB,MAAM,CAAC,EAAE,UAAU,CAAC;IACpB,IAAI,CAAC,EAAE,MAAM,CAAC;CACf,CAAC;AAEF,mEAAmE;AACnE,MAAM,MAAM,QAAQ,GAAG;IACrB,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,CAAC,EAAE,iBAAiB,GAAG,UAAU,CAAC;IACzC,UAAU,EAAE,MAAM,CAAC,MAAM,EAAE,iBAAiB,CAAC,CAAC;CAC/C,CAAC;AAEF,8DAA8D;AAC9D,wBAAgB,UAAU,CAAC,KAAK,EAAE,OAAO,GAAG,KAAK,IAAI,QAAQ,CAM5D;AAED,8DAA8D;AAC9D,wBAAgB,kBAAkB,CAAC,SAAS,EAAE,iBAAiB,GAAG,UAAU,GAAG,UAAU,CASxF;AAED,+CAA+C;AAC/C,wBAAgB,oBAAoB,CAAC,QAAQ,EAAE,QAAQ,GAAG,iBAAiB,CAM1E"}