#math #matrix #3d

no-std munum

Rust Micro Library for 3D Math

2 releases

0.1.1 Apr 16, 2022
0.1.0 Apr 11, 2022

#555 in WebAssembly

32 downloads per month
Used in 2 crates

MIT license

72KB
1.5K SLoC

πŸ…ΌπŸ†„πŸ…½πŸ†„πŸ…Ό

Rust Micro Library for 3D Math


License: MIT Crates.io Docs.rs build

Overview

munum is a minimalistic numerical library for high-performance 3D math. This is a pure Rust no_std compatible port of the JavaScript / AssemblyScript version of munum: https://github.com/andykswong/munum

Install

[dependencies]
munum = "0.1.0"

Features:

  • std - enables std support. enabled by default.
  • libm - can be used instead of std to enable trigonometry related functions in no_std environment
  • serde - enables serde serialize/deserialize implementations

Documentation

See Docs.rs: https://docs.rs/munum

Usage

Sample usage to build a perspective camera view-projection matrix:

use core::f32::{consts::PI, INFINITY};
use munum::{transform, vec3};

let eye = vec3(0_f32, 2., 0.);
let target = vec3(0., 0.6, 0.);
let up = vec3(0., 0., -1.);
let view = transform::look_at(eye, target, up);

let proj = transform::perspective(2., PI/2., 1., INFINITY);

let view_proj = proj * view;

License

This repository and the code inside it is licensed under the MIT License. Read LICENSE for more information.

Dependencies

~375–780KB
~17K SLoC