A lean linear math library, aimed at graphics programming. Supports vec3, vec4, mat4x4 and quaternions; Wolfgang Draxinger (2013).
npm install linmath.cvec3 -- 3 element vector of floats
vec4 -- 4 element vector of floats (4th component used for homogenous computations)
mat4x4 -- 4 by 4 elements matrix, computations are done in column major order
quat -- quaternion
sh
$ npm i linmath.c
`
And then include linmath.h as follows:
`c
// main.c
#include
int main() { / ... / }
`
Finally, compile while adding the path node_modules/linmath.c to your compiler's include paths.
`bash
$ clang -I./node_modules/linmath.c main.c # or, use gcc
$ gcc -I./node_modules/linmath.c main.c
`
You may also use a simpler approach with the cpoach tool, which automatically adds the necessary include paths of all the installed dependencies for your project.
`bash
$ cpoach clang main.c # or, use gcc
$ cpoach gcc main.c
``