@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
package/LICENSE CHANGED
@@ -1,6 +1,13 @@
1
+ @math.gl/geometry
2
+
3
+ The math.gl-authored portions are MIT licensed. The following upstream
4
+ notices apply to their respective adapted source or data, as identified in
5
+ source headers and adjacent notices. This file does not relicense those portions.
6
+
1
7
  MIT License
2
8
 
3
9
  Copyright (c) 2017 Uber Technologies, Inc.
10
+ Copyright (c) vis.gl contributors
4
11
 
5
12
  Permission is hereby granted, free of charge, to any person obtaining a copy
6
13
  of this software and associated documentation files (the "Software"), to deal
@@ -20,8 +27,11 @@ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
27
  OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21
28
  THE SOFTWARE.
22
29
 
30
+
23
31
  ---
24
32
 
33
+ TDL WebGL samples
34
+
25
35
  Some primitive tessellation approaches were originally inspired by the TDL WebGL samples under
26
36
  the New BSD License:
27
37
 
@@ -49,9 +59,11 @@ OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
49
59
 
50
60
  ---
51
61
 
52
- math.gl builds on docs and code from "gl-matrix", which is MIT licensed as follows:
62
+ luma.gl primitive tessellators
53
63
 
54
- Copyright (c) 2015, Brandon Jones, Colin MacKenzie IV.
64
+ The @math.gl/geometry primitive tessellators are adapted from luma.gl under the MIT License:
65
+
66
+ Copyright (c) 2020 vis.gl contributors
55
67
 
56
68
  Permission is hereby granted, free of charge, to any person obtaining a copy
57
69
  of this software and associated documentation files (the "Software"), to deal
@@ -71,70 +83,106 @@ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
71
83
  OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
72
84
  THE SOFTWARE.
73
85
 
74
- --
86
+ ---
75
87
 
76
- math.gl builds on docs and code from THREE.js, which is MIT licensed as follows:
88
+ Cesium
77
89
 
78
- The MIT License
90
+ Cesium-derived sources (identified by SPDX headers)
79
91
 
80
- Copyright © 2010-2017 three.js authors
92
+ Copyright 2011-2018 CesiumJS Contributors
81
93
 
82
- Permission is hereby granted, free of charge, to any person obtaining a copy
83
- of this software and associated documentation files (the "Software"), to deal
84
- in the Software without restriction, including without limitation the rights
85
- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
86
- copies of the Software, and to permit persons to whom the Software is
87
- furnished to do so, subject to the following conditions:
94
+ Apache License
88
95
 
89
- The above copyright notice and this permission notice shall be included in
90
- all copies or substantial portions of the Software.
96
+ Version 2.0, January 2004
91
97
 
92
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
93
- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
94
- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
95
- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
96
- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
97
- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
98
- THE SOFTWARE.
98
+ http://www.apache.org/licenses/
99
+
100
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
101
+
102
+ 1. Definitions.
103
+
104
+ "License" shall mean the terms and conditions for use, reproduction, and distribution as defined by Sections 1 through 9 of this document.
105
+
106
+ "Licensor" shall mean the copyright owner or entity authorized by the copyright owner that is granting the License.
107
+
108
+ "Legal Entity" shall mean the union of the acting entity and all other entities that control, are controlled by, or are under common control with that entity. For the purposes of this definition, "control" means (i) the power, direct or indirect, to cause the direction or management of such entity, whether by contract or otherwise, or (ii) ownership of fifty percent (50%) or more of the outstanding shares, or (iii) beneficial ownership of such entity.
109
+
110
+ "You" (or "Your") shall mean an individual or Legal Entity exercising permissions granted by this License.
111
+
112
+ "Source" form shall mean the preferred form for making modifications, including but not limited to software source code, documentation source, and configuration files.
113
+
114
+ "Object" form shall mean any form resulting from mechanical transformation or translation of a Source form, including but not limited to compiled object code, generated documentation, and conversions to other media types.
115
+
116
+ "Work" shall mean the work of authorship, whether in Source or Object form, made available under the License, as indicated by a copyright notice that is included in or attached to the work (an example is provided in the Appendix below).
117
+
118
+ "Derivative Works" shall mean any work, whether in Source or Object form, that is based on (or derived from) the Work and for which the editorial revisions, annotations, elaborations, or other modifications represent, as a whole, an original work of authorship. For the purposes of this License, Derivative Works shall not include works that remain separable from, or merely link (or bind by name) to the interfaces of, the Work and Derivative Works thereof.
119
+
120
+ "Contribution" shall mean any work of authorship, including the original version of the Work and any modifications or additions to that Work or Derivative Works thereof, that is intentionally submitted to Licensor for inclusion in the Work by the copyright owner or by an individual or Legal Entity authorized to submit on behalf of the copyright owner. For the purposes of this definition, "submitted" means any form of electronic, verbal, or written communication sent to the Licensor or its representatives, including but not limited to communication on electronic mailing lists, source code control systems, and issue tracking systems that are managed by, or on behalf of, the Licensor for the purpose of discussing and improving the Work, but excluding communication that is conspicuously marked or otherwise designated in writing by the copyright owner as "Not a Contribution."
121
+
122
+ "Contributor" shall mean Licensor and any individual or Legal Entity on behalf of whom a Contribution has been received by Licensor and subsequently incorporated within the Work.
123
+
124
+ 2. Grant of Copyright License. Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable copyright license to reproduce, prepare Derivative Works of, publicly display, publicly perform, sublicense, and distribute the Work and such Derivative Works in Source or Object form.
125
+
126
+ 3. Grant of Patent License. Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable (except as stated in this section) patent license to make, have made, use, offer to sell, sell, import, and otherwise transfer the Work, where such license applies only to those patent claims licensable by such Contributor that are necessarily infringed by their Contribution(s) alone or by combination of their Contribution(s) with the Work to which such Contribution(s) was submitted. If You institute patent litigation against any entity (including a cross-claim or counterclaim in a lawsuit) alleging that the Work or a Contribution incorporated within the Work constitutes direct or contributory patent infringement, then any patent licenses granted to You under this License for that Work shall terminate as of the date such litigation is filed.
127
+
128
+ 4. Redistribution. You may reproduce and distribute copies of the Work or Derivative Works thereof in any medium, with or without modifications, and in Source or Object form, provided that You meet the following conditions:
129
+
130
+ You must give any other recipients of the Work or Derivative Works a copy of this License; and
131
+
132
+ You must cause any modified files to carry prominent notices stating that You changed the files; and
133
+
134
+ You must retain, in the Source form of any Derivative Works that You distribute, all copyright, patent, trademark, and attribution notices from the Source form of the Work, excluding those notices that do not pertain to any part of the Derivative Works; and
135
+
136
+ If the Work includes a "NOTICE" text file as part of its distribution, then any Derivative Works that You distribute must include a readable copy of the attribution notices contained within such NOTICE file, excluding those notices that do not pertain to any part of the Derivative Works, in at least one of the following places: within a NOTICE text file distributed as part of the Derivative Works; within the Source form or documentation, if provided along with the Derivative Works; or, within a display generated by the Derivative Works, if and wherever such third-party notices normally appear. The contents of the NOTICE file are for informational purposes only and do not modify the License. You may add Your own attribution notices within Derivative Works that You distribute, alongside or as an addendum to the NOTICE text from the Work, provided that such additional attribution notices cannot be construed as modifying the License. You may add Your own copyright statement to Your modifications and may provide additional or different license terms and conditions for use, reproduction, or distribution of Your modifications, or for any such Derivative Works as a whole, provided Your use, reproduction, and distribution of the Work otherwise complies with the conditions stated in this License.
137
+
138
+ 5. Submission of Contributions. Unless You explicitly state otherwise, any Contribution intentionally submitted for inclusion in the Work by You to the Licensor shall be under the terms and conditions of this License, without any additional terms or conditions. Notwithstanding the above, nothing herein shall supersede or modify the terms of any separate license agreement you may have executed with Licensor regarding such Contributions.
139
+
140
+ 6. Trademarks. This License does not grant permission to use the trade names, trademarks, service marks, or product names of the Licensor, except as required for reasonable and customary use in describing the origin of the Work and reproducing the content of the NOTICE file.
141
+
142
+ 7. Disclaimer of Warranty. Unless required by applicable law or agreed to in writing, Licensor provides the Work (and each Contributor provides its Contributions) on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied, including, without limitation, any warranties or conditions of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A PARTICULAR PURPOSE. You are solely responsible for determining the appropriateness of using or redistributing the Work and assume any risks associated with Your exercise of permissions under this License.
143
+
144
+ 8. Limitation of Liability. In no event and under no legal theory, whether in tort (including negligence), contract, or otherwise, unless required by applicable law (such as deliberate and grossly negligent acts) or agreed to in writing, shall any Contributor be liable to You for damages, including any direct, indirect, special, incidental, or consequential damages of any character arising as a result of this License or out of the use or inability to use the Work (including but not limited to damages for loss of goodwill, work stoppage, computer failure or malfunction, or any and all other commercial damages or losses), even if such Contributor has been advised of the possibility of such damages.
145
+
146
+ 9. Accepting Warranty or Additional Liability. While redistributing the Work or Derivative Works thereof, You may choose to offer, and charge a fee for, acceptance of support, warranty, indemnity, or other liability obligations and/or rights consistent with this License. However, in accepting such obligations, You may act only on Your own behalf and on Your sole responsibility, not on behalf of any other Contributor, and only if You agree to indemnify, defend, and hold each Contributor harmless for any liability incurred by, or claims asserted against, such Contributor by reason of your accepting any such warranty or additional liability.
147
+
148
+ END OF TERMS AND CONDITIONS
99
149
 
100
150
  ---
101
151
 
102
- math.gl includes certain files from Cesium (https://github.com/AnalyticalGraphicsInc/cesium) under the Apache 2 License:
152
+ Mapbox earcut
103
153
 
104
- Copyright 2011-2018 CesiumJS Contributors
154
+ ISC License
105
155
 
106
- Licensed under the Apache License, Version 2.0 (the "License");
107
- you may not use this file except in compliance with the License.
108
- You may obtain a copy of the License at
109
- http://www.apache.org/licenses/LICENSE-2.0
156
+ Copyright (c) 2016, Mapbox
110
157
 
111
- Unless required by applicable law or agreed to in writing, software
112
- distributed under the License is distributed on an "AS IS" BASIS,
113
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
114
- See the License for the specific language governing permissions and limitations under the License.
158
+ Permission to use, copy, modify, and/or distribute this software for any purpose
159
+ with or without fee is hereby granted, provided that the above copyright notice
160
+ and this permission notice appear in all copies.
115
161
 
116
- Cesium-derived code can be found in the submodule: modules/3d-tiles
162
+ THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
163
+ REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND
164
+ FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
165
+ INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS
166
+ OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
167
+ TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF
168
+ THIS SOFTWARE.
117
169
 
118
170
  ---
119
171
 
120
- The @math.gl/geometry primitive tessellators are adapted from luma.gl under the MIT License:
172
+ Mapbox lineclip
121
173
 
122
- Copyright (c) 2020 vis.gl contributors
174
+ ISC License
123
175
 
124
- Permission is hereby granted, free of charge, to any person obtaining a copy
125
- of this software and associated documentation files (the "Software"), to deal
126
- in the Software without restriction, including without limitation the rights
127
- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
128
- copies of the Software, and to permit persons to whom the Software is
129
- furnished to do so, subject to the following conditions:
176
+ Copyright (c) 2015, Mapbox
130
177
 
131
- The above copyright notice and this permission notice shall be included in
132
- all copies or substantial portions of the Software.
178
+ Permission to use, copy, modify, and/or distribute this software for any purpose
179
+ with or without fee is hereby granted, provided that the above copyright notice
180
+ and this permission notice appear in all copies.
133
181
 
134
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
135
- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
136
- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
137
- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
138
- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
139
- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
140
- THE SOFTWARE.
182
+ THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
183
+ REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND
184
+ FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
185
+ INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS
186
+ OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
187
+ TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF
188
+ THIS SOFTWARE.
package/README.md CHANGED
@@ -3,7 +3,7 @@
3
3
  CPU-side geometry primitives and tessellation for 3D applications. The built-in box, capsule,
4
4
  cylinder, plane and sphere follow the glTF 2.1 draft shape dimensions and coordinate conventions.
5
5
  Infinite and partially infinite planes are represented analytically by `PlaneShape` in
6
- `@math.gl/culling`; `PlaneGeometry` requires finite `sizeX` and `sizeZ` values.
6
+ `@math.gl/geometry/culling`; `PlaneGeometry` requires finite `sizeX` and `sizeZ` values.
7
7
 
8
8
  ```ts
9
9
  import {CapsuleGeometry} from '@math.gl/geometry';
@@ -13,3 +13,18 @@ const capsule = new CapsuleGeometry({height: 2, radiusBottom: 0.5, radiusTop: 0.
13
13
 
14
14
  Every generated mesh uses `triangle-list` topology and the glTF attribute semantics `POSITION`,
15
15
  `NORMAL` and `TEXCOORD_0`. This package contains no GPU or renderer abstractions.
16
+
17
+ Related CPU geometry modules are available from subpaths: `@math.gl/geometry/utils`,
18
+ `@math.gl/geometry/curves`, `@math.gl/geometry/polygon`, `@math.gl/geometry/culling`, and
19
+ `@math.gl/geometry/spatial-index`. These APIs are implemented in this package. Polygon processing includes general tessellation
20
+ and mesh refinement, with Mercator clipping helpers. Globe mesh subdivision is available from
21
+ `@math.gl/geospatial/globe`.
22
+
23
+ The experimental `HingeTree` evaluates rigid panels connected by hinges. See the
24
+ [HingeTree API](https://math.gl/docs/modules/geometry/api-reference/hinge-tree) and
25
+ [unfolding polyhedra example](https://github.com/visgl/math.gl/tree/master/examples/unfolding-polyhedron).
26
+
27
+ ## Sources and credits
28
+
29
+ See [the packaged source and license index](./THIRD-PARTY-NOTICES.md) and
30
+ [math.gl references and credits](https://math.gl/docs/references-and-credits).
@@ -0,0 +1,18 @@
1
+ # @math.gl/geometry: sources and notices
2
+
3
+ This index distinguishes adapted or vendored source, separately installed
4
+ dependencies, datasets, and scientific references. It supplements the full
5
+ [package license](./LICENSE), source headers, and adjacent notices; it does not
6
+ replace or relicense them. Versions below identify the audited sources, not the
7
+ latest available upstream releases.
8
+
9
+ | Source / author | Use and retained notice |
10
+ | --- | --- |
11
+ | CesiumJS contributors | Adapted culling, bounding-volume and attribute-compression code; Apache-2.0 notices and complete terms in [LICENSE](./LICENSE). |
12
+ | Mapbox / earcut | Adapted polygon triangulation for flat arrays; ISC notice retained in `src/polygon/earcut.ts` and [LICENSE](./LICENSE). |
13
+ | Mapbox / lineclip | Adapted flat-array clipping; ISC notice retained in `src/polygon/lineclip.ts` and [LICENSE](./LICENSE). |
14
+ | luma.gl / vis.gl contributors | CPU geometry tessellation lineage, including truncated cones; MIT, [LICENSE](./LICENSE). |
15
+
16
+ Hinge evaluation and the myriahedral example were developed independently of
17
+ Nico Belmonte's application source. His work is credited as inspiration, not as
18
+ licensed source incorporated into this package.
@@ -0,0 +1,3 @@
1
+ /** Classification returned by culling intersection tests. */
2
+ export type CullingResult = 'outside' | 'intersecting' | 'inside';
3
+ //# sourceMappingURL=constants.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../../src/culling/constants.ts"],"names":[],"mappings":"AAIA,6DAA6D;AAC7D,MAAM,MAAM,aAAa,GAAG,SAAS,GAAG,cAAc,GAAG,QAAQ,CAAC"}
@@ -0,0 +1,5 @@
1
+ // math.gl
2
+ // SPDX-License-Identifier: MIT
3
+ // SPDX-FileCopyrightText: Copyright (c) vis.gl contributors
4
+ export {};
5
+ //# sourceMappingURL=constants.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"constants.js","sourceRoot":"","sources":["../../src/culling/constants.ts"],"names":[],"mappings":"AAAA,UAAU;AACV,+BAA+B;AAC/B,4DAA4D"}