gfx_maths/
lib.rs

1//! This crate implements all the basic mathematical structures and operations
2//! that are needed for almost any graphical program, namely:
3//! - [`Vec2`]
4//! - [`Vec3`]
5//! - [`Vec4`]
6//! - [`Quaternion`]
7//! - [`Mat4`]
8//!
9//! The usual operations are implemented via member functions and operator overloads.
10//! Operators should handle almost exactly as they would in GLSL, e.g.
11//! ```
12//! use gfx_maths::*;
13//!
14//! let v = Vec3::new(5.0, 6.0, 7.0);
15//! let s = 1.0 / v;
16//!
17//! let t = Mat4::translate(Vec3::new(1.0, 0.0, 0.0)) * s;
18//! ```
19//!
20//! # Notation
21//! Vectors are always treated as column vectors, which is why
22//! only [`Mat4`] * [`Vec4`] is implemented and not [`Vec4`] * [`Mat4`].
23
24#![allow(unknown_lints)]
25#![warn(clippy::all)]
26// Used to make docs.rs more readable
27#![cfg_attr(doc, feature(doc_auto_cfg))]
28#![cfg_attr(doc, feature(doc_cfg))]
29
30#[macro_use]
31mod macros;
32
33pub mod vec2;
34pub use vec2::*;
35
36pub mod vec3;
37pub use vec3::*;
38
39pub mod vec4;
40pub use vec4::*;
41
42pub mod quaternion;
43pub use quaternion::*;
44
45pub mod mat4;
46pub use mat4::*;