🥚 Omelet - A Simple Math Library in Rust
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.
Features
- 🧮
Vec2,Vec3,Vec4- Fully featured vector types - 🧊
Mat2,Mat3,Mat4- Matrix types for transformations - ⭕
Quat- Quaternions for 3D rotation - 📝 Thorough unit tests across all components
- 📃 In-depth documentation with examples (
cargo doc) - 📐 Utilities for projection, reflection, barycentric coordinates, SLERP, and more
- 🔄 Operator overloading for intuitive syntax
- ⚙️ (planned) SIMD acceleration for performance-critical operations
🚀 Getting Started
Add Omelet to your Cargo.toml:
[]
= { = "https://github.com/ethantl28/omelet", = "v0.1.2"}
*Note: Omelet is now published on crates.io
Once Omelet is added to crates.io:
[]
= "0.1.2"
Note: Please check most recent version for the updated library
Import the types you need:
use Vec2;
use Mat4;
🤖 Examples
- Vector addition, dot product, and normalization
use Vec2;
Output:
Vec2(4, 6), dot: 11, normalized: Vec2(0.4472136, 0.8944272)
- Vector cross product and reflection
use Vec3;
Output:
Cross: Vec3(0, 0, 1)
Reflected: Vec3(1, 0, 0)
- Vector rotation using rotation matrix
use Mat2;
Output:
Rotated vector: Vec2(0.8041099, 0.59448075)
Rotation matrix:
[[0.8041, -0.5945],
[0.5945, 0.8041]]
- Vector rotation using a quaternion
use Quat;
use Vec3;
Output:
Rotated Vec3: Vec3(0.000, 0.000, -1.000)
- Epsilon comparison
use Vec2;
Output:
a is approximately equal to b within given epsilon: true
📃 Documentation
Run locally:
Once published, visit: docs.rs/omelet
Vectors
Vec2,Vec3,Vec4types-
- Extensive unit testing
- Supports standard operations (addition, subtraction, dot/cross product, normalization, projections, angle calculations, etc.)
Matrices
Mat2,Mat3,Mat4fully implemented- Tested against edge cases
- Clean, consistent API
Mat4documentation is ongoing
Quaternions
- Full quaternion implementation for 3D rotation
- Includes SLERP, normalization, conversion to/from Euler angles
- Heavily tested and documented
How to run the documentation
To view the full documentation, run:
cargo doc --open
📝 Running Tests
Omelet uses Rust's built-in test framework:
All modules are tested thoroughly, including edge cases and floating-point comparisons.
🗺️ Roadmap
- ✅ Matrix functionality parity (
Mat2,Mat3,Mat4) - ✅ Quaternion support with full docs and tests
- 🟨 SIMD acceleration for vector and matrix math
- 🟨 More geometry utilities (plane intersection, AABB, etc.)
📁 Project Structure
/
├── /
│ ├── /
│ │ ├── /
│ │ ├── /
│ │ ├──
🛠️ Contributing
Want to help improve Omelet? Contributions are welcome!
- Please use pull requests
- Code should be formatted using
cargo fmt - Ensure tests pass via
cargo tests - For major changes, please open an issue first Fork the repo and open a pull request with your improvements.
💭 Feedback
Have ideas, suggestions, or found a bug? Open an issue or start a discussion.
📎 License
This project is licensed under the MIT license. See LICENSE for more information.