| Crates.io | omelet |
| lib.rs | omelet |
| version | 0.1.2 |
| created_at | 2025-07-30 16:24:39.851261+00 |
| updated_at | 2025-07-30 16:31:33.581484+00 |
| description | A lightweight, game-orented math library for Rust, including vectors, matrices, and quaternions. |
| homepage | https://github.com/ethantl28/omelet |
| repository | https://github.com/ethantl28/omelet |
| max_upload_size | |
| id | 1773751 |
| size | 326,301 |
Omelet is a lightweight and extensible Rust math library focused on game development. Designed for both clarity and performance, Omelet provides essential vector and matrix math utilities with an emphasis on clean API design, strong documentation, and comprehensive test coverage.
Vec2, Vec3, Vec4 - Fully featured vector typesMat2, Mat3, Mat4 - Matrix types for transformationsQuat - Quaternions for 3D rotationcargo doc)Add Omelet to your Cargo.toml:
[dependencies]
omelet = {git = "https://github.com/ethantl28/omelet", tag = "v0.1.2"}
*Note: Omelet is now published on crates.io
Once Omelet is added to crates.io:
[dependencies]
omelet = "0.1.2"
Note: Please check most recent version for the updated library
Import the types you need:
use omelet::vec::vec2::Vec2;
use omelet::matrices::mat4::Mat4;
use omelet::vec::Vec2;
fn main() {
let a = Vec2::new(1.0, 2.0);
let b = Vec2::new(3.0, 4.0);
let sum = a + b;
let dot = a.dot(b);
let normalized = a.normalize();
println!("{}, dot: {}, normalized: {}", sum, dot, normalized);
}
Output:
Vec2(4, 6), dot: 11, normalized: Vec2(0.4472136, 0.8944272)
use omelet::vec::Vec3;
fn main() {
let a = Vec3::new(1.0, 0.0, 0.0);
let b = Vec3::new(0.0, 1.0, 0.0);
let cross = a.cross(b);
let reflected = a.reflect(b);
println!("Cross: {}", cross);
println!("Reflected: {}", reflected);
}
Output:
Cross: Vec3(0, 0, 1)
Reflected: Vec3(1, 0, 0)
use omelet::matrices::Mat2;
fn main() {
let rot = Mat2::from_rotation(std::f32::consts::FRAC_2_PI);
let v = omelet::vec::Vec2::new(1.0, 0.0);
let rotated = rot * v;
println!("Rotated vector: {}", rotated);
println!("Rotation matrix: \n{}", rot);
}
Output:
Rotated vector: Vec2(0.8041099, 0.59448075)
Rotation matrix:
[[0.8041, -0.5945],
[0.5945, 0.8041]]
use omelet::quaternion::Quat;
use omelet::vec::Vec3;
fn main() {
let axis = Vec3::new(0.0, 1.0, 0.0);
let angle = std::f32::consts::FRAC_PI_2;
let rotation = Quat::from_axis_angle(axis, angle);
let v = Vec3::new(1.0, 0.0, 0.0);
let rotated = rotation.rotate_vec3(v);
println!("Rotated Vec3: {}", rotated);
}
Output:
Rotated Vec3: Vec3(0.000, 0.000, -1.000)
use omelet::vec::Vec2;
fn main() {
let a = Vec2::new(1.000001, 2.000001);
let b = Vec2::new(1.000002, 2.000002);
assert!(a.approx_eq_eps(b, 1e-5));
println!("a is approximately equal to b within given epsilon: {}", a.approx_eq_eps(b, 1e-5));
}
Output:
a is approximately equal to b within given epsilon: true
Run locally:
cargo doc --open
Once published, visit: docs.rs/omelet
Vec2, Vec3, Vec4 typesMat2, Mat3, Mat4 fully implementedMat4 documentation is ongoingTo view the full documentation, run:
cargo doc --open
Omelet uses Rust's built-in test framework:
cargo test
All modules are tested thoroughly, including edge cases and floating-point comparisons.
Mat2, Mat3, Mat4)omelet/
├── src/
│ ├── vec/
│ │ ├── mod.rs
│ │ ├── list_of_methods.txt
│ │ ├── vec2.rs
│ │ ├── vec2_tests.rs
│ │ ├── vec3.rs
│ │ ├── vec3_tests.rs
│ │ ├── vec4.rs
│ │ └── vec4_tests.rs
│ ├── matrices/
│ │ ├── mod.rs
│ │ ├── list_of_methods.txt
│ │ ├── mat2.rs
│ │ ├── mat2_tests.rs
│ │ ├── mat3.rs
│ │ ├── mat3_tests.rs
│ │ ├── mat4.rs
│ │ └── mat4_tests.rs
│ ├── quat/
│ │ ├── mod.rs
│ │ ├── list_of_methods.txt
│ │ ├── quat.rs
│ │ └── quat_tests.rs
│ ├── lib.rs
│ └── utils.rs
├── .gitignore
├── Cargo.toml
├── Cargo.lock
└── README.md
Want to help improve Omelet? Contributions are welcome!
cargo fmtcargo testsHave ideas, suggestions, or found a bug? Open an issue or start a discussion.
This project is licensed under the MIT license. See LICENSE for more information.