# libsst-math

Type-generic linear algebra library in C, covering vectors, matrices,
transforms, and geometric queries.

## Vectors

2D, 3D, and 4D vectors in four numeric types each:

- `SST_Vec{2,3,4}{f,d,i,u}` -- float, double, int, unsigned

Operations: add, subtract, multiply, divide, scale, dot, cross, magnitude,
normalize, project, lerp, weighted sum, negate, abs, reciprocal, sqrt, rotate,
min/max component, equality. Most have both output and in-place (`Local`)
variants.

A generic `SST_VectorNf_*` API handles arbitrary-dimension float vectors.

## Matrices

2x2, 3x3, and 4x4 matrices (column-major):

- `SST_Mat{22,33,44}{f,d,i,u}`

Operations: add, subtract, element-wise multiply, scalar multiply,
matrix-matrix multiply, matrix-vector multiply, transpose, determinant,
invert, LU decomposition and solve, orthonormality check.

## Transforms (SST_Transform)

4x4 float transform construction:

- Translation, scale, shear
- Euler rotation (X/Y/Z), quaternion rotation
- LookAt / LookDir view matrices
- Perspective and orthographic projection
- Chained variants (`*C`) for composing onto existing matrices

## Geometry (SST_Geo)

- 2D/3D line segment intersection
- Point-to-segment closest point and distance
- Ray-triangle intersection with barycentric coordinates

## Code generation

`VectorN.py` and `MatrixNxN.py` generate the type-specialized `.c` files
from templates.
