#ifndef MATRIXMATH_H #define MATRIXMATH_H //// matrix manipulation package void identityMatrix(double m[16]); int rotationMatrix(double a,double n[3],double r[16]); void translationMatrix(double t[3],double m[16]); void scaleMatrix(double s[3],double m[16]); void internalMatrix(double fx,double fy,double cx,double cy,double m[16]); // r=aXb void crossV3(double a[3],double b[3],double r[3]); // r=a-b void subV3(double a[3],double b[3],double r[3]); double norm2(double *w,int len); int normalize(double *w,int len); double norm(double *w,int len); // a(4x4).b(4x4) -> m(4x4) void multMM(double a[16],double b[16],double m[16]); // w : axis + magnitude of rot void externalMatrix(double t[3],double w[3],double m[16]); void copyM(double a[16],double b[16]); void copyV(double a[4],double b[4]); /// une matrice complete // contient dans un vecteur p: fx fy cx cy tx ty tz wx wy wz (10 params) // min et mext sont les matrices internes/externes, si desire... void cameraMatrix(double p[10],double m[16],double min[16],double mex[16]); // suppose que m[12..15] = {0,0,0,1} int inverseMaffine(double m[16],double im[16]); // inverse generique int inverse(double m[16],double im[16]); void dump4x4(double m[16]); void dump4x1(double v[4]); // a(4x4).b(4x1) -> v(4x1) void multMV(double a[16],double b[4],double v[4]); // homogenize a 3D projective point, so you have [x,y,z,1] int homogene3d(double v[4]); // homogenize a 2D projective point, so you have [x,y,1,w] int homogene2d(double v[4]); #endif