vectorama
Very simple linear algebra library for Rust.
This crate is designed for OpenGL and glTF standards: it uses column-major matrices, YXZ Euler rotation order, and is hardcoded to use the f32 data type.
Features
- Column-major matrices (OpenGL/glTF convention)
- YXZ Euler angle rotation order (glTF standard)
f32-only types for performance and interoperability- Vectors, matrices, quaternions, translations, and scales
- Interoperability with [
nalgebra] (optional, via feature flags)
Examples
Creating and using vectors
use Vec3;
let v = new;
let w = ones;
let sum = v + w;
println!; // Vec3 { x: 2.0, y: 3.0, z: 4.0 }
Creating and using matrices
use Mat3;
let a = ones;
let b = ones;
let c = a * b;
println!;
Using quaternions for rotation
use ;
let axis = new;
let angle = FRAC_PI_2;
let q = from_axis_angle;
let v = new;
let rotated = q.rotate_vector;
println!;
Using translations
use ;
let t = new;
let v = new;
let translated = t * v;
println!; // Vec3 { x: 1.0, y: 2.0, z: 3.0 }
Licensing
This project is dual-licensed under the MIT License and the Apache License 2.0. You may choose either license to govern your use of this project.
SPDX-License-Identifier: MIT OR Apache-2.0