Skip to content
This repository has been archived by the owner on Apr 17, 2022. It is now read-only.

andykswong/munum-rs

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation


🅼🆄🅽🆄🅼

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 - enabled by default.
  • libm - can be used instead of std to enable trigonometry related functions in no_std environment
  • serde - enable serde serialize/deserialize implementations

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.