00001 #ifndef _MATRIX_H_ 00002 #define _MATRIX_H_ 00003 00004 #include "fmath.h" 00005 #include "vector.h" 00006 #include "quaternion.h" 00007 00008 typedef float mat_t; 00009 typedef mat_t mat22[2][2]; 00010 typedef mat_t mat33[3][3]; 00011 typedef mat_t mat33f[9]; 00012 typedef mat_t mat44[4][4]; 00013 typedef mat_t mat44f[16]; 00014 00015 void mat33_zero(mat33); 00016 void mat33f_zero(mat33f); 00017 void mat33_identity(mat33); 00018 void mat33f_identity(mat33f); 00019 void mat33_add(mat33,mat33,mat33); 00020 void mat33f_add(mat33f,mat33f,mat33f); 00021 void mat33_addeq(mat33,mat33); 00022 void mat33f_addeq(mat33f,mat33f); 00023 void mat33_sub(mat33,mat33,mat33); 00024 void mat33f_sub(mat33f,mat33f,mat33f); 00025 void mat33_subeq(mat33,mat33); 00026 void mat33f_subeq(mat33f,mat33f); 00027 void mat33_scl(mat33,mat_t,mat33); 00028 void mat33f_scl(mat33f,mat_t,mat33f); 00029 void mat33_scleq(mat33,mat_t); 00030 void mat33f_scleq(mat33f,mat_t); 00031 void mat33_mul(mat33,mat33,mat33); 00032 void mat33f_mul(mat33f,mat33f,mat33f); 00033 void mat33_mulvec(mat33,vec3,vec3); 00034 void mat33f_mulvec(mat33f,vec3,vec3); 00035 void mat33f_to_mat33(mat33f,mat33); 00036 void mat33_to_mat33f(mat33,mat33f); 00037 00038 void mat44_zero(mat44); 00039 void mat44f_zero(mat44f); 00040 void mat44_identity(mat44); 00041 void mat44f_identity(mat44f); 00042 void mat44_add(mat44,mat44,mat44); 00043 void mat44f_add(mat44f,mat44f,mat44f); 00044 void mat44_addeq(mat44,mat44); 00045 void mat44f_addeq(mat44f,mat44f); 00046 void mat44_sub(mat44,mat44,mat44); 00047 void mat44f_sub(mat44f,mat44f,mat44f); 00048 void mat44_subeq(mat44,mat44); 00049 void mat44f_subeq(mat44f,mat44f); 00050 void mat44_scl(mat44,mat_t,mat44); 00051 void mat44f_scl(mat44f,mat_t,mat44f); 00052 void mat44_scleq(mat44,mat_t); 00053 void mat44f_scleq(mat44f,mat_t); 00054 void mat44_mul(mat44,mat44,mat44); 00055 void mat44f_mul(mat44f,mat44f,mat44f); 00056 void mat44_mulvec(mat44,vec4,vec4); 00057 void mat44f_mulvec(mat44f,vec4,vec4); 00058 void mat44f_to_mat44(mat44f,mat44); 00059 void mat44_to_mat44f(mat44,mat44f); 00060 void mat44_copy(mat44,mat44); 00061 00062 void mat33_gauss_seidel(mat33,vec3,vec3); 00063 void mat44_gauss_seidel(mat44,vec4,vec4); 00064 00065 void mat44_vec3_mul(mat44,vec3,vec3); 00066 00067 void mat33_to_quat(mat33,quat); 00068 00069 void mat44_build_transform(quat,vec3,mat44); 00070 00071 float mat22_det(mat22); 00072 float mat33_det(mat33); 00073 float mat44_det(mat44); 00074 void mat33_submatrix(mat33,int,int,mat22); 00075 void mat44_submatrix(mat44,int,int,mat33); 00076 void mat44_invert(mat44,mat44); 00077 00078 #endif