6 releases

new 0.1.5 Feb 16, 2025
0.1.4 Jan 28, 2025

#197 in Graphics APIs

Download history 199/week @ 2025-01-21 146/week @ 2025-01-28 16/week @ 2025-02-04 150/week @ 2025-02-11

511 downloads per month
Used in 2 crates

MIT license

69KB
2K SLoC

Mats

Mats is a lightweight Rust matrix math library designed to provide efficient and easy-to-use Rust vector and matrix support.

Example

Here's a simple example:

use mats::*;

fn main() {
    let vec = Vec4::from([1.0, 2.0, 3.0, 4.0]);
    let mat = Mat::from([
        [1.0, 2.0, 3.0, 4.0],
        [5.0, 6.0, 7.0, 8.0],
        [9.0, 10.0, 11.0, 12.0],
        [13.0, 14.0, 15.0, 16.0],
    ]);
    println!("{:?}", vec);
    println!("{:?}", mat);
    let vec2 = vec * mat;
    println!("{:?}", vec2);
    let vec3 = Vec4::from((vec.xy(), vec2.zw()));
    println!("{:?}", vec3);
}

Features

  • glsl : If this feature is enabled, you can make Mats integrate well with OpenGL.

Support

A vector is a matrix with a number of rows of 1.

  • Operator Overloading:
    • Mat + Mat
    • Mat - Mat
    • Mat * T
    • Mat / T
    • Mat += Mat
    • Mat -= Mat
    • Mat *= T
    • Mat /= T
    • Mat * Mat
    • - Mat
  • Matrix Operations:
    • Matrix transpose
    • The determinant
    • LU decomposition
    • Swap two rows
    • Swap two columns
    • Inverse
    • Rank
  • Dynamic size matrices
  • GLSL Extension
    • Types
    • Like GLSL syntax
    • (Option:glsl) GLSL data interface
  • Math:
    • Cooordinate transformations
    • Projection transformations

Dependencies

~19KB

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy