https://github.com/starlet-engine/math
Lightweight header-only math library for Starlet projects
https://github.com/starlet-engine/math
cmake cpp header-only math meson opengl starlet unit-testing
Last synced: about 2 months ago
JSON representation
Lightweight header-only math library for Starlet projects
- Host: GitHub
- URL: https://github.com/starlet-engine/math
- Owner: starlet-engine
- License: mit
- Created: 2025-08-28T02:59:20.000Z (10 months ago)
- Default Branch: main
- Last Pushed: 2026-03-10T22:34:08.000Z (4 months ago)
- Last Synced: 2026-04-18T01:42:11.735Z (3 months ago)
- Topics: cmake, cpp, header-only, math, meson, opengl, starlet, unit-testing
- Language: C++
- Homepage:
- Size: 84 KB
- Stars: 0
- Watchers: 0
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Starlet Math
[](https://github.com/starlet-engine/math/actions/workflows/tests.yml)
[](https://isocpp.org/std/the-standard)
[](./LICENSE)
A lightweight header-only math library for **Starlet** projects.
⚠️ **Note**
This is **NOT** intended to be a complete math library!
It's minimal and straightforward to make the math operations easier to understand and extend.
This makes it perfect for learning, experimentation, but not a drop-in replacement for full-fledged math libraries.
## Features
- Basic vector types: `Vec2`, `Vec3`, `Vec4`
- `Transform` struct for position, rotation, scale
- `Mat4` 4x4 matrix with:
- Identity, transpose, inverse
- Translation, rotation, scaling
- `lookAt` and `perspective` helpers
- Composition with `Transform`
- Constants and helpers:
`pi`, `radians()`, `degrees()`
- **Starlet** Project Constants
## Prerequisites
- C++20 or later
- One of the following Build Systems,
- CMake 3.20+
- Meson 1.1+
## Using as a Dependency
### CMake
```cmake
include(FetchContent)
FetchContent_Declare(starlet_math
GIT_REPOSITORY https://github.com/starlet-engine/math.git
GIT_TAG main
)
FetchContent_MakeAvailable(starlet_math)
target_link_libraries(app_name PRIVATE starlet_math)
```
### Meson
> **Note:** Meson does not fetch dependencies automatically. Add the [`starlet_math.wrap`](./subprojects/starlet_math.wrap) file to your project's `subprojects` directory.
In your `meson.build`:
```python
starlet_math = subproject('starlet_math')
starlet_math_dep = starlet_math.get_variable('starlet_math_dep')
executable('app_name', 'main.cpp', dependencies: starlet_math_dep)
```
## Building and Testing
```bash
# 1. Clone starlet-math
git clone https://github.com/starlet-engine/math.git
cd starlet-math
```
### CMake
```bash
cmake -B build -DBUILD_TESTS=ON
cmake --build build
ctest --test-dir build
```
### Meson
```bash
meson setup build -Dbuild_tests=true
meson compile -C build
meson test -C build
```
## License
MIT License — see [LICENSE](./LICENSE) for details.