@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
@@ -0,0 +1,91 @@
1
+ import type { Brand_ } from "./_brand.js";
2
+ /**
3
+ * An infinite line in space: a point on it then a direction, which need not be
4
+ * a unit vector.
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 line3Create}, {@link line3Of}, {@link line3Clone},
11
+ * {@link line3FromArray} and the functions that write an `out` make one; see
12
+ * `Vec3` in `@ac-kit/math-linear` for the rules that bind callers who bypass
13
+ * the types.
14
+ */
15
+ export type Line3 = [
16
+ pointX: number,
17
+ pointY: number,
18
+ pointZ: number,
19
+ directionX: number,
20
+ directionY: number,
21
+ directionZ: number
22
+ ] & Brand_<"Line3">;
23
+ /** A {@link Line3} that is only read. */
24
+ export type ReadonlyLine3 = readonly [
25
+ pointX: number,
26
+ pointY: number,
27
+ pointZ: number,
28
+ directionX: number,
29
+ directionY: number,
30
+ directionZ: number
31
+ ] & Brand_<"Line3">;
32
+ /**
33
+ * Creates the line through the origin with a zero direction.
34
+ *
35
+ * Allocates; keep it out of hot loops.
36
+ */
37
+ export declare function line3Create(): Line3;
38
+ /**
39
+ * Creates the line with the components `pointX, pointY, pointZ, directionX,
40
+ * directionY, directionZ`, in storage order.
41
+ *
42
+ * Allocates; keep it out of hot loops.
43
+ */
44
+ export declare function line3Of(pointX: number, pointY: number, pointZ: number, directionX: number, directionY: number, directionZ: number): Line3;
45
+ /**
46
+ * Creates a copy of `a`. Like every creator it starts from a clean array.
47
+ *
48
+ * Allocates; keep it out of hot loops.
49
+ */
50
+ export declare function line3Clone(a: ReadonlyLine3): Line3;
51
+ /** Writes the components, in storage order, into `out`. */
52
+ export declare function line3Set(out: Line3, pointX: number, pointY: number, pointZ: number, directionX: number, directionY: number, directionZ: number): Line3;
53
+ /** Writes a copy of `a` into `out`. `out` may be `a`. */
54
+ export declare function line3Copy(out: Line3, a: ReadonlyLine3): Line3;
55
+ /**
56
+ * Exact component-wise equality: `−0` equals `+0`, `NaN` equals nothing, itself
57
+ * included, and an infinity equals itself. See {@link line3IsClose} for a
58
+ * tolerant test.
59
+ */
60
+ export declare function line3Equals(a: ReadonlyLine3, b: ReadonlyLine3): boolean;
61
+ /**
62
+ * Component-wise approximate equality: every pair differs by at most
63
+ * `tolerance`, an absolute bound in the caller's units, and an infinity is
64
+ * close only to itself. Not transitive, so never a basis for ordering or a
65
+ * container key: use {@link line3Equals} there.
66
+ *
67
+ * @param tolerance Defaults to `geometryConfig.defaultLinearTolerance`.
68
+ */
69
+ export declare function line3IsClose(a: ReadonlyLine3, b: ReadonlyLine3, tolerance?: number): boolean;
70
+ /**
71
+ * The checked way in from untyped data (JSON, messages, arrays of unknown
72
+ * origin): `source[offset … offset + 6)` copied into `out`, each element that
73
+ * is not a number written as `NaN`, an index past the end of `source` too, so
74
+ * `out` never holds a non-number. A cold path: buffers use {@link line3Load}.
75
+ * O(1).
76
+ *
77
+ * `source` may be `out` itself: the 6 elements are read before the first write.
78
+ *
79
+ * @param out The line to fill.
80
+ * @param source The array to read, of any length and any content.
81
+ * @param offset The index of the first component in `source`.
82
+ * @returns `out`.
83
+ */
84
+ export declare function line3FromArray(out: Line3, source: ArrayLike<number>, offset?: number): Line3;
85
+ /**
86
+ * Whether every component is a finite number: the check to run after parsing
87
+ * untrusted data or before an upload, as operations never check. A component
88
+ * that is not a number at all counts as not finite.
89
+ */
90
+ export declare function line3IsFinite(value: ReadonlyLine3): boolean;
91
+ //# sourceMappingURL=line3-record.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"line3-record.d.ts","sourceRoot":"","sources":["../src/line3-record.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EA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G,OAAO,CASvE;AAED;;;;;;;GAOG;AACH,wBAAgB,YAAY,CAC3B,CAAC,EAAE,aAAa,EAChB,CAAC,EAAE,aAAa,EAChB,SAAS,GAAE,MAA8C,GACvD,OAAO,CAST;AAED;;;;;;;;;;;;;GAaG;AACH,wBAAgB,cAAc,CAC7B,GAAG,EAAE,KAAK,EACV,MAAM,EAAE,SAAS,CAAC,MAAM,CAAC,EACzB,MAAM,SAAI,GACR,KAAK,CAcP;AAED;;;;GAIG;AACH,wBAAgB,aAAa,CAAC,KAAK,EAAE,aAAa,GAAG,OAAO,CAS3D"}
@@ -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 line through the origin with a zero direction.
11
+ *
12
+ * Allocates; keep it out of hot loops.
13
+ */
14
+ export function line3Create() {
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 line with the components `pointX, pointY, pointZ, directionX,
26
+ * directionY, directionZ`, in storage order.
27
+ *
28
+ * Allocates; keep it out of hot loops.
29
+ */
30
+ export function line3Of(pointX, pointY, pointZ, directionX, directionY, directionZ) {
31
+ const out = TEMPLATE_.slice();
32
+ out[0] = pointX;
33
+ out[1] = pointY;
34
+ out[2] = pointZ;
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 line3Clone(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 line3Set(out, pointX, pointY, pointZ, directionX, directionY, directionZ) {
57
+ out[0] = pointX;
58
+ out[1] = pointY;
59
+ out[2] = pointZ;
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 line3Copy(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 line3IsClose} for a
78
+ * tolerant test.
79
+ */
80
+ export function line3Equals(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 line3Equals} there.
93
+ *
94
+ * @param tolerance Defaults to `geometryConfig.defaultLinearTolerance`.
95
+ */
96
+ export function line3IsClose(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 line3Load}.
109
+ * O(1).
110
+ *
111
+ * `source` may be `out` itself: the 6 elements are read before the first write.
112
+ *
113
+ * @param out The line 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 line3FromArray(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 line3IsFinite(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=line3-record.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"line3-record.js","sourceRoot":"","sources":["../src/line3-record.ts"],"names":[],"mappings":"AAAA,8FAA8F;AAE9F,OAAO,EAAE,eAAe,EAAE,aAAa,EAAE,MAAM,cAAc,CAAC;AAG9D,OAAO,EAAE,cAAc,EAAE,MAAM,cAAc,CAAC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C,CAAC,CAAC,CACzB,CAAC;AACH,CAAC"}
package/dist/line3.d.ts CHANGED
@@ -1,30 +1,17 @@
1
- import { Vec3 } from "@ac-kit/math-linear";
2
- import { Point3 } from "./point3.js";
3
- export type Line3 = {
4
- point: Point3;
5
- direction: Vec3;
6
- };
7
- /** Returns the closest point on the infinite line to `p`. */
8
- export declare function line3ClosestPoint(line: Line3, p: Point3): Point3;
1
+ import type { ReadonlyVec3, Vec3 } from "@ac-kit/math-linear";
2
+ import type { ReadonlyLine3 } from "./line3-record.js";
9
3
  /**
10
- * Whether `p` lies on `line`, within `tolerance` of it.
11
- *
12
- * Tolerant by necessity: a line has zero volume, so no constructed point ever
13
- * lands on one exactly. `tolerance` is a distance in the caller's own units.
4
+ * Writes the point of the line nearest to `point` into `out`; a line with a
5
+ * zero direction is the point it passes through.
14
6
  */
15
- export declare function line3ContainsPoint(line: Line3, p: Point3, tolerance?: number): boolean;
16
- export declare function line3DistanceToPoint(line: Line3, p: Point3): number;
7
+ export declare function line3ClosestPoint(out: Vec3, line: ReadonlyLine3, point: ReadonlyVec3): Vec3;
8
+ /** The distance from `point` to the line. */
9
+ export declare function line3DistanceToPoint(line: ReadonlyLine3, point: ReadonlyVec3): number;
17
10
  /**
18
- * Whether `a` and `b` are the same infinite line, within tolerance.
19
- *
20
- * Tolerant rather than exact, for the same reason as `line2Equals`: the same
21
- * line can be built from any point on it and any scaling of its direction.
22
- * Opposite directions denote the same line.
11
+ * Whether `point` lies on the line, within `tolerance` of it.
23
12
  *
24
- * @param linearTolerance - Distance, in the caller's units, within which a
25
- * point still counts as lying on the other line.
26
- * @param angularTolerance - Dimensionless residual on `|dot| - 1`, within which
27
- * two unit directions still count as collinear.
13
+ * @param tolerance A distance in the caller's units; defaults to
14
+ * `geometryConfig.defaultLinearTolerance`.
28
15
  */
29
- export declare function line3Equals(a: Line3, b: Line3, linearTolerance?: number, angularTolerance?: number): boolean;
16
+ export declare function line3ContainsPoint(line: ReadonlyLine3, point: ReadonlyVec3, tolerance?: number): boolean;
30
17
  //# sourceMappingURL=line3.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"line3.d.ts","sourceRoot":"","sources":["../src/line3.ts"],"names":[],"mappings":"AACA,OAAO,EACN,IAAI,EAKJ,MAAM,qBAAqB,CAAC;AAG7B,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AAErC,MAAM,MAAM,KAAK,GAAG;IACnB,KAAK,EAAE,MAAM,CAAC;IACd,SAAS,EAAE,IAAI,CAAC;CAChB,CAAC;AAEF,6DAA6D;AAC7D,wBAAgB,iBAAiB,CAAC,IAAI,EAAE,KAAK,EAAE,CAAC,EAAE,MAAM,GAAG,MAAM,CAShE;AAED;;;;;GAKG;AACH,wBAAgB,kBAAkB,CACjC,IAAI,EAAE,KAAK,EACX,CAAC,EAAE,MAAM,EACT,SAAS,GAAE,MAA8C,GACvD,OAAO,CAET;AAED,wBAAgB,oBAAoB,CAAC,IAAI,EAAE,KAAK,EAAE,CAAC,EAAE,MAAM,GAAG,MAAM,CAInE;AAED;;;;;;;;;;;GAWG;AACH,wBAAgB,WAAW,CAC1B,CAAC,EAAE,KAAK,EACR,CAAC,EAAE,KAAK,EACR,eAAe,GAAE,MAA8C,EAC/D,gBAAgB,GAAE,MAA+C,GAC/D,OAAO,CAOT"}
1
+ {"version":3,"file":"line3.d.ts","sourceRoot":"","sources":["../src/line3.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,IAAI,EAAE,MAAM,qBAAqB,CAAC;AAG9D,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAC;AAEvD;;;GAGG;AACH,wBAAgB,iBAAiB,CAChC,GAAG,EAAE,IAAI,EACT,IAAI,EAAE,aAAa,EACnB,KAAK,EAAE,YAAY,GACjB,IAAI,CAcN;AAED,6CAA6C;AAC7C,wBAAgB,oBAAoB,CACnC,IAAI,EAAE,aAAa,EACnB,KAAK,EAAE,YAAY,GACjB,MAAM,CAeR;AAED;;;;;GAKG;AACH,wBAAgB,kBAAkB,CACjC,IAAI,EAAE,aAAa,EACnB,KAAK,EAAE,YAAY,EACnB,SAAS,GAAE,MAA8C,GACvD,OAAO,CAET"}
package/dist/line3.js CHANGED
@@ -1,46 +1,42 @@
1
- import { isCloseAbsolute } from "@ac-kit/core";
2
- import { vec3Cross, vec3Dot, vec3Length, vec3Normalize, } from "@ac-kit/math-linear";
3
1
  import { geometryConfig } from "./globals.js";
4
- /** Returns the closest point on the infinite line to `p`. */
5
- export function line3ClosestPoint(line, p) {
6
- const d = vec3Normalize(line.direction);
7
- const v = [p.x - line.point.x, p.y - line.point.y, p.z - line.point.z];
8
- const t = vec3Dot(v, d);
9
- return {
10
- x: line.point.x + d[0] * t,
11
- y: line.point.y + d[1] * t,
12
- z: line.point.z + d[2] * t,
13
- };
14
- }
15
2
  /**
16
- * Whether `p` lies on `line`, within `tolerance` of it.
17
- *
18
- * Tolerant by necessity: a line has zero volume, so no constructed point ever
19
- * lands on one exactly. `tolerance` is a distance in the caller's own units.
3
+ * Writes the point of the line nearest to `point` into `out`; a line with a
4
+ * zero direction is the point it passes through.
20
5
  */
21
- export function line3ContainsPoint(line, p, tolerance = geometryConfig.defaultLinearTolerance) {
22
- return line3DistanceToPoint(line, p) <= tolerance;
6
+ export function line3ClosestPoint(out, line, point) {
7
+ const lengthSquared = line[3] * line[3] + line[4] * line[4] + line[5] * line[5];
8
+ const t = lengthSquared === 0
9
+ ? 0
10
+ : ((point[0] - line[0]) * line[3] +
11
+ (point[1] - line[1]) * line[4] +
12
+ (point[2] - line[2]) * line[5]) /
13
+ lengthSquared;
14
+ out[0] = line[0] + line[3] * t;
15
+ out[1] = line[1] + line[4] * t;
16
+ out[2] = line[2] + line[5] * t;
17
+ return out;
23
18
  }
24
- export function line3DistanceToPoint(line, p) {
25
- const d = vec3Normalize(line.direction);
26
- const v = [p.x - line.point.x, p.y - line.point.y, p.z - line.point.z];
27
- return vec3Length(vec3Cross(v, d));
19
+ /** The distance from `point` to the line. */
20
+ export function line3DistanceToPoint(line, point) {
21
+ const fromX = point[0] - line[0];
22
+ const fromY = point[1] - line[1];
23
+ const fromZ = point[2] - line[2];
24
+ const lengthSquared = line[3] * line[3] + line[4] * line[4] + line[5] * line[5];
25
+ if (lengthSquared === 0) {
26
+ return Math.sqrt(fromX * fromX + fromY * fromY + fromZ * fromZ);
27
+ }
28
+ const crossX = fromY * line[5] - fromZ * line[4];
29
+ const crossY = fromZ * line[3] - fromX * line[5];
30
+ const crossZ = fromX * line[4] - fromY * line[3];
31
+ return Math.sqrt((crossX * crossX + crossY * crossY + crossZ * crossZ) / lengthSquared);
28
32
  }
29
33
  /**
30
- * Whether `a` and `b` are the same infinite line, within tolerance.
31
- *
32
- * Tolerant rather than exact, for the same reason as `line2Equals`: the same
33
- * line can be built from any point on it and any scaling of its direction.
34
- * Opposite directions denote the same line.
34
+ * Whether `point` lies on the line, within `tolerance` of it.
35
35
  *
36
- * @param linearTolerance - Distance, in the caller's units, within which a
37
- * point still counts as lying on the other line.
38
- * @param angularTolerance - Dimensionless residual on `|dot| - 1`, within which
39
- * two unit directions still count as collinear.
36
+ * @param tolerance A distance in the caller's units; defaults to
37
+ * `geometryConfig.defaultLinearTolerance`.
40
38
  */
41
- export function line3Equals(a, b, linearTolerance = geometryConfig.defaultLinearTolerance, angularTolerance = geometryConfig.defaultAngularTolerance) {
42
- const dot = vec3Dot(vec3Normalize(a.direction), vec3Normalize(b.direction));
43
- return (isCloseAbsolute(Math.abs(dot), 1, angularTolerance) &&
44
- line3ContainsPoint(a, b.point, linearTolerance));
39
+ export function line3ContainsPoint(line, point, tolerance = geometryConfig.defaultLinearTolerance) {
40
+ return line3DistanceToPoint(line, point) <= tolerance;
45
41
  }
46
42
  //# sourceMappingURL=line3.js.map
package/dist/line3.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"line3.js","sourceRoot":"","sources":["../src/line3.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAA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AE,CAAC;QACzB,OAAO,IAAI,CAAC,IAAI,CAAC,KAAK,GAAG,KAAK,GAAG,KAAK,GAAG,KAAK,GAAG,KAAK,GAAG,KAAK,CAAC,CAAC;IACjE,CAAC;IACD,MAAM,MAAM,GAAG,KAAK,GAAG,IAAI,CAAC,CAAC,CAAC,GAAG,KAAK,GAAG,IAAI,CAAC,CAAC,CAAC,CAAC;IACjD,MAAM,MAAM,GAAG,KAAK,GAAG,IAAI,CAAC,CAAC,CAAC,GAAG,KAAK,GAAG,IAAI,CAAC,CAAC,CAAC,CAAC;IACjD,MAAM,MAAM,GAAG,KAAK,GAAG,IAAI,CAAC,CAAC,CAAC,GAAG,KAAK,GAAG,IAAI,CAAC,CAAC,CAAC,CAAC;IACjD,OAAO,IAAI,CAAC,IAAI,CACf,CAAC,MAAM,GAAG,MAAM,GAAG,MAAM,GAAG,MAAM,GAAG,MAAM,GAAG,MAAM,CAAC,GAAG,aAAa,CACrE,CAAC;AACH,CAAC;AAED;;;;;GAKG;AACH,MAAM,UAAU,kBAAkB,CACjC,IAAmB,EACnB,KAAmB,EACnB,SAAS,GAAW,cAAc,CAAC,sBAAsB;IAEzD,OAAO,oBAAoB,CAAC,IAAI,EAAE,KAAK,CAAC,IAAI,SAAS,CAAC;AACvD,CAAC"}
@@ -0,0 +1,14 @@
1
+ import { type GeneratedMesh3 } from "./mesh3.js";
2
+ /** Allocates the attribute arrays of a generated mesh; the caller fills them. */
3
+ export declare function allocateMesh_(vertexCount: number, triangleCount: number): GeneratedMesh3;
4
+ /** A size or a radius: finite and not negative. */
5
+ export declare function assertExtent_(name: string, option: string, value: number): void;
6
+ export declare function assertSegments_(name: string, option: string, value: number, minimum: number): void;
7
+ /**
8
+ * Fills `indices` with the two counter-clockwise (seen from +Y) triangles of
9
+ * each cell of a row-major `columns × rows` vertex grid whose columns run along
10
+ * +X and rows along +Z: `[i, i + columns + 1, i + 1]` and `[i, i + columns, i +
11
+ * columns + 1]`. O(cells).
12
+ */
13
+ export declare function fillGridIndices_(indices: Uint16Array | Uint32Array, columns: number, rows: number): void;
14
+ //# sourceMappingURL=_generator-kit.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"_generator-kit.d.ts","sourceRoot":"","sources":["../../src/mesh/_generator-kit.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,KAAK,cAAc,EAAoB,MAAM,YAAY,CAAC;AAEnE,iFAAiF;AACjF,wBAAgB,aAAa,CAC5B,WAAW,EAAE,MAAM,EACnB,aAAa,EAAE,MAAM,GACnB,cAAc,CAOhB;AAED,mDAAmD;AACnD,wBAAgB,aAAa,CAC5B,IAAI,EAAE,MAAM,EACZ,MAAM,EAAE,MAAM,EACd,KAAK,EAAE,MAAM,GACX,IAAI,CAEN;AAED,wBAAgB,eAAe,CAC9B,IAAI,EAAE,MAAM,EACZ,MAAM,EAAE,MAAM,EACd,KAAK,EAAE,MAAM,EACb,OAAO,EAAE,MAAM,GACb,IAAI,CAEN;AAED;;;;;GAKG;AACH,wBAAgB,gBAAgB,CAC/B,OAAO,EAAE,WAAW,GAAG,WAAW,EAClC,OAAO,EAAE,MAAM,EACf,IAAI,EAAE,MAAM,GACV,IAAI,CAaN"}
@@ -0,0 +1,39 @@
1
+ import { assertInteger, assertNonNegative } from "@ac-kit/core";
2
+ import { indexArrayCreate } from "./mesh3.js";
3
+ /** Allocates the attribute arrays of a generated mesh; the caller fills them. */
4
+ export function allocateMesh_(vertexCount, triangleCount) {
5
+ return {
6
+ positions: new Float64Array(vertexCount * 3),
7
+ indices: indexArrayCreate(triangleCount * 3, vertexCount),
8
+ normals: new Float64Array(vertexCount * 3),
9
+ uvs: new Float64Array(vertexCount * 2),
10
+ };
11
+ }
12
+ /** A size or a radius: finite and not negative. */
13
+ export function assertExtent_(name, option, value) {
14
+ assertNonNegative(value, `${name}: ${option}`);
15
+ }
16
+ export function assertSegments_(name, option, value, minimum) {
17
+ assertInteger(value, `${name}: ${option}`, minimum);
18
+ }
19
+ /**
20
+ * Fills `indices` with the two counter-clockwise (seen from +Y) triangles of
21
+ * each cell of a row-major `columns × rows` vertex grid whose columns run along
22
+ * +X and rows along +Z: `[i, i + columns + 1, i + 1]` and `[i, i + columns, i +
23
+ * columns + 1]`. O(cells).
24
+ */
25
+ export function fillGridIndices_(indices, columns, rows) {
26
+ let corner = 0;
27
+ for (let row = 0; row < rows - 1; row++) {
28
+ for (let column = 0; column < columns - 1; column++) {
29
+ const first = row * columns + column;
30
+ indices[corner++] = first;
31
+ indices[corner++] = first + columns + 1;
32
+ indices[corner++] = first + 1;
33
+ indices[corner++] = first;
34
+ indices[corner++] = first + columns;
35
+ indices[corner++] = first + columns + 1;
36
+ }
37
+ }
38
+ }
39
+ //# sourceMappingURL=_generator-kit.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"_generator-kit.js","sourceRoot":"","sources":["../../src/mesh/_generator-kit.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,iBAAiB,EAAE,MAAM,cAAc,CAAC;AAEhE,OAAO,EAAuB,gBAAgB,EAAE,MAAM,YAAY,CAAC;AAEnE,iFAAiF;AACjF,MAAM,UAAU,aAAa,CAC5B,WAAmB,EACnB,aAAqB;IAErB,OAAO;QACN,SAAS,EAAE,IAAI,YAAY,CAAC,WAAW,GAAG,CAAC,CAAC;QAC5C,OAAO,EAAE,gBAAgB,CAAC,aAAa,GAAG,CAAC,EAAE,WAAW,CAAC;QACzD,OAAO,EAAE,IAAI,YAAY,CAAC,WAAW,GAAG,CAAC,CAAC;QAC1C,GAAG,EAAE,IAAI,YAAY,CAAC,WAAW,GAAG,CAAC,CAAC;KACtC,CAAC;AACH,CAAC;AAED,mDAAmD;AACnD,MAAM,UAAU,aAAa,CAC5B,IAAY,EACZ,MAAc,EACd,KAAa;IAEb,iBAAiB,CAAC,KAAK,EAAE,GAAG,IAAI,KAAK,MAAM,EAAE,CAAC,CAAC;AAChD,CAAC;AAED,MAAM,UAAU,eAAe,CAC9B,IAAY,EACZ,MAAc,EACd,KAAa,EACb,OAAe;IAEf,aAAa,CAAC,KAAK,EAAE,GAAG,IAAI,KAAK,MAAM,EAAE,EAAE,OAAO,CAAC,CAAC;AACrD,CAAC;AAED;;;;;GAKG;AACH,MAAM,UAAU,gBAAgB,CAC/B,OAAkC,EAClC,OAAe,EACf,IAAY;IAEZ,IAAI,MAAM,GAAG,CAAC,CAAC;IACf,KAAK,IAAI,GAAG,GAAG,CAAC,EAAE,GAAG,GAAG,IAAI,GAAG,CAAC,EAAE,GAAG,EAAE,EAAE,CAAC;QACzC,KAAK,IAAI,MAAM,GAAG,CAAC,EAAE,MAAM,GAAG,OAAO,GAAG,CAAC,EAAE,MAAM,EAAE,EAAE,CAAC;YACrD,MAAM,KAAK,GAAG,GAAG,GAAG,OAAO,GAAG,MAAM,CAAC;YACrC,OAAO,CAAC,MAAM,EAAE,CAAC,GAAG,KAAK,CAAC;YAC1B,OAAO,CAAC,MAAM,EAAE,CAAC,GAAG,KAAK,GAAG,OAAO,GAAG,CAAC,CAAC;YACxC,OAAO,CAAC,MAAM,EAAE,CAAC,GAAG,KAAK,GAAG,CAAC,CAAC;YAC9B,OAAO,CAAC,MAAM,EAAE,CAAC,GAAG,KAAK,CAAC;YAC1B,OAAO,CAAC,MAAM,EAAE,CAAC,GAAG,KAAK,GAAG,OAAO,CAAC;YACpC,OAAO,CAAC,MAAM,EAAE,CAAC,GAAG,KAAK,GAAG,OAAO,GAAG,CAAC,CAAC;QACzC,CAAC;IACF,CAAC;AACF,CAAC"}
@@ -0,0 +1,85 @@
1
+ import { type ReadonlyMat4x4, type Vec3 } from "@ac-kit/math-linear";
2
+ import type { ReadonlyRay3 } from "../ray3-record.js";
3
+ /**
4
+ * The `Uint16Array` twin of the area-weighted vertex normals: the public
5
+ * function checks the lengths and dispatches on the index type once. Writes
6
+ * `positions.length` numbers into `out`. Each face adds its cross product,
7
+ * twice its area times its unit normal (`faceCross_`: within 2^−49 of its
8
+ * largest component, zero only for a degenerate face). While every face's
9
+ * product is plain (k = 0, its largest component in [2^−400, 2^402)), the sums
10
+ * are those products' as they come; otherwise a first pass finds, per vertex,
11
+ * the largest product among its faces, and each face adds its product scaled by
12
+ * the power of two that brings that vertex's largest to [1, 2): the weights
13
+ * keep their ratios, nothing overflows, and a vertex whose faces are all tiny
14
+ * beside other vertices' still gets its normal. Each sum keeps a running bound
15
+ * on its rounding errors (Higham, "Accuracy and Stability of Numerical
16
+ * Algorithms", §4.2: within u/(1 − u) of the partial sums' magnitudes, u =
17
+ * 2^−53); a vertex whose bound is not within 2^−50 of its largest component
18
+ * (its faces cancel, or it has very many) is summed again exactly
19
+ * (`exactVertexSums_`). O(vertices + triangles); no allocation once the
20
+ * per-vertex scratch has grown to the largest mesh.
21
+ */
22
+ export declare function mesh3VertexNormalsU16(out: Float64Array, positions: Float64Array, indices: Uint16Array): void;
23
+ /**
24
+ * The `Uint16Array` twin of the face normals: one unit normal per triangle, the
25
+ * zero vector for a degenerate one. O(triangles).
26
+ */
27
+ export declare function mesh3FaceNormalsU16(out: Float64Array, positions: Float64Array, indices: Uint16Array): void;
28
+ /**
29
+ * The `Uint16Array` twin of the surface area: each face's area from its edges
30
+ * and cross product scaled by powers of two (`faceArea_`), so no square
31
+ * overflows or underflows at any size or distance from the origin, rounded once
32
+ * per face and summed exactly: the same number in every face order.
33
+ * O(triangles), no allocation.
34
+ */
35
+ export declare function mesh3SurfaceAreaU16(positions: Float64Array, indices: Uint16Array): number;
36
+ /**
37
+ * The `Uint16Array` twin of the signed volume: six times it is `Σ (a − o) · ((b
38
+ * − a) × (c − a))` over the faces, o being the frame's anchor (any point gives
39
+ * the same volume for a closed mesh). The sum is a determinant per face, so
40
+ * each axis may take its own power-of-two scale: the frame brings every axis's
41
+ * extent below 1, then a first pass over the faces bounds their terms and one
42
+ * common power of two brings the largest near 2^1000, so that no product
43
+ * overflows and small faces keep their digits, however thin, wide or far from
44
+ * the origin the mesh is. Each face's term is then written as exact products:
45
+ * `a − o` as TwoSum's pair, the cross product as an expansion (each component
46
+ * two products and their rounding errors, Ogita, Rump & Oishi's TwoProduct),
47
+ * and the whole summed exactly (`PreciseSum`). With the face-local edge
48
+ * differences exact, which they are wherever a face is small beside its
49
+ * distance from the origin (Sterbenz), the result is six times the volume
50
+ * rounded once, then divided by 6: the same number in every face order and at
51
+ * every offset, and a vertex no triangle uses is never read. A term below about
52
+ * 2^−1900 of the largest may lose digits to the subnormal range; so may a
53
+ * volume that small beside the largest term. O(triangles), no allocation.
54
+ */
55
+ export declare function mesh3VolumeU16(positions: Float64Array, indices: Uint16Array): number;
56
+ /**
57
+ * The `Uint16Array` twin of the surface centroid: `o + Σ A · (a + b + c − 3o) /
58
+ * 3` over `Σ A`, o being the frame's anchor and A each face's doubled area
59
+ * (`faceArea_`), scaled by one power of two that brings the largest near 1, so
60
+ * no weight overflows and only one below 2^−1070 of the largest is lost. Every
61
+ * corner minus o is TwoSum's exact pair scaled into the frame per axis, every
62
+ * product split exactly (TwoProduct) and every sum exact (`PreciseSum`), so the
63
+ * result is the same in every face order, nothing overflows at any size or
64
+ * distance from the origin, and a vertex no triangle uses is never read. A zero
65
+ * total area divides zero by zero: `NaN`. O(triangles), no allocation.
66
+ */
67
+ export declare function mesh3CentroidU16(out: Vec3, positions: Float64Array, indices: Uint16Array): void;
68
+ /**
69
+ * The `Uint16Array` twin of the nearest ray hit: the triangle index, `−1` for a
70
+ * miss; `out` is `[t, u, v]`, `NaN` for a miss. O(triangles).
71
+ */
72
+ export declare function mesh3IntersectRay3U16(out: Vec3, ray: ReadonlyRay3, positions: Float64Array, indices: Uint16Array, cullBackFaces: boolean): number;
73
+ /**
74
+ * The `Uint16Array` twin of the triangle depths: `z / w` of each triangle's
75
+ * centroid under `viewProjection`. A centroid whose coordinates overflow when
76
+ * summed takes halves; one whose transformed z or w overflows is scaled by a
77
+ * power of two first, which leaves `z / w` unchanged. O(triangles).
78
+ */
79
+ export declare function mesh3TriangleDepthsU16(out: Float64Array, positions: Float64Array, indices: Uint16Array, viewProjection: ReadonlyMat4x4): void;
80
+ /**
81
+ * The `Uint16Array` twin of the triangle reordering: triangle `order[k]` of
82
+ * `indices` becomes triangle `k` of `out`. O(triangles).
83
+ */
84
+ export declare function mesh3ReorderTrianglesU16(out: Uint16Array, indices: Uint16Array, order: Uint32Array): void;
85
+ //# sourceMappingURL=_index-kernels-u16.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"_index-kernels-u16.d.ts","sourceRoot":"","sources":["../../src/mesh/_index-kernels-u16.ts"],"names":[],"mappings":"AAOA,OAAO,EACN,KAAK,cAAc,EACnB,KAAK,IAAI,EAGT,MAAM,qBAAqB,CAAC;AAW7B,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AAiFtD;;;;;;;;;;;;;;;;;;GAkBG;AACH,wBAAgB,qBAAqB,CACpC,GAAG,EAAE,YAAY,EACjB,SAAS,EAAE,YAAY,EACvB,OAAO,EAAE,WAAW,GAClB,IAAI,CAkFN;AAgPD;;;GAGG;AACH,wBAAgB,mBAAmB,CAClC,GAAG,EAAE,YAAY,EACjB,SAAS,EAAE,YAAY,EACvB,OAAO,EAAE,WAAW,GAClB,IAAI,CAmBN;AAuND;;;;;;GAMG;AACH,wBAAgB,mBAAmB,CAClC,SAAS,EAAE,YAAY,EACvB,OAAO,EAAE,WAAW,GAClB,MAAM,CA0BR;AA+JD;;;;;;;;;;;;;;;;;;GAkBG;AACH,wBAAgB,cAAc,CAC7B,SAAS,EAAE,YAAY,EACvB,OAAO,EAAE,WAAW,GAClB,MAAM,CAqGR;AA4CD;;;;;;;;;;GAUG;AACH,wBAAgB,gBAAgB,CAC/B,GAAG,EAAE,IAAI,EACT,SAAS,EAAE,YAAY,EACvB,OAAO,EAAE,WAAW,GAClB,IAAI,CAoFN;AAED;;;GAGG;AACH,wBAAgB,qBAAqB,CACpC,GAAG,EAAE,IAAI,EACT,GAAG,EAAE,YAAY,EACjB,SAAS,EAAE,YAAY,EACvB,OAAO,EAAE,WAA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