lina

Crates.iolina
lib.rslina
version0.2.1
sourcesrc
created_at2021-10-17 13:10:22.690708
updated_at2023-07-21 07:38:23.736697
descriptionLinear algebra library with a focus on 3D applications like games (i.e. low-dimensional vectors and matrices)
homepage
repositoryhttps://github.com/LukasKalbertodt/lina/
max_upload_size
id466190
size222,783
Lukas Kalbertodt (LukasKalbertodt)

documentation

https://docs.rs/lina/

README

lina: linear algebra library for 3D applications

CI status of main Crates.io Version docs.rs

lina is a linear algebra library making heavy use of strong typing. Its focus is on 3D applications like games, i.e. low-dimensional vectors and matrices.

Notable features setting lina apart from other similar libraries:

  • Usage of const generics, while still allowing scalar access via .x, .y, .z and .w.
  • Separate types for homogeneous coordinates (HcPoint and HcMatrix).
  • Most types have a Space parameter to represent the logical space (e.g. model, world, view, ... space) the vector, point, etc lives in.
  • Distinction between locations (Point) and displacements (Vector).

The last three of these illustrate the philosophy of lina regarding strong typing. For motivation and examples, please read this document. In fact, this is all still a bit of an experiment, but so far I am very happy with the results in practice! However, I'm sure this is not for everyone and many would prefer a different API.

Luckily, there exist many other libraries in the Rust ecosystem. To be clear: lina is not better than cgmath, nalgebra, glam, ultraviolet vek, etc. It is simply different, with an API that better fits my taste – and maybe yours.

Additional Features:

  • Vectors, points, matrices
  • Commonly used transformation matrices
  • Operators overloaded as you would expect
  • Strongly typed angles: Degrees and Radians
  • Spherical coordinates: SphericalPos and SphericalDir
  • Several helper functions: atan2, clamp, lerp, slerp, ...
  • Approximate float equality (including assert_approx_eq!)

The only major thing that I'd still like to add in the future is rotors. lina offers the standard translation matrices, but rotors can be better for representing and composing rotations.

See the documentation for more information.

Status of this project

lina is is certainly usable and is quite feature rich. I actively use it in a game project, which also motivated most API design decisions. But lina is not used by many other projects, and there might still be some non-minor API changes.



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.

Commit count: 184

cargo fmt