As I was working on my own game framework, I decided to decouple the math source on its own library:
This is mainly for OpenGL.
- 2D vectors
- 3D vectors
- Easing functions
Currently the library reached the first major release, but I'm adding features that don't break compatibility, and suggestions for features that break compatibility are welcome, saved for the next major release (2.0.0).
The next feature I'm planning is detection for 2D and 3D primitives (circles, lines and triangles, both 2D and 3D).
Pointers vs. Values
There are two versions of the same function, one that take pointer arguments and other that take value arguments:
Other examples in the GitHub page.
pmatrix_look_at(&pos, &target, &view);
view = matrix_look_at(pos, target);
Taking pointers is certainly faster, but you can use the function that take values if performance is not critical for you, as they are more readable.
Single Vector Structure
There's only one vector structure, used for 2D vectors, 3D vectors and quaternions. When I had to use 2D vectors, sometimes I would want to use them as 3D vectors and vice-versa. So I decided to use the same structure to make this possible.
The easing functions are great for animations: it makes easier to make smooth and organic motions.
Why another math library?
This is not intended to be a competitor with other math libraries, but a small and simple alternative.