ezcgmath 0.0.4

Easy linear algebra Math library for use with computer graphics.
Documentation
  • Coverage
  • 45.12%
    37 out of 82 items documented1 out of 27 items with examples
  • Size
  • Source code size: 83.7 kB This is the summed size of all the files inside the crates.io package for this release.
  • Documentation size: 9.07 MB This is the summed size of all files generated by rustdoc for all configured targets
  • Ø build duration
  • this release: 15s Average build duration of successful builds.
  • all releases: 15s Average build duration of successful builds in releases after 2024-10-23.
  • Links
  • Repository
  • crates.io
  • Dependencies
  • Versions
  • Owners
  • Joseph-LeGrice

ezcgmath

build crates.io docs.rs

An extremely simplified linear algebra API, for use with computer graphics.

Math should be fun, and easy. This crate aims to simplify the usage of math in computer graphics applications for both the novice, and the expert. This is achieved by providing a super-straightforward API with good documentation, and zero abstraction on the main types.

Implementation Details

The Scalar type is fixed to f32. This was chosen due to its straightforward compatibility with graphics APIs. It is up to the user to create their own abstractions if any limits are hit due to this.

The coordinate system is fixed to being left handed, with Y as up. If you wish to convert to a different coordinate system you may achieve this by creating a reflection matrix and applying it at the appropriate point.

Transformations in this API are applied in a row-major manor. As a reminder, this means that transformations are applied in the order they are specified. For example, if you wanted to scale, then rotate, and then translate a position vector, you would write these transformations in "reading order":

use ezcgmath::prelude::*;

let position_vector = Vector3::new(5.0, 0.0, 0.0);
let scale_matrix = Matrix4x4::from_nonuniform_scale(&Vector3::new(2.0, 1.0, 1.0));
let rotation_matrix = Quaternion::from_axis_angle(&Vector3::new(0.0, 1.0, 0.0), &Degrees(90.0));
let translation_matrix = Matrix4x4::from_translation(&Vector3::new(0.0, 0.0, 10.0));
let transformed_vector = position_vector * scale_matrix * rotation_matrix * translation_matrix;

Disclaimer

ezcgmath is still very much a work in progress. If there are holes you'd like filling, please feel free to open an issue on GitHub so we can start a conversation on it. If you'd like to contribute, that's great! Please read CONTRIBUTING.md for some guidelines on the process.