Skip to content
/ linmath.c Public template

A lean linear math library, aimed at graphics programming. Supports vec3, vec4, mat4x4 and quaternions; Wolfgang Draxinger (2013).

License

Notifications You must be signed in to change notification settings

nodef/linmath.c

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

linmath.h

A small library for linear math as required for computer graphics

linmath.h provides the most used types required for programming computer graphics:

  • vec3 -- 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

The types are deliberately named like the types in GLSL. In fact they are meant to be used for the client side computations and passing to same typed GLSL uniforms.


Installation

Run:

$ npm i linmath.c

And then include linmath.h as follows:

// main.c
#include "node_modules/linmath.c/linmath.h"

int main() { /* ... */ }

And then compile with clang or gcc as usual.

$ clang main.c  # or, use gcc
$ gcc   main.c

You may also use a simpler approach:

// main.c
#include <linmath.h>

int main() { /* ... */ }

If you add the path node_modules/linmath.c to your compiler's include paths.

$ clang -I./node_modules/linmath.c main.c  # or, use gcc
$ gcc   -I./node_modules/linmath.c main.c


SRC ORG

About

A lean linear math library, aimed at graphics programming. Supports vec3, vec4, mat4x4 and quaternions; Wolfgang Draxinger (2013).

Resources

License

Stars

Watchers

Forks