MCPcopy Index your code
hub / github.com/HandmadeMath/HandmadeMath

github.com/HandmadeMath/HandmadeMath @v2.0.0

Chat with this repo
repository ↗ · DeepWiki ↗ · release v2.0.0 ↗ · + Follow
176 symbols 608 edges 22 files 1 documented · 1%
What it actually does AI analysis from the code graph — generated when you open this
loading…
README

Handmade Math

A single-file, cross-platform, public domain graphics math library for both C and C++. Supports vectors, matrices, quaternions, and all the utilities you'd expect.

To get started, go download the latest release.

If you are upgrading to Handmade Math 2.0, save yourself some time and use our automatic update tool.

Here's what sets Handmade Math apart:

  • A simple single-header library. Just #include "HandmadeMath.h".
  • Supports both C and C++. While libraries like GLM only support C++, Handmade Math supports both C and C++, with convenient overloads wherever possible. For example, C++ codebases get operator overloading, and C11 codebases get _Generic versions of common operations.
  • Supports all graphics APIs. Handmade Math has left- and right-handed versions of each operation, as well as support for zero-to-one and negative-one-to-one NDC conventions.
  • Swizzling, sort of. Handmade Math's vector types use unions to provide several ways of accessing the same underlying data. For example, the components of an HMM_Vec3 can be accessed as XYZ, RGB, or UVW - or subsets can be accessed like .XY and .YZ.
  • Your choice of angle unit. While Handmade Math uses radians by default, you can configure it to use degrees or turns instead.

Usage

Simply #include "HandmadeMath.h". All functions are static inline, so there is no need for an "implementation" file as with some other single-header libraries.

A few config options are available. See the header comment in the source for details.

FAQ

What's the license?

This library is in the public domain. You can do whatever you want with it.

Where can I contact you to ask questions?

Feel free to make GitHub issues for any questions, concerns, or problems you encounter.

What if I don't want the HMM_ prefix?

Do a find and replace in the library source.

Core symbols most depended-on inside this repo

HMM_V3
called by 49
HandmadeMath.h
HMM_V4
called by 44
HandmadeMath.h
HMM_MulV3F
called by 27
HandmadeMath.h
HMM_Q
called by 27
HandmadeMath.h
HMM_V2
called by 23
HandmadeMath.h
HMM_M4D
called by 21
HandmadeMath.h
HMM_MulM4V4
called by 21
HandmadeMath.h
HMM_Mul
called by 20
HandmadeMath.h

Shape

Function 172
Class 4

Languages

C++97%
Python3%
C1%

Modules by API surface

HandmadeMath.h144 symbols
test/HandmadeTest.h13 symbols
update/update_hmm.py5 symbols
test/hmm_test.c1 symbols
test/categories/VectorOps.h1 symbols
test/categories/Transformation.h1 symbols
test/categories/Subtraction.h1 symbols
test/categories/ScalarMath.h1 symbols
test/categories/SSE.h1 symbols
test/categories/QuaternionOps.h1 symbols
test/categories/Projection.h1 symbols
test/categories/Multiplication.h1 symbols

For agents

$ claude mcp add HandmadeMath \
  -- python -m otcore.mcp_server <graph>

⬇ download graph artifact