Skip to content

Repository files navigation

Not Enough Math

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):

  1. Full math suite for real-time graphical applications
  2. Zero-dependency, lightweight
  3. Reliable and robust
  4. Fast
  5. Intuitive and easy to use
  6. Flexible and customizable
  7. Accurate
  8. Cross-platform
  9. 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).

Features

  • No dependency on std or CRT
  • Scalar operations
  • Trigonometry
  • Customizable error handling
  • Vectors
  • Matrices
  • Quaternions
  • Easing

Project is in development.

Documentation

The library uses row-major notation for vectors and matrices. Soon, it will be changed entirely to be strictly column-major.

Roadmap

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

Projects using NEM

Nanoite - Ultralightweight game engine

SIF - Substantial Instruction Format

Sources, inspiration

The core part was written by me (AnanaSeek4Jam) and later carefully extended majorly using Claude Code.

Unordered:

About

Lightweight modular modern C++ math framework

Resources

Stars

1 star

Watchers

0 watching

Forks

Releases

Contributors

Languages