@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.
- package/README.md +208 -85
- package/dist/cjs/2d/add-2d.d.ts +8 -0
- package/dist/cjs/2d/add-2d.js +11 -0
- package/dist/cjs/2d/angle-between-2d.d.ts +8 -0
- package/dist/cjs/2d/angle-between-2d.js +11 -0
- package/dist/cjs/2d/angle-x-2d.d.ts +7 -0
- package/dist/cjs/2d/angle-x-2d.js +10 -0
- package/dist/cjs/2d/angle-y-2d.d.ts +7 -0
- package/dist/cjs/2d/angle-y-2d.js +10 -0
- package/dist/cjs/2d/clamp-2d.d.ts +10 -0
- package/dist/cjs/2d/clamp-2d.js +14 -0
- package/dist/cjs/2d/clone-2d.d.ts +7 -0
- package/dist/cjs/2d/clone-2d.js +10 -0
- package/dist/cjs/2d/cross-2d.d.ts +8 -0
- package/dist/cjs/2d/cross-2d.js +11 -0
- package/dist/cjs/2d/distance-2d.d.ts +8 -0
- package/dist/cjs/2d/distance-2d.js +11 -0
- package/dist/cjs/2d/distance-chebyshev-2d.d.ts +8 -0
- package/dist/cjs/2d/distance-chebyshev-2d.js +15 -0
- package/dist/cjs/2d/distance-manhattan-2d.d.ts +8 -0
- package/dist/cjs/2d/distance-manhattan-2d.js +11 -0
- package/dist/cjs/2d/distance-minkowski-2d.d.ts +9 -0
- package/dist/cjs/2d/distance-minkowski-2d.js +12 -0
- package/dist/cjs/2d/distance-sq-2d.d.ts +8 -0
- package/dist/cjs/2d/distance-sq-2d.js +11 -0
- package/dist/cjs/2d/divide-2d.d.ts +8 -0
- package/dist/cjs/2d/divide-2d.js +14 -0
- package/dist/cjs/2d/dot-2d.d.ts +8 -0
- package/dist/cjs/2d/dot-2d.js +11 -0
- package/dist/cjs/2d/from-angle-x-2d.d.ts +8 -0
- package/dist/cjs/2d/from-angle-x-2d.js +14 -0
- package/dist/cjs/2d/from-angle-y-2d.d.ts +8 -0
- package/dist/cjs/2d/from-angle-y-2d.js +14 -0
- package/dist/cjs/2d/from-object-2d.d.ts +10 -0
- package/dist/cjs/2d/from-object-2d.js +10 -0
- package/dist/cjs/2d/from-polar-coords-2d.d.ts +8 -0
- package/dist/cjs/2d/from-polar-coords-2d.js +11 -0
- package/dist/cjs/2d/immutable-2d.d.ts +7 -0
- package/dist/cjs/2d/immutable-2d.js +10 -0
- package/dist/cjs/2d/index.d.ts +47 -0
- package/dist/cjs/2d/index.js +63 -0
- package/dist/cjs/2d/is-equal-2d.d.ts +8 -0
- package/dist/cjs/2d/is-equal-2d.js +11 -0
- package/dist/cjs/2d/is-equal-approx-2d.d.ts +9 -0
- package/dist/cjs/2d/is-equal-approx-2d.js +12 -0
- package/dist/cjs/2d/is-infinite-2d.d.ts +7 -0
- package/dist/cjs/2d/is-infinite-2d.js +13 -0
- package/dist/cjs/2d/is-nan-2d.d.ts +7 -0
- package/dist/cjs/2d/is-nan-2d.js +10 -0
- package/dist/cjs/2d/is-opposite-2d.d.ts +8 -0
- package/dist/cjs/2d/is-opposite-2d.js +11 -0
- package/dist/cjs/2d/is-zero-2d.d.ts +7 -0
- package/dist/cjs/2d/is-zero-2d.js +10 -0
- package/dist/cjs/2d/lerp-2d.d.ts +9 -0
- package/dist/cjs/2d/lerp-2d.js +15 -0
- package/dist/cjs/2d/limit-max-2d.d.ts +9 -0
- package/dist/cjs/2d/limit-max-2d.js +13 -0
- package/dist/cjs/2d/limit-min-2d.d.ts +9 -0
- package/dist/cjs/2d/limit-min-2d.js +13 -0
- package/dist/cjs/2d/look-at-2d.d.ts +10 -0
- package/dist/cjs/2d/look-at-2d.js +14 -0
- package/dist/cjs/2d/magnitude-2d.d.ts +7 -0
- package/dist/cjs/2d/magnitude-2d.js +10 -0
- package/dist/cjs/2d/magnitude-sq-2d.d.ts +7 -0
- package/dist/cjs/2d/magnitude-sq-2d.js +10 -0
- package/dist/cjs/2d/multiply-2d.d.ts +8 -0
- package/dist/cjs/2d/multiply-2d.js +11 -0
- package/dist/cjs/2d/negate-2d.d.ts +7 -0
- package/dist/cjs/2d/negate-2d.js +10 -0
- package/dist/cjs/2d/normalize-2d.d.ts +8 -0
- package/dist/cjs/2d/normalize-2d.js +12 -0
- package/dist/cjs/2d/one-2d.d.ts +6 -0
- package/dist/cjs/2d/one-2d.js +9 -0
- package/dist/cjs/2d/project-2d.d.ts +10 -0
- package/dist/cjs/2d/project-2d.js +17 -0
- package/dist/cjs/2d/random-2d.d.ts +7 -0
- package/dist/cjs/2d/random-2d.js +13 -0
- package/dist/cjs/2d/reflect-2d.d.ts +9 -0
- package/dist/cjs/2d/reflect-2d.js +16 -0
- package/dist/cjs/2d/rotate-2d.d.ts +9 -0
- package/dist/cjs/2d/rotate-2d.js +27 -0
- package/dist/cjs/2d/set-magnitude-2d.d.ts +9 -0
- package/dist/cjs/2d/set-magnitude-2d.js +16 -0
- package/dist/cjs/2d/subtract-2d.d.ts +8 -0
- package/dist/cjs/2d/subtract-2d.js +11 -0
- package/dist/cjs/2d/types.d.ts +4 -0
- package/dist/cjs/2d/types.js +2 -0
- package/dist/cjs/2d/zero-2d.d.ts +6 -0
- package/dist/cjs/2d/zero-2d.js +9 -0
- package/dist/cjs/3d/add-3d.d.ts +8 -0
- package/dist/cjs/3d/add-3d.js +15 -0
- package/dist/cjs/3d/angle-between-3d.d.ts +10 -0
- package/dist/cjs/3d/angle-between-3d.js +14 -0
- package/dist/cjs/3d/angle-x-3d.d.ts +7 -0
- package/dist/cjs/3d/angle-x-3d.js +10 -0
- package/dist/cjs/3d/angle-y-3d.d.ts +7 -0
- package/dist/cjs/3d/angle-y-3d.js +10 -0
- package/dist/cjs/3d/angle-z-3d.d.ts +7 -0
- package/dist/cjs/3d/angle-z-3d.js +10 -0
- package/dist/cjs/3d/clamp-3d.d.ts +10 -0
- package/dist/cjs/3d/clamp-3d.js +18 -0
- package/dist/cjs/3d/clone-3d.d.ts +7 -0
- package/dist/cjs/3d/clone-3d.js +10 -0
- package/dist/cjs/3d/cross-3d.d.ts +8 -0
- package/dist/cjs/3d/cross-3d.js +15 -0
- package/dist/cjs/3d/distance-3d.d.ts +8 -0
- package/dist/cjs/3d/distance-3d.js +11 -0
- package/dist/cjs/3d/distance-chebyshev-3d.d.ts +8 -0
- package/dist/cjs/3d/distance-chebyshev-3d.js +16 -0
- package/dist/cjs/3d/distance-manhattan-3d.d.ts +8 -0
- package/dist/cjs/3d/distance-manhattan-3d.js +11 -0
- package/dist/cjs/3d/distance-minkowski-3d.d.ts +9 -0
- package/dist/cjs/3d/distance-minkowski-3d.js +12 -0
- package/dist/cjs/3d/distance-sq-3d.d.ts +8 -0
- package/dist/cjs/3d/distance-sq-3d.js +11 -0
- package/dist/cjs/3d/divide-3d.d.ts +8 -0
- package/dist/cjs/3d/divide-3d.js +15 -0
- package/dist/cjs/3d/dot-3d.d.ts +8 -0
- package/dist/cjs/3d/dot-3d.js +11 -0
- package/dist/cjs/3d/from-cylindrical-coords-3d.d.ts +9 -0
- package/dist/cjs/3d/from-cylindrical-coords-3d.js +16 -0
- package/dist/cjs/3d/from-object-3d.d.ts +11 -0
- package/dist/cjs/3d/from-object-3d.js +10 -0
- package/dist/cjs/3d/from-spherical-coords-3d.d.ts +9 -0
- package/dist/cjs/3d/from-spherical-coords-3d.js +16 -0
- package/dist/cjs/3d/immutable-3d.d.ts +7 -0
- package/dist/cjs/3d/immutable-3d.js +10 -0
- package/dist/cjs/3d/index.d.ts +49 -0
- package/dist/cjs/3d/index.js +65 -0
- package/dist/cjs/3d/is-equal-3d.d.ts +8 -0
- package/dist/cjs/3d/is-equal-3d.js +11 -0
- package/dist/cjs/3d/is-equal-approx-3d.d.ts +9 -0
- package/dist/cjs/3d/is-equal-approx-3d.js +14 -0
- package/dist/cjs/3d/is-infinite-3d.d.ts +7 -0
- package/dist/cjs/3d/is-infinite-3d.js +15 -0
- package/dist/cjs/3d/is-nan-3d.d.ts +7 -0
- package/dist/cjs/3d/is-nan-3d.js +10 -0
- package/dist/cjs/3d/is-opposite-3d.d.ts +8 -0
- package/dist/cjs/3d/is-opposite-3d.js +11 -0
- package/dist/cjs/3d/is-zero-3d.d.ts +7 -0
- package/dist/cjs/3d/is-zero-3d.js +10 -0
- package/dist/cjs/3d/lerp-3d.d.ts +9 -0
- package/dist/cjs/3d/lerp-3d.js +16 -0
- package/dist/cjs/3d/limit-max-3d.d.ts +9 -0
- package/dist/cjs/3d/limit-max-3d.js +13 -0
- package/dist/cjs/3d/limit-min-3d.d.ts +9 -0
- package/dist/cjs/3d/limit-min-3d.js +13 -0
- package/dist/cjs/3d/look-at-3d.d.ts +10 -0
- package/dist/cjs/3d/look-at-3d.js +14 -0
- package/dist/cjs/3d/magnitude-3d.d.ts +7 -0
- package/dist/cjs/3d/magnitude-3d.js +10 -0
- package/dist/cjs/3d/magnitude-sq-3d.d.ts +7 -0
- package/dist/cjs/3d/magnitude-sq-3d.js +10 -0
- package/dist/cjs/3d/multiply-3d.d.ts +8 -0
- package/dist/cjs/3d/multiply-3d.js +15 -0
- package/dist/cjs/3d/negate-3d.d.ts +7 -0
- package/dist/cjs/3d/negate-3d.js +10 -0
- package/dist/cjs/3d/normalize-3d.d.ts +8 -0
- package/dist/cjs/3d/normalize-3d.js +12 -0
- package/dist/cjs/3d/one-3d.d.ts +6 -0
- package/dist/cjs/3d/one-3d.js +9 -0
- package/dist/cjs/3d/project-3d.d.ts +10 -0
- package/dist/cjs/3d/project-3d.js +17 -0
- package/dist/cjs/3d/random-3d.d.ts +7 -0
- package/dist/cjs/3d/random-3d.js +11 -0
- package/dist/cjs/3d/reflect-3d.d.ts +9 -0
- package/dist/cjs/3d/reflect-3d.js +16 -0
- package/dist/cjs/3d/rotate-x-3d.d.ts +9 -0
- package/dist/cjs/3d/rotate-x-3d.js +26 -0
- package/dist/cjs/3d/rotate-y-3d.d.ts +9 -0
- package/dist/cjs/3d/rotate-y-3d.js +26 -0
- package/dist/cjs/3d/rotate-z-3d.d.ts +9 -0
- package/dist/cjs/3d/rotate-z-3d.js +26 -0
- package/dist/cjs/3d/set-magnitude-3d.d.ts +9 -0
- package/dist/cjs/3d/set-magnitude-3d.js +13 -0
- package/dist/cjs/3d/subtract-3d.d.ts +8 -0
- package/dist/cjs/3d/subtract-3d.js +15 -0
- package/dist/cjs/3d/types.d.ts +4 -0
- package/dist/cjs/3d/types.js +2 -0
- package/dist/cjs/3d/zero-3d.d.ts +6 -0
- package/dist/cjs/3d/zero-3d.js +9 -0
- package/dist/cjs/4d/add-4d.d.ts +8 -0
- package/dist/cjs/4d/add-4d.js +16 -0
- package/dist/cjs/4d/angle-between-4d.d.ts +10 -0
- package/dist/cjs/4d/angle-between-4d.js +15 -0
- package/dist/cjs/4d/angle-w-4d.d.ts +7 -0
- package/dist/cjs/4d/angle-w-4d.js +10 -0
- package/dist/cjs/4d/angle-x-4d.d.ts +7 -0
- package/dist/cjs/4d/angle-x-4d.js +10 -0
- package/dist/cjs/4d/angle-y-4d.d.ts +7 -0
- package/dist/cjs/4d/angle-y-4d.js +10 -0
- package/dist/cjs/4d/angle-z-4d.d.ts +7 -0
- package/dist/cjs/4d/angle-z-4d.js +10 -0
- package/dist/cjs/4d/clamp-4d.d.ts +10 -0
- package/dist/cjs/4d/clamp-4d.js +18 -0
- package/dist/cjs/4d/clone-4d.d.ts +7 -0
- package/dist/cjs/4d/clone-4d.js +10 -0
- package/dist/cjs/4d/distance-4d.d.ts +8 -0
- package/dist/cjs/4d/distance-4d.js +11 -0
- package/dist/cjs/4d/distance-chebyshev-4d.d.ts +8 -0
- package/dist/cjs/4d/distance-chebyshev-4d.js +23 -0
- package/dist/cjs/4d/distance-manhattan-4d.d.ts +8 -0
- package/dist/cjs/4d/distance-manhattan-4d.js +14 -0
- package/dist/cjs/4d/distance-minkowski-4d.d.ts +9 -0
- package/dist/cjs/4d/distance-minkowski-4d.js +16 -0
- package/dist/cjs/4d/distance-sq-4d.d.ts +9 -0
- package/dist/cjs/4d/distance-sq-4d.js +12 -0
- package/dist/cjs/4d/divide-4d.d.ts +8 -0
- package/dist/cjs/4d/divide-4d.js +16 -0
- package/dist/cjs/4d/dot-4d.d.ts +8 -0
- package/dist/cjs/4d/dot-4d.js +11 -0
- package/dist/cjs/4d/from-object-4d.d.ts +12 -0
- package/dist/cjs/4d/from-object-4d.js +15 -0
- package/dist/cjs/4d/immutable-4d.d.ts +7 -0
- package/dist/cjs/4d/immutable-4d.js +10 -0
- package/dist/cjs/4d/index.d.ts +44 -0
- package/dist/cjs/4d/index.js +60 -0
- package/dist/cjs/4d/is-equal-4d.d.ts +8 -0
- package/dist/cjs/4d/is-equal-4d.js +11 -0
- package/dist/cjs/4d/is-equal-approx-4d.d.ts +9 -0
- package/dist/cjs/4d/is-equal-approx-4d.js +15 -0
- package/dist/cjs/4d/is-infinite-4d.d.ts +7 -0
- package/dist/cjs/4d/is-infinite-4d.js +17 -0
- package/dist/cjs/4d/is-nan-4d.d.ts +7 -0
- package/dist/cjs/4d/is-nan-4d.js +10 -0
- package/dist/cjs/4d/is-opposite-4d.d.ts +8 -0
- package/dist/cjs/4d/is-opposite-4d.js +11 -0
- package/dist/cjs/4d/is-zero-4d.d.ts +7 -0
- package/dist/cjs/4d/is-zero-4d.js +10 -0
- package/dist/cjs/4d/lerp-4d.d.ts +9 -0
- package/dist/cjs/4d/lerp-4d.js +17 -0
- package/dist/cjs/4d/limit-max-4d.d.ts +9 -0
- package/dist/cjs/4d/limit-max-4d.js +13 -0
- package/dist/cjs/4d/limit-min-4d.d.ts +9 -0
- package/dist/cjs/4d/limit-min-4d.js +13 -0
- package/dist/cjs/4d/look-at-4d.d.ts +10 -0
- package/dist/cjs/4d/look-at-4d.js +14 -0
- package/dist/cjs/4d/magnitude-4d.d.ts +7 -0
- package/dist/cjs/4d/magnitude-4d.js +10 -0
- package/dist/cjs/4d/magnitude-sq-4d.d.ts +8 -0
- package/dist/cjs/4d/magnitude-sq-4d.js +11 -0
- package/dist/cjs/4d/multiply-4d.d.ts +8 -0
- package/dist/cjs/4d/multiply-4d.js +16 -0
- package/dist/cjs/4d/negate-4d.d.ts +7 -0
- package/dist/cjs/4d/negate-4d.js +10 -0
- package/dist/cjs/4d/normalize-4d.d.ts +8 -0
- package/dist/cjs/4d/normalize-4d.js +17 -0
- package/dist/cjs/4d/one-4d.d.ts +6 -0
- package/dist/cjs/4d/one-4d.js +9 -0
- package/dist/cjs/4d/project-4d.d.ts +10 -0
- package/dist/cjs/4d/project-4d.js +18 -0
- package/dist/cjs/4d/random-4d.d.ts +7 -0
- package/dist/cjs/4d/random-4d.js +21 -0
- package/dist/cjs/4d/reflect-4d.d.ts +9 -0
- package/dist/cjs/4d/reflect-4d.js +21 -0
- package/dist/cjs/4d/set-magnitude-4d.d.ts +9 -0
- package/dist/cjs/4d/set-magnitude-4d.js +18 -0
- package/dist/cjs/4d/subtract-4d.d.ts +8 -0
- package/dist/cjs/4d/subtract-4d.js +16 -0
- package/dist/cjs/4d/types.d.ts +4 -0
- package/dist/cjs/4d/types.js +2 -0
- package/dist/cjs/4d/zero-4d.d.ts +6 -0
- package/dist/cjs/4d/zero-4d.js +9 -0
- package/dist/cjs/index.d.ts +7 -0
- package/dist/cjs/index.js +23 -0
- package/dist/cjs/package.json +1 -0
- package/dist/cjs/slerp.d.ts +21 -0
- package/dist/cjs/slerp.js +28 -0
- package/dist/{vec2.d.ts → cjs/vec2.d.ts} +10 -4
- package/dist/cjs/vec2.js +889 -0
- package/dist/{vec3.d.ts → cjs/vec3.d.ts} +159 -100
- package/dist/cjs/vec3.js +1045 -0
- package/dist/cjs/vec4.d.ts +602 -0
- package/dist/cjs/vec4.js +1101 -0
- package/dist/esm/2d/add-2d.d.ts +8 -0
- package/dist/esm/2d/add-2d.js +7 -0
- package/dist/esm/2d/angle-between-2d.d.ts +8 -0
- package/dist/esm/2d/angle-between-2d.js +7 -0
- package/dist/esm/2d/angle-x-2d.d.ts +7 -0
- package/dist/esm/2d/angle-x-2d.js +6 -0
- package/dist/esm/2d/angle-y-2d.d.ts +7 -0
- package/dist/esm/2d/angle-y-2d.js +6 -0
- package/dist/esm/2d/clamp-2d.d.ts +10 -0
- package/dist/esm/2d/clamp-2d.js +10 -0
- package/dist/esm/2d/clone-2d.d.ts +7 -0
- package/dist/esm/2d/clone-2d.js +6 -0
- package/dist/esm/2d/cross-2d.d.ts +8 -0
- package/dist/esm/2d/cross-2d.js +7 -0
- package/dist/esm/2d/distance-2d.d.ts +8 -0
- package/dist/esm/2d/distance-2d.js +7 -0
- package/dist/esm/2d/distance-chebyshev-2d.d.ts +8 -0
- package/dist/esm/2d/distance-chebyshev-2d.js +11 -0
- package/dist/esm/2d/distance-manhattan-2d.d.ts +8 -0
- package/dist/esm/2d/distance-manhattan-2d.js +7 -0
- package/dist/esm/2d/distance-minkowski-2d.d.ts +9 -0
- package/dist/esm/2d/distance-minkowski-2d.js +8 -0
- package/dist/esm/2d/distance-sq-2d.d.ts +8 -0
- package/dist/esm/2d/distance-sq-2d.js +7 -0
- package/dist/esm/2d/divide-2d.d.ts +8 -0
- package/dist/esm/2d/divide-2d.js +10 -0
- package/dist/esm/2d/dot-2d.d.ts +8 -0
- package/dist/esm/2d/dot-2d.js +7 -0
- package/dist/esm/2d/from-angle-x-2d.d.ts +8 -0
- package/dist/esm/2d/from-angle-x-2d.js +10 -0
- package/dist/esm/2d/from-angle-y-2d.d.ts +8 -0
- package/dist/esm/2d/from-angle-y-2d.js +10 -0
- package/dist/esm/2d/from-object-2d.d.ts +10 -0
- package/dist/esm/2d/from-object-2d.js +6 -0
- package/dist/esm/2d/from-polar-coords-2d.d.ts +8 -0
- package/dist/esm/2d/from-polar-coords-2d.js +7 -0
- package/dist/esm/2d/immutable-2d.d.ts +7 -0
- package/dist/esm/2d/immutable-2d.js +6 -0
- package/dist/esm/2d/index.d.ts +47 -0
- package/dist/esm/2d/index.js +47 -0
- package/dist/esm/2d/is-equal-2d.d.ts +8 -0
- package/dist/esm/2d/is-equal-2d.js +7 -0
- package/dist/esm/2d/is-equal-approx-2d.d.ts +9 -0
- package/dist/esm/2d/is-equal-approx-2d.js +8 -0
- package/dist/esm/2d/is-infinite-2d.d.ts +7 -0
- package/dist/esm/2d/is-infinite-2d.js +9 -0
- package/dist/esm/2d/is-nan-2d.d.ts +7 -0
- package/dist/esm/2d/is-nan-2d.js +6 -0
- package/dist/esm/2d/is-opposite-2d.d.ts +8 -0
- package/dist/esm/2d/is-opposite-2d.js +7 -0
- package/dist/esm/2d/is-zero-2d.d.ts +7 -0
- package/dist/esm/2d/is-zero-2d.js +6 -0
- package/dist/esm/2d/lerp-2d.d.ts +9 -0
- package/dist/esm/2d/lerp-2d.js +11 -0
- package/dist/esm/2d/limit-max-2d.d.ts +9 -0
- package/dist/esm/2d/limit-max-2d.js +9 -0
- package/dist/esm/2d/limit-min-2d.d.ts +9 -0
- package/dist/esm/2d/limit-min-2d.js +9 -0
- package/dist/esm/2d/look-at-2d.d.ts +10 -0
- package/dist/esm/2d/look-at-2d.js +10 -0
- package/dist/esm/2d/magnitude-2d.d.ts +7 -0
- package/dist/esm/2d/magnitude-2d.js +6 -0
- package/dist/esm/2d/magnitude-sq-2d.d.ts +7 -0
- package/dist/esm/2d/magnitude-sq-2d.js +6 -0
- package/dist/esm/2d/multiply-2d.d.ts +8 -0
- package/dist/esm/2d/multiply-2d.js +7 -0
- package/dist/esm/2d/negate-2d.d.ts +7 -0
- package/dist/esm/2d/negate-2d.js +6 -0
- package/dist/esm/2d/normalize-2d.d.ts +8 -0
- package/dist/esm/2d/normalize-2d.js +8 -0
- package/dist/esm/2d/one-2d.d.ts +6 -0
- package/dist/esm/2d/one-2d.js +5 -0
- package/dist/esm/2d/project-2d.d.ts +10 -0
- package/dist/esm/2d/project-2d.js +13 -0
- package/dist/esm/2d/random-2d.d.ts +7 -0
- package/dist/esm/2d/random-2d.js +9 -0
- package/dist/esm/2d/reflect-2d.d.ts +9 -0
- package/dist/esm/2d/reflect-2d.js +12 -0
- package/dist/esm/2d/rotate-2d.d.ts +9 -0
- package/dist/esm/2d/rotate-2d.js +23 -0
- package/dist/esm/2d/set-magnitude-2d.d.ts +9 -0
- package/dist/esm/2d/set-magnitude-2d.js +12 -0
- package/dist/esm/2d/subtract-2d.d.ts +8 -0
- package/dist/esm/2d/subtract-2d.js +7 -0
- package/dist/esm/2d/types.d.ts +4 -0
- package/dist/esm/2d/types.js +1 -0
- package/dist/esm/2d/zero-2d.d.ts +6 -0
- package/dist/esm/2d/zero-2d.js +5 -0
- package/dist/esm/3d/add-3d.d.ts +8 -0
- package/dist/esm/3d/add-3d.js +11 -0
- package/dist/esm/3d/angle-between-3d.d.ts +10 -0
- package/dist/esm/3d/angle-between-3d.js +10 -0
- package/dist/esm/3d/angle-x-3d.d.ts +7 -0
- package/dist/esm/3d/angle-x-3d.js +6 -0
- package/dist/esm/3d/angle-y-3d.d.ts +7 -0
- package/dist/esm/3d/angle-y-3d.js +6 -0
- package/dist/esm/3d/angle-z-3d.d.ts +7 -0
- package/dist/esm/3d/angle-z-3d.js +6 -0
- package/dist/esm/3d/clamp-3d.d.ts +10 -0
- package/dist/esm/3d/clamp-3d.js +14 -0
- package/dist/esm/3d/clone-3d.d.ts +7 -0
- package/dist/esm/3d/clone-3d.js +6 -0
- package/dist/esm/3d/cross-3d.d.ts +8 -0
- package/dist/esm/3d/cross-3d.js +11 -0
- package/dist/esm/3d/distance-3d.d.ts +8 -0
- package/dist/esm/3d/distance-3d.js +7 -0
- package/dist/esm/3d/distance-chebyshev-3d.d.ts +8 -0
- package/dist/esm/3d/distance-chebyshev-3d.js +12 -0
- package/dist/esm/3d/distance-manhattan-3d.d.ts +8 -0
- package/dist/esm/3d/distance-manhattan-3d.js +7 -0
- package/dist/esm/3d/distance-minkowski-3d.d.ts +9 -0
- package/dist/esm/3d/distance-minkowski-3d.js +8 -0
- package/dist/esm/3d/distance-sq-3d.d.ts +8 -0
- package/dist/esm/3d/distance-sq-3d.js +7 -0
- package/dist/esm/3d/divide-3d.d.ts +8 -0
- package/dist/esm/3d/divide-3d.js +11 -0
- package/dist/esm/3d/dot-3d.d.ts +8 -0
- package/dist/esm/3d/dot-3d.js +7 -0
- package/dist/esm/3d/from-cylindrical-coords-3d.d.ts +9 -0
- package/dist/esm/3d/from-cylindrical-coords-3d.js +12 -0
- package/dist/esm/3d/from-object-3d.d.ts +11 -0
- package/dist/esm/3d/from-object-3d.js +6 -0
- package/dist/esm/3d/from-spherical-coords-3d.d.ts +9 -0
- package/dist/esm/3d/from-spherical-coords-3d.js +12 -0
- package/dist/esm/3d/immutable-3d.d.ts +7 -0
- package/dist/esm/3d/immutable-3d.js +6 -0
- package/dist/esm/3d/index.d.ts +49 -0
- package/dist/esm/3d/index.js +49 -0
- package/dist/esm/3d/is-equal-3d.d.ts +8 -0
- package/dist/esm/3d/is-equal-3d.js +7 -0
- package/dist/esm/3d/is-equal-approx-3d.d.ts +9 -0
- package/dist/esm/3d/is-equal-approx-3d.js +10 -0
- package/dist/esm/3d/is-infinite-3d.d.ts +7 -0
- package/dist/esm/3d/is-infinite-3d.js +11 -0
- package/dist/esm/3d/is-nan-3d.d.ts +7 -0
- package/dist/esm/3d/is-nan-3d.js +6 -0
- package/dist/esm/3d/is-opposite-3d.d.ts +8 -0
- package/dist/esm/3d/is-opposite-3d.js +7 -0
- package/dist/esm/3d/is-zero-3d.d.ts +7 -0
- package/dist/esm/3d/is-zero-3d.js +6 -0
- package/dist/esm/3d/lerp-3d.d.ts +9 -0
- package/dist/esm/3d/lerp-3d.js +12 -0
- package/dist/esm/3d/limit-max-3d.d.ts +9 -0
- package/dist/esm/3d/limit-max-3d.js +9 -0
- package/dist/esm/3d/limit-min-3d.d.ts +9 -0
- package/dist/esm/3d/limit-min-3d.js +9 -0
- package/dist/esm/3d/look-at-3d.d.ts +10 -0
- package/dist/esm/3d/look-at-3d.js +10 -0
- package/dist/esm/3d/magnitude-3d.d.ts +7 -0
- package/dist/esm/3d/magnitude-3d.js +6 -0
- package/dist/esm/3d/magnitude-sq-3d.d.ts +7 -0
- package/dist/esm/3d/magnitude-sq-3d.js +6 -0
- package/dist/esm/3d/multiply-3d.d.ts +8 -0
- package/dist/esm/3d/multiply-3d.js +11 -0
- package/dist/esm/3d/negate-3d.d.ts +7 -0
- package/dist/esm/3d/negate-3d.js +6 -0
- package/dist/esm/3d/normalize-3d.d.ts +8 -0
- package/dist/esm/3d/normalize-3d.js +8 -0
- package/dist/esm/3d/one-3d.d.ts +6 -0
- package/dist/esm/3d/one-3d.js +5 -0
- package/dist/esm/3d/project-3d.d.ts +10 -0
- package/dist/esm/3d/project-3d.js +13 -0
- package/dist/esm/3d/random-3d.d.ts +7 -0
- package/dist/esm/3d/random-3d.js +7 -0
- package/dist/esm/3d/reflect-3d.d.ts +9 -0
- package/dist/esm/3d/reflect-3d.js +12 -0
- package/dist/esm/3d/rotate-x-3d.d.ts +9 -0
- package/dist/esm/3d/rotate-x-3d.js +22 -0
- package/dist/esm/3d/rotate-y-3d.d.ts +9 -0
- package/dist/esm/3d/rotate-y-3d.js +22 -0
- package/dist/esm/3d/rotate-z-3d.d.ts +9 -0
- package/dist/esm/3d/rotate-z-3d.js +22 -0
- package/dist/esm/3d/set-magnitude-3d.d.ts +9 -0
- package/dist/esm/3d/set-magnitude-3d.js +9 -0
- package/dist/esm/3d/subtract-3d.d.ts +8 -0
- package/dist/esm/3d/subtract-3d.js +11 -0
- package/dist/esm/3d/types.d.ts +4 -0
- package/dist/esm/3d/types.js +1 -0
- package/dist/esm/3d/zero-3d.d.ts +6 -0
- package/dist/esm/3d/zero-3d.js +5 -0
- package/dist/esm/4d/add-4d.d.ts +8 -0
- package/dist/esm/4d/add-4d.js +12 -0
- package/dist/esm/4d/angle-between-4d.d.ts +10 -0
- package/dist/esm/4d/angle-between-4d.js +11 -0
- package/dist/esm/4d/angle-w-4d.d.ts +7 -0
- package/dist/esm/4d/angle-w-4d.js +6 -0
- package/dist/esm/4d/angle-x-4d.d.ts +7 -0
- package/dist/esm/4d/angle-x-4d.js +6 -0
- package/dist/esm/4d/angle-y-4d.d.ts +7 -0
- package/dist/esm/4d/angle-y-4d.js +6 -0
- package/dist/esm/4d/angle-z-4d.d.ts +7 -0
- package/dist/esm/4d/angle-z-4d.js +6 -0
- package/dist/esm/4d/clamp-4d.d.ts +10 -0
- package/dist/esm/4d/clamp-4d.js +14 -0
- package/dist/esm/4d/clone-4d.d.ts +7 -0
- package/dist/esm/4d/clone-4d.js +6 -0
- package/dist/esm/4d/distance-4d.d.ts +8 -0
- package/dist/esm/4d/distance-4d.js +7 -0
- package/dist/esm/4d/distance-chebyshev-4d.d.ts +8 -0
- package/dist/esm/4d/distance-chebyshev-4d.js +19 -0
- package/dist/esm/4d/distance-manhattan-4d.d.ts +8 -0
- package/dist/esm/4d/distance-manhattan-4d.js +10 -0
- package/dist/esm/4d/distance-minkowski-4d.d.ts +9 -0
- package/dist/esm/4d/distance-minkowski-4d.js +12 -0
- package/dist/esm/4d/distance-sq-4d.d.ts +9 -0
- package/dist/esm/4d/distance-sq-4d.js +8 -0
- package/dist/esm/4d/divide-4d.d.ts +8 -0
- package/dist/esm/4d/divide-4d.js +12 -0
- package/dist/esm/4d/dot-4d.d.ts +8 -0
- package/dist/esm/4d/dot-4d.js +7 -0
- package/dist/esm/4d/from-object-4d.d.ts +12 -0
- package/dist/esm/4d/from-object-4d.js +11 -0
- package/dist/esm/4d/immutable-4d.d.ts +7 -0
- package/dist/esm/4d/immutable-4d.js +6 -0
- package/dist/esm/4d/index.d.ts +44 -0
- package/dist/esm/4d/index.js +44 -0
- package/dist/esm/4d/is-equal-4d.d.ts +8 -0
- package/dist/esm/4d/is-equal-4d.js +7 -0
- package/dist/esm/4d/is-equal-approx-4d.d.ts +9 -0
- package/dist/esm/4d/is-equal-approx-4d.js +11 -0
- package/dist/esm/4d/is-infinite-4d.d.ts +7 -0
- package/dist/esm/4d/is-infinite-4d.js +13 -0
- package/dist/esm/4d/is-nan-4d.d.ts +7 -0
- package/dist/esm/4d/is-nan-4d.js +6 -0
- package/dist/esm/4d/is-opposite-4d.d.ts +8 -0
- package/dist/esm/4d/is-opposite-4d.js +7 -0
- package/dist/esm/4d/is-zero-4d.d.ts +7 -0
- package/dist/esm/4d/is-zero-4d.js +6 -0
- package/dist/esm/4d/lerp-4d.d.ts +9 -0
- package/dist/esm/4d/lerp-4d.js +13 -0
- package/dist/esm/4d/limit-max-4d.d.ts +9 -0
- package/dist/esm/4d/limit-max-4d.js +9 -0
- package/dist/esm/4d/limit-min-4d.d.ts +9 -0
- package/dist/esm/4d/limit-min-4d.js +9 -0
- package/dist/esm/4d/look-at-4d.d.ts +10 -0
- package/dist/esm/4d/look-at-4d.js +10 -0
- package/dist/esm/4d/magnitude-4d.d.ts +7 -0
- package/dist/esm/4d/magnitude-4d.js +6 -0
- package/dist/esm/4d/magnitude-sq-4d.d.ts +8 -0
- package/dist/esm/4d/magnitude-sq-4d.js +7 -0
- package/dist/esm/4d/multiply-4d.d.ts +8 -0
- package/dist/esm/4d/multiply-4d.js +12 -0
- package/dist/esm/4d/negate-4d.d.ts +7 -0
- package/dist/esm/4d/negate-4d.js +6 -0
- package/dist/esm/4d/normalize-4d.d.ts +8 -0
- package/dist/esm/4d/normalize-4d.js +13 -0
- package/dist/esm/4d/one-4d.d.ts +6 -0
- package/dist/esm/4d/one-4d.js +5 -0
- package/dist/esm/4d/project-4d.d.ts +10 -0
- package/dist/esm/4d/project-4d.js +14 -0
- package/dist/esm/4d/random-4d.d.ts +7 -0
- package/dist/esm/4d/random-4d.js +17 -0
- package/dist/esm/4d/reflect-4d.d.ts +9 -0
- package/dist/esm/4d/reflect-4d.js +17 -0
- package/dist/esm/4d/set-magnitude-4d.d.ts +9 -0
- package/dist/esm/4d/set-magnitude-4d.js +14 -0
- package/dist/esm/4d/subtract-4d.d.ts +8 -0
- package/dist/esm/4d/subtract-4d.js +12 -0
- package/dist/esm/4d/types.d.ts +4 -0
- package/dist/esm/4d/types.js +1 -0
- package/dist/esm/4d/zero-4d.d.ts +6 -0
- package/dist/esm/4d/zero-4d.js +5 -0
- package/dist/esm/index.d.ts +7 -0
- package/dist/esm/index.js +7 -0
- package/dist/esm/slerp.d.ts +21 -0
- package/dist/esm/slerp.js +23 -0
- package/dist/{vec4.d.ts → esm/vec2.d.ts} +165 -157
- package/dist/{vec2.js → esm/vec2.js} +14 -6
- package/dist/esm/vec3.d.ts +614 -0
- package/dist/{vec3.js → esm/vec3.js} +190 -123
- package/dist/esm/vec4.d.ts +602 -0
- package/dist/{vec4.js → esm/vec4.js} +211 -130
- package/docs/ArrayVector2D.md +1090 -0
- package/docs/ArrayVector3D.md +1162 -0
- package/docs/ArrayVector4D.md +1019 -0
- package/docs/README.md +13 -0
- package/docs/Slerp.md +64 -0
- package/docs/Vec2.md +1827 -0
- package/docs/Vec3.md +2084 -0
- package/docs/Vec4.md +2031 -0
- package/package.json +95 -70
- package/VEC2.md +0 -147
- package/VEC3.md +0 -159
- package/VEC4.md +0 -146
- package/dist/index.d.ts +0 -3
- package/dist/index.js +0 -3
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Documentation for functional 3D Vector array operations.
|
|
3
|
+
* @module ArrayVector3D
|
|
4
|
+
*/
|
|
5
|
+
export * from "./add-3d.js";
|
|
6
|
+
export * from "./angle-between-3d.js";
|
|
7
|
+
export * from "./angle-x-3d.js";
|
|
8
|
+
export * from "./angle-y-3d.js";
|
|
9
|
+
export * from "./angle-z-3d.js";
|
|
10
|
+
export * from "./clamp-3d.js";
|
|
11
|
+
export * from "./clone-3d.js";
|
|
12
|
+
export * from "./cross-3d.js";
|
|
13
|
+
export * from "./distance-3d.js";
|
|
14
|
+
export * from "./distance-chebyshev-3d.js";
|
|
15
|
+
export * from "./distance-manhattan-3d.js";
|
|
16
|
+
export * from "./distance-minkowski-3d.js";
|
|
17
|
+
export * from "./distance-sq-3d.js";
|
|
18
|
+
export * from "./divide-3d.js";
|
|
19
|
+
export * from "./dot-3d.js";
|
|
20
|
+
export * from "./from-cylindrical-coords-3d.js";
|
|
21
|
+
export * from "./from-object-3d.js";
|
|
22
|
+
export * from "./from-spherical-coords-3d.js";
|
|
23
|
+
export * from "./immutable-3d.js";
|
|
24
|
+
export * from "./is-equal-3d.js";
|
|
25
|
+
export * from "./is-equal-approx-3d.js";
|
|
26
|
+
export * from "./is-infinite-3d.js";
|
|
27
|
+
export * from "./is-nan-3d.js";
|
|
28
|
+
export * from "./is-opposite-3d.js";
|
|
29
|
+
export * from "./is-zero-3d.js";
|
|
30
|
+
export * from "./lerp-3d.js";
|
|
31
|
+
export * from "./limit-max-3d.js";
|
|
32
|
+
export * from "./limit-min-3d.js";
|
|
33
|
+
export * from "./look-at-3d.js";
|
|
34
|
+
export * from "./magnitude-3d.js";
|
|
35
|
+
export * from "./magnitude-sq-3d.js";
|
|
36
|
+
export * from "./multiply-3d.js";
|
|
37
|
+
export * from "./negate-3d.js";
|
|
38
|
+
export * from "./normalize-3d.js";
|
|
39
|
+
export * from "./one-3d.js";
|
|
40
|
+
export * from "./project-3d.js";
|
|
41
|
+
export * from "./random-3d.js";
|
|
42
|
+
export * from "./reflect-3d.js";
|
|
43
|
+
export * from "./rotate-x-3d.js";
|
|
44
|
+
export * from "./rotate-y-3d.js";
|
|
45
|
+
export * from "./rotate-z-3d.js";
|
|
46
|
+
export * from "./set-magnitude-3d.js";
|
|
47
|
+
export * from "./subtract-3d.js";
|
|
48
|
+
export * from "./types.js";
|
|
49
|
+
export * from "./zero-3d.js";
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
/**
|
|
18
|
+
* Documentation for functional 3D Vector array operations.
|
|
19
|
+
* @module ArrayVector3D
|
|
20
|
+
*/
|
|
21
|
+
__exportStar(require("./add-3d.js"), exports);
|
|
22
|
+
__exportStar(require("./angle-between-3d.js"), exports);
|
|
23
|
+
__exportStar(require("./angle-x-3d.js"), exports);
|
|
24
|
+
__exportStar(require("./angle-y-3d.js"), exports);
|
|
25
|
+
__exportStar(require("./angle-z-3d.js"), exports);
|
|
26
|
+
__exportStar(require("./clamp-3d.js"), exports);
|
|
27
|
+
__exportStar(require("./clone-3d.js"), exports);
|
|
28
|
+
__exportStar(require("./cross-3d.js"), exports);
|
|
29
|
+
__exportStar(require("./distance-3d.js"), exports);
|
|
30
|
+
__exportStar(require("./distance-chebyshev-3d.js"), exports);
|
|
31
|
+
__exportStar(require("./distance-manhattan-3d.js"), exports);
|
|
32
|
+
__exportStar(require("./distance-minkowski-3d.js"), exports);
|
|
33
|
+
__exportStar(require("./distance-sq-3d.js"), exports);
|
|
34
|
+
__exportStar(require("./divide-3d.js"), exports);
|
|
35
|
+
__exportStar(require("./dot-3d.js"), exports);
|
|
36
|
+
__exportStar(require("./from-cylindrical-coords-3d.js"), exports);
|
|
37
|
+
__exportStar(require("./from-object-3d.js"), exports);
|
|
38
|
+
__exportStar(require("./from-spherical-coords-3d.js"), exports);
|
|
39
|
+
__exportStar(require("./immutable-3d.js"), exports);
|
|
40
|
+
__exportStar(require("./is-equal-3d.js"), exports);
|
|
41
|
+
__exportStar(require("./is-equal-approx-3d.js"), exports);
|
|
42
|
+
__exportStar(require("./is-infinite-3d.js"), exports);
|
|
43
|
+
__exportStar(require("./is-nan-3d.js"), exports);
|
|
44
|
+
__exportStar(require("./is-opposite-3d.js"), exports);
|
|
45
|
+
__exportStar(require("./is-zero-3d.js"), exports);
|
|
46
|
+
__exportStar(require("./lerp-3d.js"), exports);
|
|
47
|
+
__exportStar(require("./limit-max-3d.js"), exports);
|
|
48
|
+
__exportStar(require("./limit-min-3d.js"), exports);
|
|
49
|
+
__exportStar(require("./look-at-3d.js"), exports);
|
|
50
|
+
__exportStar(require("./magnitude-3d.js"), exports);
|
|
51
|
+
__exportStar(require("./magnitude-sq-3d.js"), exports);
|
|
52
|
+
__exportStar(require("./multiply-3d.js"), exports);
|
|
53
|
+
__exportStar(require("./negate-3d.js"), exports);
|
|
54
|
+
__exportStar(require("./normalize-3d.js"), exports);
|
|
55
|
+
__exportStar(require("./one-3d.js"), exports);
|
|
56
|
+
__exportStar(require("./project-3d.js"), exports);
|
|
57
|
+
__exportStar(require("./random-3d.js"), exports);
|
|
58
|
+
__exportStar(require("./reflect-3d.js"), exports);
|
|
59
|
+
__exportStar(require("./rotate-x-3d.js"), exports);
|
|
60
|
+
__exportStar(require("./rotate-y-3d.js"), exports);
|
|
61
|
+
__exportStar(require("./rotate-z-3d.js"), exports);
|
|
62
|
+
__exportStar(require("./set-magnitude-3d.js"), exports);
|
|
63
|
+
__exportStar(require("./subtract-3d.js"), exports);
|
|
64
|
+
__exportStar(require("./types.js"), exports);
|
|
65
|
+
__exportStar(require("./zero-3d.js"), exports);
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { ArrayVector3D } from "./types";
|
|
2
|
+
/**
|
|
3
|
+
* Checks if two 3D vectors are equal.
|
|
4
|
+
* @param {ArrayVector3D} xyz1 - First vector as `[x, y, z]`
|
|
5
|
+
* @param {ArrayVector3D} xyz2 - Second vector as `[x, y, z]`
|
|
6
|
+
* @returns {ArrayVector3D} `true` if the vectors are equal, `false` otherwise
|
|
7
|
+
*/
|
|
8
|
+
export declare const isEqual3D: (xyz1: ArrayVector3D, xyz2: ArrayVector3D) => boolean;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.isEqual3D = void 0;
|
|
4
|
+
/**
|
|
5
|
+
* Checks if two 3D vectors are equal.
|
|
6
|
+
* @param {ArrayVector3D} xyz1 - First vector as `[x, y, z]`
|
|
7
|
+
* @param {ArrayVector3D} xyz2 - Second vector as `[x, y, z]`
|
|
8
|
+
* @returns {ArrayVector3D} `true` if the vectors are equal, `false` otherwise
|
|
9
|
+
*/
|
|
10
|
+
const isEqual3D = (xyz1, xyz2) => xyz1[0] === xyz2[0] && xyz1[1] === xyz2[1] && xyz1[2] === xyz2[2];
|
|
11
|
+
exports.isEqual3D = isEqual3D;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { ArrayVector3D } from "./types";
|
|
2
|
+
/**
|
|
3
|
+
* Compares two 3D vectors using an epsilon value for floating-point comparison.
|
|
4
|
+
* @param {ArrayVector3D} xyz1 - First vector as `[x, y, z]`
|
|
5
|
+
* @param {ArrayVector3D} xyz2 - Second vector as `[x, y, z]`
|
|
6
|
+
* @param {number} epsilon - Tolerance for comparison (default: `Number.EPSILON`)
|
|
7
|
+
* @returns {boolean} `true` if the vectors are approximately equal, `false` otherwise
|
|
8
|
+
*/
|
|
9
|
+
export declare const isEqualApprox3D: (xyz1: ArrayVector3D, xyz2: ArrayVector3D, epsilon?: number) => boolean;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.isEqualApprox3D = void 0;
|
|
4
|
+
/**
|
|
5
|
+
* Compares two 3D vectors using an epsilon value for floating-point comparison.
|
|
6
|
+
* @param {ArrayVector3D} xyz1 - First vector as `[x, y, z]`
|
|
7
|
+
* @param {ArrayVector3D} xyz2 - Second vector as `[x, y, z]`
|
|
8
|
+
* @param {number} epsilon - Tolerance for comparison (default: `Number.EPSILON`)
|
|
9
|
+
* @returns {boolean} `true` if the vectors are approximately equal, `false` otherwise
|
|
10
|
+
*/
|
|
11
|
+
const isEqualApprox3D = (xyz1, xyz2, epsilon = Number.EPSILON) => Math.abs(xyz1[0] - xyz2[0]) <= epsilon &&
|
|
12
|
+
Math.abs(xyz1[1] - xyz2[1]) <= epsilon &&
|
|
13
|
+
Math.abs(xyz1[2] - xyz2[2]) <= epsilon;
|
|
14
|
+
exports.isEqualApprox3D = isEqualApprox3D;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { ArrayVector3D } from "./types";
|
|
2
|
+
/**
|
|
3
|
+
* Checks if a vector has infinite components.
|
|
4
|
+
* @param {ArrayVector3D} xyz - Vector as `[x, y, z]`
|
|
5
|
+
* @returns {boolean} `true` if the vector has infinite components, `false` otherwise
|
|
6
|
+
*/
|
|
7
|
+
export declare const isInfinite3D: (xyz: ArrayVector3D) => boolean;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.isInfinite3D = void 0;
|
|
4
|
+
/**
|
|
5
|
+
* Checks if a vector has infinite components.
|
|
6
|
+
* @param {ArrayVector3D} xyz - Vector as `[x, y, z]`
|
|
7
|
+
* @returns {boolean} `true` if the vector has infinite components, `false` otherwise
|
|
8
|
+
*/
|
|
9
|
+
const isInfinite3D = (xyz) => xyz[0] === Number.POSITIVE_INFINITY ||
|
|
10
|
+
xyz[0] === Number.NEGATIVE_INFINITY ||
|
|
11
|
+
xyz[1] === Number.POSITIVE_INFINITY ||
|
|
12
|
+
xyz[1] === Number.NEGATIVE_INFINITY ||
|
|
13
|
+
xyz[2] === Number.POSITIVE_INFINITY ||
|
|
14
|
+
xyz[2] === Number.NEGATIVE_INFINITY;
|
|
15
|
+
exports.isInfinite3D = isInfinite3D;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { ArrayVector3D } from "./types";
|
|
2
|
+
/**
|
|
3
|
+
* Checks if a 3D vector has NaN components.
|
|
4
|
+
* @param {ArrayVector3D} xyz - Vector as `[x, y, z]`
|
|
5
|
+
* @returns {boolean} `true` if the vector has `NaN` components, `false` otherwise.
|
|
6
|
+
*/
|
|
7
|
+
export declare const isNaN3D: (xyz: ArrayVector3D) => boolean;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.isNaN3D = void 0;
|
|
4
|
+
/**
|
|
5
|
+
* Checks if a 3D vector has NaN components.
|
|
6
|
+
* @param {ArrayVector3D} xyz - Vector as `[x, y, z]`
|
|
7
|
+
* @returns {boolean} `true` if the vector has `NaN` components, `false` otherwise.
|
|
8
|
+
*/
|
|
9
|
+
const isNaN3D = (xyz) => Number.isNaN(xyz[0]) || Number.isNaN(xyz[1]) || Number.isNaN(xyz[2]);
|
|
10
|
+
exports.isNaN3D = isNaN3D;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { ArrayVector3D } from "./types";
|
|
2
|
+
/**
|
|
3
|
+
* Checks if two 3D vectors are opposite.
|
|
4
|
+
* @param {ArrayVector3D} xyz1 - First vector as `[x, y, z]`
|
|
5
|
+
* @param {ArrayVector3D} xyz2 - Second vector as `[x, y, z]`
|
|
6
|
+
* @returns {boolean} `true` if the vectors are opposite, `false` otherwise
|
|
7
|
+
*/
|
|
8
|
+
export declare const isOpposite3D: (xyz1: ArrayVector3D, xyz2: ArrayVector3D) => boolean;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.isOpposite3D = void 0;
|
|
4
|
+
/**
|
|
5
|
+
* Checks if two 3D vectors are opposite.
|
|
6
|
+
* @param {ArrayVector3D} xyz1 - First vector as `[x, y, z]`
|
|
7
|
+
* @param {ArrayVector3D} xyz2 - Second vector as `[x, y, z]`
|
|
8
|
+
* @returns {boolean} `true` if the vectors are opposite, `false` otherwise
|
|
9
|
+
*/
|
|
10
|
+
const isOpposite3D = (xyz1, xyz2) => xyz1[0] === -xyz2[0] && xyz1[1] === -xyz2[1] && xyz1[2] === -xyz2[2];
|
|
11
|
+
exports.isOpposite3D = isOpposite3D;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { ArrayVector3D } from "./types";
|
|
2
|
+
/**
|
|
3
|
+
* Checks if a 3D vector is zero.
|
|
4
|
+
* @param {ArrayVector3D} xyz - Vector as `[x, y, z]`
|
|
5
|
+
* @returns {boolean} `true` if the vector is zero, `false` otherwise
|
|
6
|
+
*/
|
|
7
|
+
export declare const isZero3D: (xyz: ArrayVector3D) => boolean;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.isZero3D = void 0;
|
|
4
|
+
/**
|
|
5
|
+
* Checks if a 3D vector is zero.
|
|
6
|
+
* @param {ArrayVector3D} xyz - Vector as `[x, y, z]`
|
|
7
|
+
* @returns {boolean} `true` if the vector is zero, `false` otherwise
|
|
8
|
+
*/
|
|
9
|
+
const isZero3D = (xyz) => xyz[0] === 0 && xyz[1] === 0 && xyz[2] === 0;
|
|
10
|
+
exports.isZero3D = isZero3D;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { ArrayVector3D } from "./types";
|
|
2
|
+
/**
|
|
3
|
+
* Performs linear interpolation between two vectors.
|
|
4
|
+
* @param {ArrayVector3D} xyz1 - First vector as `[x, y, z]`
|
|
5
|
+
* @param {ArrayVector3D} xyz2 - Second vector as `[x, y, z]`
|
|
6
|
+
* @param {number} t - Interpolation parameter
|
|
7
|
+
* @returns {ArrayVector3D} The interpolated vector
|
|
8
|
+
*/
|
|
9
|
+
export declare const lerp3D: (xyz1: ArrayVector3D, xyz2: ArrayVector3D, t: number) => ArrayVector3D;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.lerp3D = void 0;
|
|
4
|
+
/**
|
|
5
|
+
* Performs linear interpolation between two vectors.
|
|
6
|
+
* @param {ArrayVector3D} xyz1 - First vector as `[x, y, z]`
|
|
7
|
+
* @param {ArrayVector3D} xyz2 - Second vector as `[x, y, z]`
|
|
8
|
+
* @param {number} t - Interpolation parameter
|
|
9
|
+
* @returns {ArrayVector3D} The interpolated vector
|
|
10
|
+
*/
|
|
11
|
+
const lerp3D = (xyz1, xyz2, t) => [
|
|
12
|
+
xyz1[0] + (xyz2[0] - xyz1[0]) * t,
|
|
13
|
+
xyz1[1] + (xyz2[1] - xyz1[1]) * t,
|
|
14
|
+
xyz1[2] + (xyz2[2] - xyz1[2]) * t,
|
|
15
|
+
];
|
|
16
|
+
exports.lerp3D = lerp3D;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { ArrayVector3D } from "./types.js";
|
|
2
|
+
/**
|
|
3
|
+
* Limits the maximum magnitude of a 3D vector.
|
|
4
|
+
* @param {ArrayVector3D} xyz - Vector as `[x, y, z]`
|
|
5
|
+
* @param {number} max - Maximum magnitude
|
|
6
|
+
* @param {number} [m] - Optional current magnitude (default: `magnitude3D(xyz)`)
|
|
7
|
+
* @returns {ArrayVector3D} The adjusted vector
|
|
8
|
+
*/
|
|
9
|
+
export declare const limitMax3D: (xyz: ArrayVector3D, max: number, m?: number) => ArrayVector3D;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.limitMax3D = void 0;
|
|
4
|
+
const magnitude_3d_js_1 = require("./magnitude-3d.js");
|
|
5
|
+
/**
|
|
6
|
+
* Limits the maximum magnitude of a 3D vector.
|
|
7
|
+
* @param {ArrayVector3D} xyz - Vector as `[x, y, z]`
|
|
8
|
+
* @param {number} max - Maximum magnitude
|
|
9
|
+
* @param {number} [m] - Optional current magnitude (default: `magnitude3D(xyz)`)
|
|
10
|
+
* @returns {ArrayVector3D} The adjusted vector
|
|
11
|
+
*/
|
|
12
|
+
const limitMax3D = (xyz, max, m = (0, magnitude_3d_js_1.magnitude3D)(xyz)) => m > max ? [(xyz[0] / m) * max, (xyz[1] / m) * max, (xyz[2] / m) * max] : xyz;
|
|
13
|
+
exports.limitMax3D = limitMax3D;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { ArrayVector3D } from "./types.js";
|
|
2
|
+
/**
|
|
3
|
+
* Limits the minimum magnitude of a 3D vector.
|
|
4
|
+
* @param {ArrayVector3D} xyz - Vector as `[x, y, z]`
|
|
5
|
+
* @param {number} min - Minimum magnitude
|
|
6
|
+
* @param {number} [m] - Optional current magnitude (default: `magnitude3D(xyz)`)
|
|
7
|
+
* @returns {ArrayVector3D} The adjusted vector
|
|
8
|
+
*/
|
|
9
|
+
export declare const limitMin3D: (xyz: ArrayVector3D, min: number, m?: number) => ArrayVector3D;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.limitMin3D = void 0;
|
|
4
|
+
const magnitude_3d_js_1 = require("./magnitude-3d.js");
|
|
5
|
+
/**
|
|
6
|
+
* Limits the minimum magnitude of a 3D vector.
|
|
7
|
+
* @param {ArrayVector3D} xyz - Vector as `[x, y, z]`
|
|
8
|
+
* @param {number} min - Minimum magnitude
|
|
9
|
+
* @param {number} [m] - Optional current magnitude (default: `magnitude3D(xyz)`)
|
|
10
|
+
* @returns {ArrayVector3D} The adjusted vector
|
|
11
|
+
*/
|
|
12
|
+
const limitMin3D = (xyz, min, m = (0, magnitude_3d_js_1.magnitude3D)(xyz)) => m < min ? [(xyz[0] / m) * min, (xyz[1] / m) * min, (xyz[2] / m) * min] : xyz;
|
|
13
|
+
exports.limitMin3D = limitMin3D;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { ArrayVector3D } from "./types.js";
|
|
2
|
+
/**
|
|
3
|
+
* Creates a vector pointing from the first vector to the second vector, maintaining the magnitude of the first vector.
|
|
4
|
+
* @param {ArrayVector3D} xyz1 - First vector as `[x, y, z]` (source direction)
|
|
5
|
+
* @param {ArrayVector3D} xyz2 - Second vector as `[x, y, z]` (target direction)
|
|
6
|
+
* @param {number} [m1] - Optional current magnitude of the first vector (default: `magnitude3D(xyz1)`)
|
|
7
|
+
* @param {number} [m2] - Optional current magnitude of the second vector (default: `magnitude3D(xyz2)`)
|
|
8
|
+
* @returns {ArrayVector3D} The look-at vector
|
|
9
|
+
*/
|
|
10
|
+
export declare const lookAt3D: (xyz1: ArrayVector3D, xyz2: ArrayVector3D, m1?: number, m2?: number) => ArrayVector3D;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.lookAt3D = void 0;
|
|
4
|
+
const magnitude_3d_js_1 = require("./magnitude-3d.js");
|
|
5
|
+
/**
|
|
6
|
+
* Creates a vector pointing from the first vector to the second vector, maintaining the magnitude of the first vector.
|
|
7
|
+
* @param {ArrayVector3D} xyz1 - First vector as `[x, y, z]` (source direction)
|
|
8
|
+
* @param {ArrayVector3D} xyz2 - Second vector as `[x, y, z]` (target direction)
|
|
9
|
+
* @param {number} [m1] - Optional current magnitude of the first vector (default: `magnitude3D(xyz1)`)
|
|
10
|
+
* @param {number} [m2] - Optional current magnitude of the second vector (default: `magnitude3D(xyz2)`)
|
|
11
|
+
* @returns {ArrayVector3D} The look-at vector
|
|
12
|
+
*/
|
|
13
|
+
const lookAt3D = (xyz1, xyz2, m1 = (0, magnitude_3d_js_1.magnitude3D)(xyz1), m2 = (0, magnitude_3d_js_1.magnitude3D)(xyz2)) => [(xyz2[0] / m2) * m1, (xyz2[1] / m2) * m1, (xyz2[2] / m2) * m1];
|
|
14
|
+
exports.lookAt3D = lookAt3D;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { ArrayVector3D } from "./types";
|
|
2
|
+
/**
|
|
3
|
+
* Calculates the magnitude of a 3D vector.
|
|
4
|
+
* @param {ArrayVector3D} xyz - Vector as `[x, y, z]`
|
|
5
|
+
* @returns {number} Magnitude of the vector
|
|
6
|
+
*/
|
|
7
|
+
export declare const magnitude3D: (xyz: ArrayVector3D) => number;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.magnitude3D = void 0;
|
|
4
|
+
/**
|
|
5
|
+
* Calculates the magnitude of a 3D vector.
|
|
6
|
+
* @param {ArrayVector3D} xyz - Vector as `[x, y, z]`
|
|
7
|
+
* @returns {number} Magnitude of the vector
|
|
8
|
+
*/
|
|
9
|
+
const magnitude3D = (xyz) => Math.sqrt(xyz[0] ** 2 + xyz[1] ** 2 + xyz[2] ** 2);
|
|
10
|
+
exports.magnitude3D = magnitude3D;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { ArrayVector3D } from "./types";
|
|
2
|
+
/**
|
|
3
|
+
* Calculate the squared magnitude of a 3D vector.
|
|
4
|
+
* @param {ArrayVector3D} xyz - Vector as `[x, y, z]`
|
|
5
|
+
* @returns {number} Squared magnitude
|
|
6
|
+
*/
|
|
7
|
+
export declare const magnitudeSq3D: (xyz: ArrayVector3D) => number;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.magnitudeSq3D = void 0;
|
|
4
|
+
/**
|
|
5
|
+
* Calculate the squared magnitude of a 3D vector.
|
|
6
|
+
* @param {ArrayVector3D} xyz - Vector as `[x, y, z]`
|
|
7
|
+
* @returns {number} Squared magnitude
|
|
8
|
+
*/
|
|
9
|
+
const magnitudeSq3D = (xyz) => xyz[0] ** 2 + xyz[1] ** 2 + xyz[2] ** 2;
|
|
10
|
+
exports.magnitudeSq3D = magnitudeSq3D;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { ArrayVector3D } from "./types.js";
|
|
2
|
+
/**
|
|
3
|
+
* Multiplies one 3D vector with another component-wise.
|
|
4
|
+
* @param {ArrayVector3D} xyz1 - First vector as `[x, y, z]`
|
|
5
|
+
* @param {ArrayVector3D} xyz2 - Second vector as `[x, y, z]`
|
|
6
|
+
* @returns {ArrayVector3D} The multiplied value
|
|
7
|
+
*/
|
|
8
|
+
export declare const multiply3D: (xyz1: ArrayVector3D, xyz2: ArrayVector3D) => ArrayVector3D;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.multiply3D = void 0;
|
|
4
|
+
/**
|
|
5
|
+
* Multiplies one 3D vector with another component-wise.
|
|
6
|
+
* @param {ArrayVector3D} xyz1 - First vector as `[x, y, z]`
|
|
7
|
+
* @param {ArrayVector3D} xyz2 - Second vector as `[x, y, z]`
|
|
8
|
+
* @returns {ArrayVector3D} The multiplied value
|
|
9
|
+
*/
|
|
10
|
+
const multiply3D = (xyz1, xyz2) => [
|
|
11
|
+
xyz1[0] * xyz2[0],
|
|
12
|
+
xyz1[1] * xyz2[1],
|
|
13
|
+
xyz1[2] * xyz2[2],
|
|
14
|
+
];
|
|
15
|
+
exports.multiply3D = multiply3D;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.negate3D = void 0;
|
|
4
|
+
/**
|
|
5
|
+
* Negates a 3D vector.
|
|
6
|
+
* @param {ArrayVector3D} xyz - Vector as `[x, y, z]`
|
|
7
|
+
* @returns {ArrayVector3D} The negated vector
|
|
8
|
+
*/
|
|
9
|
+
const negate3D = (xyz) => [-xyz[0], -xyz[1], -xyz[2]];
|
|
10
|
+
exports.negate3D = negate3D;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { ArrayVector3D } from "./types.js";
|
|
2
|
+
/**
|
|
3
|
+
* Normalize a 3D vector.
|
|
4
|
+
* @param {ArrayVector3D} xyz - Vector as `[x, y, z]`
|
|
5
|
+
* @param {number} [m] - Optional current magnitude (default: `magnitude3D(xyz)`)
|
|
6
|
+
* @returns {ArrayVector3D} The normalized vector
|
|
7
|
+
*/
|
|
8
|
+
export declare const normalize3D: (xyz: ArrayVector3D, m?: number) => ArrayVector3D;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.normalize3D = void 0;
|
|
4
|
+
const magnitude_3d_js_1 = require("./magnitude-3d.js");
|
|
5
|
+
/**
|
|
6
|
+
* Normalize a 3D vector.
|
|
7
|
+
* @param {ArrayVector3D} xyz - Vector as `[x, y, z]`
|
|
8
|
+
* @param {number} [m] - Optional current magnitude (default: `magnitude3D(xyz)`)
|
|
9
|
+
* @returns {ArrayVector3D} The normalized vector
|
|
10
|
+
*/
|
|
11
|
+
const normalize3D = (xyz, m = (0, magnitude_3d_js_1.magnitude3D)(xyz)) => m === 0 ? [0, 0, 0] : [xyz[0] / m, xyz[1] / m, xyz[2] / m];
|
|
12
|
+
exports.normalize3D = normalize3D;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.one3D = void 0;
|
|
4
|
+
/**
|
|
5
|
+
* Creates a 3D vector with all components to to 1.0.
|
|
6
|
+
* @returns {ArrayVector3D} Vector `[1, 1, 1]`
|
|
7
|
+
*/
|
|
8
|
+
const one3D = () => [1, 1, 1];
|
|
9
|
+
exports.one3D = one3D;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { ArrayVector3D } from "./types";
|
|
2
|
+
/**
|
|
3
|
+
* Projects one 3D vector onto the second.
|
|
4
|
+
* @param {ArrayVector3D} xyz1 - Vector to project
|
|
5
|
+
* @param {ArrayVector3D} xyz2 - Vector to project onto
|
|
6
|
+
* @param {number} [m1] - Optional magnitude of the vector to project (default: `magnitude3D(xyz1)`)
|
|
7
|
+
* @param {number} [m2] - Optional magnitude of the vector to project onto (default: `magnitude3D(xyz2)`)
|
|
8
|
+
* @returns {ArrayVector3D} The projected vector
|
|
9
|
+
*/
|
|
10
|
+
export declare const project3D: (xyz1: ArrayVector3D, xyz2: ArrayVector3D, m1?: number, m2?: number) => ArrayVector3D;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.project3D = void 0;
|
|
4
|
+
const magnitude_3d_1 = require("./magnitude-3d");
|
|
5
|
+
/**
|
|
6
|
+
* Projects one 3D vector onto the second.
|
|
7
|
+
* @param {ArrayVector3D} xyz1 - Vector to project
|
|
8
|
+
* @param {ArrayVector3D} xyz2 - Vector to project onto
|
|
9
|
+
* @param {number} [m1] - Optional magnitude of the vector to project (default: `magnitude3D(xyz1)`)
|
|
10
|
+
* @param {number} [m2] - Optional magnitude of the vector to project onto (default: `magnitude3D(xyz2)`)
|
|
11
|
+
* @returns {ArrayVector3D} The projected vector
|
|
12
|
+
*/
|
|
13
|
+
const project3D = (xyz1, xyz2, m1 = (0, magnitude_3d_1.magnitude3D)(xyz1), m2 = (0, magnitude_3d_1.magnitude3D)(xyz2)) => {
|
|
14
|
+
const f = m1 * Math.cos(Math.acos((xyz1[0] * xyz2[0] + xyz1[1] * xyz2[1] + xyz1[2] * xyz2[2]) / (m1 * m2)));
|
|
15
|
+
return [(xyz2[0] / m2) * f, (xyz2[1] / m2) * f, (xyz2[2] / m2) * f];
|
|
16
|
+
};
|
|
17
|
+
exports.project3D = project3D;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { ArrayVector3D } from "./types.js";
|
|
2
|
+
/**
|
|
3
|
+
* Creates a random unit 3D vector.
|
|
4
|
+
* @param {() => number} random - A function that returns a random number between 0 and 1 (default: `Math.random`)
|
|
5
|
+
* @returns {ArrayVector3D} Random unit vector
|
|
6
|
+
*/
|
|
7
|
+
export declare const random3D: (random?: () => number) => ArrayVector3D;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.random3D = void 0;
|
|
4
|
+
const from_spherical_coords_3d_js_1 = require("./from-spherical-coords-3d.js");
|
|
5
|
+
/**
|
|
6
|
+
* Creates a random unit 3D vector.
|
|
7
|
+
* @param {() => number} random - A function that returns a random number between 0 and 1 (default: `Math.random`)
|
|
8
|
+
* @returns {ArrayVector3D} Random unit vector
|
|
9
|
+
*/
|
|
10
|
+
const random3D = (random = Math.random) => (0, from_spherical_coords_3d_js_1.fromSphericalCoords3D)(Math.acos(2 * random() - 1), random() * Math.PI * 2, 1);
|
|
11
|
+
exports.random3D = random3D;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { ArrayVector3D } from "./types";
|
|
2
|
+
/**
|
|
3
|
+
* Reflects a vector across a normal vector.
|
|
4
|
+
* The normal vector should be normalized (unit length).
|
|
5
|
+
* @param {ArrayVector3D} xyz - Vector as `[x, y, z]` to reflect
|
|
6
|
+
* @param {ArrayVector3D} normal - Normal vector to reflect across (must be normalized)
|
|
7
|
+
* @returns {ArrayVector3D} The reflected vector
|
|
8
|
+
*/
|
|
9
|
+
export declare const reflect3D: (xyz: ArrayVector3D, normal: ArrayVector3D) => ArrayVector3D;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.reflect3D = void 0;
|
|
4
|
+
const dot_3d_1 = require("./dot-3d");
|
|
5
|
+
/**
|
|
6
|
+
* Reflects a vector across a normal vector.
|
|
7
|
+
* The normal vector should be normalized (unit length).
|
|
8
|
+
* @param {ArrayVector3D} xyz - Vector as `[x, y, z]` to reflect
|
|
9
|
+
* @param {ArrayVector3D} normal - Normal vector to reflect across (must be normalized)
|
|
10
|
+
* @returns {ArrayVector3D} The reflected vector
|
|
11
|
+
*/
|
|
12
|
+
const reflect3D = (xyz, normal) => {
|
|
13
|
+
const dot = (0, dot_3d_1.dot3D)(xyz, normal);
|
|
14
|
+
return [xyz[0] - 2 * dot * normal[0], xyz[1] - 2 * dot * normal[1], xyz[2] - 2 * dot * normal[2]];
|
|
15
|
+
};
|
|
16
|
+
exports.reflect3D = reflect3D;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { ArrayVector3D } from "./types";
|
|
2
|
+
/**
|
|
3
|
+
* Rotates a 3D vector around the x-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 rotateX3D: (xyz: ArrayVector3D, phi: number, axis?: ArrayVector3D) => ArrayVector3D;
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.rotateX3D = void 0;
|
|
4
|
+
/**
|
|
5
|
+
* Rotates a 3D vector around the x-axis.
|
|
6
|
+
* @param {ArrayVector3D} xyz - Vector as `[x, y, z]`
|
|
7
|
+
* @param {number} phi - Angle of rotation in radians
|
|
8
|
+
* @param {ArrayVector3D} axis - Rotation axis point (default: `[0, 0, 0]`)
|
|
9
|
+
* @returns {ArrayVector3D} The rotated vector
|
|
10
|
+
*/
|
|
11
|
+
const rotateX3D = (xyz, phi, axis = [0, 0, 0]) => {
|
|
12
|
+
const cosPhi = Math.cos(phi);
|
|
13
|
+
const sinPhi = Math.sin(phi);
|
|
14
|
+
if (axis[0] === 0 && axis[1] === 0 && axis[2] === 0) {
|
|
15
|
+
return [xyz[0], xyz[1] * cosPhi - xyz[2] * sinPhi, xyz[1] * sinPhi + xyz[2] * cosPhi];
|
|
16
|
+
}
|
|
17
|
+
// Translate point to origin (relative to axis)
|
|
18
|
+
const translatedY = xyz[1] - axis[1];
|
|
19
|
+
const translatedZ = xyz[2] - axis[2];
|
|
20
|
+
// Rotate around origin
|
|
21
|
+
const rotatedY = translatedY * cosPhi - translatedZ * sinPhi;
|
|
22
|
+
const rotatedZ = translatedY * sinPhi + translatedZ * cosPhi;
|
|
23
|
+
// Translate back
|
|
24
|
+
return [xyz[0], rotatedY + axis[1], rotatedZ + axis[2]];
|
|
25
|
+
};
|
|
26
|
+
exports.rotateX3D = rotateX3D;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { ArrayVector3D } from "./types";
|
|
2
|
+
/**
|
|
3
|
+
* Rotates a 3D vector around the y-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 rotateY3D: (xyz: ArrayVector3D, phi: number, axis?: ArrayVector3D) => ArrayVector3D;
|