lina 0.1.1

Linear algebra library with a focus on 3D applications like games (i.e. low-dimensional vectors and matrices)
Documentation

lina: linear algebra library for 3D applications

lina is yet another linear algebra library with a focus on 3D applications like games, i.e. low-dimensional vectors and matrices. Currently nightly only (see below).

One special feature is the heavy use of const generics to make vectors, points and matrices generic over their dimensions, while still allowing scalar access via .x, .y, .z and .w. This has several advantages like a reduced API surface and easier to understand docs.

Features:

  • Vectors and points (strongly typed locations in space) with generic dimension and scalar type
  • Matrices with generic dimensions and element type
  • Strongly typed angles: Degrees and Radians
  • Commonly used transformation matrices
  • Spherical coordinates: SphericalPos and NormedSphericalPos
  • Several helper functions: atan2, clamp, lerp, slerp, ...
  • Auxiliary documentation about topics like computer graphics, linear algebra, ...

Still missing (but planned):

  • Rotors and everything related to rotations
  • Matrix inversion & determinants
  • SIMD
    • Using SIMD is currently not feasible as there is no way to specify alignments for the generic Point, Vector and Matrix types. If Rust ever offers more alignment control, I will revisit SIMD.
    • But: this might not matter too much as long as you do not perform lots of operations on the CPU. The GPU is better at it anyway!

See the documentation for more information.

Why yet another of these libraries?!

What about cgmath, nalgebra, glam, ultraviolet vek, ...? Those are all fine libraries, but I was not 100% happy with either of them. So I wrote my own! lina is not better than these other libraries, just has a different API that better fits my taste.

Why nightly only?

Currently only two features are used:

  • generic_const_exprs: this allows methods like Vector<T, N>::extend(T) -> Vector<T, N + 1>. I could hide all of those methods behind a feature gate, but I don't need that. If people are interested in that, I'm happy to accept a PR.

  • array_from_fn: this simplifies a lot of operations that otherwise I would have to hand code with unsafe code. And no one wants that. I expect the function to be stabilized somewhat quickly.

Status of this project

lina is still young, but I already use it in a project of mine. For the foreseeable future, I will shape lina exactly to my liking for use in said project. But of course, I'm happy about feedback, suggestions and people finding use in lina. Pull requests are generally welcome, but please talk to me first as I might just decline PRs that don't fit my vision for lina.


License

Licensed under either of Apache License, Version 2.0 or MIT license at your option. Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in this project by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any additional terms or conditions.