HandmadeMath/Handmade-Math
FreeA simple math library for games and computer graphics. Compatible with both C and C++.
About HandmadeMath/Handmade-Math
Handmade Math is a single-file, cross-platform, public domain graphics math library designed for game development and computer graphics. It supports vectors (2D, 3D, 4D), matrices, and quaternions, with comprehensive utilities for common operations. The library is written in C and C++, with C++ operator overloading and C11 _Generic support. It offers configurable conventions: left‑handed and right‑handed coordinate systems, zero‑to‑one or negative‑one‑to‑one NDC ranges, and choice of angle units (radians, degrees, or turns). Vector types provide swizzling via unions (e.g., .xy, .rgb). The library is public domain (CC0‑1.0), easy to modify, and requires no separate implementation file—just #include "HandmadeMath.h".
Key Features
Pros & Cons
- Truly free and open source (public domain) with no restrictions
- Single‑header design simplifies integration into any project
- Works with both C and C++ codebases without extra wrappers
- Highly configurable to match different graphics APIs (OpenGL, DirectX, Vulkan, Metal)
- Lightweight and easy to understand/modify
- Limited to basic linear algebra and quaternions; no advanced matrix factorization or solvers
- No GPU‑specific optimizations or SIMD acceleration out of the box
- Documentation is primarily the header comments and GitHub README