@ac-kit/math-geometry 0.2.2 → 0.3.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 (371) hide show
  1. package/CHANGELOG.md +228 -0
  2. package/README.md +323 -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/_ray3-intersect.d.ts +19 -0
  12. package/dist/_ray3-intersect.d.ts.map +1 -0
  13. package/dist/_ray3-intersect.js +122 -0
  14. package/dist/_ray3-intersect.js.map +1 -0
  15. package/dist/box2-array-boundary.d.ts +50 -0
  16. package/dist/box2-array-boundary.d.ts.map +1 -0
  17. package/dist/box2-array-boundary.js +97 -0
  18. package/dist/box2-array-boundary.js.map +1 -0
  19. package/dist/box2-array.d.ts +42 -0
  20. package/dist/box2-array.d.ts.map +1 -0
  21. package/dist/box2-array.js +134 -0
  22. package/dist/box2-array.js.map +1 -0
  23. package/dist/box2-componentwise.d.ts +110 -0
  24. package/dist/box2-componentwise.d.ts.map +1 -0
  25. package/dist/box2-componentwise.js +325 -0
  26. package/dist/box2-componentwise.js.map +1 -0
  27. package/dist/box2-grid-index.d.ts +67 -0
  28. package/dist/box2-grid-index.d.ts.map +1 -0
  29. package/dist/box2-grid-index.js +198 -0
  30. package/dist/box2-grid-index.js.map +1 -0
  31. package/dist/box2-record.d.ts +83 -0
  32. package/dist/box2-record.d.ts.map +1 -0
  33. package/dist/box2-record.js +124 -0
  34. package/dist/box2-record.js.map +1 -0
  35. package/dist/box2.d.ts +38 -0
  36. package/dist/box2.d.ts.map +1 -0
  37. package/dist/box2.js +97 -0
  38. package/dist/box2.js.map +1 -0
  39. package/dist/box3-array-boundary.d.ts +50 -0
  40. package/dist/box3-array-boundary.d.ts.map +1 -0
  41. package/dist/box3-array-boundary.js +107 -0
  42. package/dist/box3-array-boundary.js.map +1 -0
  43. package/dist/box3-componentwise.d.ts +110 -0
  44. package/dist/box3-componentwise.d.ts.map +1 -0
  45. package/dist/box3-componentwise.js +392 -0
  46. package/dist/box3-componentwise.js.map +1 -0
  47. package/dist/box3-record.d.ts +92 -0
  48. package/dist/box3-record.d.ts.map +1 -0
  49. package/dist/box3-record.js +147 -0
  50. package/dist/box3-record.js.map +1 -0
  51. package/dist/box3.d.ts +19 -16
  52. package/dist/box3.d.ts.map +1 -1
  53. package/dist/box3.js +73 -76
  54. package/dist/box3.js.map +1 -1
  55. package/dist/box4-array-boundary.d.ts +50 -0
  56. package/dist/box4-array-boundary.d.ts.map +1 -0
  57. package/dist/box4-array-boundary.js +117 -0
  58. package/dist/box4-array-boundary.js.map +1 -0
  59. package/dist/box4-componentwise.d.ts +110 -0
  60. package/dist/box4-componentwise.d.ts.map +1 -0
  61. package/dist/box4-componentwise.js +459 -0
  62. package/dist/box4-componentwise.js.map +1 -0
  63. package/dist/box4-record.d.ts +96 -0
  64. package/dist/box4-record.d.ts.map +1 -0
  65. package/dist/box4-record.js +167 -0
  66. package/dist/box4-record.js.map +1 -0
  67. package/dist/box4.d.ts +13 -8
  68. package/dist/box4.d.ts.map +1 -1
  69. package/dist/box4.js +27 -5
  70. package/dist/box4.js.map +1 -1
  71. package/dist/circle2-array-boundary.d.ts +51 -0
  72. package/dist/circle2-array-boundary.d.ts.map +1 -0
  73. package/dist/circle2-array-boundary.js +93 -0
  74. package/dist/circle2-array-boundary.js.map +1 -0
  75. package/dist/circle2-array.d.ts +17 -0
  76. package/dist/circle2-array.d.ts.map +1 -0
  77. package/dist/circle2-array.js +44 -0
  78. package/dist/circle2-array.js.map +1 -0
  79. package/dist/circle2-record.d.ts +81 -0
  80. package/dist/circle2-record.d.ts.map +1 -0
  81. package/dist/circle2-record.js +114 -0
  82. package/dist/circle2-record.js.map +1 -0
  83. package/dist/circle2.d.ts +27 -82
  84. package/dist/circle2.d.ts.map +1 -1
  85. package/dist/circle2.js +59 -104
  86. package/dist/circle2.js.map +1 -1
  87. package/dist/coordinates/cylindrical-record.d.ts +86 -0
  88. package/dist/coordinates/cylindrical-record.d.ts.map +1 -0
  89. package/dist/coordinates/cylindrical-record.js +114 -0
  90. package/dist/coordinates/cylindrical-record.js.map +1 -0
  91. package/dist/coordinates/horizontal-record.d.ts +86 -0
  92. package/dist/coordinates/horizontal-record.d.ts.map +1 -0
  93. package/dist/coordinates/horizontal-record.js +114 -0
  94. package/dist/coordinates/horizontal-record.js.map +1 -0
  95. package/dist/coordinates/horizontal.d.ts +48 -0
  96. package/dist/coordinates/horizontal.d.ts.map +1 -0
  97. package/dist/coordinates/horizontal.js +100 -0
  98. package/dist/coordinates/horizontal.js.map +1 -0
  99. package/dist/coordinates/index.d.ts +10 -0
  100. package/dist/coordinates/index.d.ts.map +1 -0
  101. package/dist/coordinates/index.js +10 -0
  102. package/dist/coordinates/index.js.map +1 -0
  103. package/dist/coordinates/longitude-latitude-record.d.ts +81 -0
  104. package/dist/coordinates/longitude-latitude-record.d.ts.map +1 -0
  105. package/dist/coordinates/longitude-latitude-record.js +104 -0
  106. package/dist/coordinates/longitude-latitude-record.js.map +1 -0
  107. package/dist/coordinates/longitude-latitude.d.ts +33 -0
  108. package/dist/coordinates/longitude-latitude.d.ts.map +1 -0
  109. package/dist/coordinates/longitude-latitude.js +78 -0
  110. package/dist/coordinates/longitude-latitude.js.map +1 -0
  111. package/dist/coordinates/polar-record.d.ts +77 -0
  112. package/dist/coordinates/polar-record.d.ts.map +1 -0
  113. package/dist/coordinates/polar-record.js +104 -0
  114. package/dist/coordinates/polar-record.js.map +1 -0
  115. package/dist/coordinates/polar.d.ts +28 -0
  116. package/dist/coordinates/polar.d.ts.map +1 -0
  117. package/dist/coordinates/polar.js +68 -0
  118. package/dist/coordinates/polar.js.map +1 -0
  119. package/dist/coordinates/spherical-cylindrical.d.ts +49 -0
  120. package/dist/coordinates/spherical-cylindrical.d.ts.map +1 -0
  121. package/dist/coordinates/spherical-cylindrical.js +110 -0
  122. package/dist/coordinates/spherical-cylindrical.js.map +1 -0
  123. package/dist/coordinates/spherical-record.d.ts +86 -0
  124. package/dist/coordinates/spherical-record.d.ts.map +1 -0
  125. package/dist/coordinates/spherical-record.js +114 -0
  126. package/dist/coordinates/spherical-record.js.map +1 -0
  127. package/dist/frustum3-record.d.ts +132 -0
  128. package/dist/frustum3-record.d.ts.map +1 -0
  129. package/dist/frustum3-record.js +333 -0
  130. package/dist/frustum3-record.js.map +1 -0
  131. package/dist/frustum3.d.ts +60 -0
  132. package/dist/frustum3.d.ts.map +1 -0
  133. package/dist/frustum3.js +186 -0
  134. package/dist/frustum3.js.map +1 -0
  135. package/dist/index.d.ts +36 -16
  136. package/dist/index.d.ts.map +1 -1
  137. package/dist/index.js +36 -16
  138. package/dist/index.js.map +1 -1
  139. package/dist/line2-record.d.ts +87 -0
  140. package/dist/line2-record.d.ts.map +1 -0
  141. package/dist/line2-record.js +123 -0
  142. package/dist/line2-record.js.map +1 -0
  143. package/dist/line2.d.ts +20 -33
  144. package/dist/line2.d.ts.map +1 -1
  145. package/dist/line2.js +56 -51
  146. package/dist/line2.js.map +1 -1
  147. package/dist/line3-record.d.ts +91 -0
  148. package/dist/line3-record.d.ts.map +1 -0
  149. package/dist/line3-record.js +146 -0
  150. package/dist/line3-record.js.map +1 -0
  151. package/dist/line3.d.ts +11 -24
  152. package/dist/line3.d.ts.map +1 -1
  153. package/dist/line3.js +32 -36
  154. package/dist/line3.js.map +1 -1
  155. package/dist/mesh/_generator-kit.d.ts +14 -0
  156. package/dist/mesh/_generator-kit.d.ts.map +1 -0
  157. package/dist/mesh/_generator-kit.js +39 -0
  158. package/dist/mesh/_generator-kit.js.map +1 -0
  159. package/dist/mesh/_index-kernels-u16.d.ts +43 -0
  160. package/dist/mesh/_index-kernels-u16.d.ts.map +1 -0
  161. package/dist/mesh/_index-kernels-u16.js +264 -0
  162. package/dist/mesh/_index-kernels-u16.js.map +1 -0
  163. package/dist/mesh/_index-kernels-u32.d.ts +43 -0
  164. package/dist/mesh/_index-kernels-u32.d.ts.map +1 -0
  165. package/dist/mesh/_index-kernels-u32.js +264 -0
  166. package/dist/mesh/_index-kernels-u32.js.map +1 -0
  167. package/dist/mesh/generate-box.d.ts +16 -0
  168. package/dist/mesh/generate-box.d.ts.map +1 -0
  169. package/dist/mesh/generate-box.js +79 -0
  170. package/dist/mesh/generate-box.js.map +1 -0
  171. package/dist/mesh/generate-cylinder.d.ts +25 -0
  172. package/dist/mesh/generate-cylinder.d.ts.map +1 -0
  173. package/dist/mesh/generate-cylinder.js +117 -0
  174. package/dist/mesh/generate-cylinder.js.map +1 -0
  175. package/dist/mesh/generate-heightfield.d.ts +24 -0
  176. package/dist/mesh/generate-heightfield.d.ts.map +1 -0
  177. package/dist/mesh/generate-heightfield.js +48 -0
  178. package/dist/mesh/generate-heightfield.js.map +1 -0
  179. package/dist/mesh/generate-plane.d.ts +18 -0
  180. package/dist/mesh/generate-plane.d.ts.map +1 -0
  181. package/dist/mesh/generate-plane.js +39 -0
  182. package/dist/mesh/generate-plane.js.map +1 -0
  183. package/dist/mesh/generate-sphere.d.ts +50 -0
  184. package/dist/mesh/generate-sphere.d.ts.map +1 -0
  185. package/dist/mesh/generate-sphere.js +244 -0
  186. package/dist/mesh/generate-sphere.js.map +1 -0
  187. package/dist/mesh/index.d.ts +8 -0
  188. package/dist/mesh/index.d.ts.map +1 -0
  189. package/dist/mesh/index.js +8 -0
  190. package/dist/mesh/index.js.map +1 -0
  191. package/dist/mesh/mesh3-kernels.d.ts +82 -0
  192. package/dist/mesh/mesh3-kernels.d.ts.map +1 -0
  193. package/dist/mesh/mesh3-kernels.js +180 -0
  194. package/dist/mesh/mesh3-kernels.js.map +1 -0
  195. package/dist/mesh/mesh3.d.ts +66 -0
  196. package/dist/mesh/mesh3.d.ts.map +1 -0
  197. package/dist/mesh/mesh3.js +128 -0
  198. package/dist/mesh/mesh3.js.map +1 -0
  199. package/dist/plane3-record.d.ts +88 -0
  200. package/dist/plane3-record.d.ts.map +1 -0
  201. package/dist/plane3-record.js +123 -0
  202. package/dist/plane3-record.js.map +1 -0
  203. package/dist/plane3.d.ts +42 -28
  204. package/dist/plane3.d.ts.map +1 -1
  205. package/dist/plane3.js +166 -48
  206. package/dist/plane3.js.map +1 -1
  207. package/dist/polygon2.d.ts +82 -29
  208. package/dist/polygon2.d.ts.map +1 -1
  209. package/dist/polygon2.js +236 -93
  210. package/dist/polygon2.js.map +1 -1
  211. package/dist/polygon3.d.ts +40 -21
  212. package/dist/polygon3.d.ts.map +1 -1
  213. package/dist/polygon3.js +215 -91
  214. package/dist/polygon3.js.map +1 -1
  215. package/dist/polyline2.d.ts +37 -0
  216. package/dist/polyline2.d.ts.map +1 -0
  217. package/dist/polyline2.js +146 -0
  218. package/dist/polyline2.js.map +1 -0
  219. package/dist/polyline3.d.ts +35 -0
  220. package/dist/polyline3.d.ts.map +1 -0
  221. package/dist/polyline3.js +159 -0
  222. package/dist/polyline3.js.map +1 -0
  223. package/dist/quadtree.d.ts +238 -0
  224. package/dist/quadtree.d.ts.map +1 -0
  225. package/dist/quadtree.js +1019 -0
  226. package/dist/quadtree.js.map +1 -0
  227. package/dist/ray2-record.d.ts +86 -0
  228. package/dist/ray2-record.d.ts.map +1 -0
  229. package/dist/ray2-record.js +123 -0
  230. package/dist/ray2-record.js.map +1 -0
  231. package/dist/ray2.d.ts +38 -13
  232. package/dist/ray2.d.ts.map +1 -1
  233. package/dist/ray2.js +85 -22
  234. package/dist/ray2.js.map +1 -1
  235. package/dist/ray3-array.d.ts +27 -0
  236. package/dist/ray3-array.d.ts.map +1 -0
  237. package/dist/ray3-array.js +89 -0
  238. package/dist/ray3-array.js.map +1 -0
  239. package/dist/ray3-record.d.ts +90 -0
  240. package/dist/ray3-record.d.ts.map +1 -0
  241. package/dist/ray3-record.js +146 -0
  242. package/dist/ray3-record.js.map +1 -0
  243. package/dist/ray3.d.ts +72 -25
  244. package/dist/ray3.d.ts.map +1 -1
  245. package/dist/ray3.js +233 -64
  246. package/dist/ray3.js.map +1 -1
  247. package/dist/segment2-record.d.ts +80 -0
  248. package/dist/segment2-record.d.ts.map +1 -0
  249. package/dist/segment2-record.js +122 -0
  250. package/dist/segment2-record.js.map +1 -0
  251. package/dist/segment2.d.ts +34 -19
  252. package/dist/segment2.d.ts.map +1 -1
  253. package/dist/segment2.js +88 -42
  254. package/dist/segment2.js.map +1 -1
  255. package/dist/segment3-record.d.ts +90 -0
  256. package/dist/segment3-record.d.ts.map +1 -0
  257. package/dist/segment3-record.js +146 -0
  258. package/dist/segment3-record.js.map +1 -0
  259. package/dist/segment3.d.ts +24 -12
  260. package/dist/segment3.d.ts.map +1 -1
  261. package/dist/segment3.js +67 -30
  262. package/dist/segment3.js.map +1 -1
  263. package/dist/size.d.ts +40 -0
  264. package/dist/size.d.ts.map +1 -0
  265. package/dist/size.js +72 -0
  266. package/dist/size.js.map +1 -0
  267. package/dist/sphere3-array-boundary.d.ts +51 -0
  268. package/dist/sphere3-array-boundary.d.ts.map +1 -0
  269. package/dist/sphere3-array-boundary.js +98 -0
  270. package/dist/sphere3-array-boundary.js.map +1 -0
  271. package/dist/sphere3-record.d.ts +88 -0
  272. package/dist/sphere3-record.d.ts.map +1 -0
  273. package/dist/sphere3-record.js +123 -0
  274. package/dist/sphere3-record.js.map +1 -0
  275. package/dist/sphere3.d.ts +55 -12
  276. package/dist/sphere3.d.ts.map +1 -1
  277. package/dist/sphere3.js +233 -24
  278. package/dist/sphere3.js.map +1 -1
  279. package/dist/spherical/cap.d.ts +56 -0
  280. package/dist/spherical/cap.d.ts.map +1 -0
  281. package/dist/spherical/cap.js +363 -0
  282. package/dist/spherical/cap.js.map +1 -0
  283. package/dist/spherical/great-circle.d.ts +39 -0
  284. package/dist/spherical/great-circle.d.ts.map +1 -0
  285. package/dist/spherical/great-circle.js +158 -0
  286. package/dist/spherical/great-circle.js.map +1 -0
  287. package/dist/spherical/index.d.ts +3 -0
  288. package/dist/spherical/index.d.ts.map +1 -0
  289. package/dist/spherical/index.js +3 -0
  290. package/dist/spherical/index.js.map +1 -0
  291. package/dist/triangle2-record.d.ts +91 -0
  292. package/dist/triangle2-record.d.ts.map +1 -0
  293. package/dist/triangle2-record.js +146 -0
  294. package/dist/triangle2-record.js.map +1 -0
  295. package/dist/triangle2.d.ts +29 -14
  296. package/dist/triangle2.d.ts.map +1 -1
  297. package/dist/triangle2.js +86 -22
  298. package/dist/triangle2.js.map +1 -1
  299. package/dist/triangle3-record.d.ts +97 -0
  300. package/dist/triangle3-record.d.ts.map +1 -0
  301. package/dist/triangle3-record.js +178 -0
  302. package/dist/triangle3-record.js.map +1 -0
  303. package/dist/triangle3.d.ts +41 -17
  304. package/dist/triangle3.d.ts.map +1 -1
  305. package/dist/triangle3.js +267 -38
  306. package/dist/triangle3.js.map +1 -1
  307. package/package.json +15 -8
  308. package/dist/angles.d.ts +0 -31
  309. package/dist/angles.d.ts.map +0 -1
  310. package/dist/angles.js +0 -53
  311. package/dist/angles.js.map +0 -1
  312. package/dist/coordinate-spaces.d.ts +0 -39
  313. package/dist/coordinate-spaces.d.ts.map +0 -1
  314. package/dist/coordinate-spaces.js +0 -52
  315. package/dist/coordinate-spaces.js.map +0 -1
  316. package/dist/coordinates-vec2.d.ts +0 -7
  317. package/dist/coordinates-vec2.d.ts.map +0 -1
  318. package/dist/coordinates-vec2.js +0 -35
  319. package/dist/coordinates-vec2.js.map +0 -1
  320. package/dist/coordinates-vec3.d.ts +0 -11
  321. package/dist/coordinates-vec3.d.ts.map +0 -1
  322. package/dist/coordinates-vec3.js +0 -61
  323. package/dist/coordinates-vec3.js.map +0 -1
  324. package/dist/coordinates.d.ts +0 -54
  325. package/dist/coordinates.d.ts.map +0 -1
  326. package/dist/coordinates.js +0 -2
  327. package/dist/coordinates.js.map +0 -1
  328. package/dist/euler-angles-quaternion.d.ts +0 -7
  329. package/dist/euler-angles-quaternion.d.ts.map +0 -1
  330. package/dist/euler-angles-quaternion.js +0 -100
  331. package/dist/euler-angles-quaternion.js.map +0 -1
  332. package/dist/euler-angles.d.ts +0 -33
  333. package/dist/euler-angles.d.ts.map +0 -1
  334. package/dist/euler-angles.js +0 -35
  335. package/dist/euler-angles.js.map +0 -1
  336. package/dist/geometry-vectors.d.ts +0 -11
  337. package/dist/geometry-vectors.d.ts.map +0 -1
  338. package/dist/geometry-vectors.js +0 -19
  339. package/dist/geometry-vectors.js.map +0 -1
  340. package/dist/mesh3.d.ts +0 -32
  341. package/dist/mesh3.d.ts.map +0 -1
  342. package/dist/mesh3.js +0 -142
  343. package/dist/mesh3.js.map +0 -1
  344. package/dist/point2.d.ts +0 -41
  345. package/dist/point2.d.ts.map +0 -1
  346. package/dist/point2.js +0 -92
  347. package/dist/point2.js.map +0 -1
  348. package/dist/point3.d.ts +0 -43
  349. package/dist/point3.d.ts.map +0 -1
  350. package/dist/point3.js +0 -103
  351. package/dist/point3.js.map +0 -1
  352. package/dist/point4.d.ts +0 -12
  353. package/dist/point4.d.ts.map +0 -1
  354. package/dist/point4.js +0 -28
  355. package/dist/point4.js.map +0 -1
  356. package/dist/rect2.d.ts +0 -54
  357. package/dist/rect2.d.ts.map +0 -1
  358. package/dist/rect2.js +0 -149
  359. package/dist/rect2.js.map +0 -1
  360. package/dist/size2.d.ts +0 -33
  361. package/dist/size2.d.ts.map +0 -1
  362. package/dist/size2.js +0 -81
  363. package/dist/size2.js.map +0 -1
  364. package/dist/size3.d.ts +0 -21
  365. package/dist/size3.d.ts.map +0 -1
  366. package/dist/size3.js +0 -59
  367. package/dist/size3.js.map +0 -1
  368. package/dist/size4.d.ts +0 -10
  369. package/dist/size4.d.ts.map +0 -1
  370. package/dist/size4.js +0 -16
  371. package/dist/size4.js.map +0 -1
package/dist/box3.d.ts CHANGED
@@ -1,17 +1,20 @@
1
- import { Vec3 } from "@ac-kit/math-linear";
2
- import { Point3 } from "./point3.js";
3
- import { Size3 } from "./size3.js";
4
- export type Box3 = {
5
- origin: Point3;
6
- size: Size3;
7
- };
8
- export declare function box3Center(b: Box3): Point3;
9
- export declare function box3Contains(container: Box3, contained: Box3): boolean;
10
- export declare function box3ContainsPoint(b: Box3, p: Point3): boolean;
11
- export declare function box3Equals(a: Box3, b: Box3): boolean;
12
- export declare function box3Intersects(a: Box3, b: Box3): boolean;
13
- export declare function box3Intersection(a: Box3, b: Box3): Box3 | null;
14
- export declare function box3Translate(b: Box3, offset: Vec3): Box3;
15
- export declare function box3Union(a: Box3, b: Box3): Box3;
16
- export declare function box3Volume(b: Box3): number;
1
+ import type { ReadonlyAffine3, Vec3 } from "@ac-kit/math-linear";
2
+ import type { Box3, ReadonlyBox3 } from "./box3-record.js";
3
+ /** The volume, `0` for an empty box. */
4
+ export declare function box3Volume(box: ReadonlyBox3): number;
5
+ /** The area of the six faces, `0` for an empty box. */
6
+ export declare function box3SurfaceArea(box: ReadonlyBox3): number;
7
+ /**
8
+ * Writes corner `index`, `0` to `7`, into `out`: bit 0 selects the x maximum,
9
+ * bit 1 the y maximum and bit 2 the z maximum, so `0` is the minimum corner and
10
+ * `7` the maximum one. Other bits are ignored.
11
+ */
12
+ export declare function box3Corner(out: Vec3, box: ReadonlyBox3, index: number): Vec3;
13
+ /**
14
+ * Writes the bounds of the box moved by `transform` into `out`: exact for the
15
+ * translations, scales and quarter turns, the enclosing box for any other
16
+ * rotation or shear (Arvo's method). An empty box gives an empty box. `out` may
17
+ * be `box`.
18
+ */
19
+ export declare function box3TransformAffine3(out: Box3, box: ReadonlyBox3, transform: ReadonlyAffine3): Box3;
17
20
  //# sourceMappingURL=box3.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"box3.d.ts","sourceRoot":"","sources":["../src/box3.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,qBAAqB,CAAC;AAE3C,OAAO,EAAE,MAAM,EAAgB,MAAM,aAAa,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GAAG,EAAE,YAAY,GAAG,MAAM,CAOzD;AAED;;;;GAIG;AACH,wBAAgB,UAAU,CAAC,GAAG,EAAE,IAAI,EAAE,GAAG,EAAE,YAAY,EAAE,KAAK,EAAE,MAAM,GAAG,IAAI,CAK5E;AAED;;;;;GAKG;AACH,wBAAgB,oBAAoB,CACnC,GAAG,EAAE,IAAI,EACT,GAAG,EAAE,YAAY,EACjB,SAAS,EAAE,eAAe,GACxB,IAAI,CA2CN"}
package/dist/box3.js CHANGED
@@ -1,82 +1,79 @@
1
- import { point3Equals } from "./point3.js";
2
- import { size3Equals, size3Volume } from "./size3.js";
3
- export function box3Center(b) {
4
- return {
5
- x: b.origin.x + b.size.width / 2,
6
- y: b.origin.y + b.size.height / 2,
7
- z: b.origin.z + b.size.depth / 2,
8
- };
1
+ import { box3Empty } from "./box3-componentwise.js";
2
+ /** The volume, `0` for an empty box. */
3
+ export function box3Volume(box) {
4
+ const width = box[3] - box[0];
5
+ const height = box[4] - box[1];
6
+ const depth = box[5] - box[2];
7
+ return width < 0 || height < 0 || depth < 0 ? 0 : width * height * depth;
9
8
  }
10
- export function box3Contains(container, contained) {
11
- return (contained.origin.x >= container.origin.x &&
12
- contained.origin.x + contained.size.width <=
13
- container.origin.x + container.size.width &&
14
- contained.origin.y >= container.origin.y &&
15
- contained.origin.y + contained.size.height <=
16
- container.origin.y + container.size.height &&
17
- contained.origin.z >= container.origin.z &&
18
- contained.origin.z + contained.size.depth <=
19
- container.origin.z + container.size.depth);
9
+ /** The area of the six faces, `0` for an empty box. */
10
+ export function box3SurfaceArea(box) {
11
+ const width = box[3] - box[0];
12
+ const height = box[4] - box[1];
13
+ const depth = box[5] - box[2];
14
+ return width < 0 || height < 0 || depth < 0
15
+ ? 0
16
+ : 2 * (width * height + height * depth + depth * width);
20
17
  }
21
- export function box3ContainsPoint(b, p) {
22
- return (p.x >= b.origin.x &&
23
- p.x <= b.origin.x + b.size.width &&
24
- p.y >= b.origin.y &&
25
- p.y <= b.origin.y + b.size.height &&
26
- p.z >= b.origin.z &&
27
- p.z <= b.origin.z + b.size.depth);
18
+ /**
19
+ * Writes corner `index`, `0` to `7`, into `out`: bit 0 selects the x maximum,
20
+ * bit 1 the y maximum and bit 2 the z maximum, so `0` is the minimum corner and
21
+ * `7` the maximum one. Other bits are ignored.
22
+ */
23
+ export function box3Corner(out, box, index) {
24
+ out[0] = (index & 1) === 0 ? box[0] : box[3];
25
+ out[1] = (index & 2) === 0 ? box[1] : box[4];
26
+ out[2] = (index & 4) === 0 ? box[2] : box[5];
27
+ return out;
28
28
  }
29
- export function box3Equals(a, b) {
30
- return point3Equals(a.origin, b.origin) && size3Equals(a.size, b.size);
31
- }
32
- export function box3Intersects(a, b) {
33
- return !(a.origin.x + a.size.width < b.origin.x ||
34
- b.origin.x + b.size.width < a.origin.x ||
35
- a.origin.y + a.size.height < b.origin.y ||
36
- b.origin.y + b.size.height < a.origin.y ||
37
- a.origin.z + a.size.depth < b.origin.z ||
38
- b.origin.z + b.size.depth < a.origin.z);
39
- }
40
- export function box3Intersection(a, b) {
41
- if (!box3Intersects(a, b)) {
42
- return null;
29
+ /**
30
+ * Writes the bounds of the box moved by `transform` into `out`: exact for the
31
+ * translations, scales and quarter turns, the enclosing box for any other
32
+ * rotation or shear (Arvo's method). An empty box gives an empty box. `out` may
33
+ * be `box`.
34
+ */
35
+ export function box3TransformAffine3(out, box, transform) {
36
+ const minX = box[0];
37
+ const minY = box[1];
38
+ const minZ = box[2];
39
+ const maxX = box[3];
40
+ const maxY = box[4];
41
+ const maxZ = box[5];
42
+ if (minX > maxX || minY > maxY || minZ > maxZ) {
43
+ return box3Empty(out);
43
44
  }
44
- const ox = Math.max(a.origin.x, b.origin.x);
45
- const oy = Math.max(a.origin.y, b.origin.y);
46
- const oz = Math.max(a.origin.z, b.origin.z);
47
- return {
48
- origin: { x: ox, y: oy, z: oz },
49
- size: {
50
- width: Math.min(a.origin.x + a.size.width, b.origin.x + b.size.width) - ox,
51
- height: Math.min(a.origin.y + a.size.height, b.origin.y + b.size.height) - oy,
52
- depth: Math.min(a.origin.z + a.size.depth, b.origin.z + b.size.depth) - oz,
53
- },
54
- };
55
- }
56
- export function box3Translate(b, offset) {
57
- return {
58
- origin: {
59
- x: b.origin.x + offset[0],
60
- y: b.origin.y + offset[1],
61
- z: b.origin.z + offset[2],
62
- },
63
- size: b.size,
64
- };
65
- }
66
- export function box3Union(a, b) {
67
- const ox = Math.min(a.origin.x, b.origin.x);
68
- const oy = Math.min(a.origin.y, b.origin.y);
69
- const oz = Math.min(a.origin.z, b.origin.z);
70
- return {
71
- origin: { x: ox, y: oy, z: oz },
72
- size: {
73
- width: Math.max(a.origin.x + a.size.width, b.origin.x + b.size.width) - ox,
74
- height: Math.max(a.origin.y + a.size.height, b.origin.y + b.size.height) - oy,
75
- depth: Math.max(a.origin.z + a.size.depth, b.origin.z + b.size.depth) - oz,
76
- },
77
- };
78
- }
79
- export function box3Volume(b) {
80
- return size3Volume(b.size);
45
+ // Column j of the transform scales axis j: entry (row i, column j) is
46
+ // transform[3 * j + i].
47
+ const x0 = transform[0] * minX;
48
+ const x1 = transform[0] * maxX;
49
+ const x2 = transform[3] * minY;
50
+ const x3 = transform[3] * maxY;
51
+ const x4 = transform[6] * minZ;
52
+ const x5 = transform[6] * maxZ;
53
+ const y0 = transform[1] * minX;
54
+ const y1 = transform[1] * maxX;
55
+ const y2 = transform[4] * minY;
56
+ const y3 = transform[4] * maxY;
57
+ const y4 = transform[7] * minZ;
58
+ const y5 = transform[7] * maxZ;
59
+ const z0 = transform[2] * minX;
60
+ const z1 = transform[2] * maxX;
61
+ const z2 = transform[5] * minY;
62
+ const z3 = transform[5] * maxY;
63
+ const z4 = transform[8] * minZ;
64
+ const z5 = transform[8] * maxZ;
65
+ out[0] =
66
+ transform[9] + Math.min(x0, x1) + Math.min(x2, x3) + Math.min(x4, x5);
67
+ out[1] =
68
+ transform[10] + Math.min(y0, y1) + Math.min(y2, y3) + Math.min(y4, y5);
69
+ out[2] =
70
+ transform[11] + Math.min(z0, z1) + Math.min(z2, z3) + Math.min(z4, z5);
71
+ out[3] =
72
+ transform[9] + Math.max(x0, x1) + Math.max(x2, x3) + Math.max(x4, x5);
73
+ out[4] =
74
+ transform[10] + Math.max(y0, y1) + Math.max(y2, y3) + Math.max(y4, y5);
75
+ out[5] =
76
+ transform[11] + Math.max(z0, z1) + Math.max(z2, z3) + Math.max(z4, z5);
77
+ return out;
81
78
  }
82
79
  //# sourceMappingURL=box3.js.map
package/dist/box3.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"box3.js","sourceRoot":"","sources":["../src/box3.ts"],"names":[],"mappings":"AAEA,OAAO,EAAU,YAAY,EAAE,MAAM,aAAa,CAAC;AACnD,OAAO,EAAS,WAAW,EAAE,WAAW,EAAE,MAAM,YAAY,CAAC;AAO7D,MAAM,UAAU,UAAU,CAAC,CAAO;IACjC,OAAO;QACN,CAAC,EAAE,CAAC,CAAC,MAAM,CAAC,CAAC,GAAG,CAAC,CAAC,IAAI,CAAC,KAAK,GAAG,CAAC;QAChC,CAAC,EAAE,CAAC,CAAC,MAAM,CAAC,CAAC,GAAG,CAAC,CAAC,IAAI,CAAC,MAAM,GAAG,CAAC;QACjC,CAAC,EAAE,CAAC,CAAC,MAAM,CAAC,CAAC,GAAG,CAAC,CAAC,IAAI,CAAC,KAAK,GAAG,CAAC;KAChC,CAAC;AACH,CAAC;AAED,MAAM,UAAU,YAAY,CAAC,SAAe,EAAE,SAAe;IAC5D,OAAO,CACN,SAAS,CAAC,MAAM,CAAC,CAAC,IAAI,SAAS,CAAC,MAAM,CAAC,CAAC;QACxC,SAAS,CAAC,MAAM,CAAC,CAAC,GAAG,SAAS,CAAC,IAAI,CAAC,KAAK;YACxC,SAAS,CAAC,MAAM,CAAC,CAAC,GAAG,SAAS,CAAC,IAAI,CAAC,KAAK;QAC1C,SAAS,CAAC,MAAM,CAAC,CAAC,IAAI,SAAS,CAAC,MAAM,CAAC,CAAC;QACxC,SAAS,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count ×
4
+ * 8` numbers, element `i` at `[i·8, i·8 + 8)`. Allocates.
5
+ *
6
+ * @throws {RangeError} When `count` is not a non-negative safe integer or
7
+ * `count × 8` is not a valid typed array length.
8
+ */
9
+ export declare function box4ArrayCreate(count: number): Float64Array<ArrayBuffer>;
10
+ /**
11
+ * Writes element `index` of `array`, the numbers at `[index·8, index·8 + 8)`,
12
+ * into `out`. Each component is written as `+array[i]`, so an index past the
13
+ * end of `array` gives `NaN`, never `undefined`: the box stays clean whatever
14
+ * the caller does. Checking the index is the job of the checked layer.
15
+ *
16
+ * The box is copied: it is never a view of `array`. O(1).
17
+ */
18
+ export declare function box4Load(out: Box4, array: Float64Array, index: number): Box4;
19
+ /**
20
+ * Writes `value` into `array` as element `index`, at `[index·8, index·8 + 8)`.
21
+ * An element past the end of `array` writes nothing, as a typed array drops an
22
+ * out-of-range write. O(1).
23
+ */
24
+ export declare function box4Store(array: Float64Array, index: number, value: ReadonlyBox4): void;
25
+ /**
26
+ * Like {@link box4Load} for interleaved data: element `index` starts at `offset +
27
+ * index·stride`, both counted in numbers, and its 8 components follow one
28
+ * another. An index past the end gives `NaN` components. O(1).
29
+ */
30
+ export declare function box4LoadStrided(out: Box4, array: Float64Array, offset: number, stride: number, index: number): Box4;
31
+ /**
32
+ * Like {@link box4Store} for interleaved data: element `index` starts at `offset +
33
+ * index·stride`, both counted in numbers. A component past the end of `array`
34
+ * writes nothing. O(1).
35
+ */
36
+ export declare function box4StoreStrided(array: Float64Array, offset: number, stride: number, index: number, value: ReadonlyBox4): void;
37
+ /**
38
+ * Narrows `value` to binary32 and writes its 8 components into `array` from
39
+ * element `offset` on, unrolled: the way to stage a bounds or instance value
40
+ * for the GPU, where `array.set` costs several times as much for one value. A
41
+ * component past the end of `array` writes nothing. O(1).
42
+ */
43
+ export declare function box4StoreFloat32(array: Float32Array, offset: number, value: ReadonlyBox4): void;
44
+ /**
45
+ * Whether every number of `array` is finite: the check for a buffer of box4
46
+ * elements read from untrusted data or about to be uploaded. The length is not
47
+ * required to be a multiple of 8. O(n).
48
+ */
49
+ export declare function box4ArrayIsFinite(array: Float64Array): boolean;
50
+ //# sourceMappingURL=box4-array-boundary.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"box4-array-boundary.d.ts","sourceRoot":"","sources":["../src/box4-array-boundary.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,YAAY,EAAE,IAAI,EAAE,MAAM,kBAAkB,CAAC;AAE3D;;;;;;GAMG;AACH,wBAAgB,eAAe,CAAC,KAAK,EAAE,MAAM,GAAG,YAAY,CAAC,WAAW,CAAC,CAGxE;AAED;;;;;;;GAOG;AACH,wBAAgB,QAAQ,CAAC,GAAG,EAAE,IAAI,EAAE,KAAK,EAAE,YAAY,EAAE,KAAK,EAAE,MAAM,GAAG,IAAI,CAY5E;AAED;;;;GAIG;AACH,wBAAgB,SAAS,CACxB,KAAK,EAAE,YAAY,EACnB,KAAK,EAAE,MAAM,EACb,KAAK,EAAE,YAAY,GACjB,IAAI,CAUN;AAED;;;;GAIG;AACH,wBAAgB,eAAe,CAC9B,GAAG,EAAE,IAAI,EACT,KAAK,EAAE,YAAY,EACnB,MAAM,EAAE,MAAM,EACd,MAAM,EAAE,MAAM,EACd,KAAK,EAAE,MAAM,GACX,IAAI,CAYN;AAED;;;;GAIG;AACH,wBAAgB,gBAAgB,CAC/B,KAAK,EAAE,YAAY,EACnB,MAAM,EAAE,MAAM,EACd,MAAM,EAAE,MAAM,EACd,KAAK,EAAE,MAAM,EACb,KAAK,EAAE,YAAY,GACjB,IAAI,CAUN;AAED;;;;;GAKG;AACH,wBAAgB,gBAAgB,CAC/B,KAAK,EAAE,YAAY,EACnB,MAAM,EAAE,MAAM,EACd,KAAK,EAAE,YAAY,GACjB,IAAI,CASN;AAED;;;;GAIG;AACH,wBAAgB,iBAAiB,CAAC,KAAK,EAAE,YAAY,GAAG,OAAO,CAU9D"}
@@ -0,0 +1,117 @@
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` boxes: a zero-filled `Float64Array` of `count ×
5
+ * 8` numbers, element `i` at `[i·8, i·8 + 8)`. Allocates.
6
+ *
7
+ * @throws {RangeError} When `count` is not a non-negative safe integer or
8
+ * `count × 8` is not a valid typed array length.
9
+ */
10
+ export function box4ArrayCreate(count) {
11
+ assertInteger(count, "box4ArrayCreate: count", 0);
12
+ return new Float64Array(count * 8);
13
+ }
14
+ /**
15
+ * Writes element `index` of `array`, the numbers at `[index·8, index·8 + 8)`,
16
+ * into `out`. Each component is written as `+array[i]`, so an index past the
17
+ * end of `array` gives `NaN`, never `undefined`: the box stays clean whatever
18
+ * the caller does. Checking the index is the job of the checked layer.
19
+ *
20
+ * The box is copied: it is never a view of `array`. O(1).
21
+ */
22
+ export function box4Load(out, array, index) {
23
+ const base = index * 8;
24
+ // The `!` is for the compiler: past the end `+undefined` is `NaN`.
25
+ out[0] = +array[base];
26
+ out[1] = +array[base + 1];
27
+ out[2] = +array[base + 2];
28
+ out[3] = +array[base + 3];
29
+ out[4] = +array[base + 4];
30
+ out[5] = +array[base + 5];
31
+ out[6] = +array[base + 6];
32
+ out[7] = +array[base + 7];
33
+ return out;
34
+ }
35
+ /**
36
+ * Writes `value` into `array` as element `index`, at `[index·8, index·8 + 8)`.
37
+ * An element past the end of `array` writes nothing, as a typed array drops an
38
+ * out-of-range write. O(1).
39
+ */
40
+ export function box4Store(array, index, value) {
41
+ const base = index * 8;
42
+ array[base] = value[0];
43
+ array[base + 1] = value[1];
44
+ array[base + 2] = value[2];
45
+ array[base + 3] = value[3];
46
+ array[base + 4] = value[4];
47
+ array[base + 5] = value[5];
48
+ array[base + 6] = value[6];
49
+ array[base + 7] = value[7];
50
+ }
51
+ /**
52
+ * Like {@link box4Load} for interleaved data: element `index` starts at `offset +
53
+ * index·stride`, both counted in numbers, and its 8 components follow one
54
+ * another. An index past the end gives `NaN` components. O(1).
55
+ */
56
+ export function box4LoadStrided(out, array, offset, stride, index) {
57
+ const base = offset + index * stride;
58
+ // The `!` is for the compiler: past the end `+undefined` is `NaN`.
59
+ out[0] = +array[base];
60
+ out[1] = +array[base + 1];
61
+ out[2] = +array[base + 2];
62
+ out[3] = +array[base + 3];
63
+ out[4] = +array[base + 4];
64
+ out[5] = +array[base + 5];
65
+ out[6] = +array[base + 6];
66
+ out[7] = +array[base + 7];
67
+ return out;
68
+ }
69
+ /**
70
+ * Like {@link box4Store} for interleaved data: element `index` starts at `offset +
71
+ * index·stride`, both counted in numbers. A component past the end of `array`
72
+ * writes nothing. O(1).
73
+ */
74
+ export function box4StoreStrided(array, offset, stride, index, value) {
75
+ const base = offset + index * stride;
76
+ array[base] = value[0];
77
+ array[base + 1] = value[1];
78
+ array[base + 2] = value[2];
79
+ array[base + 3] = value[3];
80
+ array[base + 4] = value[4];
81
+ array[base + 5] = value[5];
82
+ array[base + 6] = value[6];
83
+ array[base + 7] = value[7];
84
+ }
85
+ /**
86
+ * Narrows `value` to binary32 and writes its 8 components into `array` from
87
+ * element `offset` on, unrolled: the way to stage a bounds or instance value
88
+ * for the GPU, where `array.set` costs several times as much for one value. A
89
+ * component past the end of `array` writes nothing. O(1).
90
+ */
91
+ export function box4StoreFloat32(array, offset, value) {
92
+ array[offset] = value[0];
93
+ array[offset + 1] = value[1];
94
+ array[offset + 2] = value[2];
95
+ array[offset + 3] = value[3];
96
+ array[offset + 4] = value[4];
97
+ array[offset + 5] = value[5];
98
+ array[offset + 6] = value[6];
99
+ array[offset + 7] = value[7];
100
+ }
101
+ /**
102
+ * Whether every number of `array` is finite: the check for a buffer of box4
103
+ * elements read from untrusted data or about to be uploaded. The length is not
104
+ * required to be a multiple of 8. O(n).
105
+ */
106
+ export function box4ArrayIsFinite(array) {
107
+ // A loop, not `array.every(Number.isFinite)`: measured at 0.5–0.7 ms against
108
+ // 4.1 ms per million numbers on Node (the callback is not inlined), and the
109
+ // check runs on every upload of an untrusted buffer.
110
+ for (let index = 0; index < array.length; index++) {
111
+ if (!Number.isFinite(array[index])) {
112
+ return false;
113
+ }
114
+ }
115
+ return true;
116
+ }
117
+ //# sourceMappingURL=box4-array-boundary.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"box4-array-boundary.js","sourceRoot":"","sources":["../src/box4-array-boundary.ts"],"names":[],"mappings":"AAAA,sGAAsG;AAEtG,OAAO,EAAE,aAAa,EAAE,MAAM,cAAc,CAAC;AAI7C;;;;;;GAMG;AACH,MAAM,UAAU,eAAe,CAAC,KAAa;IAC5C,aAAa,CAAC,KAAK,EAAE,wBAAwB,EAAE,CAAC,CAAC,CAAC;IAClD,OAAO,IAAI,YAAY,CAAC,KAAK,GAAG,CAAC,CAAC,CAAC;AACpC,CAAC;AAED;;;;;;;GAOG;AACH,MAAM,UAAU,QAAQ,CAAC,GAAS,EAAE,KAAmB,EAAE,KAAa;IACrE,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,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,GAAG,CAAC,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yBox4, Box4 } from "./box4-record.js";
3
+ /**
4
+ * Writes the empty box into `out`: `+∞` minima and `−∞` maxima, so that the
5
+ * union with any box is that box and nothing intersects it.
6
+ */
7
+ export declare function box4Empty(out: Box4): Box4;
8
+ /**
9
+ * Writes the box of the given `center` and `size` (the full extent on each
10
+ * axis) into `out`. A negative size gives an empty box.
11
+ */
12
+ export declare function box4FromCenterSize(out: Box4, center: ReadonlyVec4, size: ReadonlyVec4): Box4;
13
+ /** Writes the box spanned by any two opposite corners into `out`. */
14
+ export declare function box4FromCorners(out: Box4, a: ReadonlyVec4, b: ReadonlyVec4): Box4;
15
+ /**
16
+ * Writes the bounds of the 4-number points of `points` into `out`; an empty
17
+ * buffer gives the empty box. A point with a `NaN` component leaves that axis
18
+ * to the other points. O(n).
19
+ *
20
+ * @throws {RangeError} When `points.length` is not a multiple of 4.
21
+ */
22
+ export declare function box4FromPoints(out: Box4, points: Float64Array): Box4;
23
+ /**
24
+ * Like {@link box4FromPoints} for interleaved data: point `i` starts at `offset +
25
+ * i·stride`, both counted in numbers, for `count` points. O(count).
26
+ *
27
+ * @throws {RangeError} When `count` is not a non-negative integer or the last
28
+ * point does not fit in `points`.
29
+ */
30
+ export declare function box4FromPointsStrided(out: Box4, points: Float64Array, offset: number, stride: number, count: number): Box4;
31
+ /**
32
+ * Whether the box has a minimum above its maximum on some axis. `NaN` is not
33
+ * above anything.
34
+ */
35
+ export declare function box4IsEmpty(box: ReadonlyBox4): boolean;
36
+ /**
37
+ * Writes the extent of the box on each axis, `max − min`, into `out`. An empty
38
+ * box gives negative extents.
39
+ */
40
+ export declare function box4Size(out: Vec4, box: ReadonlyBox4): Vec4;
41
+ /**
42
+ * Writes the centre of the box into `out`. An empty box gives `NaN` where a
43
+ * bound is infinite.
44
+ */
45
+ export declare function box4Center(out: Vec4, box: ReadonlyBox4): Vec4;
46
+ /** Whether `point` lies in the box, boundary included. */
47
+ export declare function box4ContainsPoint(box: ReadonlyBox4, point: ReadonlyVec4): boolean;
48
+ /**
49
+ * Whether `inner` lies in the box, boundary included. An empty `inner` is
50
+ * contained in any box.
51
+ */
52
+ export declare function box4ContainsBox4(box: ReadonlyBox4, inner: ReadonlyBox4): boolean;
53
+ /**
54
+ * Whether the two boxes share a point, boundaries included. An empty box (an
55
+ * inverted axis) intersects nothing.
56
+ */
57
+ export declare function box4IntersectsBox4(a: ReadonlyBox4, b: ReadonlyBox4): boolean;
58
+ /**
59
+ * Writes the common part of two boxes into `out`; disjoint boxes give an empty
60
+ * box ({@link box4IsEmpty}).
61
+ */
62
+ export declare function box4Intersection(out: Box4, a: ReadonlyBox4, b: ReadonlyBox4): Box4;
63
+ /**
64
+ * Writes the smallest box holding both boxes into `out`; an empty box (an
65
+ * inverted axis) adds nothing, and two empty boxes give {@link box4Empty}. `out`
66
+ * may be `a` or `b`.
67
+ */
68
+ export declare function box4Union(out: Box4, a: ReadonlyBox4, b: ReadonlyBox4): Box4;
69
+ /** Writes the smallest box holding `box` and `point` into `out`. */
70
+ export declare function box4ExpandByPoint(out: Box4, box: ReadonlyBox4, point: ReadonlyVec4): Box4;
71
+ /**
72
+ * Writes `box` grown by `margin` on every side into `out`; a negative margin
73
+ * insets and may empty the box.
74
+ */
75
+ export declare function box4ExpandByScalar(out: Box4, box: ReadonlyBox4, margin: number): Box4;
76
+ /** Writes `box` moved by `offset` into `out`. */
77
+ export declare function box4Translate(out: Box4, box: ReadonlyBox4, offset: ReadonlyVec4): Box4;
78
+ /**
79
+ * Writes the point of the box nearest to `point` into `out`; `out` may be
80
+ * `point`. An empty box gives an unspecified point.
81
+ */
82
+ export declare function box4ClampPoint(out: Vec4, box: ReadonlyBox4, point: ReadonlyVec4): Vec4;
83
+ /** The distance from `point` to the box: `0` inside or on it. */
84
+ export declare function box4DistanceToPoint(box: ReadonlyBox4, point: ReadonlyVec4): number;
85
+ /**
86
+ * Writes the bounds interpolated from `a` (`t = 0`) to `b` (`t = 1`, exact)
87
+ * into `out`. Not math-scalar's `lerp`, which is `a + (b − a)·t` and misses `b`
88
+ * by rounding at `t = 1`.
89
+ */
90
+ export declare function box4Lerp(out: Box4, a: ReadonlyBox4, b: ReadonlyBox4, t: number): Box4;
91
+ /**
92
+ * Writes the coordinates of `point` inside the box, `0` at the minimum corner
93
+ * and `1` at the maximum, into `out`: the inverse of {@link box4PointAt}. A flat
94
+ * axis gives non-finite coordinates.
95
+ */
96
+ export declare function box4Parameter(out: Vec4, box: ReadonlyBox4, point: ReadonlyVec4): Vec4;
97
+ /**
98
+ * Writes the point of the box at `parameter` (`0` at the minimum corner, `1` at
99
+ * the maximum) into `out`.
100
+ */
101
+ export declare function box4PointAt(out: Vec4, box: ReadonlyBox4, parameter: ReadonlyVec4): Vec4;
102
+ /**
103
+ * Writes the union of every box of `boxes` (8 numbers each) into `out`; an
104
+ * empty buffer, or one of empty (inverted) boxes only, gives the empty box.
105
+ * O(n).
106
+ *
107
+ * @throws {RangeError} When `boxes.length` is not a multiple of 8.
108
+ */
109
+ export declare function box4ArrayUnion(out: Box4, boxes: Float64Array): Box4;
110
+ //# sourceMappingURL=box4-componentwise.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"box4-componentwise.d.ts","sourceRoot":"","sources":["../src/box4-componentwise.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,YAAY,EAAE,IAAI,EAAE,MAAM,qBAAqB,CAAC;AAG9D,OAAO,KAAK,EAAE,YAAY,EAAE,IAAI,EAAE,MAAM,kBAAkB,CAAC;AAE3D;;;GAGG;AACH,wBAAgB,SAAS,CAAC,GAAG,EAAE,IAAI,GAAG,IAAI,CAUzC;AAED;;;GAGG;AACH,wBAAgB,kBAAkB,CACjC,GAAG,EAAE,IAAI,EACT,MAAM,EAAE,YAAY,EACpB,IAAI,EAAE,YAAY,GAChB,IAAI,CAUN;AAED,qEAAqE;AACrE,wBAAgB,eAAe,CAC9B,GAAG,EAAE,IAAI,EACT,CAAC,EAAE,YAAY,EACf,CAAC,EAAE,YAAY,GACb,IAAI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