new_matrix, new_vec - allocate a new matrix or vector |
#include <matvec.h> #define new_matrix(pool) ((float *) pmalloc ((pool), sizeof (float) * 16)) #define new_vec(pool) ((float *) pmalloc ((pool), sizeof (float) * 4)) |
new_matrix allocates a new 4x4 matrix of floats in pool. |
new_vec allocates a new 4-vector of floats in pool. |
You may use these functions to allocate matrices and vectors dynamically, or you may allocate them statically. The other matrix and vector functions available do not distriguish between dynamically and statically allocated variables. |
Note: All matrices are stored in COLUMN-MAJOR ORDER! This is for compatibility with OpenGL, but it is the OPPOSITE of the natural C row-major ordering, so beware. |
Richard Jones <rich@annexia.org> |
GNU LGPL (see http://www.gnu.org/) |
c2lib-1.2.13 |
new_identity_matrix(3), new_zero_vec(3). |