VML is a simple 3D math library intended for game development.
- Single header library written in C99
- 2D and 3D vector functions
- 3x3 and 4x4 matrix functions
Include library
#define VML_IMPLEMENTATION
#include "vml.h"
Returning a scalar value
float vector_a[3] = {1,2,3};
float scalar_b;
vml_vec3_mag(vector_a,&scalar_b); // scalar_b = ||vector_a||
Adding two vec3's
float vector_a[3] = {1,2,3};
float vector_b[3] = {4,5,6};
vml_vec3_add(vector_a,vector_b,vector_a); // vector_a = vector_a+vector_b
Multiplying mat4 with vec3
float matrix_a[16] = VML_MAT4_IDENTITY;
float vector_b[3] = {1,2,3};
vml_mat4_vec3_mul(matrix_a,vector_b,vector_b}; // vector_b = matrix_a*vector_b
Refer to vml.h to see rest of the functions.
This software is free to use. You can modify it and redistribute it under the terms of the MIT license. Check LICENSE for further details.