@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/dist/size.d.ts ADDED
@@ -0,0 +1,40 @@
1
+ import type { ReadonlyVec2, ReadonlyVec3, Vec2, Vec3 } from "@ac-kit/math-linear";
2
+ /**
3
+ * Sizes are plain vectors (`Vec2`, `Vec3`): the width and height, or width,
4
+ * height and depth. The functions here are the ones that only make sense for a
5
+ * size.
6
+ */
7
+ /** The width divided by the height. */
8
+ export declare function size2AspectRatio(size: ReadonlyVec2): number;
9
+ /** The area, `width × height`. */
10
+ export declare function size2Area(size: ReadonlyVec2): number;
11
+ /** Whether `size` fits inside `container` on both axes (equal sizes fit). */
12
+ export declare function size2Contains(container: ReadonlyVec2, size: ReadonlyVec2): boolean;
13
+ /**
14
+ * Whether both extents are within `tolerance` of zero.
15
+ *
16
+ * @param tolerance Absolute, in the caller's units; defaults to `0` (exactly
17
+ * zero).
18
+ */
19
+ export declare function size2IsZero(size: ReadonlyVec2, tolerance?: number): boolean;
20
+ /**
21
+ * Writes into `out` `size` scaled uniformly by the largest factor that makes it
22
+ * fit inside `container`. A zero extent in `size` gives non-finite results.
23
+ * `out` may be `size` or `container`.
24
+ */
25
+ export declare function size2ScaleToFit(out: Vec2, size: ReadonlyVec2, container: ReadonlyVec2): Vec2;
26
+ /**
27
+ * Writes into `out` `size` scaled uniformly by the smallest factor that makes
28
+ * it cover `container`. A zero extent in `size` gives non-finite results. `out`
29
+ * may be `size` or `container`.
30
+ */
31
+ export declare function size2ScaleToFill(out: Vec2, size: ReadonlyVec2, container: ReadonlyVec2): Vec2;
32
+ /**
33
+ * Writes into `out` `size` scaled uniformly by the largest factor that makes it
34
+ * fit inside `container`. A zero extent in `size` gives non-finite results.
35
+ * `out` may be `size` or `container`.
36
+ */
37
+ export declare function size3ScaleToFit(out: Vec3, size: ReadonlyVec3, container: ReadonlyVec3): Vec3;
38
+ /** The volume, `width × height × depth`. */
39
+ export declare function size3Volume(size: ReadonlyVec3): number;
40
+ //# sourceMappingURL=size.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"size.d.ts","sourceRoot":"","sources":["../src/size.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACX,YAAY,EACZ,YAAY,EACZ,IAAI,EACJ,IAAI,EACJ,MAAM,qBAAqB,CAAC;AAE7B;;;;GAIG;AAEH,uCAAuC;AACvC,wBAAgB,gBAAgB,CAAC,IAAI,EAAE,YAAY,GAAG,MAAM,CAE3D;AAED,kCAAkC;AAClC,wBAAgB,SAAS,CAAC,IAAI,EAAE,YAAY,GAAG,MAAM,CAEpD;AAED,6EAA6E;AAC7E,wBAAgB,aAAa,CAC5B,SAAS,EAAE,YAAY,EACvB,IAAI,EAAE,YAAY,GAChB,OAAO,CAET;AAED;;;;;GAKG;AACH,wBAAgB,WAAW,CAAC,IAAI,EAAE,YAAY,EAAE,SAAS,SAAI,GAAG,OAAO,CAEtE;AAED;;;;GAIG;AACH,wBAAgB,eAAe,CAC9B,GAAG,EAAE,IAAI,EACT,IAAI,EAAE,YAAY,EAClB,SAAS,EAAE,YAAY,GACrB,IAAI,CAON;AAED;;;;GAIG;AACH,wBAAgB,gBAAgB,CAC/B,GAAG,EAAE,IAAI,EACT,IAAI,EAAE,YAAY,EAClB,SAAS,EAAE,YAAY,GACrB,IAAI,CAON;AAED;;;;GAIG;AACH,wBAAgB,eAAe,CAC9B,GAAG,EAAE,IAAI,EACT,IAAI,EAAE,YAAY,EAClB,SAAS,EAAE,YAAY,GACrB,IAAI,CAaN;AAED,4CAA4C;AAC5C,wBAAgB,WAAW,CAAC,IAAI,EAAE,YAAY,GAAG,MAAM,CAEtD"}
package/dist/size.js ADDED
@@ -0,0 +1,72 @@
1
+ /**
2
+ * Sizes are plain vectors (`Vec2`, `Vec3`): the width and height, or width,
3
+ * height and depth. The functions here are the ones that only make sense for a
4
+ * size.
5
+ */
6
+ /** The width divided by the height. */
7
+ export function size2AspectRatio(size) {
8
+ return size[0] / size[1];
9
+ }
10
+ /** The area, `width × height`. */
11
+ export function size2Area(size) {
12
+ return size[0] * size[1];
13
+ }
14
+ /** Whether `size` fits inside `container` on both axes (equal sizes fit). */
15
+ export function size2Contains(container, size) {
16
+ return size[0] <= container[0] && size[1] <= container[1];
17
+ }
18
+ /**
19
+ * Whether both extents are within `tolerance` of zero.
20
+ *
21
+ * @param tolerance Absolute, in the caller's units; defaults to `0` (exactly
22
+ * zero).
23
+ */
24
+ export function size2IsZero(size, tolerance = 0) {
25
+ return Math.abs(size[0]) <= tolerance && Math.abs(size[1]) <= tolerance;
26
+ }
27
+ /**
28
+ * Writes into `out` `size` scaled uniformly by the largest factor that makes it
29
+ * fit inside `container`. A zero extent in `size` gives non-finite results.
30
+ * `out` may be `size` or `container`.
31
+ */
32
+ export function size2ScaleToFit(out, size, container) {
33
+ const scale = Math.min(container[0] / size[0], container[1] / size[1]);
34
+ const width = size[0] * scale;
35
+ const height = size[1] * scale;
36
+ out[0] = width;
37
+ out[1] = height;
38
+ return out;
39
+ }
40
+ /**
41
+ * Writes into `out` `size` scaled uniformly by the smallest factor that makes
42
+ * it cover `container`. A zero extent in `size` gives non-finite results. `out`
43
+ * may be `size` or `container`.
44
+ */
45
+ export function size2ScaleToFill(out, size, container) {
46
+ const scale = Math.max(container[0] / size[0], container[1] / size[1]);
47
+ const width = size[0] * scale;
48
+ const height = size[1] * scale;
49
+ out[0] = width;
50
+ out[1] = height;
51
+ return out;
52
+ }
53
+ /**
54
+ * Writes into `out` `size` scaled uniformly by the largest factor that makes it
55
+ * fit inside `container`. A zero extent in `size` gives non-finite results.
56
+ * `out` may be `size` or `container`.
57
+ */
58
+ export function size3ScaleToFit(out, size, container) {
59
+ const scale = Math.min(container[0] / size[0], container[1] / size[1], container[2] / size[2]);
60
+ const width = size[0] * scale;
61
+ const height = size[1] * scale;
62
+ const depth = size[2] * scale;
63
+ out[0] = width;
64
+ out[1] = height;
65
+ out[2] = depth;
66
+ return out;
67
+ }
68
+ /** The volume, `width × height × depth`. */
69
+ export function size3Volume(size) {
70
+ return size[0] * size[1] * size[2];
71
+ }
72
+ //# sourceMappingURL=size.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"size.js","sourceRoot":"","sources":["../src/size.ts"],"names":[],"mappings":"AAOA;;;;GAIG;AAEH,uCAAuC;AACvC,MAAM,UAAU,gBAAgB,CAAC,IAAkB;IAClD,OAAO,IAAI,CAAC,CAAC,CAAC,GAAG,IAAI,CAAC,CAAC,CAAC,CAAC;AAC1B,CAAC;AAED,kCAAkC;AAClC,MAAM,UAAU,SAAS,CAAC,IAAkB;IAC3C,OAAO,IAAI,CAAC,CAAC,CAAC,GAAG,IAAI,CAAC,CAAC,CAAC,CAAC;AAC1B,CAAC;AAED,6EAA6E;AAC7E,MAAM,UAAU,aAAa,CAC5B,SAAuB,EACvB,IAAkB;IAElB,OAAO,IAAI,CAAC,CAAC,CAAC,IAAI,SAAS,CAAC,CAAC,CAAC,IAAI,IAAI,CAAC,CAAC,CAAC,IAAI,SAAS,CAAC,CAAC,CAAC,CAAC;AAC3D,CAAC;AAED;;;;;GAKG;AACH,MAAM,UAAU,WAAW,CAAC,IAAkB,EAAE,SAAS,GAAG,CAAC;IAC5D,OAAO,IAAI,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,IAAI,SAAS,IAAI,IAAI,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,IAAI,SAAS,CAAC;AACzE,CAAC;AAED;;;;GAIG;AACH,MAAM,UAAU,eAAe,CAC9B,GAAS,EACT,IAAkB,EAClB,SAAuB;IAEvB,MAAM,KAAK,GAAG,IAAI,CAAC,GAAG,CAAC,SAAS,CAAC,CAAC,CAAC,GAAG,IAAI,CAAC,CAAC,CAAC,EAAE,SAAS,CAAC,CAAC,CAAC,G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I,CAAC,CAAC,CAAC,GAAG,KAAK,CAAC;IAC/B,MAAM,KAAK,GAAG,IAAI,CAAC,CAAC,CAAC,GAAG,KAAK,CAAC;IAC9B,GAAG,CAAC,CAAC,CAAC,GAAG,KAAK,CAAC;IACf,GAAG,CAAC,CAAC,CAAC,GAAG,MAAM,CAAC;IAChB,GAAG,CAAC,CAAC,CAAC,GAAG,KAAK,CAAC;IACf,OAAO,GAAG,CAAC;AACZ,CAAC;AAED,4CAA4C;AAC5C,MAAM,UAAU,WAAW,CAAC,IAAkB;IAC7C,OAAO,IAAI,CAAC,CAAC,CAAC,GAAG,IAAI,CAAC,CAAC,CAAC,GAAG,IAAI,CAAC,CAAC,CAAC,CAAC;AACpC,CAAC"}
@@ -0,0 +1,51 @@
1
+ import type { ReadonlySphere3, Sphere3 } from "./sphere3-record.js";
2
+ /**
3
+ * Creates a buffer for `count` spheres: a zero-filled `Float64Array` of `count
4
+ * × 4` numbers, element `i` at `[i·4, i·4 + 4)`. Allocates.
5
+ *
6
+ * @throws {RangeError} When `count` is not a non-negative safe integer or
7
+ * `count × 4` is not a valid typed array length.
8
+ */
9
+ export declare function sphere3ArrayCreate(count: number): Float64Array<ArrayBuffer>;
10
+ /**
11
+ * Writes element `index` of `array`, the numbers at `[index·4, index·4 + 4)`,
12
+ * into `out`. Each component is written as `+array[i]`, so an index past the
13
+ * end of `array` gives `NaN`, never `undefined`: the sphere stays clean
14
+ * whatever the caller does. Checking the index is the job of the checked
15
+ * layer.
16
+ *
17
+ * The sphere is copied: it is never a view of `array`. O(1).
18
+ */
19
+ export declare function sphere3Load(out: Sphere3, array: Float64Array, index: number): Sphere3;
20
+ /**
21
+ * Writes `value` into `array` as element `index`, at `[index·4, index·4 + 4)`.
22
+ * An element past the end of `array` writes nothing, as a typed array drops an
23
+ * out-of-range write. O(1).
24
+ */
25
+ export declare function sphere3Store(array: Float64Array, index: number, value: ReadonlySphere3): void;
26
+ /**
27
+ * Like {@link sphere3Load} for interleaved data: element `index` starts at
28
+ * `offset + index·stride`, both counted in numbers, and its 4 components follow
29
+ * one another. An index past the end gives `NaN` components. O(1).
30
+ */
31
+ export declare function sphere3LoadStrided(out: Sphere3, array: Float64Array, offset: number, stride: number, index: number): Sphere3;
32
+ /**
33
+ * Like {@link sphere3Store} for interleaved data: element `index` starts at
34
+ * `offset + index·stride`, both counted in numbers. A component past the end of
35
+ * `array` writes nothing. O(1).
36
+ */
37
+ export declare function sphere3StoreStrided(array: Float64Array, offset: number, stride: number, index: number, value: ReadonlySphere3): void;
38
+ /**
39
+ * Narrows `value` to binary32 and writes its 4 components into `array` from
40
+ * element `offset` on, unrolled: the way to stage a bounds or instance value
41
+ * for the GPU, where `array.set` costs several times as much for one value. A
42
+ * component past the end of `array` writes nothing. O(1).
43
+ */
44
+ export declare function sphere3StoreFloat32(array: Float32Array, offset: number, value: ReadonlySphere3): void;
45
+ /**
46
+ * Whether every number of `array` is finite: the check for a buffer of sphere3
47
+ * elements read from untrusted data or about to be uploaded. The length is not
48
+ * required to be a multiple of 4. O(n).
49
+ */
50
+ export declare function sphere3ArrayIsFinite(array: Float64Array): boolean;
51
+ //# sourceMappingURL=sphere3-array-boundary.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"sphere3-array-boundary.d.ts","sourceRoot":"","sources":["../src/sphere3-array-boundary.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,eAAe,EAAE,OAAO,EAAE,MAAM,qBAAqB,CAAC;AAEpE;;;;;;GAMG;AACH,wBAAgB,kBAAkB,CAAC,KAAK,EAAE,MAAM,GAAG,YAAY,CAAC,WAAW,CAAC,CAG3E;AAED;;;;;;;;GAQG;AACH,wBAAgB,WAAW,CAC1B,GAAG,EAAE,OAAO,EACZ,KAAK,EAAE,YAAY,EACnB,KAAK,EAAE,MAAM,GACX,OAAO,CAQT;AAED;;;;GAIG;AACH,wBAAgB,YAAY,CAC3B,KAAK,EAAE,YAAY,EACnB,KAAK,EAAE,MAAM,EACb,KAAK,EAAE,eAAe,GACpB,IAAI,CAMN;AAED;;;;GAIG;AACH,wBAAgB,kBAAkB,CACjC,GAAG,EAAE,OAAO,EACZ,KAAK,EAAE,YAAY,EACnB,MAAM,EAAE,MAAM,EACd,MAAM,EAAE,MAAM,EACd,KAAK,EAAE,MAAM,GACX,OAAO,CAQT;AAED;;;;GAIG;AACH,wBAAgB,mBAAmB,CAClC,KAAK,EAAE,YAAY,EACnB,MAAM,EAAE,MAAM,EACd,MAAM,EAAE,MAAM,EACd,KAAK,EAAE,MAAM,EACb,KAAK,EAAE,eAAe,GACpB,IAAI,CAMN;AAED;;;;;GAKG;AACH,wBAAgB,mBAAmB,CAClC,KAAK,EAAE,YAAY,EACnB,MAAM,EAAE,MAAM,EACd,KAAK,EAAE,eAAe,GACpB,IAAI,CAKN;AAED;;;;GAIG;AACH,wBAAgB,oBAAoB,CAAC,KAAK,EAAE,YAAY,GAAG,OAAO,CAUjE"}
@@ -0,0 +1,98 @@
1
+ // Generated from scripts/templates/array-boundary.liquid by scripts/generate-records.ts. Do not edit.
2
+ import { assertInteger } from "@ac-kit/core";
3
+ /**
4
+ * Creates a buffer for `count` spheres: a zero-filled `Float64Array` of `count
5
+ * × 4` numbers, element `i` at `[i·4, i·4 + 4)`. Allocates.
6
+ *
7
+ * @throws {RangeError} When `count` is not a non-negative safe integer or
8
+ * `count × 4` is not a valid typed array length.
9
+ */
10
+ export function sphere3ArrayCreate(count) {
11
+ assertInteger(count, "sphere3ArrayCreate: count", 0);
12
+ return new Float64Array(count * 4);
13
+ }
14
+ /**
15
+ * Writes element `index` of `array`, the numbers at `[index·4, index·4 + 4)`,
16
+ * into `out`. Each component is written as `+array[i]`, so an index past the
17
+ * end of `array` gives `NaN`, never `undefined`: the sphere stays clean
18
+ * whatever the caller does. Checking the index is the job of the checked
19
+ * layer.
20
+ *
21
+ * The sphere is copied: it is never a view of `array`. O(1).
22
+ */
23
+ export function sphere3Load(out, array, index) {
24
+ const base = index * 4;
25
+ // The `!` is for the compiler: past the end `+undefined` is `NaN`.
26
+ out[0] = +array[base];
27
+ out[1] = +array[base + 1];
28
+ out[2] = +array[base + 2];
29
+ out[3] = +array[base + 3];
30
+ return out;
31
+ }
32
+ /**
33
+ * Writes `value` into `array` as element `index`, at `[index·4, index·4 + 4)`.
34
+ * An element past the end of `array` writes nothing, as a typed array drops an
35
+ * out-of-range write. O(1).
36
+ */
37
+ export function sphere3Store(array, index, value) {
38
+ const base = index * 4;
39
+ array[base] = value[0];
40
+ array[base + 1] = value[1];
41
+ array[base + 2] = value[2];
42
+ array[base + 3] = value[3];
43
+ }
44
+ /**
45
+ * Like {@link sphere3Load} for interleaved data: element `index` starts at
46
+ * `offset + index·stride`, both counted in numbers, and its 4 components follow
47
+ * one another. An index past the end gives `NaN` components. O(1).
48
+ */
49
+ export function sphere3LoadStrided(out, array, offset, stride, index) {
50
+ const base = offset + index * stride;
51
+ // The `!` is for the compiler: past the end `+undefined` is `NaN`.
52
+ out[0] = +array[base];
53
+ out[1] = +array[base + 1];
54
+ out[2] = +array[base + 2];
55
+ out[3] = +array[base + 3];
56
+ return out;
57
+ }
58
+ /**
59
+ * Like {@link sphere3Store} for interleaved data: element `index` starts at
60
+ * `offset + index·stride`, both counted in numbers. A component past the end of
61
+ * `array` writes nothing. O(1).
62
+ */
63
+ export function sphere3StoreStrided(array, offset, stride, index, value) {
64
+ const base = offset + index * stride;
65
+ array[base] = value[0];
66
+ array[base + 1] = value[1];
67
+ array[base + 2] = value[2];
68
+ array[base + 3] = value[3];
69
+ }
70
+ /**
71
+ * Narrows `value` to binary32 and writes its 4 components into `array` from
72
+ * element `offset` on, unrolled: the way to stage a bounds or instance value
73
+ * for the GPU, where `array.set` costs several times as much for one value. A
74
+ * component past the end of `array` writes nothing. O(1).
75
+ */
76
+ export function sphere3StoreFloat32(array, offset, value) {
77
+ array[offset] = value[0];
78
+ array[offset + 1] = value[1];
79
+ array[offset + 2] = value[2];
80
+ array[offset + 3] = value[3];
81
+ }
82
+ /**
83
+ * Whether every number of `array` is finite: the check for a buffer of sphere3
84
+ * elements read from untrusted data or about to be uploaded. The length is not
85
+ * required to be a multiple of 4. O(n).
86
+ */
87
+ export function sphere3ArrayIsFinite(array) {
88
+ // A loop, not `array.every(Number.isFinite)`: measured at 0.5–0.7 ms against
89
+ // 4.1 ms per million numbers on Node (the callback is not inlined), and the
90
+ // check runs on every upload of an untrusted buffer.
91
+ for (let index = 0; index < array.length; index++) {
92
+ if (!Number.isFinite(array[index])) {
93
+ return false;
94
+ }
95
+ }
96
+ return true;
97
+ }
98
+ //# sourceMappingURL=sphere3-array-boundary.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"sphere3-array-boundary.js","sourceRoot":"","sources":["../src/sphere3-array-boundary.ts"],"names":[],"mappings":"AAAA,sGAAsG;AAEtG,OAAO,EAAE,aAAa,EAAE,MAAM,cAAc,CAAC;AAI7C;;;;;;GAMG;AACH,MAAM,UAAU,kBAAkB,CAAC,KAAa;IAC/C,aAAa,CAAC,KAAK,EAAE,2BAA2B,EAAE,CAAC,CAAC,CAAC;IACrD,OAAO,IAAI,YAAY,CAAC,KAAK,GAAG,CAAC,CAAC,CAAC;AACpC,CAAC;AAED;;;;;;;;GAQG;AACH,MAAM,UAAU,WAAW,CAC1B,GAAY,EACZ,KAAmB,EACnB,KAAa;IAEb,MAAM,IAAI,GAAG,KAAK,GAAG,CAAC,CAAC;IACvB,mEAAmE;IACnE,GAAG,CAAC,CAAC,CAAC,GAAG,CAAC,KAAK,CAAC,IAAI,CAAE,CAAC;IACvB,GAAG,CAAC,CAAC,CAAC,GAAG,CAAC,KAAK,CAAC,IAAI,GAAG,CAAC,CAAE,CAAC;IAC3B,GAAG,CAAC,CAAC,CAAC,GAAG,CAAC,KAAK,CAAC,IAAI,GAAG,CAAC,CAAE,CAAC;IAC3B,GAAG,CAAC,CAAC,CAAC,GAAG,CAAC,KAAK,CAAC,IAAI,GAAG,CAAC,CAAE,CAAC;IAC3B,OAAO,GAAG,CAAC;A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C,IAAI,GAAG,CAAC,CAAC,GAAG,KAAK,CAAC,CAAC,CAAC,CAAC;IAC3B,KAAK,CAAC,IAAI,GAAG,CAAC,CAAC,GAAG,KAAK,CAAC,CAAC,CAAC,CAAC;IAC3B,KAAK,CAAC,IAAI,GAAG,CAAC,CAAC,GAAG,KAAK,CAAC,CAAC,CAAC,CAAC;AAC5B,CAAC;AAED;;;;;GAKG;AACH,MAAM,UAAU,mBAAmB,CAClC,KAAmB,EACnB,MAAc,EACd,KAAsB;IAEtB,KAAK,CAAC,MAAM,CAAC,GAAG,KAAK,CAAC,CAAC,CAAC,CAAC;IACzB,KAAK,CAAC,MAAM,GAAG,CAAC,CAAC,GAAG,KAAK,CAAC,CAAC,CAAC,CAAC;IAC7B,KAAK,CAAC,MAAM,GAAG,CAAC,CAAC,GAAG,KAAK,CAAC,CAAC,CAAC,CAAC;IAC7B,KAAK,CAAC,MAAM,GAAG,CAAC,CAAC,GAAG,KAAK,CAAC,CAAC,CAAC,CAAC;AAC9B,CAAC;AAED;;;;GAIG;AACH,MAAM,UAAU,oBAAoB,CAAC,KAAmB;IACvD,6EAA6E;IAC7E,4EAA4E;IAC5E,qDAAqD;IACrD,KAAK,IAAI,KAAK,GAAG,CAAC,EAAE,KAAK,GAAG,KAAK,CAAC,MAAM,EAAE,KAAK,EAAE,EAAE,CAAC;QACnD,IAAI,CAAC,MAAM,CAAC,QAAQ,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC,EAAE,CAAC;YACpC,OAAO,KAAK,CAAC;QACd,CAAC;IACF,CAAC;IACD,OAAO,IAAI,CAAC;AACb,CAAC"}
@@ -0,0 +1,88 @@
1
+ import type { Brand_ } from "./_brand.js";
2
+ /**
3
+ * A sphere (a ball, for the containment tests): its centre then its radius, the
4
+ * layout of a GPU `vec4` bounds entry. A negative radius makes the sphere
5
+ * empty.
6
+ *
7
+ * A plain array of 4 binary64 numbers carrying a type-level brand, holding
8
+ * exactly the numbers one element of the matching bulk buffer holds, in the
9
+ * same order.
10
+ *
11
+ * Only {@link sphere3Create}, {@link sphere3Of}, {@link sphere3Clone},
12
+ * {@link sphere3FromArray} and the functions that write an `out` make one; see
13
+ * `Vec3` in `@ac-kit/math-linear` for the rules that bind callers who bypass
14
+ * the types.
15
+ */
16
+ export type Sphere3 = [
17
+ centerX: number,
18
+ centerY: number,
19
+ centerZ: number,
20
+ radius: number
21
+ ] & Brand_<"Sphere3">;
22
+ /** A {@link Sphere3} that is only read. */
23
+ export type ReadonlySphere3 = readonly [
24
+ centerX: number,
25
+ centerY: number,
26
+ centerZ: number,
27
+ radius: number
28
+ ] & Brand_<"Sphere3">;
29
+ /**
30
+ * Creates the sphere of radius 0 at the origin.
31
+ *
32
+ * Allocates; keep it out of hot loops.
33
+ */
34
+ export declare function sphere3Create(): Sphere3;
35
+ /**
36
+ * Creates the sphere with the components `centerX, centerY, centerZ, radius`,
37
+ * in storage order.
38
+ *
39
+ * Allocates; keep it out of hot loops.
40
+ */
41
+ export declare function sphere3Of(centerX: number, centerY: number, centerZ: number, radius: number): Sphere3;
42
+ /**
43
+ * Creates a copy of `a`. Like every creator it starts from a clean array.
44
+ *
45
+ * Allocates; keep it out of hot loops.
46
+ */
47
+ export declare function sphere3Clone(a: ReadonlySphere3): Sphere3;
48
+ /** Writes the components, in storage order, into `out`. */
49
+ export declare function sphere3Set(out: Sphere3, centerX: number, centerY: number, centerZ: number, radius: number): Sphere3;
50
+ /** Writes a copy of `a` into `out`. `out` may be `a`. */
51
+ export declare function sphere3Copy(out: Sphere3, a: ReadonlySphere3): Sphere3;
52
+ /**
53
+ * Exact component-wise equality: `−0` equals `+0`, `NaN` equals nothing, itself
54
+ * included, and an infinity equals itself. See {@link sphere3IsClose} for a
55
+ * tolerant test.
56
+ */
57
+ export declare function sphere3Equals(a: ReadonlySphere3, b: ReadonlySphere3): boolean;
58
+ /**
59
+ * Component-wise approximate equality: every pair differs by at most
60
+ * `tolerance`, an absolute bound in the caller's units, and an infinity is
61
+ * close only to itself. Not transitive, so never a basis for ordering or a
62
+ * container key: use {@link sphere3Equals} there.
63
+ *
64
+ * @param tolerance Defaults to `geometryConfig.defaultLinearTolerance`.
65
+ */
66
+ export declare function sphere3IsClose(a: ReadonlySphere3, b: ReadonlySphere3, tolerance?: number): boolean;
67
+ /**
68
+ * The checked way in from untyped data (JSON, messages, arrays of unknown
69
+ * origin): `source[offset … offset + 4)` copied into `out`, each element that
70
+ * is not a number written as `NaN`, an index past the end of `source` too, so
71
+ * `out` never holds a non-number. A cold path: buffers use {@link sphere3Load}.
72
+ * O(1).
73
+ *
74
+ * `source` may be `out` itself: the 4 elements are read before the first write.
75
+ *
76
+ * @param out The sphere to fill.
77
+ * @param source The array to read, of any length and any content.
78
+ * @param offset The index of the first component in `source`.
79
+ * @returns `out`.
80
+ */
81
+ export declare function sphere3FromArray(out: Sphere3, source: ArrayLike<number>, offset?: number): Sphere3;
82
+ /**
83
+ * Whether every component is a finite number: the check to run after parsing
84
+ * untrusted data or before an upload, as operations never check. A component
85
+ * that is not a number at all counts as not finite.
86
+ */
87
+ export declare function sphere3IsFinite(value: ReadonlySphere3): boolean;
88
+ //# sourceMappingURL=sphere3-record.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"sphere3-record.d.ts","sourceRoot":"","sources":["../src/sphere3-record.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AAG1C;;;;;;;;;;;;;GAaG;AACH,MAAM,MAAM,OAAO,GAAG;IACrB,OAAO,EAAE,MAAM;IACf,OAAO,EAAE,MAAM;IACf,OAAO,EAAE,MAAM;IACf,MAAM,EAAE,MAAM;CACd,GACA,MAAM,CAAC,SAAS,CAAC,CAAC;AAEnB,2CAA2C;AAC3C,MAAM,MAAM,eAAe,GAAG,SAAS;IACtC,OAAO,EAAE,MAAM;IACf,OAAO,EAAE,MAAM;IACf,OAAO,EAAE,MAAM;IACf,MAAM,EAAE,MAAM;CACd,GACA,MAAM,CAAC,SAAS,CAAC,CAAC;AAQnB;;;;GAIG;AACH,wBAAgB,aAAa,IAAI,OAAO,CAOvC;AAED;;;;;GAKG;AACH,wBAAgB,SAAS,CACxB,OAAO,EAAE,MAAM,EACf,OAAO,EAAE,MAAM,EACf,OAAO,EAAE,MAAM,EACf,MAAM,EAAE,MAAM,GACZ,OAAO,CAOT;AAED;;;;GAIG;AACH,wBAAgB,YAAY,CAAC,CAAC,EAAE,eAAe,GAAG,OAAO,CAOxD;AAED,2DAA2D;AAC3D,wBAAgB,UAAU,CACzB,GAAG,EAAE,OAAO,EACZ,OAAO,EAAE,MAAM,EACf,OAAO,EAAE,MAAM,EACf,OAAO,EAAE,MAAM,EACf,MAAM,EAAE,MAAM,GACZ,OAAO,CAMT;AAED,yDAAyD;AACzD,wBAAgB,WAAW,CAAC,GAAG,EAAE,OAAO,EAAE,CAAC,EAAE,eAAe,GAAG,OAAO,CAMrE;AAED;;;;GAIG;AACH,wBAAgB,aAAa,CAAC,CAAC,EAAE,eAAe,EAAE,CAAC,EAAE,eAAe,GAAG,OAAO,CAE7E;AAED;;;;;;;GAOG;AACH,wBAAgB,cAAc,CAC7B,CAAC,EAAE,eAAe,EAClB,CAAC,EAAE,eAAe,EAClB,SAAS,GAAE,MAA8C,GACvD,OAAO,CAOT;AAED;;;;;;;;;;;;;GAaG;AACH,wBAAgB,gBAAgB,CAC/B,GAAG,EAAE,OAAO,EACZ,MAAM,EAAE,SAAS,CAAC,MAAM,CAAC,EACzB,MAAM,SAAI,GACR,OAAO,CAUT;AAED;;;;GAIG;AACH,wBAAgB,eAAe,CAAC,KAAK,EAAE,eAAe,GAAG,OAAO,CAO/D"}
@@ -0,0 +1,123 @@
1
+ // Generated from scripts/templates/record.liquid by scripts/generate-records.ts. Do not edit.
2
+ import { isCloseAbsolute, numberAtOrNaN } from "@ac-kit/core";
3
+ import { geometryConfig } from "./globals.js";
4
+ /**
5
+ * Every creator copies this array, which holds non-integer doubles and is never
6
+ * exposed: nothing a caller does can change the element kind it copies.
7
+ */
8
+ const TEMPLATE_ = [0.5, 0.5, 0.5, 0.5];
9
+ /**
10
+ * Creates the sphere of radius 0 at the origin.
11
+ *
12
+ * Allocates; keep it out of hot loops.
13
+ */
14
+ export function sphere3Create() {
15
+ const out = TEMPLATE_.slice();
16
+ out[0] = 0;
17
+ out[1] = 0;
18
+ out[2] = 0;
19
+ out[3] = 0;
20
+ return out;
21
+ }
22
+ /**
23
+ * Creates the sphere with the components `centerX, centerY, centerZ, radius`,
24
+ * in storage order.
25
+ *
26
+ * Allocates; keep it out of hot loops.
27
+ */
28
+ export function sphere3Of(centerX, centerY, centerZ, radius) {
29
+ const out = TEMPLATE_.slice();
30
+ out[0] = centerX;
31
+ out[1] = centerY;
32
+ out[2] = centerZ;
33
+ out[3] = radius;
34
+ return out;
35
+ }
36
+ /**
37
+ * Creates a copy of `a`. Like every creator it starts from a clean array.
38
+ *
39
+ * Allocates; keep it out of hot loops.
40
+ */
41
+ export function sphere3Clone(a) {
42
+ const out = TEMPLATE_.slice();
43
+ out[0] = a[0];
44
+ out[1] = a[1];
45
+ out[2] = a[2];
46
+ out[3] = a[3];
47
+ return out;
48
+ }
49
+ /** Writes the components, in storage order, into `out`. */
50
+ export function sphere3Set(out, centerX, centerY, centerZ, radius) {
51
+ out[0] = centerX;
52
+ out[1] = centerY;
53
+ out[2] = centerZ;
54
+ out[3] = radius;
55
+ return out;
56
+ }
57
+ /** Writes a copy of `a` into `out`. `out` may be `a`. */
58
+ export function sphere3Copy(out, a) {
59
+ out[0] = a[0];
60
+ out[1] = a[1];
61
+ out[2] = a[2];
62
+ out[3] = a[3];
63
+ return out;
64
+ }
65
+ /**
66
+ * Exact component-wise equality: `−0` equals `+0`, `NaN` equals nothing, itself
67
+ * included, and an infinity equals itself. See {@link sphere3IsClose} for a
68
+ * tolerant test.
69
+ */
70
+ export function sphere3Equals(a, b) {
71
+ return a[0] === b[0] && a[1] === b[1] && a[2] === b[2] && a[3] === b[3];
72
+ }
73
+ /**
74
+ * Component-wise approximate equality: every pair differs by at most
75
+ * `tolerance`, an absolute bound in the caller's units, and an infinity is
76
+ * close only to itself. Not transitive, so never a basis for ordering or a
77
+ * container key: use {@link sphere3Equals} there.
78
+ *
79
+ * @param tolerance Defaults to `geometryConfig.defaultLinearTolerance`.
80
+ */
81
+ export function sphere3IsClose(a, b, tolerance = geometryConfig.defaultLinearTolerance) {
82
+ return (isCloseAbsolute(a[0], b[0], tolerance) &&
83
+ isCloseAbsolute(a[1], b[1], tolerance) &&
84
+ isCloseAbsolute(a[2], b[2], tolerance) &&
85
+ isCloseAbsolute(a[3], b[3], tolerance));
86
+ }
87
+ /**
88
+ * The checked way in from untyped data (JSON, messages, arrays of unknown
89
+ * origin): `source[offset … offset + 4)` copied into `out`, each element that
90
+ * is not a number written as `NaN`, an index past the end of `source` too, so
91
+ * `out` never holds a non-number. A cold path: buffers use {@link sphere3Load}.
92
+ * O(1).
93
+ *
94
+ * `source` may be `out` itself: the 4 elements are read before the first write.
95
+ *
96
+ * @param out The sphere to fill.
97
+ * @param source The array to read, of any length and any content.
98
+ * @param offset The index of the first component in `source`.
99
+ * @returns `out`.
100
+ */
101
+ export function sphere3FromArray(out, source, offset = 0) {
102
+ const value0 = numberAtOrNaN(source, offset);
103
+ const value1 = numberAtOrNaN(source, offset + 1);
104
+ const value2 = numberAtOrNaN(source, offset + 2);
105
+ const value3 = numberAtOrNaN(source, offset + 3);
106
+ out[0] = value0;
107
+ out[1] = value1;
108
+ out[2] = value2;
109
+ out[3] = value3;
110
+ return out;
111
+ }
112
+ /**
113
+ * Whether every component is a finite number: the check to run after parsing
114
+ * untrusted data or before an upload, as operations never check. A component
115
+ * that is not a number at all counts as not finite.
116
+ */
117
+ export function sphere3IsFinite(value) {
118
+ return (Number.isFinite(value[0]) &&
119
+ Number.isFinite(value[1]) &&
120
+ Number.isFinite(value[2]) &&
121
+ Number.isFinite(value[3]));
122
+ }
123
+ //# sourceMappingURL=sphere3-record.js.map
@@ -0,0 +1 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CAAC,CAAC,CAAC,CAAC;QACzB,MAAM,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC;QACzB,MAAM,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CACzB,CAAC;AACH,CAAC"}
package/dist/sphere3.d.ts CHANGED
@@ -1,13 +1,56 @@
1
- import { Vec3 } from "@ac-kit/math-linear";
2
- export type Sphere3 = {
3
- center: Vec3;
4
- radius: number;
5
- };
6
- export declare function sphere3ContainsPoint(s: Sphere3, p: Vec3): boolean;
7
- /** Exact equality of centre and radius. */
8
- export declare function sphere3Equals(a: Sphere3, b: Sphere3): boolean;
9
- export declare function sphere3Intersects(a: Sphere3, b: Sphere3): boolean;
10
- export declare function sphere3SurfaceArea(s: Sphere3): number;
11
- export declare function sphere3Translate(s: Sphere3, v: Vec3): Sphere3;
12
- export declare function sphere3Volume(s: Sphere3): number;
1
+ import type { ReadonlyAffine3, ReadonlyVec3 } from "@ac-kit/math-linear";
2
+ import type { Box3, ReadonlyBox3 } from "./box3-record.js";
3
+ import type { ReadonlySphere3, Sphere3 } from "./sphere3-record.js";
4
+ /** The surface area, `4 π r²`; `0` for a negative radius (an empty sphere). */
5
+ export declare function sphere3SurfaceArea(sphere: ReadonlySphere3): number;
6
+ /** The volume, `4/3 π r³`; `0` for a negative radius. */
7
+ export declare function sphere3Volume(sphere: ReadonlySphere3): number;
8
+ /**
9
+ * Whether `point` lies in the ball, boundary included: exact, `|p − c|² ≤ r²`.
10
+ * A negative radius contains nothing.
11
+ */
12
+ export declare function sphere3ContainsPoint(sphere: ReadonlySphere3, point: ReadonlyVec3): boolean;
13
+ /**
14
+ * Whether the two balls share a point, boundaries included. A negative radius
15
+ * intersects nothing.
16
+ */
17
+ export declare function sphere3IntersectsSphere3(a: ReadonlySphere3, b: ReadonlySphere3): boolean;
18
+ /**
19
+ * Whether the ball and the box share a point, boundaries included. An empty box
20
+ * or a negative radius intersects nothing.
21
+ */
22
+ export declare function sphere3IntersectsBox3(sphere: ReadonlySphere3, box: ReadonlyBox3): boolean;
23
+ /** Writes `sphere` moved by `offset` into `out`. `out` may be `sphere`. */
24
+ export declare function sphere3Translate(out: Sphere3, sphere: ReadonlySphere3, offset: ReadonlyVec3): Sphere3;
25
+ /**
26
+ * Writes the sphere moved by `transform` into `out`: the centre transformed,
27
+ * the radius times an upper bound of the largest scale of the linear part `A`
28
+ * (its spectral norm). The bound is `√min(‖AᵀA‖∞, tr AᵀA)`: both the largest
29
+ * absolute row sum of the Gram matrix and its trace bound its largest
30
+ * eigenvalue, so the sphere holds the image of the original for any transform,
31
+ * shears included (the longest column alone does not). It is exact for a
32
+ * rotation with a uniform or an axis-aligned scale (up to rounding), and within
33
+ * a factor √3 of the best otherwise. `out` may be `sphere`.
34
+ */
35
+ export declare function sphere3TransformAffine3(out: Sphere3, sphere: ReadonlySphere3, transform: ReadonlyAffine3): Sphere3;
36
+ /**
37
+ * Writes an approximate bounding sphere of the points of `points` (three
38
+ * numbers each) into `out`, by Ritter's method: within about 5–20 % of the
39
+ * smallest enclosing sphere, never smaller than it, and every point inside. An
40
+ * empty buffer gives the empty sphere (centre at the origin, radius `−∞`). Two
41
+ * passes, O(n).
42
+ *
43
+ * @throws {RangeError} When `points.length` is not a multiple of 3.
44
+ */
45
+ export declare function sphere3FromPoints(out: Sphere3, points: Float64Array): Sphere3;
46
+ /**
47
+ * Writes the sphere through the corners of `box` into `out`; an empty box gives
48
+ * the empty sphere (radius `−∞`).
49
+ */
50
+ export declare function sphere3FromBox3(out: Sphere3, box: ReadonlyBox3): Sphere3;
51
+ /**
52
+ * Writes the smallest box holding the sphere into `out`; a negative radius
53
+ * gives an empty box.
54
+ */
55
+ export declare function sphere3BoundingBox(out: Box3, sphere: ReadonlySphere3): Box3;
13
56
  //# sourceMappingURL=sphere3.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"sphere3.d.ts","sourceRoot":"","sources":["../src/sphere3.ts"],"names":[],"mappings":"AAAA,OAAO,E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