#mathematics #numerics #graphics


Graphics Math Library. Generic Vector and Matrix Math library targetting graphics applications.

3 stable releases

Uses old Rust 2015

1.1.0 May 28, 2015
1.0.1 May 26, 2015

#1237 in Algorithms




Graphics Math Library. A vector and matrix library for Rust targeting low level graphics operations. Similar to C++ libraries glm, cml, MathGeoLib, Eigen, CGGeometry from Cocoa, and others. It may be useful to anyone working with low level graphic operations in Rust.

This library was created to determine if header-only generic template C++ libraries such as you would find in Boost, glm.g-truc.net, and the like could be implemented in a simpler fashion in Rust with less boilerplate while maintaining performance. After several iterations we are fairly happy with the result. Version 1.0 of this library (gml) implements a complete and tested fully generic vector and matrix library, modelled after the functionality found in the OpenGL shader language, the C++ library GLM, and the math portion of the Unity game engine. With OpenGL or DirectX bindings (not included here) and this library you can be coding up spinning 3D geometries with Rust in no time.


Documentation may be found at CreekWare/OpenSource/gml

Alternatively, documentation may be generated by cloning a local copy of this project on a machine with Rust 1.xx installed, using cargo doc to generate the documentation, and finally cargo doc --open to view the documentation in your web browser.


Version 1.0.0 represents a stable and tested API. The third digit (ie from 1.0.0 to 1.0.1) represents minor revisions, bug fixes and the like. The second digit (ie from 1.0.23 to 1.1.0) represents significant backwards compatible feature additions. The first digit (ie from 1.3.43 to 2.0.0) represents breaking API changes. Development prior to 1.0.0 was performed using a private repository.


To use the currently released version from crates.io (recommended), add this to your Cargo.toml:

gml = "*"

or to use the latest version from the github repository, add this instead to your Cargo.toml:

git = "https://github.com/creekware/rust-gml.git"

and this to your crate root:

extern crate gml;

Hello Vector Example

extern crate gml;

fn main() {
    let a = gml::Vector3::new(2.0, 5.0, 7.0);
    let b = gml::Vector3::new(11.0, -32.0, 14.0);
    let c = a + b;
    println!("Hello from gml.  c={:?}", c);


Discussions on how to implement these features using Rust in a simpler or perhaps more performant fashion are welcome, as are bug fixes or feature additions within the scope of the library. A variety of additional features cherry picked from the C++ reference libraries will be added as time permits.