@ac-kit/math-geometry 0.2.3 → 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 +217 -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
@@ -0,0 +1,90 @@
1
+ import type { Brand_ } from "./_brand.js";
2
+ /**
3
+ * A ray in space: an origin then a direction, which need not be a unit vector;
4
+ * a parameter `t ≥ 0` is in units of the direction's length.
5
+ *
6
+ * A plain array of 6 binary64 numbers carrying a type-level brand, holding
7
+ * exactly the numbers one element of the matching bulk buffer holds, in the
8
+ * same order.
9
+ *
10
+ * Only {@link ray3Create}, {@link ray3Of}, {@link ray3Clone}, {@link ray3FromArray}
11
+ * and the functions that write an `out` make one; see `Vec3` in
12
+ * `@ac-kit/math-linear` for the rules that bind callers who bypass the types.
13
+ */
14
+ export type Ray3 = [
15
+ originX: number,
16
+ originY: number,
17
+ originZ: number,
18
+ directionX: number,
19
+ directionY: number,
20
+ directionZ: number
21
+ ] & Brand_<"Ray3">;
22
+ /** A {@link Ray3} that is only read. */
23
+ export type ReadonlyRay3 = readonly [
24
+ originX: number,
25
+ originY: number,
26
+ originZ: number,
27
+ directionX: number,
28
+ directionY: number,
29
+ directionZ: number
30
+ ] & Brand_<"Ray3">;
31
+ /**
32
+ * Creates the ray at the origin with a zero direction.
33
+ *
34
+ * Allocates; keep it out of hot loops.
35
+ */
36
+ export declare function ray3Create(): Ray3;
37
+ /**
38
+ * Creates the ray with the components `originX, originY, originZ, directionX,
39
+ * directionY, directionZ`, in storage order.
40
+ *
41
+ * Allocates; keep it out of hot loops.
42
+ */
43
+ export declare function ray3Of(originX: number, originY: number, originZ: number, directionX: number, directionY: number, directionZ: number): Ray3;
44
+ /**
45
+ * Creates a copy of `a`. Like every creator it starts from a clean array.
46
+ *
47
+ * Allocates; keep it out of hot loops.
48
+ */
49
+ export declare function ray3Clone(a: ReadonlyRay3): Ray3;
50
+ /** Writes the components, in storage order, into `out`. */
51
+ export declare function ray3Set(out: Ray3, originX: number, originY: number, originZ: number, directionX: number, directionY: number, directionZ: number): Ray3;
52
+ /** Writes a copy of `a` into `out`. `out` may be `a`. */
53
+ export declare function ray3Copy(out: Ray3, a: ReadonlyRay3): Ray3;
54
+ /**
55
+ * Exact component-wise equality: `−0` equals `+0`, `NaN` equals nothing, itself
56
+ * included, and an infinity equals itself. See {@link ray3IsClose} for a
57
+ * tolerant test.
58
+ */
59
+ export declare function ray3Equals(a: ReadonlyRay3, b: ReadonlyRay3): boolean;
60
+ /**
61
+ * Component-wise approximate equality: every pair differs by at most
62
+ * `tolerance`, an absolute bound in the caller's units, and an infinity is
63
+ * close only to itself. Not transitive, so never a basis for ordering or a
64
+ * container key: use {@link ray3Equals} there.
65
+ *
66
+ * @param tolerance Defaults to `geometryConfig.defaultLinearTolerance`.
67
+ */
68
+ export declare function ray3IsClose(a: ReadonlyRay3, b: ReadonlyRay3, tolerance?: number): boolean;
69
+ /**
70
+ * The checked way in from untyped data (JSON, messages, arrays of unknown
71
+ * origin): `source[offset … offset + 6)` copied into `out`, each element that
72
+ * is not a number written as `NaN`, an index past the end of `source` too, so
73
+ * `out` never holds a non-number. A cold path: buffers use {@link ray3Load}.
74
+ * O(1).
75
+ *
76
+ * `source` may be `out` itself: the 6 elements are read before the first write.
77
+ *
78
+ * @param out The ray to fill.
79
+ * @param source The array to read, of any length and any content.
80
+ * @param offset The index of the first component in `source`.
81
+ * @returns `out`.
82
+ */
83
+ export declare function ray3FromArray(out: Ray3, source: ArrayLike<number>, offset?: number): Ray3;
84
+ /**
85
+ * Whether every component is a finite number: the check to run after parsing
86
+ * untrusted data or before an upload, as operations never check. A component
87
+ * that is not a number at all counts as not finite.
88
+ */
89
+ export declare function ray3IsFinite(value: ReadonlyRay3): boolean;
90
+ //# sourceMappingURL=ray3-record.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ray3-record.d.ts","sourceRoot":"","sources":["../src/ray3-record.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AAG1C;;;;;;;;;;;GAWG;AACH,MAAM,MAAM,IAAI,GAAG;IAClB,OAAO,EAAE,MAAM;IACf,OAAO,EAAE,MAAM;IACf,OAAO,EAAE,MAAM;IACf,UAAU,EAAE,MAAM;IAClB,UAAU,EAAE,MAAM;IAClB,UAAU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AAM,EAAE,SAAS,CAAC,MAAM,CAAC,EACzB,MAAM,SAAI,GACR,IAAI,CAcN;AAED;;;;GAIG;AACH,wBAAgB,YAAY,CAAC,KAAK,EAAE,YAAY,GAAG,OAAO,CASzD"}
@@ -0,0 +1,146 @@
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, 0.5, 0.5];
9
+ /**
10
+ * Creates the ray at the origin with a zero direction.
11
+ *
12
+ * Allocates; keep it out of hot loops.
13
+ */
14
+ export function ray3Create() {
15
+ const out = TEMPLATE_.slice();
16
+ out[0] = 0;
17
+ out[1] = 0;
18
+ out[2] = 0;
19
+ out[3] = 0;
20
+ out[4] = 0;
21
+ out[5] = 0;
22
+ return out;
23
+ }
24
+ /**
25
+ * Creates the ray with the components `originX, originY, originZ, directionX,
26
+ * directionY, directionZ`, in storage order.
27
+ *
28
+ * Allocates; keep it out of hot loops.
29
+ */
30
+ export function ray3Of(originX, originY, originZ, directionX, directionY, directionZ) {
31
+ const out = TEMPLATE_.slice();
32
+ out[0] = originX;
33
+ out[1] = originY;
34
+ out[2] = originZ;
35
+ out[3] = directionX;
36
+ out[4] = directionY;
37
+ out[5] = directionZ;
38
+ return out;
39
+ }
40
+ /**
41
+ * Creates a copy of `a`. Like every creator it starts from a clean array.
42
+ *
43
+ * Allocates; keep it out of hot loops.
44
+ */
45
+ export function ray3Clone(a) {
46
+ const out = TEMPLATE_.slice();
47
+ out[0] = a[0];
48
+ out[1] = a[1];
49
+ out[2] = a[2];
50
+ out[3] = a[3];
51
+ out[4] = a[4];
52
+ out[5] = a[5];
53
+ return out;
54
+ }
55
+ /** Writes the components, in storage order, into `out`. */
56
+ export function ray3Set(out, originX, originY, originZ, directionX, directionY, directionZ) {
57
+ out[0] = originX;
58
+ out[1] = originY;
59
+ out[2] = originZ;
60
+ out[3] = directionX;
61
+ out[4] = directionY;
62
+ out[5] = directionZ;
63
+ return out;
64
+ }
65
+ /** Writes a copy of `a` into `out`. `out` may be `a`. */
66
+ export function ray3Copy(out, a) {
67
+ out[0] = a[0];
68
+ out[1] = a[1];
69
+ out[2] = a[2];
70
+ out[3] = a[3];
71
+ out[4] = a[4];
72
+ out[5] = a[5];
73
+ return out;
74
+ }
75
+ /**
76
+ * Exact component-wise equality: `−0` equals `+0`, `NaN` equals nothing, itself
77
+ * included, and an infinity equals itself. See {@link ray3IsClose} for a
78
+ * tolerant test.
79
+ */
80
+ export function ray3Equals(a, b) {
81
+ return (a[0] === b[0] &&
82
+ a[1] === b[1] &&
83
+ a[2] === b[2] &&
84
+ a[3] === b[3] &&
85
+ a[4] === b[4] &&
86
+ a[5] === b[5]);
87
+ }
88
+ /**
89
+ * Component-wise approximate equality: every pair differs by at most
90
+ * `tolerance`, an absolute bound in the caller's units, and an infinity is
91
+ * close only to itself. Not transitive, so never a basis for ordering or a
92
+ * container key: use {@link ray3Equals} there.
93
+ *
94
+ * @param tolerance Defaults to `geometryConfig.defaultLinearTolerance`.
95
+ */
96
+ export function ray3IsClose(a, b, tolerance = geometryConfig.defaultLinearTolerance) {
97
+ return (isCloseAbsolute(a[0], b[0], tolerance) &&
98
+ isCloseAbsolute(a[1], b[1], tolerance) &&
99
+ isCloseAbsolute(a[2], b[2], tolerance) &&
100
+ isCloseAbsolute(a[3], b[3], tolerance) &&
101
+ isCloseAbsolute(a[4], b[4], tolerance) &&
102
+ isCloseAbsolute(a[5], b[5], tolerance));
103
+ }
104
+ /**
105
+ * The checked way in from untyped data (JSON, messages, arrays of unknown
106
+ * origin): `source[offset … offset + 6)` copied into `out`, each element that
107
+ * is not a number written as `NaN`, an index past the end of `source` too, so
108
+ * `out` never holds a non-number. A cold path: buffers use {@link ray3Load}.
109
+ * O(1).
110
+ *
111
+ * `source` may be `out` itself: the 6 elements are read before the first write.
112
+ *
113
+ * @param out The ray to fill.
114
+ * @param source The array to read, of any length and any content.
115
+ * @param offset The index of the first component in `source`.
116
+ * @returns `out`.
117
+ */
118
+ export function ray3FromArray(out, source, offset = 0) {
119
+ const value0 = numberAtOrNaN(source, offset);
120
+ const value1 = numberAtOrNaN(source, offset + 1);
121
+ const value2 = numberAtOrNaN(source, offset + 2);
122
+ const value3 = numberAtOrNaN(source, offset + 3);
123
+ const value4 = numberAtOrNaN(source, offset + 4);
124
+ const value5 = numberAtOrNaN(source, offset + 5);
125
+ out[0] = value0;
126
+ out[1] = value1;
127
+ out[2] = value2;
128
+ out[3] = value3;
129
+ out[4] = value4;
130
+ out[5] = value5;
131
+ return out;
132
+ }
133
+ /**
134
+ * Whether every component is a finite number: the check to run after parsing
135
+ * untrusted data or before an upload, as operations never check. A component
136
+ * that is not a number at all counts as not finite.
137
+ */
138
+ export function ray3IsFinite(value) {
139
+ return (Number.isFinite(value[0]) &&
140
+ Number.isFinite(value[1]) &&
141
+ Number.isFinite(value[2]) &&
142
+ Number.isFinite(value[3]) &&
143
+ Number.isFinite(value[4]) &&
144
+ Number.isFinite(value[5]));
145
+ }
146
+ //# sourceMappingURL=ray3-record.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ray3-record.js","sourceRoot":"","sources":["../src/ray3-record.ts"],"names":[],"mappings":"AAAA,8FAA8F;AAE9F,OAAO,EAAE,eAAe,EAAE,aAAa,EAAE,MAAM,cAAc,CAAC;AAG9D,OAAO,EAAE,cAAc,EAAE,MAAM,cAAc,CAAC;AAmC9C;;;GAGG;AACH,MAAM,SAAS,GAAsB,CAAC,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,CAAC,CAAC;AAEpE;;;;GAIG;AACH,MAAM,UAAU,UAAU;IACzB,MAAM,GAAG,GAAG,SAAS,CAAC,KAAK,EAAU,CA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AAM,GAAG,CAAC,CAAC,CAAC;IACjD,MAAM,MAAM,GAAG,aAAa,CAAC,MAAM,EAAE,MAAM,GAAG,CAAC,CAAC,CAAC;IACjD,MAAM,MAAM,GAAG,aAAa,CAAC,MAAM,EAAE,MAAM,GAAG,CAAC,CAAC,CAAC;IACjD,MAAM,MAAM,GAAG,aAAa,CAAC,MAAM,EAAE,MAAM,GAAG,CAAC,CAAC,CAAC;IACjD,GAAG,CAAC,CAAC,CAAC,GAAG,MAAM,CAAC;IAChB,GAAG,CAAC,CAAC,CAAC,GAAG,MAAM,CAAC;IAChB,GAAG,CAAC,CAAC,CAAC,GAAG,MAAM,CAAC;IAChB,GAAG,CAAC,CAAC,CAAC,GAAG,MAAM,CAAC;IAChB,GAAG,CAAC,CAAC,CAAC,GAAG,MAAM,CAAC;IAChB,GAAG,CAAC,CAAC,CAAC,GAAG,MAAM,CAAC;IAChB,OAAO,GAAG,CAAC;AACZ,CAAC;AAED;;;;GAIG;AACH,MAAM,UAAU,YAAY,CAAC,KAAmB;IAC/C,OAAO,CACN,MAAM,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC;QACzB,MAAM,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC;QACzB,MAAM,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC;QACzB,MAAM,CAAC,QAAQ,CAAC,KAAK,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/ray3.d.ts CHANGED
@@ -1,30 +1,77 @@
1
- import { Vec3 } from "@ac-kit/math-linear";
2
- import { Plane3 } from "./plane3.js";
3
- import { Point3 } from "./point3.js";
4
- import { Sphere3 } from "./sphere3.js";
5
- export type Ray3 = {
6
- origin: Point3;
7
- direction: Vec3;
8
- };
9
- /** Returns the point along the ray at parameter `t` (origin + direction * t). */
10
- export declare function ray3At(ray: Ray3, t: number): Point3;
11
- /** Returns the closest point on the ray (t >= 0) to `p`. */
12
- export declare function ray3ClosestPoint(ray: Ray3, p: Point3): Point3;
13
- export declare function ray3DistanceToPoint(ray: Ray3, p: Point3): number;
14
- /** Exact equality of origin and direction. */
15
- export declare function ray3Equals(a: Ray3, b: Ray3): boolean;
16
- /**
17
- * Returns the intersection point of the ray with the plane, or `null` if
18
- * parallel or behind the ray.
1
+ import type { DepthRange, ReadonlyAffine3, ReadonlyMat4x4, ReadonlyVec3, ReadonlyViewport, Vec2, Vec3 } from "@ac-kit/math-linear";
2
+ import type { ReadonlyBox3 } from "./box3-record.js";
3
+ import type { ReadonlyPlane3 } from "./plane3-record.js";
4
+ import type { Ray3, ReadonlyRay3 } from "./ray3-record.js";
5
+ import type { ReadonlySphere3 } from "./sphere3-record.js";
6
+ import type { ReadonlyTriangle3 } from "./triangle3-record.js";
7
+ /** Writes the point `origin + t · direction` into `out`. */
8
+ export declare function ray3At(out: Vec3, ray: ReadonlyRay3, t: number): Vec3;
9
+ /**
10
+ * The parameter `t ≥ 0`, in units of the direction's length, of the point of
11
+ * the ray nearest to `point`; a zero direction gives `0`.
12
+ */
13
+ export declare function ray3ClosestParameter(ray: ReadonlyRay3, point: ReadonlyVec3): number;
14
+ /** Writes the point of the ray nearest to `point` into `out`. */
15
+ export declare function ray3ClosestPoint(out: Vec3, ray: ReadonlyRay3, point: ReadonlyVec3): Vec3;
16
+ /** The distance from `point` to the ray. */
17
+ export declare function ray3DistanceToPoint(ray: ReadonlyRay3, point: ReadonlyVec3): number;
18
+ /**
19
+ * Writes the ray that starts at `ray`'s point at parameter `t` and keeps its
20
+ * direction into `out`. `out` may be `ray`.
21
+ */
22
+ export declare function ray3Recast(out: Ray3, ray: ReadonlyRay3, t: number): Ray3;
23
+ /**
24
+ * The parameter `t ≥ 0` at which the ray crosses the plane, `Infinity` for a
25
+ * miss: parallel (`|n · d| ≤ tolerance · |n| · |d|`, a ray lying in the plane
26
+ * included) or pointing away from it. The point is {@link ray3At}.
19
27
  *
20
- * @param tolerance - Dimensionless bound on the dot product of the ray
21
- * direction and the plane normal, below which the two count as parallel. Both
22
- * are unit-length, so the raw dot product is already scale-free.
28
+ * @param tolerance Dimensionless bound on the sine of the angle between the ray
29
+ * and the plane; defaults to `geometryConfig.defaultAngularTolerance`.
30
+ */
31
+ export declare function ray3IntersectPlane3(ray: ReadonlyRay3, plane: ReadonlyPlane3, tolerance?: number): number;
32
+ /**
33
+ * The parameter `t ≥ 0` of the nearest hit of the ray with the ball, `Infinity`
34
+ * for a miss or a negative radius; an origin inside gives the far side. A zero
35
+ * direction gives `NaN`.
23
36
  */
24
- export declare function ray3IntersectPlane(ray: Ray3, plane: Plane3, tolerance?: number): Point3 | null;
37
+ export declare function ray3IntersectSphere3(ray: ReadonlyRay3, sphere: ReadonlySphere3): number;
25
38
  /**
26
- * Returns the first intersection point of the ray with the sphere (nearest to
27
- * origin), or `null` if no intersection.
39
+ * The parameter `t ≥ 0` of the nearest hit of the ray with the box (slab test):
40
+ * `0` for an origin inside, `Infinity` for a miss or an empty box.
41
+ */
42
+ export declare function ray3IntersectBox3(ray: ReadonlyRay3, box: ReadonlyBox3): number;
43
+ /**
44
+ * Möller–Trumbore: the parameter `t ≥ 0` at which the ray crosses the triangle,
45
+ * `Infinity` for a miss. On a hit `out` holds the barycentric coordinates `[u,
46
+ * v]` of the point (`a·(1 − u − v) + b·u + c·v`); on a miss `NaN`. A triangle
47
+ * seen from behind (its counter-clockwise normal pointing away from the ray) is
48
+ * a miss when `cullBackFaces` is set. A ray parallel to the triangle is a
49
+ * miss.
50
+ */
51
+ export declare function ray3IntersectTriangle3(out: Vec2, ray: ReadonlyRay3, triangle: ReadonlyTriangle3, cullBackFaces: boolean): number;
52
+ /**
53
+ * Writes the ray moved by `transform` into `out`: the origin as a point, the
54
+ * direction as a vector (the translation does not apply, and the length scales
55
+ * with the transform, so a `t` along the result is a `t` along the input).
56
+ * `out` may be `ray`.
57
+ */
58
+ export declare function ray3TransformAffine3(out: Ray3, ray: ReadonlyRay3, transform: ReadonlyAffine3): Ray3;
59
+ /**
60
+ * Writes the picking ray through the pixel `(x, y)` into `out`: the origin is
61
+ * the point unprojected at the near plane's depth of `depthRange` (`0` for
62
+ * `"zero-to-one"`, `−1` for `"negative-one-to-one"`, `1` for `"one-to-zero"`),
63
+ * the direction points toward the far plane's depth and is a unit vector. Both
64
+ * unproject in homogeneous coordinates, so an infinite far plane (`w = 0`
65
+ * there) still gives a finite direction in all three ranges.
66
+ *
67
+ * `depthRange` must be the projection's own: with a reversed infinite
68
+ * projection, `"zero-to-one"` would unproject the origin at infinity. A
69
+ * non-finite origin or direction (a singular matrix, an eye-plane origin, a
70
+ * zero-size viewport) writes `NaN` into every component of `out`: nothing
71
+ * throws.
72
+ *
73
+ * @param inverseViewProjection `mat4x4Invert` of the view-projection.
74
+ * @param viewport The render target in pixels, origin top-left, y down.
28
75
  */
29
- export declare function ray3IntersectSphere(ray: Ray3, sphere: Sphere3): Point3 | null;
76
+ export declare function ray3FromViewport(out: Ray3, x: number, y: number, inverseViewProjection: ReadonlyMat4x4, viewport: ReadonlyViewport, depthRange: DepthRange): Ray3;
30
77
  //# sourceMappingURL=ray3.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"ray3.d.ts","sourceRoot":"","sources":["../src/ray3.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAA0B,MAAM,qBAAqB,CAAC;AAInE,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AACrC,OAAO,EAAE,MAAM,EAAkB,MAAM,aAAa,CAAC;AACrD,OAAO,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC;AAEvC,MAAM,MAAM,IAAI,GAAG;IAClB,MAAM,EAAE,MAAM,CAAC;IACf,SAAS,EAAE,IAAI,CAAC;CAChB,CAAC;AAEF,iFAAiF;AACjF,w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