@fimbul-works/vec 1.0.3 → 2.0.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 (560) hide show
  1. package/README.md +208 -85
  2. package/dist/cjs/2d/add-2d.d.ts +8 -0
  3. package/dist/cjs/2d/add-2d.js +11 -0
  4. package/dist/cjs/2d/angle-between-2d.d.ts +8 -0
  5. package/dist/cjs/2d/angle-between-2d.js +11 -0
  6. package/dist/cjs/2d/angle-x-2d.d.ts +7 -0
  7. package/dist/cjs/2d/angle-x-2d.js +10 -0
  8. package/dist/cjs/2d/angle-y-2d.d.ts +7 -0
  9. package/dist/cjs/2d/angle-y-2d.js +10 -0
  10. package/dist/cjs/2d/clamp-2d.d.ts +10 -0
  11. package/dist/cjs/2d/clamp-2d.js +14 -0
  12. package/dist/cjs/2d/clone-2d.d.ts +7 -0
  13. package/dist/cjs/2d/clone-2d.js +10 -0
  14. package/dist/cjs/2d/cross-2d.d.ts +8 -0
  15. package/dist/cjs/2d/cross-2d.js +11 -0
  16. package/dist/cjs/2d/distance-2d.d.ts +8 -0
  17. package/dist/cjs/2d/distance-2d.js +11 -0
  18. package/dist/cjs/2d/distance-chebyshev-2d.d.ts +8 -0
  19. package/dist/cjs/2d/distance-chebyshev-2d.js +15 -0
  20. package/dist/cjs/2d/distance-manhattan-2d.d.ts +8 -0
  21. package/dist/cjs/2d/distance-manhattan-2d.js +11 -0
  22. package/dist/cjs/2d/distance-minkowski-2d.d.ts +9 -0
  23. package/dist/cjs/2d/distance-minkowski-2d.js +12 -0
  24. package/dist/cjs/2d/distance-sq-2d.d.ts +8 -0
  25. package/dist/cjs/2d/distance-sq-2d.js +11 -0
  26. package/dist/cjs/2d/divide-2d.d.ts +8 -0
  27. package/dist/cjs/2d/divide-2d.js +14 -0
  28. package/dist/cjs/2d/dot-2d.d.ts +8 -0
  29. package/dist/cjs/2d/dot-2d.js +11 -0
  30. package/dist/cjs/2d/from-angle-x-2d.d.ts +8 -0
  31. package/dist/cjs/2d/from-angle-x-2d.js +14 -0
  32. package/dist/cjs/2d/from-angle-y-2d.d.ts +8 -0
  33. package/dist/cjs/2d/from-angle-y-2d.js +14 -0
  34. package/dist/cjs/2d/from-object-2d.d.ts +10 -0
  35. package/dist/cjs/2d/from-object-2d.js +10 -0
  36. package/dist/cjs/2d/from-polar-coords-2d.d.ts +8 -0
  37. package/dist/cjs/2d/from-polar-coords-2d.js +11 -0
  38. package/dist/cjs/2d/immutable-2d.d.ts +7 -0
  39. package/dist/cjs/2d/immutable-2d.js +10 -0
  40. package/dist/cjs/2d/index.d.ts +47 -0
  41. package/dist/cjs/2d/index.js +63 -0
  42. package/dist/cjs/2d/is-equal-2d.d.ts +8 -0
  43. package/dist/cjs/2d/is-equal-2d.js +11 -0
  44. package/dist/cjs/2d/is-equal-approx-2d.d.ts +9 -0
  45. package/dist/cjs/2d/is-equal-approx-2d.js +12 -0
  46. package/dist/cjs/2d/is-infinite-2d.d.ts +7 -0
  47. package/dist/cjs/2d/is-infinite-2d.js +13 -0
  48. package/dist/cjs/2d/is-nan-2d.d.ts +7 -0
  49. package/dist/cjs/2d/is-nan-2d.js +10 -0
  50. package/dist/cjs/2d/is-opposite-2d.d.ts +8 -0
  51. package/dist/cjs/2d/is-opposite-2d.js +11 -0
  52. package/dist/cjs/2d/is-zero-2d.d.ts +7 -0
  53. package/dist/cjs/2d/is-zero-2d.js +10 -0
  54. package/dist/cjs/2d/lerp-2d.d.ts +9 -0
  55. package/dist/cjs/2d/lerp-2d.js +15 -0
  56. package/dist/cjs/2d/limit-max-2d.d.ts +9 -0
  57. package/dist/cjs/2d/limit-max-2d.js +13 -0
  58. package/dist/cjs/2d/limit-min-2d.d.ts +9 -0
  59. package/dist/cjs/2d/limit-min-2d.js +13 -0
  60. package/dist/cjs/2d/look-at-2d.d.ts +10 -0
  61. package/dist/cjs/2d/look-at-2d.js +14 -0
  62. package/dist/cjs/2d/magnitude-2d.d.ts +7 -0
  63. package/dist/cjs/2d/magnitude-2d.js +10 -0
  64. package/dist/cjs/2d/magnitude-sq-2d.d.ts +7 -0
  65. package/dist/cjs/2d/magnitude-sq-2d.js +10 -0
  66. package/dist/cjs/2d/multiply-2d.d.ts +8 -0
  67. package/dist/cjs/2d/multiply-2d.js +11 -0
  68. package/dist/cjs/2d/negate-2d.d.ts +7 -0
  69. package/dist/cjs/2d/negate-2d.js +10 -0
  70. package/dist/cjs/2d/normalize-2d.d.ts +8 -0
  71. package/dist/cjs/2d/normalize-2d.js +12 -0
  72. package/dist/cjs/2d/one-2d.d.ts +6 -0
  73. package/dist/cjs/2d/one-2d.js +9 -0
  74. package/dist/cjs/2d/project-2d.d.ts +10 -0
  75. package/dist/cjs/2d/project-2d.js +17 -0
  76. package/dist/cjs/2d/random-2d.d.ts +7 -0
  77. package/dist/cjs/2d/random-2d.js +13 -0
  78. package/dist/cjs/2d/reflect-2d.d.ts +9 -0
  79. package/dist/cjs/2d/reflect-2d.js +16 -0
  80. package/dist/cjs/2d/rotate-2d.d.ts +9 -0
  81. package/dist/cjs/2d/rotate-2d.js +27 -0
  82. package/dist/cjs/2d/set-magnitude-2d.d.ts +9 -0
  83. package/dist/cjs/2d/set-magnitude-2d.js +16 -0
  84. package/dist/cjs/2d/subtract-2d.d.ts +8 -0
  85. package/dist/cjs/2d/subtract-2d.js +11 -0
  86. package/dist/cjs/2d/types.d.ts +4 -0
  87. package/dist/cjs/2d/types.js +2 -0
  88. package/dist/cjs/2d/zero-2d.d.ts +6 -0
  89. package/dist/cjs/2d/zero-2d.js +9 -0
  90. package/dist/cjs/3d/add-3d.d.ts +8 -0
  91. package/dist/cjs/3d/add-3d.js +15 -0
  92. package/dist/cjs/3d/angle-between-3d.d.ts +10 -0
  93. package/dist/cjs/3d/angle-between-3d.js +14 -0
  94. package/dist/cjs/3d/angle-x-3d.d.ts +7 -0
  95. package/dist/cjs/3d/angle-x-3d.js +10 -0
  96. package/dist/cjs/3d/angle-y-3d.d.ts +7 -0
  97. package/dist/cjs/3d/angle-y-3d.js +10 -0
  98. package/dist/cjs/3d/angle-z-3d.d.ts +7 -0
  99. package/dist/cjs/3d/angle-z-3d.js +10 -0
  100. package/dist/cjs/3d/clamp-3d.d.ts +10 -0
  101. package/dist/cjs/3d/clamp-3d.js +18 -0
  102. package/dist/cjs/3d/clone-3d.d.ts +7 -0
  103. package/dist/cjs/3d/clone-3d.js +10 -0
  104. package/dist/cjs/3d/cross-3d.d.ts +8 -0
  105. package/dist/cjs/3d/cross-3d.js +15 -0
  106. package/dist/cjs/3d/distance-3d.d.ts +8 -0
  107. package/dist/cjs/3d/distance-3d.js +11 -0
  108. package/dist/cjs/3d/distance-chebyshev-3d.d.ts +8 -0
  109. package/dist/cjs/3d/distance-chebyshev-3d.js +16 -0
  110. package/dist/cjs/3d/distance-manhattan-3d.d.ts +8 -0
  111. package/dist/cjs/3d/distance-manhattan-3d.js +11 -0
  112. package/dist/cjs/3d/distance-minkowski-3d.d.ts +9 -0
  113. package/dist/cjs/3d/distance-minkowski-3d.js +12 -0
  114. package/dist/cjs/3d/distance-sq-3d.d.ts +8 -0
  115. package/dist/cjs/3d/distance-sq-3d.js +11 -0
  116. package/dist/cjs/3d/divide-3d.d.ts +8 -0
  117. package/dist/cjs/3d/divide-3d.js +15 -0
  118. package/dist/cjs/3d/dot-3d.d.ts +8 -0
  119. package/dist/cjs/3d/dot-3d.js +11 -0
  120. package/dist/cjs/3d/from-cylindrical-coords-3d.d.ts +9 -0
  121. package/dist/cjs/3d/from-cylindrical-coords-3d.js +16 -0
  122. package/dist/cjs/3d/from-object-3d.d.ts +11 -0
  123. package/dist/cjs/3d/from-object-3d.js +10 -0
  124. package/dist/cjs/3d/from-spherical-coords-3d.d.ts +9 -0
  125. package/dist/cjs/3d/from-spherical-coords-3d.js +16 -0
  126. package/dist/cjs/3d/immutable-3d.d.ts +7 -0
  127. package/dist/cjs/3d/immutable-3d.js +10 -0
  128. package/dist/cjs/3d/index.d.ts +49 -0
  129. package/dist/cjs/3d/index.js +65 -0
  130. package/dist/cjs/3d/is-equal-3d.d.ts +8 -0
  131. package/dist/cjs/3d/is-equal-3d.js +11 -0
  132. package/dist/cjs/3d/is-equal-approx-3d.d.ts +9 -0
  133. package/dist/cjs/3d/is-equal-approx-3d.js +14 -0
  134. package/dist/cjs/3d/is-infinite-3d.d.ts +7 -0
  135. package/dist/cjs/3d/is-infinite-3d.js +15 -0
  136. package/dist/cjs/3d/is-nan-3d.d.ts +7 -0
  137. package/dist/cjs/3d/is-nan-3d.js +10 -0
  138. package/dist/cjs/3d/is-opposite-3d.d.ts +8 -0
  139. package/dist/cjs/3d/is-opposite-3d.js +11 -0
  140. package/dist/cjs/3d/is-zero-3d.d.ts +7 -0
  141. package/dist/cjs/3d/is-zero-3d.js +10 -0
  142. package/dist/cjs/3d/lerp-3d.d.ts +9 -0
  143. package/dist/cjs/3d/lerp-3d.js +16 -0
  144. package/dist/cjs/3d/limit-max-3d.d.ts +9 -0
  145. package/dist/cjs/3d/limit-max-3d.js +13 -0
  146. package/dist/cjs/3d/limit-min-3d.d.ts +9 -0
  147. package/dist/cjs/3d/limit-min-3d.js +13 -0
  148. package/dist/cjs/3d/look-at-3d.d.ts +10 -0
  149. package/dist/cjs/3d/look-at-3d.js +14 -0
  150. package/dist/cjs/3d/magnitude-3d.d.ts +7 -0
  151. package/dist/cjs/3d/magnitude-3d.js +10 -0
  152. package/dist/cjs/3d/magnitude-sq-3d.d.ts +7 -0
  153. package/dist/cjs/3d/magnitude-sq-3d.js +10 -0
  154. package/dist/cjs/3d/multiply-3d.d.ts +8 -0
  155. package/dist/cjs/3d/multiply-3d.js +15 -0
  156. package/dist/cjs/3d/negate-3d.d.ts +7 -0
  157. package/dist/cjs/3d/negate-3d.js +10 -0
  158. package/dist/cjs/3d/normalize-3d.d.ts +8 -0
  159. package/dist/cjs/3d/normalize-3d.js +12 -0
  160. package/dist/cjs/3d/one-3d.d.ts +6 -0
  161. package/dist/cjs/3d/one-3d.js +9 -0
  162. package/dist/cjs/3d/project-3d.d.ts +10 -0
  163. package/dist/cjs/3d/project-3d.js +17 -0
  164. package/dist/cjs/3d/random-3d.d.ts +7 -0
  165. package/dist/cjs/3d/random-3d.js +11 -0
  166. package/dist/cjs/3d/reflect-3d.d.ts +9 -0
  167. package/dist/cjs/3d/reflect-3d.js +16 -0
  168. package/dist/cjs/3d/rotate-x-3d.d.ts +9 -0
  169. package/dist/cjs/3d/rotate-x-3d.js +26 -0
  170. package/dist/cjs/3d/rotate-y-3d.d.ts +9 -0
  171. package/dist/cjs/3d/rotate-y-3d.js +26 -0
  172. package/dist/cjs/3d/rotate-z-3d.d.ts +9 -0
  173. package/dist/cjs/3d/rotate-z-3d.js +26 -0
  174. package/dist/cjs/3d/set-magnitude-3d.d.ts +9 -0
  175. package/dist/cjs/3d/set-magnitude-3d.js +13 -0
  176. package/dist/cjs/3d/subtract-3d.d.ts +8 -0
  177. package/dist/cjs/3d/subtract-3d.js +15 -0
  178. package/dist/cjs/3d/types.d.ts +4 -0
  179. package/dist/cjs/3d/types.js +2 -0
  180. package/dist/cjs/3d/zero-3d.d.ts +6 -0
  181. package/dist/cjs/3d/zero-3d.js +9 -0
  182. package/dist/cjs/4d/add-4d.d.ts +8 -0
  183. package/dist/cjs/4d/add-4d.js +16 -0
  184. package/dist/cjs/4d/angle-between-4d.d.ts +10 -0
  185. package/dist/cjs/4d/angle-between-4d.js +15 -0
  186. package/dist/cjs/4d/angle-w-4d.d.ts +7 -0
  187. package/dist/cjs/4d/angle-w-4d.js +10 -0
  188. package/dist/cjs/4d/angle-x-4d.d.ts +7 -0
  189. package/dist/cjs/4d/angle-x-4d.js +10 -0
  190. package/dist/cjs/4d/angle-y-4d.d.ts +7 -0
  191. package/dist/cjs/4d/angle-y-4d.js +10 -0
  192. package/dist/cjs/4d/angle-z-4d.d.ts +7 -0
  193. package/dist/cjs/4d/angle-z-4d.js +10 -0
  194. package/dist/cjs/4d/clamp-4d.d.ts +10 -0
  195. package/dist/cjs/4d/clamp-4d.js +18 -0
  196. package/dist/cjs/4d/clone-4d.d.ts +7 -0
  197. package/dist/cjs/4d/clone-4d.js +10 -0
  198. package/dist/cjs/4d/distance-4d.d.ts +8 -0
  199. package/dist/cjs/4d/distance-4d.js +11 -0
  200. package/dist/cjs/4d/distance-chebyshev-4d.d.ts +8 -0
  201. package/dist/cjs/4d/distance-chebyshev-4d.js +23 -0
  202. package/dist/cjs/4d/distance-manhattan-4d.d.ts +8 -0
  203. package/dist/cjs/4d/distance-manhattan-4d.js +14 -0
  204. package/dist/cjs/4d/distance-minkowski-4d.d.ts +9 -0
  205. package/dist/cjs/4d/distance-minkowski-4d.js +16 -0
  206. package/dist/cjs/4d/distance-sq-4d.d.ts +9 -0
  207. package/dist/cjs/4d/distance-sq-4d.js +12 -0
  208. package/dist/cjs/4d/divide-4d.d.ts +8 -0
  209. package/dist/cjs/4d/divide-4d.js +16 -0
  210. package/dist/cjs/4d/dot-4d.d.ts +8 -0
  211. package/dist/cjs/4d/dot-4d.js +11 -0
  212. package/dist/cjs/4d/from-object-4d.d.ts +12 -0
  213. package/dist/cjs/4d/from-object-4d.js +15 -0
  214. package/dist/cjs/4d/immutable-4d.d.ts +7 -0
  215. package/dist/cjs/4d/immutable-4d.js +10 -0
  216. package/dist/cjs/4d/index.d.ts +44 -0
  217. package/dist/cjs/4d/index.js +60 -0
  218. package/dist/cjs/4d/is-equal-4d.d.ts +8 -0
  219. package/dist/cjs/4d/is-equal-4d.js +11 -0
  220. package/dist/cjs/4d/is-equal-approx-4d.d.ts +9 -0
  221. package/dist/cjs/4d/is-equal-approx-4d.js +15 -0
  222. package/dist/cjs/4d/is-infinite-4d.d.ts +7 -0
  223. package/dist/cjs/4d/is-infinite-4d.js +17 -0
  224. package/dist/cjs/4d/is-nan-4d.d.ts +7 -0
  225. package/dist/cjs/4d/is-nan-4d.js +10 -0
  226. package/dist/cjs/4d/is-opposite-4d.d.ts +8 -0
  227. package/dist/cjs/4d/is-opposite-4d.js +11 -0
  228. package/dist/cjs/4d/is-zero-4d.d.ts +7 -0
  229. package/dist/cjs/4d/is-zero-4d.js +10 -0
  230. package/dist/cjs/4d/lerp-4d.d.ts +9 -0
  231. package/dist/cjs/4d/lerp-4d.js +17 -0
  232. package/dist/cjs/4d/limit-max-4d.d.ts +9 -0
  233. package/dist/cjs/4d/limit-max-4d.js +13 -0
  234. package/dist/cjs/4d/limit-min-4d.d.ts +9 -0
  235. package/dist/cjs/4d/limit-min-4d.js +13 -0
  236. package/dist/cjs/4d/look-at-4d.d.ts +10 -0
  237. package/dist/cjs/4d/look-at-4d.js +14 -0
  238. package/dist/cjs/4d/magnitude-4d.d.ts +7 -0
  239. package/dist/cjs/4d/magnitude-4d.js +10 -0
  240. package/dist/cjs/4d/magnitude-sq-4d.d.ts +8 -0
  241. package/dist/cjs/4d/magnitude-sq-4d.js +11 -0
  242. package/dist/cjs/4d/multiply-4d.d.ts +8 -0
  243. package/dist/cjs/4d/multiply-4d.js +16 -0
  244. package/dist/cjs/4d/negate-4d.d.ts +7 -0
  245. package/dist/cjs/4d/negate-4d.js +10 -0
  246. package/dist/cjs/4d/normalize-4d.d.ts +8 -0
  247. package/dist/cjs/4d/normalize-4d.js +17 -0
  248. package/dist/cjs/4d/one-4d.d.ts +6 -0
  249. package/dist/cjs/4d/one-4d.js +9 -0
  250. package/dist/cjs/4d/project-4d.d.ts +10 -0
  251. package/dist/cjs/4d/project-4d.js +18 -0
  252. package/dist/cjs/4d/random-4d.d.ts +7 -0
  253. package/dist/cjs/4d/random-4d.js +21 -0
  254. package/dist/cjs/4d/reflect-4d.d.ts +9 -0
  255. package/dist/cjs/4d/reflect-4d.js +21 -0
  256. package/dist/cjs/4d/set-magnitude-4d.d.ts +9 -0
  257. package/dist/cjs/4d/set-magnitude-4d.js +18 -0
  258. package/dist/cjs/4d/subtract-4d.d.ts +8 -0
  259. package/dist/cjs/4d/subtract-4d.js +16 -0
  260. package/dist/cjs/4d/types.d.ts +4 -0
  261. package/dist/cjs/4d/types.js +2 -0
  262. package/dist/cjs/4d/zero-4d.d.ts +6 -0
  263. package/dist/cjs/4d/zero-4d.js +9 -0
  264. package/dist/cjs/index.d.ts +7 -0
  265. package/dist/cjs/index.js +23 -0
  266. package/dist/cjs/package.json +1 -0
  267. package/dist/cjs/slerp.d.ts +21 -0
  268. package/dist/cjs/slerp.js +28 -0
  269. package/dist/{vec2.d.ts → cjs/vec2.d.ts} +10 -4
  270. package/dist/cjs/vec2.js +889 -0
  271. package/dist/{vec3.d.ts → cjs/vec3.d.ts} +159 -100
  272. package/dist/cjs/vec3.js +1045 -0
  273. package/dist/cjs/vec4.d.ts +602 -0
  274. package/dist/cjs/vec4.js +1101 -0
  275. package/dist/esm/2d/add-2d.d.ts +8 -0
  276. package/dist/esm/2d/add-2d.js +7 -0
  277. package/dist/esm/2d/angle-between-2d.d.ts +8 -0
  278. package/dist/esm/2d/angle-between-2d.js +7 -0
  279. package/dist/esm/2d/angle-x-2d.d.ts +7 -0
  280. package/dist/esm/2d/angle-x-2d.js +6 -0
  281. package/dist/esm/2d/angle-y-2d.d.ts +7 -0
  282. package/dist/esm/2d/angle-y-2d.js +6 -0
  283. package/dist/esm/2d/clamp-2d.d.ts +10 -0
  284. package/dist/esm/2d/clamp-2d.js +10 -0
  285. package/dist/esm/2d/clone-2d.d.ts +7 -0
  286. package/dist/esm/2d/clone-2d.js +6 -0
  287. package/dist/esm/2d/cross-2d.d.ts +8 -0
  288. package/dist/esm/2d/cross-2d.js +7 -0
  289. package/dist/esm/2d/distance-2d.d.ts +8 -0
  290. package/dist/esm/2d/distance-2d.js +7 -0
  291. package/dist/esm/2d/distance-chebyshev-2d.d.ts +8 -0
  292. package/dist/esm/2d/distance-chebyshev-2d.js +11 -0
  293. package/dist/esm/2d/distance-manhattan-2d.d.ts +8 -0
  294. package/dist/esm/2d/distance-manhattan-2d.js +7 -0
  295. package/dist/esm/2d/distance-minkowski-2d.d.ts +9 -0
  296. package/dist/esm/2d/distance-minkowski-2d.js +8 -0
  297. package/dist/esm/2d/distance-sq-2d.d.ts +8 -0
  298. package/dist/esm/2d/distance-sq-2d.js +7 -0
  299. package/dist/esm/2d/divide-2d.d.ts +8 -0
  300. package/dist/esm/2d/divide-2d.js +10 -0
  301. package/dist/esm/2d/dot-2d.d.ts +8 -0
  302. package/dist/esm/2d/dot-2d.js +7 -0
  303. package/dist/esm/2d/from-angle-x-2d.d.ts +8 -0
  304. package/dist/esm/2d/from-angle-x-2d.js +10 -0
  305. package/dist/esm/2d/from-angle-y-2d.d.ts +8 -0
  306. package/dist/esm/2d/from-angle-y-2d.js +10 -0
  307. package/dist/esm/2d/from-object-2d.d.ts +10 -0
  308. package/dist/esm/2d/from-object-2d.js +6 -0
  309. package/dist/esm/2d/from-polar-coords-2d.d.ts +8 -0
  310. package/dist/esm/2d/from-polar-coords-2d.js +7 -0
  311. package/dist/esm/2d/immutable-2d.d.ts +7 -0
  312. package/dist/esm/2d/immutable-2d.js +6 -0
  313. package/dist/esm/2d/index.d.ts +47 -0
  314. package/dist/esm/2d/index.js +47 -0
  315. package/dist/esm/2d/is-equal-2d.d.ts +8 -0
  316. package/dist/esm/2d/is-equal-2d.js +7 -0
  317. package/dist/esm/2d/is-equal-approx-2d.d.ts +9 -0
  318. package/dist/esm/2d/is-equal-approx-2d.js +8 -0
  319. package/dist/esm/2d/is-infinite-2d.d.ts +7 -0
  320. package/dist/esm/2d/is-infinite-2d.js +9 -0
  321. package/dist/esm/2d/is-nan-2d.d.ts +7 -0
  322. package/dist/esm/2d/is-nan-2d.js +6 -0
  323. package/dist/esm/2d/is-opposite-2d.d.ts +8 -0
  324. package/dist/esm/2d/is-opposite-2d.js +7 -0
  325. package/dist/esm/2d/is-zero-2d.d.ts +7 -0
  326. package/dist/esm/2d/is-zero-2d.js +6 -0
  327. package/dist/esm/2d/lerp-2d.d.ts +9 -0
  328. package/dist/esm/2d/lerp-2d.js +11 -0
  329. package/dist/esm/2d/limit-max-2d.d.ts +9 -0
  330. package/dist/esm/2d/limit-max-2d.js +9 -0
  331. package/dist/esm/2d/limit-min-2d.d.ts +9 -0
  332. package/dist/esm/2d/limit-min-2d.js +9 -0
  333. package/dist/esm/2d/look-at-2d.d.ts +10 -0
  334. package/dist/esm/2d/look-at-2d.js +10 -0
  335. package/dist/esm/2d/magnitude-2d.d.ts +7 -0
  336. package/dist/esm/2d/magnitude-2d.js +6 -0
  337. package/dist/esm/2d/magnitude-sq-2d.d.ts +7 -0
  338. package/dist/esm/2d/magnitude-sq-2d.js +6 -0
  339. package/dist/esm/2d/multiply-2d.d.ts +8 -0
  340. package/dist/esm/2d/multiply-2d.js +7 -0
  341. package/dist/esm/2d/negate-2d.d.ts +7 -0
  342. package/dist/esm/2d/negate-2d.js +6 -0
  343. package/dist/esm/2d/normalize-2d.d.ts +8 -0
  344. package/dist/esm/2d/normalize-2d.js +8 -0
  345. package/dist/esm/2d/one-2d.d.ts +6 -0
  346. package/dist/esm/2d/one-2d.js +5 -0
  347. package/dist/esm/2d/project-2d.d.ts +10 -0
  348. package/dist/esm/2d/project-2d.js +13 -0
  349. package/dist/esm/2d/random-2d.d.ts +7 -0
  350. package/dist/esm/2d/random-2d.js +9 -0
  351. package/dist/esm/2d/reflect-2d.d.ts +9 -0
  352. package/dist/esm/2d/reflect-2d.js +12 -0
  353. package/dist/esm/2d/rotate-2d.d.ts +9 -0
  354. package/dist/esm/2d/rotate-2d.js +23 -0
  355. package/dist/esm/2d/set-magnitude-2d.d.ts +9 -0
  356. package/dist/esm/2d/set-magnitude-2d.js +12 -0
  357. package/dist/esm/2d/subtract-2d.d.ts +8 -0
  358. package/dist/esm/2d/subtract-2d.js +7 -0
  359. package/dist/esm/2d/types.d.ts +4 -0
  360. package/dist/esm/2d/types.js +1 -0
  361. package/dist/esm/2d/zero-2d.d.ts +6 -0
  362. package/dist/esm/2d/zero-2d.js +5 -0
  363. package/dist/esm/3d/add-3d.d.ts +8 -0
  364. package/dist/esm/3d/add-3d.js +11 -0
  365. package/dist/esm/3d/angle-between-3d.d.ts +10 -0
  366. package/dist/esm/3d/angle-between-3d.js +10 -0
  367. package/dist/esm/3d/angle-x-3d.d.ts +7 -0
  368. package/dist/esm/3d/angle-x-3d.js +6 -0
  369. package/dist/esm/3d/angle-y-3d.d.ts +7 -0
  370. package/dist/esm/3d/angle-y-3d.js +6 -0
  371. package/dist/esm/3d/angle-z-3d.d.ts +7 -0
  372. package/dist/esm/3d/angle-z-3d.js +6 -0
  373. package/dist/esm/3d/clamp-3d.d.ts +10 -0
  374. package/dist/esm/3d/clamp-3d.js +14 -0
  375. package/dist/esm/3d/clone-3d.d.ts +7 -0
  376. package/dist/esm/3d/clone-3d.js +6 -0
  377. package/dist/esm/3d/cross-3d.d.ts +8 -0
  378. package/dist/esm/3d/cross-3d.js +11 -0
  379. package/dist/esm/3d/distance-3d.d.ts +8 -0
  380. package/dist/esm/3d/distance-3d.js +7 -0
  381. package/dist/esm/3d/distance-chebyshev-3d.d.ts +8 -0
  382. package/dist/esm/3d/distance-chebyshev-3d.js +12 -0
  383. package/dist/esm/3d/distance-manhattan-3d.d.ts +8 -0
  384. package/dist/esm/3d/distance-manhattan-3d.js +7 -0
  385. package/dist/esm/3d/distance-minkowski-3d.d.ts +9 -0
  386. package/dist/esm/3d/distance-minkowski-3d.js +8 -0
  387. package/dist/esm/3d/distance-sq-3d.d.ts +8 -0
  388. package/dist/esm/3d/distance-sq-3d.js +7 -0
  389. package/dist/esm/3d/divide-3d.d.ts +8 -0
  390. package/dist/esm/3d/divide-3d.js +11 -0
  391. package/dist/esm/3d/dot-3d.d.ts +8 -0
  392. package/dist/esm/3d/dot-3d.js +7 -0
  393. package/dist/esm/3d/from-cylindrical-coords-3d.d.ts +9 -0
  394. package/dist/esm/3d/from-cylindrical-coords-3d.js +12 -0
  395. package/dist/esm/3d/from-object-3d.d.ts +11 -0
  396. package/dist/esm/3d/from-object-3d.js +6 -0
  397. package/dist/esm/3d/from-spherical-coords-3d.d.ts +9 -0
  398. package/dist/esm/3d/from-spherical-coords-3d.js +12 -0
  399. package/dist/esm/3d/immutable-3d.d.ts +7 -0
  400. package/dist/esm/3d/immutable-3d.js +6 -0
  401. package/dist/esm/3d/index.d.ts +49 -0
  402. package/dist/esm/3d/index.js +49 -0
  403. package/dist/esm/3d/is-equal-3d.d.ts +8 -0
  404. package/dist/esm/3d/is-equal-3d.js +7 -0
  405. package/dist/esm/3d/is-equal-approx-3d.d.ts +9 -0
  406. package/dist/esm/3d/is-equal-approx-3d.js +10 -0
  407. package/dist/esm/3d/is-infinite-3d.d.ts +7 -0
  408. package/dist/esm/3d/is-infinite-3d.js +11 -0
  409. package/dist/esm/3d/is-nan-3d.d.ts +7 -0
  410. package/dist/esm/3d/is-nan-3d.js +6 -0
  411. package/dist/esm/3d/is-opposite-3d.d.ts +8 -0
  412. package/dist/esm/3d/is-opposite-3d.js +7 -0
  413. package/dist/esm/3d/is-zero-3d.d.ts +7 -0
  414. package/dist/esm/3d/is-zero-3d.js +6 -0
  415. package/dist/esm/3d/lerp-3d.d.ts +9 -0
  416. package/dist/esm/3d/lerp-3d.js +12 -0
  417. package/dist/esm/3d/limit-max-3d.d.ts +9 -0
  418. package/dist/esm/3d/limit-max-3d.js +9 -0
  419. package/dist/esm/3d/limit-min-3d.d.ts +9 -0
  420. package/dist/esm/3d/limit-min-3d.js +9 -0
  421. package/dist/esm/3d/look-at-3d.d.ts +10 -0
  422. package/dist/esm/3d/look-at-3d.js +10 -0
  423. package/dist/esm/3d/magnitude-3d.d.ts +7 -0
  424. package/dist/esm/3d/magnitude-3d.js +6 -0
  425. package/dist/esm/3d/magnitude-sq-3d.d.ts +7 -0
  426. package/dist/esm/3d/magnitude-sq-3d.js +6 -0
  427. package/dist/esm/3d/multiply-3d.d.ts +8 -0
  428. package/dist/esm/3d/multiply-3d.js +11 -0
  429. package/dist/esm/3d/negate-3d.d.ts +7 -0
  430. package/dist/esm/3d/negate-3d.js +6 -0
  431. package/dist/esm/3d/normalize-3d.d.ts +8 -0
  432. package/dist/esm/3d/normalize-3d.js +8 -0
  433. package/dist/esm/3d/one-3d.d.ts +6 -0
  434. package/dist/esm/3d/one-3d.js +5 -0
  435. package/dist/esm/3d/project-3d.d.ts +10 -0
  436. package/dist/esm/3d/project-3d.js +13 -0
  437. package/dist/esm/3d/random-3d.d.ts +7 -0
  438. package/dist/esm/3d/random-3d.js +7 -0
  439. package/dist/esm/3d/reflect-3d.d.ts +9 -0
  440. package/dist/esm/3d/reflect-3d.js +12 -0
  441. package/dist/esm/3d/rotate-x-3d.d.ts +9 -0
  442. package/dist/esm/3d/rotate-x-3d.js +22 -0
  443. package/dist/esm/3d/rotate-y-3d.d.ts +9 -0
  444. package/dist/esm/3d/rotate-y-3d.js +22 -0
  445. package/dist/esm/3d/rotate-z-3d.d.ts +9 -0
  446. package/dist/esm/3d/rotate-z-3d.js +22 -0
  447. package/dist/esm/3d/set-magnitude-3d.d.ts +9 -0
  448. package/dist/esm/3d/set-magnitude-3d.js +9 -0
  449. package/dist/esm/3d/subtract-3d.d.ts +8 -0
  450. package/dist/esm/3d/subtract-3d.js +11 -0
  451. package/dist/esm/3d/types.d.ts +4 -0
  452. package/dist/esm/3d/types.js +1 -0
  453. package/dist/esm/3d/zero-3d.d.ts +6 -0
  454. package/dist/esm/3d/zero-3d.js +5 -0
  455. package/dist/esm/4d/add-4d.d.ts +8 -0
  456. package/dist/esm/4d/add-4d.js +12 -0
  457. package/dist/esm/4d/angle-between-4d.d.ts +10 -0
  458. package/dist/esm/4d/angle-between-4d.js +11 -0
  459. package/dist/esm/4d/angle-w-4d.d.ts +7 -0
  460. package/dist/esm/4d/angle-w-4d.js +6 -0
  461. package/dist/esm/4d/angle-x-4d.d.ts +7 -0
  462. package/dist/esm/4d/angle-x-4d.js +6 -0
  463. package/dist/esm/4d/angle-y-4d.d.ts +7 -0
  464. package/dist/esm/4d/angle-y-4d.js +6 -0
  465. package/dist/esm/4d/angle-z-4d.d.ts +7 -0
  466. package/dist/esm/4d/angle-z-4d.js +6 -0
  467. package/dist/esm/4d/clamp-4d.d.ts +10 -0
  468. package/dist/esm/4d/clamp-4d.js +14 -0
  469. package/dist/esm/4d/clone-4d.d.ts +7 -0
  470. package/dist/esm/4d/clone-4d.js +6 -0
  471. package/dist/esm/4d/distance-4d.d.ts +8 -0
  472. package/dist/esm/4d/distance-4d.js +7 -0
  473. package/dist/esm/4d/distance-chebyshev-4d.d.ts +8 -0
  474. package/dist/esm/4d/distance-chebyshev-4d.js +19 -0
  475. package/dist/esm/4d/distance-manhattan-4d.d.ts +8 -0
  476. package/dist/esm/4d/distance-manhattan-4d.js +10 -0
  477. package/dist/esm/4d/distance-minkowski-4d.d.ts +9 -0
  478. package/dist/esm/4d/distance-minkowski-4d.js +12 -0
  479. package/dist/esm/4d/distance-sq-4d.d.ts +9 -0
  480. package/dist/esm/4d/distance-sq-4d.js +8 -0
  481. package/dist/esm/4d/divide-4d.d.ts +8 -0
  482. package/dist/esm/4d/divide-4d.js +12 -0
  483. package/dist/esm/4d/dot-4d.d.ts +8 -0
  484. package/dist/esm/4d/dot-4d.js +7 -0
  485. package/dist/esm/4d/from-object-4d.d.ts +12 -0
  486. package/dist/esm/4d/from-object-4d.js +11 -0
  487. package/dist/esm/4d/immutable-4d.d.ts +7 -0
  488. package/dist/esm/4d/immutable-4d.js +6 -0
  489. package/dist/esm/4d/index.d.ts +44 -0
  490. package/dist/esm/4d/index.js +44 -0
  491. package/dist/esm/4d/is-equal-4d.d.ts +8 -0
  492. package/dist/esm/4d/is-equal-4d.js +7 -0
  493. package/dist/esm/4d/is-equal-approx-4d.d.ts +9 -0
  494. package/dist/esm/4d/is-equal-approx-4d.js +11 -0
  495. package/dist/esm/4d/is-infinite-4d.d.ts +7 -0
  496. package/dist/esm/4d/is-infinite-4d.js +13 -0
  497. package/dist/esm/4d/is-nan-4d.d.ts +7 -0
  498. package/dist/esm/4d/is-nan-4d.js +6 -0
  499. package/dist/esm/4d/is-opposite-4d.d.ts +8 -0
  500. package/dist/esm/4d/is-opposite-4d.js +7 -0
  501. package/dist/esm/4d/is-zero-4d.d.ts +7 -0
  502. package/dist/esm/4d/is-zero-4d.js +6 -0
  503. package/dist/esm/4d/lerp-4d.d.ts +9 -0
  504. package/dist/esm/4d/lerp-4d.js +13 -0
  505. package/dist/esm/4d/limit-max-4d.d.ts +9 -0
  506. package/dist/esm/4d/limit-max-4d.js +9 -0
  507. package/dist/esm/4d/limit-min-4d.d.ts +9 -0
  508. package/dist/esm/4d/limit-min-4d.js +9 -0
  509. package/dist/esm/4d/look-at-4d.d.ts +10 -0
  510. package/dist/esm/4d/look-at-4d.js +10 -0
  511. package/dist/esm/4d/magnitude-4d.d.ts +7 -0
  512. package/dist/esm/4d/magnitude-4d.js +6 -0
  513. package/dist/esm/4d/magnitude-sq-4d.d.ts +8 -0
  514. package/dist/esm/4d/magnitude-sq-4d.js +7 -0
  515. package/dist/esm/4d/multiply-4d.d.ts +8 -0
  516. package/dist/esm/4d/multiply-4d.js +12 -0
  517. package/dist/esm/4d/negate-4d.d.ts +7 -0
  518. package/dist/esm/4d/negate-4d.js +6 -0
  519. package/dist/esm/4d/normalize-4d.d.ts +8 -0
  520. package/dist/esm/4d/normalize-4d.js +13 -0
  521. package/dist/esm/4d/one-4d.d.ts +6 -0
  522. package/dist/esm/4d/one-4d.js +5 -0
  523. package/dist/esm/4d/project-4d.d.ts +10 -0
  524. package/dist/esm/4d/project-4d.js +14 -0
  525. package/dist/esm/4d/random-4d.d.ts +7 -0
  526. package/dist/esm/4d/random-4d.js +17 -0
  527. package/dist/esm/4d/reflect-4d.d.ts +9 -0
  528. package/dist/esm/4d/reflect-4d.js +17 -0
  529. package/dist/esm/4d/set-magnitude-4d.d.ts +9 -0
  530. package/dist/esm/4d/set-magnitude-4d.js +14 -0
  531. package/dist/esm/4d/subtract-4d.d.ts +8 -0
  532. package/dist/esm/4d/subtract-4d.js +12 -0
  533. package/dist/esm/4d/types.d.ts +4 -0
  534. package/dist/esm/4d/types.js +1 -0
  535. package/dist/esm/4d/zero-4d.d.ts +6 -0
  536. package/dist/esm/4d/zero-4d.js +5 -0
  537. package/dist/esm/index.d.ts +7 -0
  538. package/dist/esm/index.js +7 -0
  539. package/dist/esm/slerp.d.ts +21 -0
  540. package/dist/esm/slerp.js +23 -0
  541. package/dist/{vec4.d.ts → esm/vec2.d.ts} +165 -157
  542. package/dist/{vec2.js → esm/vec2.js} +14 -6
  543. package/dist/esm/vec3.d.ts +614 -0
  544. package/dist/{vec3.js → esm/vec3.js} +190 -123
  545. package/dist/esm/vec4.d.ts +602 -0
  546. package/dist/{vec4.js → esm/vec4.js} +211 -130
  547. package/docs/ArrayVector2D.md +1090 -0
  548. package/docs/ArrayVector3D.md +1162 -0
  549. package/docs/ArrayVector4D.md +1019 -0
  550. package/docs/README.md +13 -0
  551. package/docs/Slerp.md +64 -0
  552. package/docs/Vec2.md +1827 -0
  553. package/docs/Vec3.md +2084 -0
  554. package/docs/Vec4.md +2031 -0
  555. package/package.json +95 -70
  556. package/VEC2.md +0 -147
  557. package/VEC3.md +0 -159
  558. package/VEC4.md +0 -146
  559. package/dist/index.d.ts +0 -3
  560. package/dist/index.js +0 -3
@@ -0,0 +1,22 @@
1
+ /**
2
+ * Rotates a 3D vector around the y-axis.
3
+ * @param {ArrayVector3D} xyz - Vector as `[x, y, z]`
4
+ * @param {number} phi - Angle of rotation in radians
5
+ * @param {ArrayVector3D} axis - Rotation axis point (default: `[0, 0, 0]`)
6
+ * @returns {ArrayVector3D} The rotated vector
7
+ */
8
+ export const rotateY3D = (xyz, phi, axis = [0, 0, 0]) => {
9
+ const cosPhi = Math.cos(phi);
10
+ const sinPhi = Math.sin(phi);
11
+ if (axis[0] === 0 && axis[1] === 0 && axis[2] === 0) {
12
+ return [xyz[0] * cosPhi + xyz[2] * sinPhi, xyz[1], -xyz[0] * sinPhi + xyz[2] * cosPhi];
13
+ }
14
+ // Translate point to origin (relative to axis)
15
+ const translatedX = xyz[0] - axis[0];
16
+ const translatedZ = xyz[2] - axis[2];
17
+ // Rotate around origin
18
+ const rotatedX = translatedX * cosPhi + translatedZ * sinPhi;
19
+ const rotatedZ = -translatedX * sinPhi + translatedZ * cosPhi;
20
+ // Translate back
21
+ return [rotatedX + axis[0], xyz[1], rotatedZ + axis[2]];
22
+ };
@@ -0,0 +1,9 @@
1
+ import type { ArrayVector3D } from "./types";
2
+ /**
3
+ * Rotates a 3D vector around the z-axis.
4
+ * @param {ArrayVector3D} xyz - Vector as `[x, y, z]`
5
+ * @param {number} phi - Angle of rotation in radians
6
+ * @param {ArrayVector3D} axis - Rotation axis point (default: `[0, 0, 0]`)
7
+ * @returns {ArrayVector3D} The rotated vector
8
+ */
9
+ export declare const rotateZ3D: (xyz: ArrayVector3D, phi: number, axis?: ArrayVector3D) => ArrayVector3D;
@@ -0,0 +1,22 @@
1
+ /**
2
+ * Rotates a 3D vector around the z-axis.
3
+ * @param {ArrayVector3D} xyz - Vector as `[x, y, z]`
4
+ * @param {number} phi - Angle of rotation in radians
5
+ * @param {ArrayVector3D} axis - Rotation axis point (default: `[0, 0, 0]`)
6
+ * @returns {ArrayVector3D} The rotated vector
7
+ */
8
+ export const rotateZ3D = (xyz, phi, axis = [0, 0, 0]) => {
9
+ const cosPhi = Math.cos(phi);
10
+ const sinPhi = Math.sin(phi);
11
+ if (axis[0] === 0 && axis[1] === 0 && axis[2] === 0) {
12
+ return [xyz[0] * cosPhi - xyz[1] * sinPhi, xyz[0] * sinPhi + xyz[1] * cosPhi, xyz[2]];
13
+ }
14
+ // Translate point to origin (relative to axis)
15
+ const translatedX = xyz[0] - axis[0];
16
+ const translatedY = xyz[1] - axis[1];
17
+ // Rotate around origin
18
+ const rotatedX = translatedX * cosPhi - translatedY * sinPhi;
19
+ const rotatedY = translatedX * sinPhi + translatedY * cosPhi;
20
+ // Translate back
21
+ return [rotatedX + axis[0], rotatedY + axis[1], xyz[2]];
22
+ };
@@ -0,0 +1,9 @@
1
+ import type { ArrayVector3D } from "./types.js";
2
+ /**
3
+ * Sets the magnitude (length) of a 3D vector, maintaining its direction.
4
+ * @param {ArrayVector3D} xyz - Vector as `[x, y, z]`
5
+ * @param {number} newMagnitude - New magnitude
6
+ * @param {number} [m] - Optional current magnitude (default: `magnitude3D(xyz)`)
7
+ * @returns {ArrayVector3D} The adjusted vector
8
+ */
9
+ export declare const setMagnitude3D: (xyz: ArrayVector3D, newMagnitude: number, m?: number) => ArrayVector3D;
@@ -0,0 +1,9 @@
1
+ import { magnitude3D } from "./magnitude-3d.js";
2
+ /**
3
+ * Sets the magnitude (length) of a 3D vector, maintaining its direction.
4
+ * @param {ArrayVector3D} xyz - Vector as `[x, y, z]`
5
+ * @param {number} newMagnitude - New magnitude
6
+ * @param {number} [m] - Optional current magnitude (default: `magnitude3D(xyz)`)
7
+ * @returns {ArrayVector3D} The adjusted vector
8
+ */
9
+ export const setMagnitude3D = (xyz, newMagnitude, m = magnitude3D(xyz)) => [(xyz[0] / m) * newMagnitude, (xyz[1] / m) * newMagnitude, (xyz[2] / m) * newMagnitude];
@@ -0,0 +1,8 @@
1
+ import type { ArrayVector3D } from "./types";
2
+ /**
3
+ * Subtracts a 3D vector from another.
4
+ * @param {ArrayVector3D} xyz1 - First vector as `[x, y, z]`
5
+ * @param {ArrayVector3D} xyz2 - Second vector as `[x, y, z]`
6
+ * @returns {ArrayVector3D} The difference between the vectors
7
+ */
8
+ export declare const subtract3D: (xyz1: ArrayVector3D, xyz2: ArrayVector3D) => ArrayVector3D;
@@ -0,0 +1,11 @@
1
+ /**
2
+ * Subtracts a 3D vector from another.
3
+ * @param {ArrayVector3D} xyz1 - First vector as `[x, y, z]`
4
+ * @param {ArrayVector3D} xyz2 - Second vector as `[x, y, z]`
5
+ * @returns {ArrayVector3D} The difference between the vectors
6
+ */
7
+ export const subtract3D = (xyz1, xyz2) => [
8
+ xyz1[0] - xyz2[0],
9
+ xyz1[1] - xyz2[1],
10
+ xyz1[2] - xyz2[2],
11
+ ];
@@ -0,0 +1,4 @@
1
+ /**
2
+ * 3D vector as an array.
3
+ */
4
+ export type ArrayVector3D = [number, number, number];
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,6 @@
1
+ import type { ArrayVector3D } from "./types.js";
2
+ /**
3
+ * Creates a zero 3D vector.
4
+ * @returns {ArrayVector3D} Vector `[0, 0, 0]`
5
+ */
6
+ export declare const zero3D: () => ArrayVector3D;
@@ -0,0 +1,5 @@
1
+ /**
2
+ * Creates a zero 3D vector.
3
+ * @returns {ArrayVector3D} Vector `[0, 0, 0]`
4
+ */
5
+ export const zero3D = () => [0, 0, 0];
@@ -0,0 +1,8 @@
1
+ import type { ArrayVector4D } from "./types.js";
2
+ /**
3
+ * Adds two 4D vectors.
4
+ * @param {ArrayVector4D} xyzw1 - First vector as `[x, y, z, w]`
5
+ * @param {ArrayVector4D} xyzw2 - Second vector as `[x, y, z, w]`
6
+ * @returns {ArrayVector4D} The sum of the vectors
7
+ */
8
+ export declare const add4D: (xyzw1: ArrayVector4D, xyzw2: ArrayVector4D) => ArrayVector4D;
@@ -0,0 +1,12 @@
1
+ /**
2
+ * Adds two 4D vectors.
3
+ * @param {ArrayVector4D} xyzw1 - First vector as `[x, y, z, w]`
4
+ * @param {ArrayVector4D} xyzw2 - Second vector as `[x, y, z, w]`
5
+ * @returns {ArrayVector4D} The sum of the vectors
6
+ */
7
+ export const add4D = (xyzw1, xyzw2) => [
8
+ xyzw1[0] + xyzw2[0],
9
+ xyzw1[1] + xyzw2[1],
10
+ xyzw1[2] + xyzw2[2],
11
+ xyzw1[3] + xyzw2[3],
12
+ ];
@@ -0,0 +1,10 @@
1
+ import type { ArrayVector4D } from "./types.js";
2
+ /**
3
+ * Calculates the angle between two 4D vectors.
4
+ * @param {ArrayVector4D} xyzw1 - First vector as `[x, y, z, w]`
5
+ * @param {ArrayVector4D} xyzw2 - Second vector as `[x, y, z, w]`
6
+ * @param {number} [m1] - Optional magnitude of the first vector (default: `magnitude4D(xyzw1)`)
7
+ * @param {number} [m2] - Optional magnitude of the second vector (default: `magnitude4D(xyzw2)`)
8
+ * @returns {number} The angle in radians
9
+ */
10
+ export declare const angleBetween4D: (xyzw1: ArrayVector4D, xyzw2: ArrayVector4D, m1?: number, m2?: number) => number;
@@ -0,0 +1,11 @@
1
+ import { dot4D } from "./dot-4d.js";
2
+ import { magnitude4D } from "./magnitude-4d.js";
3
+ /**
4
+ * Calculates the angle between two 4D vectors.
5
+ * @param {ArrayVector4D} xyzw1 - First vector as `[x, y, z, w]`
6
+ * @param {ArrayVector4D} xyzw2 - Second vector as `[x, y, z, w]`
7
+ * @param {number} [m1] - Optional magnitude of the first vector (default: `magnitude4D(xyzw1)`)
8
+ * @param {number} [m2] - Optional magnitude of the second vector (default: `magnitude4D(xyzw2)`)
9
+ * @returns {number} The angle in radians
10
+ */
11
+ export const angleBetween4D = (xyzw1, xyzw2, m1 = magnitude4D(xyzw1), m2 = magnitude4D(xyzw2)) => Math.acos(dot4D(xyzw1, xyzw2) / (m1 * m2));
@@ -0,0 +1,7 @@
1
+ import type { ArrayVector4D } from "./types.js";
2
+ /**
3
+ * Calculates the angle between a 4D vector and the positive w-axis.
4
+ * @param {ArrayVector4D} xyzw - Vector as `[x, y, z, w]`
5
+ * @returns {number} The angle in radians
6
+ */
7
+ export declare const angleW4D: (xyzw: ArrayVector4D) => number;
@@ -0,0 +1,6 @@
1
+ /**
2
+ * Calculates the angle between a 4D vector and the positive w-axis.
3
+ * @param {ArrayVector4D} xyzw - Vector as `[x, y, z, w]`
4
+ * @returns {number} The angle in radians
5
+ */
6
+ export const angleW4D = (xyzw) => Math.atan2(Math.sqrt(xyzw[0] ** 2 + xyzw[1] ** 2 + xyzw[2] ** 2), xyzw[3]);
@@ -0,0 +1,7 @@
1
+ import type { ArrayVector4D } from "./types.js";
2
+ /**
3
+ * Calculates the angle between a 4D vector and the positive x-axis.
4
+ * @param {ArrayVector4D} xyzw - Vector as `[x, y, z, w]`
5
+ * @returns {number} The angle in radians
6
+ */
7
+ export declare const angleX4D: (xyzw: ArrayVector4D) => number;
@@ -0,0 +1,6 @@
1
+ /**
2
+ * Calculates the angle between a 4D vector and the positive x-axis.
3
+ * @param {ArrayVector4D} xyzw - Vector as `[x, y, z, w]`
4
+ * @returns {number} The angle in radians
5
+ */
6
+ export const angleX4D = (xyzw) => Math.atan2(Math.sqrt(xyzw[1] ** 2 + xyzw[2] ** 2 + xyzw[3] ** 2), xyzw[0]);
@@ -0,0 +1,7 @@
1
+ import type { ArrayVector4D } from "./types.js";
2
+ /**
3
+ * Calculates the angle between a 4D vector and the positive y-axis.
4
+ * @param {ArrayVector4D} xyzw - Vector as `[x, y, z, w]`
5
+ * @returns {number} The angle in radians
6
+ */
7
+ export declare const angleY4D: (xyzw: ArrayVector4D) => number;
@@ -0,0 +1,6 @@
1
+ /**
2
+ * Calculates the angle between a 4D vector and the positive y-axis.
3
+ * @param {ArrayVector4D} xyzw - Vector as `[x, y, z, w]`
4
+ * @returns {number} The angle in radians
5
+ */
6
+ export const angleY4D = (xyzw) => Math.atan2(Math.sqrt(xyzw[2] ** 2 + xyzw[3] ** 2 + xyzw[0] ** 2), xyzw[1]);
@@ -0,0 +1,7 @@
1
+ import type { ArrayVector4D } from "./types.js";
2
+ /**
3
+ * Calculates the angle between a 4D vector and the positive z-axis.
4
+ * @param {ArrayVector4D} xyzw - Vector as `[x, y, z, w]`
5
+ * @returns {number} The angle in radians
6
+ */
7
+ export declare const angleZ4D: (xyzw: ArrayVector4D) => number;
@@ -0,0 +1,6 @@
1
+ /**
2
+ * Calculates the angle between a 4D vector and the positive z-axis.
3
+ * @param {ArrayVector4D} xyzw - Vector as `[x, y, z, w]`
4
+ * @returns {number} The angle in radians
5
+ */
6
+ export const angleZ4D = (xyzw) => Math.atan2(Math.sqrt(xyzw[3] ** 2 + xyzw[0] ** 2 + xyzw[1] ** 2), xyzw[2]);
@@ -0,0 +1,10 @@
1
+ import type { ArrayVector4D } from "./types.js";
2
+ /**
3
+ * Clamps the magnitude of a 4D vector between min and max.
4
+ * @param {ArrayVector4D} xyzw - Vector as `[x, y, z, w]`
5
+ * @param {number} min - Minimum magnitude
6
+ * @param {number} max - Maximum magnitude
7
+ * @param {number} [m] - Optional current magnitude (default: `magnitude4D(xyzw)`)
8
+ * @returns {ArrayVector4D} The clamped vector
9
+ */
10
+ export declare const clamp4D: (xyzw: ArrayVector4D, min: number, max: number, m?: number) => ArrayVector4D;
@@ -0,0 +1,14 @@
1
+ import { magnitude4D } from "./magnitude-4d.js";
2
+ /**
3
+ * Clamps the magnitude of a 4D vector between min and max.
4
+ * @param {ArrayVector4D} xyzw - Vector as `[x, y, z, w]`
5
+ * @param {number} min - Minimum magnitude
6
+ * @param {number} max - Maximum magnitude
7
+ * @param {number} [m] - Optional current magnitude (default: `magnitude4D(xyzw)`)
8
+ * @returns {ArrayVector4D} The clamped vector
9
+ */
10
+ export const clamp4D = (xyzw, min, max, m = magnitude4D(xyzw)) => m > max
11
+ ? [(xyzw[0] / m) * max, (xyzw[1] / m) * max, (xyzw[2] / m) * max, (xyzw[3] / m) * max]
12
+ : m < min
13
+ ? [(xyzw[0] / m) * min, (xyzw[1] / m) * min, (xyzw[2] / m) * min, (xyzw[3] / m) * min]
14
+ : xyzw;
@@ -0,0 +1,7 @@
1
+ import type { ArrayVector4D } from "./types.js";
2
+ /**
3
+ * Clone a 4D vector.
4
+ * @param {ArrayVector4D} xyzw - Vector as `[x, y, z, w]`
5
+ * @returns {ArrayVector4D} The cloned vector
6
+ */
7
+ export declare const clone4D: (xyzw: ArrayVector4D) => ArrayVector4D;
@@ -0,0 +1,6 @@
1
+ /**
2
+ * Clone a 4D vector.
3
+ * @param {ArrayVector4D} xyzw - Vector as `[x, y, z, w]`
4
+ * @returns {ArrayVector4D} The cloned vector
5
+ */
6
+ export const clone4D = (xyzw) => [xyzw[0], xyzw[1], xyzw[2], xyzw[3]];
@@ -0,0 +1,8 @@
1
+ import type { ArrayVector4D } from "./types.js";
2
+ /**
3
+ * Calculates the Euclidean distance between two 4D vectors.
4
+ * @param {ArrayVector4D} xyzw1 - First vector as `[x, y, z, w]`
5
+ * @param {ArrayVector4D} xyzw2 - Second vector as `[x, y, z, w]`
6
+ * @returns {number} The distance
7
+ */
8
+ export declare const distance4D: (xyzw1: ArrayVector4D, xyzw2: ArrayVector4D) => number;
@@ -0,0 +1,7 @@
1
+ /**
2
+ * Calculates the Euclidean distance between two 4D vectors.
3
+ * @param {ArrayVector4D} xyzw1 - First vector as `[x, y, z, w]`
4
+ * @param {ArrayVector4D} xyzw2 - Second vector as `[x, y, z, w]`
5
+ * @returns {number} The distance
6
+ */
7
+ export const distance4D = (xyzw1, xyzw2) => Math.sqrt((xyzw1[0] - xyzw2[0]) ** 2 + (xyzw1[1] - xyzw2[1]) ** 2 + (xyzw1[2] - xyzw2[2]) ** 2 + (xyzw1[3] - xyzw2[3]) ** 2);
@@ -0,0 +1,8 @@
1
+ import type { ArrayVector4D } from "./types.js";
2
+ /**
3
+ * Calculates the Chebyshev distance between two 4D vectors.
4
+ * @param {ArrayVector4D} xyzw1 - First vector as `[x, y, z, w]`
5
+ * @param {ArrayVector4D} xyzw2 - Second vector as `[x, y, z, w]`
6
+ * @returns {number} The Chebyshev distance
7
+ */
8
+ export declare const distanceChebyshev4D: (xyzw1: ArrayVector4D, xyzw2: ArrayVector4D) => number;
@@ -0,0 +1,19 @@
1
+ /**
2
+ * Calculates the Chebyshev distance between two 4D vectors.
3
+ * @param {ArrayVector4D} xyzw1 - First vector as `[x, y, z, w]`
4
+ * @param {ArrayVector4D} xyzw2 - Second vector as `[x, y, z, w]`
5
+ * @returns {number} The Chebyshev distance
6
+ */
7
+ export const distanceChebyshev4D = (xyzw1, xyzw2) => {
8
+ const absX = Math.abs(xyzw1[0] - xyzw2[0]);
9
+ const absY = Math.abs(xyzw1[1] - xyzw2[1]);
10
+ const absZ = Math.abs(xyzw1[2] - xyzw2[2]);
11
+ const absW = Math.abs(xyzw1[3] - xyzw2[3]);
12
+ return absX >= absY && absX >= absZ && absX >= absW
13
+ ? absX
14
+ : absY >= absZ && absY >= absW
15
+ ? absY
16
+ : absZ >= absW
17
+ ? absZ
18
+ : absW;
19
+ };
@@ -0,0 +1,8 @@
1
+ import type { ArrayVector4D } from "./types.js";
2
+ /**
3
+ * Calculates the Manhattan distance between two 4D vectors.
4
+ * @param {ArrayVector4D} xyzw1 - First vector as `[x, y, z, w]`
5
+ * @param {ArrayVector4D} xyzw2 - Second vector as `[x, y, z, w]`
6
+ * @returns {number} The Manhattan distance
7
+ */
8
+ export declare const distanceManhattan4D: (xyzw1: ArrayVector4D, xyzw2: ArrayVector4D) => number;
@@ -0,0 +1,10 @@
1
+ /**
2
+ * Calculates the Manhattan distance between two 4D vectors.
3
+ * @param {ArrayVector4D} xyzw1 - First vector as `[x, y, z, w]`
4
+ * @param {ArrayVector4D} xyzw2 - Second vector as `[x, y, z, w]`
5
+ * @returns {number} The Manhattan distance
6
+ */
7
+ export const distanceManhattan4D = (xyzw1, xyzw2) => Math.abs(xyzw1[0] - xyzw2[0]) +
8
+ Math.abs(xyzw1[1] - xyzw2[1]) +
9
+ Math.abs(xyzw1[2] - xyzw2[2]) +
10
+ Math.abs(xyzw1[3] - xyzw2[3]);
@@ -0,0 +1,9 @@
1
+ import type { ArrayVector4D } from "./types.js";
2
+ /**
3
+ * Calculates the Minkowski distance between two 4D vectors.
4
+ * @param {ArrayVector4D} xyzw1 - First vector as `[x, y, z, w]`
5
+ * @param {ArrayVector4D} xyzw2 - Second vector as `[x, y, z, w]`
6
+ * @param {number} p - The order of the Minkowski distance
7
+ * @returns {number} The Minkowski distance
8
+ */
9
+ export declare const distanceMinkowski4D: (xyzw1: ArrayVector4D, xyzw2: ArrayVector4D, p: number) => number;
@@ -0,0 +1,12 @@
1
+ /**
2
+ * Calculates the Minkowski distance between two 4D vectors.
3
+ * @param {ArrayVector4D} xyzw1 - First vector as `[x, y, z, w]`
4
+ * @param {ArrayVector4D} xyzw2 - Second vector as `[x, y, z, w]`
5
+ * @param {number} p - The order of the Minkowski distance
6
+ * @returns {number} The Minkowski distance
7
+ */
8
+ export const distanceMinkowski4D = (xyzw1, xyzw2, p) => (Math.abs(xyzw1[0] - xyzw2[0]) ** p +
9
+ Math.abs(xyzw1[1] - xyzw2[1]) ** p +
10
+ Math.abs(xyzw1[2] - xyzw2[2]) ** p +
11
+ Math.abs(xyzw1[3] - xyzw2[3]) ** p) **
12
+ (1 / p);
@@ -0,0 +1,9 @@
1
+ import type { ArrayVector4D } from "./types.js";
2
+ /**
3
+ * Calculates the squared Euclidean distance between two 4D vectors.
4
+ * Faster than distance for comparisons.
5
+ * @param {ArrayVector4D} xyzw1 - First vector as `[x, y, z, w]`
6
+ * @param {ArrayVector4D} xyzw2 - Second vector as `[x, y, z, w]`
7
+ * @returns {number} The squared distance
8
+ */
9
+ export declare const distanceSq4D: (xyzw1: ArrayVector4D, xyzw2: ArrayVector4D) => number;
@@ -0,0 +1,8 @@
1
+ /**
2
+ * Calculates the squared Euclidean distance between two 4D vectors.
3
+ * Faster than distance for comparisons.
4
+ * @param {ArrayVector4D} xyzw1 - First vector as `[x, y, z, w]`
5
+ * @param {ArrayVector4D} xyzw2 - Second vector as `[x, y, z, w]`
6
+ * @returns {number} The squared distance
7
+ */
8
+ export const distanceSq4D = (xyzw1, xyzw2) => (xyzw1[0] - xyzw2[0]) ** 2 + (xyzw1[1] - xyzw2[1]) ** 2 + (xyzw1[2] - xyzw2[2]) ** 2 + (xyzw1[3] - xyzw2[3]) ** 2;
@@ -0,0 +1,8 @@
1
+ import type { ArrayVector4D } from "./types.js";
2
+ /**
3
+ * Divides two 4D vectors component-wise.
4
+ * @param {ArrayVector4D} xyzw1 - First vector as `[x, y, z, w]`
5
+ * @param {ArrayVector4D} xyzw2 - Second vector as `[x, y, z, w]`
6
+ * @returns {ArrayVector4D} The divided vector
7
+ */
8
+ export declare const divide4D: (xyzw1: ArrayVector4D, xyzw2: ArrayVector4D) => ArrayVector4D;
@@ -0,0 +1,12 @@
1
+ /**
2
+ * Divides two 4D vectors component-wise.
3
+ * @param {ArrayVector4D} xyzw1 - First vector as `[x, y, z, w]`
4
+ * @param {ArrayVector4D} xyzw2 - Second vector as `[x, y, z, w]`
5
+ * @returns {ArrayVector4D} The divided vector
6
+ */
7
+ export const divide4D = (xyzw1, xyzw2) => [
8
+ xyzw2[0] === 0 ? Number.POSITIVE_INFINITY : xyzw1[0] / xyzw2[0],
9
+ xyzw2[1] === 0 ? Number.POSITIVE_INFINITY : xyzw1[1] / xyzw2[1],
10
+ xyzw2[2] === 0 ? Number.POSITIVE_INFINITY : xyzw1[2] / xyzw2[2],
11
+ xyzw2[3] === 0 ? Number.POSITIVE_INFINITY : xyzw1[3] / xyzw2[3],
12
+ ];
@@ -0,0 +1,8 @@
1
+ import type { ArrayVector4D } from "./types.js";
2
+ /**
3
+ * Calculates the dot product of two 4D vectors.
4
+ * @param {ArrayVector4D} xyzw1 - First vector as `[x, y, z, w]`
5
+ * @param {ArrayVector4D} xyzw2 - Second vector as `[x, y, z, w]`
6
+ * @returns {number} The dot product
7
+ */
8
+ export declare const dot4D: (xyzw1: ArrayVector4D, xyzw2: ArrayVector4D) => number;
@@ -0,0 +1,7 @@
1
+ /**
2
+ * Calculates the dot product of two 4D vectors.
3
+ * @param {ArrayVector4D} xyzw1 - First vector as `[x, y, z, w]`
4
+ * @param {ArrayVector4D} xyzw2 - Second vector as `[x, y, z, w]`
5
+ * @returns {number} The dot product
6
+ */
7
+ export const dot4D = (xyzw1, xyzw2) => xyzw1[0] * xyzw2[0] + xyzw1[1] * xyzw2[1] + xyzw1[2] * xyzw2[2] + xyzw1[3] * xyzw2[3];
@@ -0,0 +1,12 @@
1
+ import type { ArrayVector4D } from "./types.js";
2
+ /**
3
+ * Creates a 4D vector from an object with x, y, z, w properties.
4
+ * @param {{ x: number; y: number; z: number; w: number }} obj - Object with x, y, z, w properties
5
+ * @returns {ArrayVector4D} 4D vector
6
+ */
7
+ export declare const fromObject4D: ({ x, y, z, w }: {
8
+ x: number;
9
+ y: number;
10
+ z: number;
11
+ w: number;
12
+ }) => ArrayVector4D;
@@ -0,0 +1,11 @@
1
+ /**
2
+ * Creates a 4D vector from an object with x, y, z, w properties.
3
+ * @param {{ x: number; y: number; z: number; w: number }} obj - Object with x, y, z, w properties
4
+ * @returns {ArrayVector4D} 4D vector
5
+ */
6
+ export const fromObject4D = ({ x, y, z, w }) => [
7
+ x,
8
+ y,
9
+ z,
10
+ w,
11
+ ];
@@ -0,0 +1,7 @@
1
+ import type { ArrayVector4D } from "./types.js";
2
+ /**
3
+ * Create an immutable 4D vector.
4
+ * @param {ArrayVector4D} xyzw - Vector as `[x, y, z, w]`
5
+ * @returns {Readonly<ArrayVector4D>} The immutable vector
6
+ */
7
+ export declare const immutable4D: (xyzw: ArrayVector4D) => Readonly<ArrayVector4D>;
@@ -0,0 +1,6 @@
1
+ /**
2
+ * Create an immutable 4D vector.
3
+ * @param {ArrayVector4D} xyzw - Vector as `[x, y, z, w]`
4
+ * @returns {Readonly<ArrayVector4D>} The immutable vector
5
+ */
6
+ export const immutable4D = (xyzw) => Object.freeze([xyzw[0], xyzw[1], xyzw[2], xyzw[3]]);
@@ -0,0 +1,44 @@
1
+ /**
2
+ * Documentation for functional 4D Vector array operations.
3
+ * @module ArrayVector4D
4
+ */
5
+ export * from "./add-4d.js";
6
+ export * from "./angle-between-4d.js";
7
+ export * from "./angle-w-4d.js";
8
+ export * from "./angle-x-4d.js";
9
+ export * from "./angle-y-4d.js";
10
+ export * from "./angle-z-4d.js";
11
+ export * from "./clamp-4d.js";
12
+ export * from "./clone-4d.js";
13
+ export * from "./distance-4d.js";
14
+ export * from "./distance-chebyshev-4d.js";
15
+ export * from "./distance-manhattan-4d.js";
16
+ export * from "./distance-minkowski-4d.js";
17
+ export * from "./distance-sq-4d.js";
18
+ export * from "./divide-4d.js";
19
+ export * from "./dot-4d.js";
20
+ export * from "./from-object-4d.js";
21
+ export * from "./immutable-4d.js";
22
+ export * from "./is-equal-4d.js";
23
+ export * from "./is-equal-approx-4d.js";
24
+ export * from "./is-infinite-4d.js";
25
+ export * from "./is-nan-4d.js";
26
+ export * from "./is-opposite-4d.js";
27
+ export * from "./is-zero-4d.js";
28
+ export * from "./lerp-4d.js";
29
+ export * from "./limit-max-4d.js";
30
+ export * from "./limit-min-4d.js";
31
+ export * from "./look-at-4d.js";
32
+ export * from "./magnitude-4d.js";
33
+ export * from "./magnitude-sq-4d.js";
34
+ export * from "./multiply-4d.js";
35
+ export * from "./negate-4d.js";
36
+ export * from "./normalize-4d.js";
37
+ export * from "./one-4d.js";
38
+ export * from "./project-4d.js";
39
+ export * from "./random-4d.js";
40
+ export * from "./reflect-4d.js";
41
+ export * from "./set-magnitude-4d.js";
42
+ export * from "./subtract-4d.js";
43
+ export * from "./types.js";
44
+ export * from "./zero-4d.js";
@@ -0,0 +1,44 @@
1
+ /**
2
+ * Documentation for functional 4D Vector array operations.
3
+ * @module ArrayVector4D
4
+ */
5
+ export * from "./add-4d.js";
6
+ export * from "./angle-between-4d.js";
7
+ export * from "./angle-w-4d.js";
8
+ export * from "./angle-x-4d.js";
9
+ export * from "./angle-y-4d.js";
10
+ export * from "./angle-z-4d.js";
11
+ export * from "./clamp-4d.js";
12
+ export * from "./clone-4d.js";
13
+ export * from "./distance-4d.js";
14
+ export * from "./distance-chebyshev-4d.js";
15
+ export * from "./distance-manhattan-4d.js";
16
+ export * from "./distance-minkowski-4d.js";
17
+ export * from "./distance-sq-4d.js";
18
+ export * from "./divide-4d.js";
19
+ export * from "./dot-4d.js";
20
+ export * from "./from-object-4d.js";
21
+ export * from "./immutable-4d.js";
22
+ export * from "./is-equal-4d.js";
23
+ export * from "./is-equal-approx-4d.js";
24
+ export * from "./is-infinite-4d.js";
25
+ export * from "./is-nan-4d.js";
26
+ export * from "./is-opposite-4d.js";
27
+ export * from "./is-zero-4d.js";
28
+ export * from "./lerp-4d.js";
29
+ export * from "./limit-max-4d.js";
30
+ export * from "./limit-min-4d.js";
31
+ export * from "./look-at-4d.js";
32
+ export * from "./magnitude-4d.js";
33
+ export * from "./magnitude-sq-4d.js";
34
+ export * from "./multiply-4d.js";
35
+ export * from "./negate-4d.js";
36
+ export * from "./normalize-4d.js";
37
+ export * from "./one-4d.js";
38
+ export * from "./project-4d.js";
39
+ export * from "./random-4d.js";
40
+ export * from "./reflect-4d.js";
41
+ export * from "./set-magnitude-4d.js";
42
+ export * from "./subtract-4d.js";
43
+ export * from "./types.js";
44
+ export * from "./zero-4d.js";
@@ -0,0 +1,8 @@
1
+ import type { ArrayVector4D } from "./types.js";
2
+ /**
3
+ * Checks if two 4D vectors are exactly equal.
4
+ * @param {ArrayVector4D} xyzw1 - First vector as `[x, y, z, w]`
5
+ * @param {ArrayVector4D} xyzw2 - Second vector as `[x, y, z, w]`
6
+ * @returns {boolean} `true` if vectors are equal, `false` otherwse
7
+ */
8
+ export declare const isEqual4D: (xyzw1: ArrayVector4D, xyzw2: ArrayVector4D) => boolean;
@@ -0,0 +1,7 @@
1
+ /**
2
+ * Checks if two 4D vectors are exactly equal.
3
+ * @param {ArrayVector4D} xyzw1 - First vector as `[x, y, z, w]`
4
+ * @param {ArrayVector4D} xyzw2 - Second vector as `[x, y, z, w]`
5
+ * @returns {boolean} `true` if vectors are equal, `false` otherwse
6
+ */
7
+ export const isEqual4D = (xyzw1, xyzw2) => xyzw1[0] === xyzw2[0] && xyzw1[1] === xyzw2[1] && xyzw1[2] === xyzw2[2] && xyzw1[3] === xyzw2[3];
@@ -0,0 +1,9 @@
1
+ import type { ArrayVector4D } from "./types.js";
2
+ /**
3
+ * Checks if two 4D vectors are approximately equal within epsilon.
4
+ * @param {ArrayVector4D} xyzw1 - First vector as `[x, y, z, w]`
5
+ * @param {ArrayVector4D} xyzw2 - Second vector as `[x, y, z, w]`
6
+ * @param {number} epsilon - Maximum difference (default: `Number.EPSILON`)
7
+ * @returns {boolean} `true` if vectors are approximately equal, `false` otherwise
8
+ */
9
+ export declare const isEqualApprox4D: (xyzw1: ArrayVector4D, xyzw2: ArrayVector4D, epsilon?: number) => boolean;
@@ -0,0 +1,11 @@
1
+ /**
2
+ * Checks if two 4D vectors are approximately equal within epsilon.
3
+ * @param {ArrayVector4D} xyzw1 - First vector as `[x, y, z, w]`
4
+ * @param {ArrayVector4D} xyzw2 - Second vector as `[x, y, z, w]`
5
+ * @param {number} epsilon - Maximum difference (default: `Number.EPSILON`)
6
+ * @returns {boolean} `true` if vectors are approximately equal, `false` otherwise
7
+ */
8
+ export const isEqualApprox4D = (xyzw1, xyzw2, epsilon = Number.EPSILON) => Math.abs(xyzw1[0] - xyzw2[0]) <= epsilon &&
9
+ Math.abs(xyzw1[1] - xyzw2[1]) <= epsilon &&
10
+ Math.abs(xyzw1[2] - xyzw2[2]) <= epsilon &&
11
+ Math.abs(xyzw1[3] - xyzw2[3]) <= epsilon;
@@ -0,0 +1,7 @@
1
+ import type { ArrayVector4D } from "./types.js";
2
+ /**
3
+ * Checks if a 4D vector has infinite components.
4
+ * @param {ArrayVector4D} xyzw - Vector as `[x, y, z, w]`
5
+ * @returns {boolean} `true` if vector has infinite components, `false` otherwise
6
+ */
7
+ export declare const isInfinite4D: (xyzw: ArrayVector4D) => boolean;