https://github.com/rob2309/gfx-maths-rs
Implementations for the most essential math operations used in graphics programming.
https://github.com/rob2309/gfx-maths-rs
directx graphics matrix opengl quaternion rust vector vulkan
Last synced: over 1 year ago
JSON representation
Implementations for the most essential math operations used in graphics programming.
- Host: GitHub
- URL: https://github.com/rob2309/gfx-maths-rs
- Owner: Rob2309
- License: mit
- Created: 2021-08-16T19:18:18.000Z (almost 5 years ago)
- Default Branch: master
- Last Pushed: 2023-03-26T12:22:35.000Z (over 3 years ago)
- Last Synced: 2024-04-30T01:40:21.291Z (about 2 years ago)
- Topics: directx, graphics, matrix, opengl, quaternion, rust, vector, vulkan
- Language: Rust
- Homepage:
- Size: 41 KB
- Stars: 4
- Watchers: 2
- Forks: 1
- Open Issues: 2
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
[](https://choosealicense.com/licenses/mit/)
[](https://crates.io/crates/gfx-maths)
[](https://docs.rs/gfx-maths)
[](https://github.com/Rob2309/gfx-maths-rs/actions)
# GFX Maths
This crate implements all the basic mathematical structures and operations
that are needed for almost any graphical program, namely:
- [Vec2](src/vec2.rs)
- [Vec3](src/vec3.rs)
- [Vec4](src/vec4.rs)
- [Quaternion](src/quaternion.rs)
- [Mat4](src/mat4.rs)
The usual operations are implemented via member functions and operator overloads.
Operators should handle almost exactly as they would in GLSL, e.g.
```rust
use gfx_maths::*;
let v = Vec3::new(5.0, 6.0, 7.0);
let s = 1.0 / v;
let t = Mat4::translate(Vec3::new(1.0, 0.0, 0.0)) * s;
```
# Notation
Vectors are always treated as column vectors, which is why
only [Mat4](src/mat4.rs) * [Vec4](src/vec4.rs) is implemented and not [Vec4](src/vec4.rs) * [Mat4](src/mat4.rs).