@ac-kit/math-geometry 0.2.3 → 0.4.0

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 (379) hide show
  1. package/CHANGELOG.md +321 -0
  2. package/README.md +363 -52
  3. package/dist/_brand.d.ts +14 -0
  4. package/dist/_brand.d.ts.map +1 -0
  5. package/dist/_brand.js +2 -0
  6. package/dist/_brand.js.map +1 -0
  7. package/dist/_ear-clipping.d.ts +20 -0
  8. package/dist/_ear-clipping.d.ts.map +1 -0
  9. package/dist/_ear-clipping.js +360 -0
  10. package/dist/_ear-clipping.js.map +1 -0
  11. package/dist/_polygon3-cross.d.ts +23 -0
  12. package/dist/_polygon3-cross.d.ts.map +1 -0
  13. package/dist/_polygon3-cross.js +418 -0
  14. package/dist/_polygon3-cross.js.map +1 -0
  15. package/dist/_ray3-intersect.d.ts +19 -0
  16. package/dist/_ray3-intersect.d.ts.map +1 -0
  17. package/dist/_ray3-intersect.js +122 -0
  18. package/dist/_ray3-intersect.js.map +1 -0
  19. package/dist/_triangle3-cross.d.ts +66 -0
  20. package/dist/_triangle3-cross.d.ts.map +1 -0
  21. package/dist/_triangle3-cross.js +396 -0
  22. package/dist/_triangle3-cross.js.map +1 -0
  23. package/dist/box2-array-boundary.d.ts +50 -0
  24. package/dist/box2-array-boundary.d.ts.map +1 -0
  25. package/dist/box2-array-boundary.js +97 -0
  26. package/dist/box2-array-boundary.js.map +1 -0
  27. package/dist/box2-array.d.ts +42 -0
  28. package/dist/box2-array.d.ts.map +1 -0
  29. package/dist/box2-array.js +134 -0
  30. package/dist/box2-array.js.map +1 -0
  31. package/dist/box2-componentwise.d.ts +110 -0
  32. package/dist/box2-componentwise.d.ts.map +1 -0
  33. package/dist/box2-componentwise.js +325 -0
  34. package/dist/box2-componentwise.js.map +1 -0
  35. package/dist/box2-grid-index.d.ts +67 -0
  36. package/dist/box2-grid-index.d.ts.map +1 -0
  37. package/dist/box2-grid-index.js +198 -0
  38. package/dist/box2-grid-index.js.map +1 -0
  39. package/dist/box2-record.d.ts +83 -0
  40. package/dist/box2-record.d.ts.map +1 -0
  41. package/dist/box2-record.js +124 -0
  42. package/dist/box2-record.js.map +1 -0
  43. package/dist/box2.d.ts +38 -0
  44. package/dist/box2.d.ts.map +1 -0
  45. package/dist/box2.js +97 -0
  46. package/dist/box2.js.map +1 -0
  47. package/dist/box3-array-boundary.d.ts +50 -0
  48. package/dist/box3-array-boundary.d.ts.map +1 -0
  49. package/dist/box3-array-boundary.js +107 -0
  50. package/dist/box3-array-boundary.js.map +1 -0
  51. package/dist/box3-componentwise.d.ts +110 -0
  52. package/dist/box3-componentwise.d.ts.map +1 -0
  53. package/dist/box3-componentwise.js +392 -0
  54. package/dist/box3-componentwise.js.map +1 -0
  55. package/dist/box3-record.d.ts +92 -0
  56. package/dist/box3-record.d.ts.map +1 -0
  57. package/dist/box3-record.js +147 -0
  58. package/dist/box3-record.js.map +1 -0
  59. package/dist/box3.d.ts +19 -16
  60. package/dist/box3.d.ts.map +1 -1
  61. package/dist/box3.js +73 -76
  62. package/dist/box3.js.map +1 -1
  63. package/dist/box4-array-boundary.d.ts +50 -0
  64. package/dist/box4-array-boundary.d.ts.map +1 -0
  65. package/dist/box4-array-boundary.js +117 -0
  66. package/dist/box4-array-boundary.js.map +1 -0
  67. package/dist/box4-componentwise.d.ts +110 -0
  68. package/dist/box4-componentwise.d.ts.map +1 -0
  69. package/dist/box4-componentwise.js +459 -0
  70. package/dist/box4-componentwise.js.map +1 -0
  71. package/dist/box4-record.d.ts +96 -0
  72. package/dist/box4-record.d.ts.map +1 -0
  73. package/dist/box4-record.js +167 -0
  74. package/dist/box4-record.js.map +1 -0
  75. package/dist/box4.d.ts +13 -8
  76. package/dist/box4.d.ts.map +1 -1
  77. package/dist/box4.js +27 -5
  78. package/dist/box4.js.map +1 -1
  79. package/dist/circle2-array-boundary.d.ts +51 -0
  80. package/dist/circle2-array-boundary.d.ts.map +1 -0
  81. package/dist/circle2-array-boundary.js +93 -0
  82. package/dist/circle2-array-boundary.js.map +1 -0
  83. package/dist/circle2-array.d.ts +17 -0
  84. package/dist/circle2-array.d.ts.map +1 -0
  85. package/dist/circle2-array.js +44 -0
  86. package/dist/circle2-array.js.map +1 -0
  87. package/dist/circle2-record.d.ts +81 -0
  88. package/dist/circle2-record.d.ts.map +1 -0
  89. package/dist/circle2-record.js +114 -0
  90. package/dist/circle2-record.js.map +1 -0
  91. package/dist/circle2.d.ts +27 -82
  92. package/dist/circle2.d.ts.map +1 -1
  93. package/dist/circle2.js +59 -104
  94. package/dist/circle2.js.map +1 -1
  95. package/dist/coordinates/cylindrical-record.d.ts +86 -0
  96. package/dist/coordinates/cylindrical-record.d.ts.map +1 -0
  97. package/dist/coordinates/cylindrical-record.js +114 -0
  98. package/dist/coordinates/cylindrical-record.js.map +1 -0
  99. package/dist/coordinates/horizontal-record.d.ts +86 -0
  100. package/dist/coordinates/horizontal-record.d.ts.map +1 -0
  101. package/dist/coordinates/horizontal-record.js +114 -0
  102. package/dist/coordinates/horizontal-record.js.map +1 -0
  103. package/dist/coordinates/horizontal.d.ts +48 -0
  104. package/dist/coordinates/horizontal.d.ts.map +1 -0
  105. package/dist/coordinates/horizontal.js +100 -0
  106. package/dist/coordinates/horizontal.js.map +1 -0
  107. package/dist/coordinates/index.d.ts +10 -0
  108. package/dist/coordinates/index.d.ts.map +1 -0
  109. package/dist/coordinates/index.js +10 -0
  110. package/dist/coordinates/index.js.map +1 -0
  111. package/dist/coordinates/longitude-latitude-record.d.ts +81 -0
  112. package/dist/coordinates/longitude-latitude-record.d.ts.map +1 -0
  113. package/dist/coordinates/longitude-latitude-record.js +104 -0
  114. package/dist/coordinates/longitude-latitude-record.js.map +1 -0
  115. package/dist/coordinates/longitude-latitude.d.ts +33 -0
  116. package/dist/coordinates/longitude-latitude.d.ts.map +1 -0
  117. package/dist/coordinates/longitude-latitude.js +78 -0
  118. package/dist/coordinates/longitude-latitude.js.map +1 -0
  119. package/dist/coordinates/polar-record.d.ts +77 -0
  120. package/dist/coordinates/polar-record.d.ts.map +1 -0
  121. package/dist/coordinates/polar-record.js +104 -0
  122. package/dist/coordinates/polar-record.js.map +1 -0
  123. package/dist/coordinates/polar.d.ts +28 -0
  124. package/dist/coordinates/polar.d.ts.map +1 -0
  125. package/dist/coordinates/polar.js +68 -0
  126. package/dist/coordinates/polar.js.map +1 -0
  127. package/dist/coordinates/spherical-cylindrical.d.ts +49 -0
  128. package/dist/coordinates/spherical-cylindrical.d.ts.map +1 -0
  129. package/dist/coordinates/spherical-cylindrical.js +110 -0
  130. package/dist/coordinates/spherical-cylindrical.js.map +1 -0
  131. package/dist/coordinates/spherical-record.d.ts +86 -0
  132. package/dist/coordinates/spherical-record.d.ts.map +1 -0
  133. package/dist/coordinates/spherical-record.js +114 -0
  134. package/dist/coordinates/spherical-record.js.map +1 -0
  135. package/dist/frustum3-record.d.ts +132 -0
  136. package/dist/frustum3-record.d.ts.map +1 -0
  137. package/dist/frustum3-record.js +333 -0
  138. package/dist/frustum3-record.js.map +1 -0
  139. package/dist/frustum3.d.ts +60 -0
  140. package/dist/frustum3.d.ts.map +1 -0
  141. package/dist/frustum3.js +186 -0
  142. package/dist/frustum3.js.map +1 -0
  143. package/dist/index.d.ts +36 -16
  144. package/dist/index.d.ts.map +1 -1
  145. package/dist/index.js +36 -16
  146. package/dist/index.js.map +1 -1
  147. package/dist/line2-record.d.ts +87 -0
  148. package/dist/line2-record.d.ts.map +1 -0
  149. package/dist/line2-record.js +123 -0
  150. package/dist/line2-record.js.map +1 -0
  151. package/dist/line2.d.ts +24 -33
  152. package/dist/line2.d.ts.map +1 -1
  153. package/dist/line2.js +78 -52
  154. package/dist/line2.js.map +1 -1
  155. package/dist/line3-record.d.ts +91 -0
  156. package/dist/line3-record.d.ts.map +1 -0
  157. package/dist/line3-record.js +146 -0
  158. package/dist/line3-record.js.map +1 -0
  159. package/dist/line3.d.ts +11 -24
  160. package/dist/line3.d.ts.map +1 -1
  161. package/dist/line3.js +32 -36
  162. package/dist/line3.js.map +1 -1
  163. package/dist/mesh/_generator-kit.d.ts +14 -0
  164. package/dist/mesh/_generator-kit.d.ts.map +1 -0
  165. package/dist/mesh/_generator-kit.js +39 -0
  166. package/dist/mesh/_generator-kit.js.map +1 -0
  167. package/dist/mesh/_index-kernels-u16.d.ts +85 -0
  168. package/dist/mesh/_index-kernels-u16.d.ts.map +1 -0
  169. package/dist/mesh/_index-kernels-u16.js +1045 -0
  170. package/dist/mesh/_index-kernels-u16.js.map +1 -0
  171. package/dist/mesh/_index-kernels-u32.d.ts +85 -0
  172. package/dist/mesh/_index-kernels-u32.d.ts.map +1 -0
  173. package/dist/mesh/_index-kernels-u32.js +1045 -0
  174. package/dist/mesh/_index-kernels-u32.js.map +1 -0
  175. package/dist/mesh/generate-box.d.ts +16 -0
  176. package/dist/mesh/generate-box.d.ts.map +1 -0
  177. package/dist/mesh/generate-box.js +79 -0
  178. package/dist/mesh/generate-box.js.map +1 -0
  179. package/dist/mesh/generate-cylinder.d.ts +25 -0
  180. package/dist/mesh/generate-cylinder.d.ts.map +1 -0
  181. package/dist/mesh/generate-cylinder.js +117 -0
  182. package/dist/mesh/generate-cylinder.js.map +1 -0
  183. package/dist/mesh/generate-heightfield.d.ts +24 -0
  184. package/dist/mesh/generate-heightfield.d.ts.map +1 -0
  185. package/dist/mesh/generate-heightfield.js +48 -0
  186. package/dist/mesh/generate-heightfield.js.map +1 -0
  187. package/dist/mesh/generate-plane.d.ts +18 -0
  188. package/dist/mesh/generate-plane.d.ts.map +1 -0
  189. package/dist/mesh/generate-plane.js +39 -0
  190. package/dist/mesh/generate-plane.js.map +1 -0
  191. package/dist/mesh/generate-sphere.d.ts +50 -0
  192. package/dist/mesh/generate-sphere.d.ts.map +1 -0
  193. package/dist/mesh/generate-sphere.js +244 -0
  194. package/dist/mesh/generate-sphere.js.map +1 -0
  195. package/dist/mesh/index.d.ts +8 -0
  196. package/dist/mesh/index.d.ts.map +1 -0
  197. package/dist/mesh/index.js +8 -0
  198. package/dist/mesh/index.js.map +1 -0
  199. package/dist/mesh/mesh3-kernels.d.ts +122 -0
  200. package/dist/mesh/mesh3-kernels.d.ts.map +1 -0
  201. package/dist/mesh/mesh3-kernels.js +220 -0
  202. package/dist/mesh/mesh3-kernels.js.map +1 -0
  203. package/dist/mesh/mesh3.d.ts +66 -0
  204. package/dist/mesh/mesh3.d.ts.map +1 -0
  205. package/dist/mesh/mesh3.js +128 -0
  206. package/dist/mesh/mesh3.js.map +1 -0
  207. package/dist/plane3-record.d.ts +88 -0
  208. package/dist/plane3-record.d.ts.map +1 -0
  209. package/dist/plane3-record.js +123 -0
  210. package/dist/plane3-record.js.map +1 -0
  211. package/dist/plane3.d.ts +43 -28
  212. package/dist/plane3.d.ts.map +1 -1
  213. package/dist/plane3.js +149 -48
  214. package/dist/plane3.js.map +1 -1
  215. package/dist/polygon2.d.ts +132 -29
  216. package/dist/polygon2.d.ts.map +1 -1
  217. package/dist/polygon2.js +529 -96
  218. package/dist/polygon2.js.map +1 -1
  219. package/dist/polygon3.d.ts +56 -21
  220. package/dist/polygon3.d.ts.map +1 -1
  221. package/dist/polygon3.js +239 -91
  222. package/dist/polygon3.js.map +1 -1
  223. package/dist/polyline2.d.ts +37 -0
  224. package/dist/polyline2.d.ts.map +1 -0
  225. package/dist/polyline2.js +146 -0
  226. package/dist/polyline2.js.map +1 -0
  227. package/dist/polyline3.d.ts +35 -0
  228. package/dist/polyline3.d.ts.map +1 -0
  229. package/dist/polyline3.js +159 -0
  230. package/dist/polyline3.js.map +1 -0
  231. package/dist/quadtree.d.ts +255 -0
  232. package/dist/quadtree.d.ts.map +1 -0
  233. package/dist/quadtree.js +1096 -0
  234. package/dist/quadtree.js.map +1 -0
  235. package/dist/ray2-record.d.ts +86 -0
  236. package/dist/ray2-record.d.ts.map +1 -0
  237. package/dist/ray2-record.js +123 -0
  238. package/dist/ray2-record.js.map +1 -0
  239. package/dist/ray2.d.ts +38 -13
  240. package/dist/ray2.d.ts.map +1 -1
  241. package/dist/ray2.js +85 -22
  242. package/dist/ray2.js.map +1 -1
  243. package/dist/ray3-array.d.ts +27 -0
  244. package/dist/ray3-array.d.ts.map +1 -0
  245. package/dist/ray3-array.js +89 -0
  246. package/dist/ray3-array.js.map +1 -0
  247. package/dist/ray3-record.d.ts +90 -0
  248. package/dist/ray3-record.d.ts.map +1 -0
  249. package/dist/ray3-record.js +146 -0
  250. package/dist/ray3-record.js.map +1 -0
  251. package/dist/ray3.d.ts +72 -25
  252. package/dist/ray3.d.ts.map +1 -1
  253. package/dist/ray3.js +233 -64
  254. package/dist/ray3.js.map +1 -1
  255. package/dist/segment2-record.d.ts +80 -0
  256. package/dist/segment2-record.d.ts.map +1 -0
  257. package/dist/segment2-record.js +122 -0
  258. package/dist/segment2-record.js.map +1 -0
  259. package/dist/segment2.d.ts +39 -19
  260. package/dist/segment2.d.ts.map +1 -1
  261. package/dist/segment2.js +104 -42
  262. package/dist/segment2.js.map +1 -1
  263. package/dist/segment3-record.d.ts +90 -0
  264. package/dist/segment3-record.d.ts.map +1 -0
  265. package/dist/segment3-record.js +146 -0
  266. package/dist/segment3-record.js.map +1 -0
  267. package/dist/segment3.d.ts +24 -12
  268. package/dist/segment3.d.ts.map +1 -1
  269. package/dist/segment3.js +67 -30
  270. package/dist/segment3.js.map +1 -1
  271. package/dist/size.d.ts +40 -0
  272. package/dist/size.d.ts.map +1 -0
  273. package/dist/size.js +72 -0
  274. package/dist/size.js.map +1 -0
  275. package/dist/sphere3-array-boundary.d.ts +51 -0
  276. package/dist/sphere3-array-boundary.d.ts.map +1 -0
  277. package/dist/sphere3-array-boundary.js +98 -0
  278. package/dist/sphere3-array-boundary.js.map +1 -0
  279. package/dist/sphere3-record.d.ts +88 -0
  280. package/dist/sphere3-record.d.ts.map +1 -0
  281. package/dist/sphere3-record.js +123 -0
  282. package/dist/sphere3-record.js.map +1 -0
  283. package/dist/sphere3.d.ts +55 -12
  284. package/dist/sphere3.d.ts.map +1 -1
  285. package/dist/sphere3.js +233 -24
  286. package/dist/sphere3.js.map +1 -1
  287. package/dist/spherical/cap.d.ts +56 -0
  288. package/dist/spherical/cap.d.ts.map +1 -0
  289. package/dist/spherical/cap.js +363 -0
  290. package/dist/spherical/cap.js.map +1 -0
  291. package/dist/spherical/great-circle.d.ts +39 -0
  292. package/dist/spherical/great-circle.d.ts.map +1 -0
  293. package/dist/spherical/great-circle.js +158 -0
  294. package/dist/spherical/great-circle.js.map +1 -0
  295. package/dist/spherical/index.d.ts +3 -0
  296. package/dist/spherical/index.d.ts.map +1 -0
  297. package/dist/spherical/index.js +3 -0
  298. package/dist/spherical/index.js.map +1 -0
  299. package/dist/triangle2-record.d.ts +91 -0
  300. package/dist/triangle2-record.d.ts.map +1 -0
  301. package/dist/triangle2-record.js +146 -0
  302. package/dist/triangle2-record.js.map +1 -0
  303. package/dist/triangle2.d.ts +29 -14
  304. package/dist/triangle2.d.ts.map +1 -1
  305. package/dist/triangle2.js +86 -22
  306. package/dist/triangle2.js.map +1 -1
  307. package/dist/triangle3-record.d.ts +97 -0
  308. package/dist/triangle3-record.d.ts.map +1 -0
  309. package/dist/triangle3-record.js +178 -0
  310. package/dist/triangle3-record.js.map +1 -0
  311. package/dist/triangle3.d.ts +60 -17
  312. package/dist/triangle3.d.ts.map +1 -1
  313. package/dist/triangle3.js +287 -38
  314. package/dist/triangle3.js.map +1 -1
  315. package/package.json +15 -8
  316. package/dist/angles.d.ts +0 -31
  317. package/dist/angles.d.ts.map +0 -1
  318. package/dist/angles.js +0 -53
  319. package/dist/angles.js.map +0 -1
  320. package/dist/coordinate-spaces.d.ts +0 -39
  321. package/dist/coordinate-spaces.d.ts.map +0 -1
  322. package/dist/coordinate-spaces.js +0 -52
  323. package/dist/coordinate-spaces.js.map +0 -1
  324. package/dist/coordinates-vec2.d.ts +0 -7
  325. package/dist/coordinates-vec2.d.ts.map +0 -1
  326. package/dist/coordinates-vec2.js +0 -35
  327. package/dist/coordinates-vec2.js.map +0 -1
  328. package/dist/coordinates-vec3.d.ts +0 -11
  329. package/dist/coordinates-vec3.d.ts.map +0 -1
  330. package/dist/coordinates-vec3.js +0 -61
  331. package/dist/coordinates-vec3.js.map +0 -1
  332. package/dist/coordinates.d.ts +0 -54
  333. package/dist/coordinates.d.ts.map +0 -1
  334. package/dist/coordinates.js +0 -2
  335. package/dist/coordinates.js.map +0 -1
  336. package/dist/euler-angles-quaternion.d.ts +0 -7
  337. package/dist/euler-angles-quaternion.d.ts.map +0 -1
  338. package/dist/euler-angles-quaternion.js +0 -100
  339. package/dist/euler-angles-quaternion.js.map +0 -1
  340. package/dist/euler-angles.d.ts +0 -33
  341. package/dist/euler-angles.d.ts.map +0 -1
  342. package/dist/euler-angles.js +0 -35
  343. package/dist/euler-angles.js.map +0 -1
  344. package/dist/geometry-vectors.d.ts +0 -11
  345. package/dist/geometry-vectors.d.ts.map +0 -1
  346. package/dist/geometry-vectors.js +0 -19
  347. package/dist/geometry-vectors.js.map +0 -1
  348. package/dist/mesh3.d.ts +0 -32
  349. package/dist/mesh3.d.ts.map +0 -1
  350. package/dist/mesh3.js +0 -142
  351. package/dist/mesh3.js.map +0 -1
  352. package/dist/point2.d.ts +0 -41
  353. package/dist/point2.d.ts.map +0 -1
  354. package/dist/point2.js +0 -92
  355. package/dist/point2.js.map +0 -1
  356. package/dist/point3.d.ts +0 -43
  357. package/dist/point3.d.ts.map +0 -1
  358. package/dist/point3.js +0 -103
  359. package/dist/point3.js.map +0 -1
  360. package/dist/point4.d.ts +0 -12
  361. package/dist/point4.d.ts.map +0 -1
  362. package/dist/point4.js +0 -28
  363. package/dist/point4.js.map +0 -1
  364. package/dist/rect2.d.ts +0 -54
  365. package/dist/rect2.d.ts.map +0 -1
  366. package/dist/rect2.js +0 -149
  367. package/dist/rect2.js.map +0 -1
  368. package/dist/size2.d.ts +0 -33
  369. package/dist/size2.d.ts.map +0 -1
  370. package/dist/size2.js +0 -81
  371. package/dist/size2.js.map +0 -1
  372. package/dist/size3.d.ts +0 -21
  373. package/dist/size3.d.ts.map +0 -1
  374. package/dist/size3.js +0 -59
  375. package/dist/size3.js.map +0 -1
  376. package/dist/size4.d.ts +0 -10
  377. package/dist/size4.d.ts.map +0 -1
  378. package/dist/size4.js +0 -16
  379. package/dist/size4.js.map +0 -1
package/CHANGELOG.md CHANGED
@@ -1,5 +1,326 @@
1
1
  # Changelog
2
2
 
3
+ ## 0.4.0
4
+
5
+ ### Minor Changes
6
+
7
+ - 0b4fe43: `polygon2SignedArea(coordinates, vertexCount?)` and
8
+ `polygon2Area(coordinates, vertexCount?)` measure the polygon of the first
9
+ `vertexCount` vertices when a count is given, so a polygon can live at the start
10
+ of a longer working buffer; a count that is not an integer from 0 to
11
+ `coordinates.length / 2` throws a `RangeError`. Without it they read every
12
+ vertex, as before.
13
+
14
+ `polygon2ClipHalfPlane(out, coordinates, vertexCount, halfPlanes, index?)`
15
+ writes the polygon cut to the half-plane `normal · p ≤ limit`, read as
16
+ `(normalX, normalY, limit)` from `halfPlanes[index]`, into `out` and
17
+ returns its vertex count (Sutherland–Hodgman): the convex intersection, at most
18
+ `vertexCount + 1` vertices, for a convex polygon; pieces of the same area joined
19
+ by zero-width bridges, at most `⌊3 · vertexCount / 2⌋` vertices, for a concave
20
+ one. Vertices on the line are kept; an infinite limit (or a zero normal) keeps
21
+ everything or nothing, and the half-plane is scaled by a power of two before
22
+ any side is evaluated, so every finite input gives finite vertices; a vertex
23
+ too near the line for the scaled evaluation is placed by the exact sign of its
24
+ side, so which vertices are kept is exact. No double
25
+ crosses the call, so it allocates nothing whether or not the engine inlines it;
26
+ it throws a `RangeError` before
27
+ writing when `out` is shorter than `2 · ⌊3 · vertexCount / 2⌋` entries or
28
+ shares memory with the vertices read, the count or index is out of range, the
29
+ normal is not finite or `limit` is `NaN`.
30
+
31
+ `line2IntersectLine2` now allocates nothing for coordinate-sized lines (its
32
+ determinants go through `diffOfProductsInPlace`), and `segment2ClosestPoint`
33
+ allocates nothing whether or not the engine inlines it; their results are
34
+ unchanged.
35
+
36
+ ### Patch Changes
37
+
38
+ - 0b4fe43: The mesh kernels stay finite and independent of order over the whole binary64
39
+ range. `triangle3Normal`, `mesh3FaceNormals` and `mesh3VertexNormals` take the
40
+ exact cross product's direction for any finite corners: the unit normal within
41
+ 2^−48 per component (normwise, about 3.4 · 2^−53 at worst in testing), so a
42
+ component smaller than that beside the largest may round to a zero of either
43
+ sign while every larger one has the exact sign; +0 where the exact component
44
+ is 0, and the zero
45
+ vector exactly for a degenerate triangle (collinear or repeated corners) — a
46
+ triangle with edges of `Number.MAX_VALUE` and `Number.MIN_VALUE` gets its
47
+ normal; `plane3FromPoints` takes the same normal. `mesh3VertexNormals` takes faces of any size, spanning
48
+ ±`Number.MAX_VALUE` included. `mesh3SurfaceArea` scales each face's edges per
49
+ axis by powers of two, so no square overflows or underflows, and sums the faces
50
+ exactly. `mesh3Volume` and `mesh3Centroid` are exact sums over face-local edges,
51
+ relative to a corner of the mesh's bounding box, each axis scaled by its own
52
+ power of two: the result is the same in every face or merge order, and nothing
53
+ overflows for a mesh however thin, wide or small, anywhere up to
54
+ ±`Number.MAX_VALUE`. `mesh3TriangleDepths` is finite next to ±`Number.MAX_VALUE`
55
+ wherever `z / w` is.
56
+ - 0b4fe43: The quadtree stores its nodes in typed columns reused across calls, so once
57
+ warmed up `assign`, `visit`, `visitAfter`, `find` and `forEachInBox` allocate
58
+ nothing, and not only the traversal per node.
59
+ - 0b4fe43: `polygon3Normal` takes the exact Newell vector's direction for any finite
60
+ coordinates, with `triangle3Normal`'s guarantee: each component within 2^−48 of
61
+ the exact unit normal's (normwise), +0 where the exact component is 0, the exact
62
+ sign wherever that bound cannot reach 0, and the zero vector exactly when the
63
+ vector is zero. A polygon of `Number.MAX_VALUE` or `Number.MIN_VALUE` size, or
64
+ one whose fan triangles cancel, gets its normal where it used to get `NaN` or
65
+ the zero vector; a coordinate that is not finite gives `NaN`s.
66
+ `mesh3VertexNormals` gives each vertex the direction of the exact sum of its
67
+ faces' cross products, within 2^−48 per component: opposite faces that cancel no
68
+ longer take a far smaller face's normal with them (two faces of 2^2000 beside
69
+ one of `Number.MIN_VALUE²`, or unit faces beside one of 2^−80), and a vertex
70
+ whose faces cancel exactly, as on a double-sided mesh, gets the zero vector
71
+ exactly. Neither allocates once its scratch has grown to the largest input.
72
+ - Updated dependencies [0b4fe43]
73
+ - Updated dependencies [0b4fe43]
74
+ - Updated dependencies [0b4fe43]
75
+ - Updated dependencies [0b4fe43]
76
+ - Updated dependencies [0b4fe43]
77
+ - Updated dependencies [0b4fe43]
78
+ - Updated dependencies [0b4fe43]
79
+ - Updated dependencies [0b4fe43]
80
+ - Updated dependencies [0b4fe43]
81
+ - Updated dependencies [0b4fe43]
82
+ - Updated dependencies [0b4fe43]
83
+ - Updated dependencies [0b4fe43]
84
+ - Updated dependencies [0b4fe43]
85
+ - Updated dependencies [0b4fe43]
86
+ - Updated dependencies [0b4fe43]
87
+ - Updated dependencies [0b4fe43]
88
+ - Updated dependencies [0b4fe43]
89
+ - Updated dependencies [0b4fe43]
90
+ - Updated dependencies [0b4fe43]
91
+ - Updated dependencies [0b4fe43]
92
+ - Updated dependencies [0b4fe43]
93
+ - Updated dependencies [0b4fe43]
94
+ - Updated dependencies [0b4fe43]
95
+ - Updated dependencies [0b4fe43]
96
+ - Updated dependencies [0b4fe43]
97
+ - Updated dependencies [0b4fe43]
98
+ - Updated dependencies [0b4fe43]
99
+ - Updated dependencies [0b4fe43]
100
+ - Updated dependencies [0b4fe43]
101
+ - Updated dependencies [0b4fe43]
102
+ - Updated dependencies [0b4fe43]
103
+ - @ac-kit/core@0.13.0
104
+ - @ac-kit/math-linear@0.4.0
105
+ - @ac-kit/math-scalar@0.4.0
106
+
107
+ ## 0.3.0
108
+
109
+ ### Minor Changes
110
+
111
+ - 34e8cfa: `polyline2CumulativeLengths(out, coordinates)` and
112
+ `polyline3CumulativeLengths(out, coordinates)` write the length of a chain up
113
+ to each vertex into `out` (the first is 0, the last `polyline2Length`'s result):
114
+ what a dash pattern or a distance label along a path needs. They allocate
115
+ nothing and throw a `RangeError` for an odd or non-multiple-of-3 coordinate
116
+ count, an `out` that has not one entry per vertex, or an `out` that may share
117
+ memory with `coordinates` (a `SharedArrayBuffer` and its clones count as
118
+ shared).
119
+ - 34e8cfa: Shapes and coordinate records are packed, branded tuples of numbers made by
120
+ creators, with buffer forms and hit-tests, and points, vectors and sizes are
121
+ `@ac-kit/math-linear`'s `Vec2`, `Vec3` and `Vec4`.
122
+
123
+ - **Boxes, circles, spheres.** `Box2`, `Box3` and `Box4` (kept: an axis-aligned
124
+ box in four dimensions, the fourth axis often time) are min/max records,
125
+ `[minX, minY, maxX, maxY]`, and `Circle2` and `Sphere3` are
126
+ `[centerX, centerY, radius]` and `[centerX, centerY, centerZ, radius]`. Each
127
+ has `…Create` (the empty box, for a box), `…Of`, `…Clone`, `…Set`, `…Copy`,
128
+ exact `…Equals`, tolerant `…IsClose`, the checked `…FromArray` and
129
+ `…IsFinite`, and a `Float64Array` buffer family (`…ArrayCreate`, `…Load`,
130
+ `…Store`, `…LoadStrided`, `…StoreStrided`, `…StoreFloat32`,
131
+ `…ArrayIsFinite`). Hit-tests over packed boxes and circles:
132
+ `box2ArrayFindIndexContainingXy`, `box2ArrayFindLastIndexContainingXy` (the
133
+ topmost), `box2ArrayContainingXy`, `box2ArrayFindIndexIntersecting`,
134
+ `box2ArrayIntersecting`, `circle2ArrayFindIndexContainingXy`. New: the box
135
+ family (union, intersection, expansion, translation, clamping, distance, lerp,
136
+ parameter, letterboxing with `box2FitInside`, transformed bounds by an
137
+ affine map), `box3FromPoints` and `sphere3FromPoints` (Ritter), unions of
138
+ buffers, and `Box2GridIndex` for overlap queries (label collision, broad
139
+ phase).
140
+ - **Linear shapes.** `Segment2/3`, `Ray2/3`, `Line2/3` and `Plane3`
141
+ (`[normalX, normalY, normalZ, d]`, `n·p + d = 0`), with closest points,
142
+ distances, and intersections that return a parameter (`Infinity` for a miss):
143
+ `ray3IntersectPlane3`, `ray3IntersectSphere3`, `ray3IntersectBox3`,
144
+ `ray3IntersectTriangle3` (Möller–Trumbore, with back-face culling),
145
+ `ray2IntersectSegment2`; the crossing of two segments or lines is a `boolean`
146
+ with `NaN` in `out` on a miss. Picking: `ray3FromViewport` (a finite unit
147
+ direction in all three depth ranges, an infinite far plane included) and
148
+ `ray3FindNearestPoint`, `ray3FindNearestBox3`, `ray3FindNearestSphere3` over
149
+ buffers.
150
+ - **Frustums.** `Frustum3` is six inward planes; `frustum3FromMat4x4` reads them
151
+ from a view-projection for `"zero-to-one"`, `"negative-one-to-one"` and
152
+ `"one-to-zero"` (reversed depth), an infinite far plane allowed;
153
+ `frustum3ContainsPoint`, `frustum3IntersectsSphere3`, `frustum3IntersectsBox3`
154
+ and the culling kernels `frustum3CullSphere3Array`, `frustum3CullBox3Array`.
155
+ - **Triangles, polygons, polylines.** `Triangle2/3` tuples (areas, barycentric
156
+ coordinates, containment, closest point, front-facing); polygons and
157
+ polylines are `Float64Array`s of vertices, rings implicitly closed, holes
158
+ given by start index; `polygon2ContainsXy` with both fill rules,
159
+ `polygon2Triangulate` by ear clipping with holes (it was a fan),
160
+ `polygon3Triangulate`, areas, centroids, perimeters, `polygon2IsConvex`,
161
+ polyline distances and closest points.
162
+ - **Coordinates.** `PolarCoords`, `SphericalCoords`, `CylindricalCoords` are
163
+ tuples, converted by `polarFromVec2`, `sphericalFromVec3YUp`,
164
+ `vec3FromSphericalZUp`, `cylindricalFromVec3ZUp`, … ; new: `LongitudeLatitude`
165
+ (longitude first) with buffer forms, `mat3x3FromLocalFrame` (`"east-north-up"`,
166
+ `"north-east-down"`) and `HorizontalCoords` (azimuth clockwise from north).
167
+ - **The sphere.** `sphericalBearing`, `sphericalDestination`, `sphericalCircle`,
168
+ `sphericalArc`, `sphericalCapContains` (the angle to the centre at most the
169
+ radius, boundary included, accurate for caps of any size), and clipping to a
170
+ cap: `sphericalArcClipToCap` and `sphericalPolylineClipToCap` (room for
171
+ `9n − 6` numbers for `n` vertices), for the visible
172
+ region of an azimuthal projection.
173
+ - **Meshes.** `Mesh3` is `{ positions, indices, normals?, uvs? }`: packed
174
+ `Float64Array`s (3 numbers per vertex, `uvs` 2) and `indices` as a
175
+ `Uint16Array` up to 65 535 vertices (`indexArrayCreate` picks; `0xFFFF` stays
176
+ free as a restart index) or a `Uint32Array`. Kernels write into an `out`:
177
+ `mesh3VertexNormals` (area-weighted, unit, zero for an unused vertex),
178
+ `mesh3FaceNormals` (zero for a zero-area face), `mesh3SurfaceArea`,
179
+ `mesh3Volume` (signed), `mesh3Centroid`, `mesh3IntersectRay3` (the nearest
180
+ triangle and `[t, u, v]`, `−1` for a miss), `mesh3TriangleDepths` and
181
+ `mesh3ReorderTriangles` (back-to-front sorting of translucent triangles); each
182
+ runs a generated twin per index type, with bit-identical results. Also
183
+ `mesh3VertexCount`, `mesh3TriangleCount`, `mesh3Triangle` (`false` and `NaN`
184
+ for a selector that is not a triangle), `mesh3Equals` and
185
+ `mesh3Merge` (the index type follows the total vertex count; an index past its
186
+ own mesh is a `RangeError`). Kernels refuse an `out` that shares memory with an
187
+ input. Generators, Y up,
188
+ counter-clockwise, with normals and uvs: `mesh3Box`, `mesh3Plane`,
189
+ `mesh3Heightfield`, `mesh3Octahedron`, `mesh3IcoSphere`, `mesh3UvSphere`,
190
+ `mesh3Cylinder`; a bad size or segment count is a `RangeError`.
191
+ - Every operation takes `out` first, never throws on degenerate input and
192
+ returns `NaN` rather than a stale value; per-element operations allocate
193
+ nothing (the triangulations allocate O(n) scratch, and only the creators
194
+ allocate values), and a creator's result never has holey or integer storage.
195
+ Bulk functions throw a `RangeError` once per call for a bad length.
196
+ Degree-2 quantities (areas, centroids, barycentric determinants, a ray's
197
+ perpendicular distance) are accurate for products within [1e−150, 1e150]; no
198
+ `…Scaled` variants yet.
199
+
200
+ Migration:
201
+
202
+ - `Point2<T>`, `Point3<T>`, `Point4`, `Size2<T>`, `Size3<T>`, `Size4` and every
203
+ `point*`/`size*` function are gone: use `Vec2`, `Vec3`, `Vec4` and the `vec*`
204
+ functions of `@ac-kit/math-linear` (`{ x, y }` becomes `vec2Of(x, y)`,
205
+ `point2Distance(a, b, "manhattan")` becomes `vec2DistanceManhattan(a, b)`).
206
+ `DistanceType` is gone with them: code that chooses a distance at run time
207
+ passes `@ac-kit/core`'s `Distance<T>`. The `size2` functions that make sense
208
+ for a size (`size2AspectRatio`, `size2Area`, `size2Contains`, `size2IsZero`,
209
+ `size2ScaleToFit`, `size2ScaleToFill`, `size3ScaleToFit`, `size3Volume`) take
210
+ `Vec2`/`Vec3`, `out` first. `point2ToNdc`/`ndcToPoint2` are
211
+ `vec2ViewportToNdc`/`vec2NdcToViewport`, `point2ToUv`/`uvToPoint2` are
212
+ `box2Parameter`/`box2PointAt`, and `geometry-vectors.ts`'s converters are
213
+ gone (points are vectors).
214
+ - `Rect2` (origin and size) is `Box2`, min/max: `box2FromXywh(out, x, y, w, h)`;
215
+ `rect2Right`, `rect2Bottom` are `box[2]`, `box[3]`; `rect2Inflate` and
216
+ `rect2Inset` are `box2ExpandByScalar` with `+margin` and `−margin`;
217
+ `rect2Intersect` is `box2IntersectsBox2` and `rect2Intersection` returns an
218
+ empty box (`box2IsEmpty`) instead of `null`; `rect2FitInside(container,
219
+ contained)` is `box2FitInside(out, box, container)`; `rect2Clamp` has no
220
+ meaning on min/max records and is removed. `Box3` (origin and size) is
221
+ min/max, same verbs; `Box4` is `[minX, minY, minZ, minW, maxX, maxY, maxZ,
222
+ maxW]`, so `{ origin, size }` becomes `box4Of(o.x, o.y, o.z, o.w, o.x +
223
+ s.width, o.y + s.height, o.z + s.depth, o.w + s.duration)`.
224
+ - `Circle2`, `Sphere3`, `Line*`, `Ray*`, `Segment*`, `Triangle*`, `Plane3`,
225
+ `Polygon2`, `Polygon3` are no longer objects: they are the tuples above, and
226
+ a polygon is its `Float64Array` coordinates (`polygon2ContainsPoint(p,
227
+ point)` becomes `polygon2ContainsPoint(coordinates, point, "evenodd")`,
228
+ `polygonNBoundingBox` is `boxNFromPoints`). `circle2Intersects` and
229
+ `sphere3Intersects` are `circle2IntersectsCircle2` and
230
+ `sphere3IntersectsSphere3`; `line2Intersect` and `segment2Intersect` are
231
+ `line2IntersectLine2(out, a, b): boolean` (the point) and
232
+ `segment2IntersectSegment2(out, a, b): boolean` (the parameters);
233
+ `ray3IntersectPlane` and `ray3IntersectSphere` return a point or `null`, their
234
+ successors `ray3IntersectPlane3` and `ray3IntersectSphere3` return the
235
+ parameter `t` (`Infinity` for a miss; the point is `ray3At`). A plane
236
+ `{ normal, distance }` (`n·p − distance = 0`) is `[nx, ny, nz, d]` with `d =
237
+ −distance`, and `plane3DistanceToPoint` is `plane3SignedDistanceToPoint`.
238
+ - Direction functions no longer throw on a zero direction: a degenerate ray or
239
+ line is documented per function.
240
+ - `Mesh3` (`{ vertices: Point3[], faces: [a, b, c][] }`) is the packed
241
+ `{ positions, indices }` of `Float64Array` and `Uint16Array | Uint32Array`:
242
+ `mesh3FaceCount` and `mesh3FaceTriangle` are `mesh3TriangleCount` and
243
+ `mesh3Triangle(out, positions, indices, triangle): boolean`, `mesh3FaceNormal` is the
244
+ bulk `mesh3FaceNormals(out, positions, indices)`, `mesh3BoundingBox` is
245
+ `box3FromPoints`, and `mesh3VertexNormals(mesh)` is
246
+ `mesh3VertexNormals(out, positions, indices)` (a vertex no triangle uses gets
247
+ the zero vector, no longer `[0, 1, 0]`). `mesh3Centroid` of a mesh of zero
248
+ area is `NaN`, no longer the vertex average.
249
+ - `PolarCoords`, `SphericalCoords(Y/Z)`, `CylindricalCoords(Y/Z)` and
250
+ `PolygonalPolar…` are tuples: `vec2ToPolar`, `polarToVec2`,
251
+ `vec3ToSphericalY`, `sphericalYToVec3` and the Z and cylindrical ones become
252
+ `polarFromVec2`, `vec2FromPolar`, `sphericalFromVec3YUp`,
253
+ `vec3FromSphericalYUp`, `…ZUp`, `cylindricalFrom…`; `vec2ToPolygonalPolar` and
254
+ `polygonalPolarToVec2` are `polygonalPolarFromVec2(out, v, sides, rotation)`
255
+ and `vec2FromPolygonalPolar`. An inclination is an `atan2`, so the zero vector
256
+ gives `[0, 0, 0]` rather than `NaN`.
257
+ - The angle functions (`angleWrapDeg`, `angleNormalizeRad`, …) are no longer
258
+ re-exported: import them from `@ac-kit/math-scalar`. Euler angles and their
259
+ conversions (`eulerAnglesToQuaternion`, …) are `@ac-kit/math-linear`'s
260
+ (`quaternionFromEuler`, `eulerFromQuaternion`, twelve orders).
261
+ - Values are made by creators: an array literal no longer type-checks as a
262
+ `Box2`, and a value from `JSON.parse` goes through `box2FromArray`.
263
+ - 34e8cfa: `Quadtree` indexes 2-D points by integer id. `new Quadtree(points)` or
264
+ `assign(points)` builds it over a `Float64Array` of x, y pairs (ids 0…n−1,
265
+ reusing its storage across calls, as a force step does each tick); `add`,
266
+ `remove`, `clear` change it afterwards. `find(x, y, maxDistance?)` returns the
267
+ nearest id (lowest id on ties, −1 when none) and `forEachInBox` lists the ids
268
+ in a closed box. `visit` and `visitAfter` walk the tree in pre- and post-order,
269
+ handing the visitor each node's number and its square cell as a box the
270
+ traversal reuses (read it during the call, copy it to keep it), so the
271
+ traversal allocates nothing per node; node numbers are dense, so an aggregate such
272
+ as a Barnes–Hut centre of mass lives in a `Float64Array(nodeCount() * k)`. The
273
+ cells and visit order match d3-quadtree for the same points wherever d3's cell
274
+ edges are exact (integer edges below 2⁵³, so at every ordinary scale); beyond
275
+ that the root cell is re-rooted on exact edges instead, so growing the tree
276
+ never loses a point. Coincident points
277
+ share a leaf, listed in ascending id order. Stored coordinates (construction,
278
+ `assign`, `add`) must be finite with |x|, |y| ≤ 1e150: an odd length, a
279
+ non-finite coordinate or one beyond that range throws `RangeError` before the
280
+ tree changes (`assign` checks every point first and leaves the tree as it was).
281
+ Queries never throw: `find` returns −1 for a NaN, infinite or beyond-±1e150
282
+ coordinate (outside the supported range: no result), and `forEachInBox` visits
283
+ what lies inside the supported range (an infinite box lists every id), nothing
284
+ for a NaN or inverted box. Ids are never reissued, so storage grows with the ids
285
+ issued until `clear` or `assign`.
286
+
287
+ ### Patch Changes
288
+
289
+ - Updated dependencies [34e8cfa]
290
+ - Updated dependencies [34e8cfa]
291
+ - Updated dependencies [34e8cfa]
292
+ - Updated dependencies [34e8cfa]
293
+ - Updated dependencies [34e8cfa]
294
+ - Updated dependencies [34e8cfa]
295
+ - Updated dependencies [34e8cfa]
296
+ - Updated dependencies [34e8cfa]
297
+ - Updated dependencies [34e8cfa]
298
+ - Updated dependencies [34e8cfa]
299
+ - Updated dependencies [34e8cfa]
300
+ - Updated dependencies [34e8cfa]
301
+ - Updated dependencies [34e8cfa]
302
+ - Updated dependencies [34e8cfa]
303
+ - Updated dependencies [34e8cfa]
304
+ - Updated dependencies [34e8cfa]
305
+ - Updated dependencies [34e8cfa]
306
+ - Updated dependencies [34e8cfa]
307
+ - Updated dependencies [34e8cfa]
308
+ - Updated dependencies [34e8cfa]
309
+ - Updated dependencies [34e8cfa]
310
+ - Updated dependencies [34e8cfa]
311
+ - Updated dependencies [34e8cfa]
312
+ - Updated dependencies [34e8cfa]
313
+ - Updated dependencies [34e8cfa]
314
+ - Updated dependencies [34e8cfa]
315
+ - Updated dependencies [34e8cfa]
316
+ - Updated dependencies [34e8cfa]
317
+ - Updated dependencies [34e8cfa]
318
+ - Updated dependencies [34e8cfa]
319
+ - Updated dependencies [34e8cfa]
320
+ - @ac-kit/core@0.12.0
321
+ - @ac-kit/math-scalar@0.3.0
322
+ - @ac-kit/math-linear@0.3.0
323
+
3
324
  ## 0.2.3
4
325
 
5
326
  ### Patch Changes