#vector-math #graphics #vector-graphics #nalgebra #most #wrapper #matrix

na

na is a wrapper around nalgebra to make it easier and mostly less verbose to work with the most used types in vector math for graphics

32 releases (16 breaking)

0.32.2 Jul 18, 2023
0.31.1 May 25, 2023
0.31.0 May 2, 2022
0.30.1 Mar 23, 2022
0.13.0 Aug 16, 2017

#144 in Math

Download history 11/week @ 2024-01-15 4/week @ 2024-02-05 4/week @ 2024-02-12 70/week @ 2024-02-19 30/week @ 2024-02-26 18/week @ 2024-03-04 25/week @ 2024-03-11 25/week @ 2024-03-18 21/week @ 2024-03-25 51/week @ 2024-04-01 6/week @ 2024-04-08 10/week @ 2024-04-15

92 downloads per month
Used in 13 crates (5 directly)

BSD-3-Clause

49KB
1K SLoC

na

na is a wrapper around nalgebra to make it easier and mostly less verbose to work with the most used types in vector math for graphics.

na shortens the most common types Vector*, Point*, Quaternion... to Vec*, Pnt*, Quat... and defaults the generic parameters to f32 so you can write:

struct Pos(Vec3);

It also inlcudes some other functionalities not yet present in nalgebra:

  • Fast versions of multiplication of matrices (including matrices with vectors) that can be used by calling:
let m4: Mat4 = ...;
let v4: Vec4 = ...;
let v4_2 = m4.fast_mul(&v4);
  • Fast versions of inversion for matrices

  • GLSL style swizzles:

let xy = v3.xy()
let xz = v3.xz()
....
  • Macros to easily create vectors:
let one = vec3!(1.); //sets all components to 1
let composed = vec3!(v2, z); // creates a Vector3 from a Vector2 and a float
...
  • Easy to use traits for the most common types:

    • BaseNum (Integers and reals)
    • BaseInt
    • BaseFloat
    • NumVec (Vector of any number type)
    • FloatVec
    • NumPnt
    • FloatPnt

Dependencies

~3.5MB
~67K SLoC