C++ 20 zero-dependency cross platform cross compiler* template math library for graphics, games, simulations, visualization and research.
Quality criteria (from most to least important):
- Full math suite for real-time graphical applications
- Zero-dependency, lightweight
- Reliable and robust
- Fast
- Intuitive and easy to use
- Flexible and customizable
- Accurate
- Cross-platform
- Cross-compiler
Zero-dependency is the top-most priority as it is designed to be used in ultra lightweight applications. Without such restriction, other libraries may offer greater flexibility or feature set.
As seen, accuracy is of low importance, because in games and graphics performance is far more important than accuracy, and often these two cannot be achieved at once.
Reliability and robustness is achieved via extensive automatic testing against precalculated values and trusted libraries, and by active use in real projects.
Clang/GCC for Windows is first priority, then MSVC, then Linux.
*- some features are implemented using compiler-specific builtins. Currently GCC, Clang and MSVC are supported (Clang is used in development and therefore is most tested).
- No dependency on std or CRT
- Scalar operations
- Trigonometry
- Customizable error handling
- Vectors
- Matrices
- Quaternions
- Easing
Project is in development.
The library uses row-major notation for vectors and matrices. Soon, it will be changed entirely to be strictly column-major.
Ordered (from most to least important):
Core:
- Basic scalar utils
- Comparisons, overflow, signs, lerping
- Sin, cos
- Powers, logarithms, roots
- Full matrix & quaternion feature set for graphics
- Test scalars against std
- Test linear algebra against glm
- Advanced trigonometry (inverse functions, tangents, reciprocals)
- Easing
- Random and noises
- ND White noise
- 1-3D Perlin noise
- 2-3D? Voronoi noise
- ND Simplex noise
- Colors
- Transformations (grayscale, gamma/linear, luminance)
- Lerping, gradients, RGB<->HSV
- Packed, palette
- Hashing
- Fast hashing for maps
Geometry extensions:
- Vector utils same as scalar
- 2D and 3D geometry
- Intersection points
- Intersection overlays
- Distances to shapes
- SDFs
- Analysis (center of mass, interior/exterior quantity, aerodynamics)
- Complex numbers
- Fractals
Safety/speed extensions:
- Safe-unsafe compile-time execution mode with zero runtime cost
- Advanced constexpr algebra
Algebra & Calculus extensions:
- Non-convertable scalable unit systems
- Analytic & discrete derivatives, integrals
- Dynamic Taylor series
- Fourier transform
Low-level speed extensions:
- Full support for SIMD backend (for x86 and ARM)
- Full use of compiler intrinsics
Nanoite - Ultralightweight game engine
SIF - Substantial Instruction Format
The core part was written by me (AnanaSeek4Jam) and later carefully extended majorly using Claude Code.
Unordered:
- Interactive IEEE
- Romeric's fastapprox on Github
- Intel's paper about x87 trigonometry instructions
- Lasse Schlör's minimax tables for sin and cos
- Ben Eater's and Grant Sanderson's quaternion explanation
- Andrey Sitnik's and Ivan Solovev's easing functions list
- Desmos
- Wolfram Alpha
- Anthropic Claude (limited use)
- Quake III rsqrt
- Cppreference
- Godbolt
- Henry S. Warren, Jr.'s Hacker's Delight
- Unity Math library
- glm
- AnanaSeek4Jam's AEngine's Math
- Clang compiler extensions
- GCC builtins
- Intel SIMD intrinsics guide
- Officedaytime x86-64 SIMD instruction list