Math
SIMD optimized C++ mathematics library. (vector, matrix, quaternion, ray, triangle, sphere, AABB, etc.)
Install / Use
/learn @cfnptr/MathREADME
Math
A library providing common linear algebra math operations.
See the documentation.
Features
- Vector (float2/3/4, int2/3/4, half)
- Matrix (float2x2/3x3/4x4)
- Quaternion (float4)
- SIMD optimized (f32x4, f32x4x4, f16x4)
- Euler angles/radians conversion
- Matrix translate, scale, rotate
- Pespective, orthographics projection
- Ray, line, plane, triangle, sphere...
- Axis aligned bounding box (AABB)
- Frustum culling, matrix extraction
- Bounding volume hierarchy (BVH)
- Color conversion (RGBA, linear)
- Version (major, minor, patch, build)
- Hexadecimal string conversion
- Packed vector (1bit container)
- Tone mapping, gamma correction
- Image based lighting (IBL, BRDF)
- Spherical harmonics (SH)
- Enum class flags declaration
- Simplified integer types (int64, uint32, int8...)
Supported operating systems
- Windows (10/11)
- Ubuntu (22.04/24.04)
- macOS (15/26)
This list includes only those systems on which functionality testing is conducted. However, you can also compile it under any other Linux distribution or operating system.
Build requirements
- C++17 compiler
- Git 2.30+
- CMake 3.16+
Use building instructions to install all required tools and libraries.
CMake options
| Name | Description | Default value |
|-------------------|---------------------------|---------------|
| MATH_BUILD_SHARED | Build Math shared library | ON |
| MATH_BUILD_TESTS | Build Math library tests | ON |
CMake targets
| Name | Description | Windows | macOS | Linux |
|-------------|----------------------|---------|----------|-------|
| math-static | Static Math library | .lib | .a | .a |
| math-shared | Dynamic Math library | .dll | .dylib | .so |
Cloning
git clone https://github.com/cfnptr/math
Building 
- Windows:
./scripts/build-release.bat - macOS / Ubuntu:
./scripts/build-release.sh
Inspired by
Related Skills
node-connect
344.4kDiagnose OpenClaw node connection and pairing failures for Android, iOS, and macOS companion apps
frontend-design
99.2kCreate distinctive, production-grade frontend interfaces with high design quality. Use this skill when the user asks to build web components, pages, or applications. Generates creative, polished code that avoids generic AI aesthetics.
openai-whisper-api
344.4kTranscribe audio via OpenAI Audio Transcriptions API (Whisper).
qqbot-media
344.4kQQBot 富媒体收发能力。使用 <qqmedia> 标签,系统根据文件扩展名自动识别类型(图片/语音/视频/文件)。
