Matrix.h

Go to the documentation of this file.
00001 /*
00002 ** Matrix.h
00003 ** 
00004 ** Made by damien
00005 ** Login   <damien@ortie>
00006 ** 
00007 ** Started on  Sun Jan 27 09:44:38 2008 damien
00008 ** Last update Sun Jan 27 09:44:38 2008 damien
00009 */
00010 
00011 #ifndef         MATRIX_H_
00012 # define        MATRIX_H_
00013 
00014 #include <stdlib.h>
00015 #include <iostream>
00016 #include <cmath>
00017 #include <string>
00018 #include <errno.h>
00019 #include <stdio.h>
00020 using namespace std;
00021 
00022 #include <V_3D.h>
00023 
00024 
00025 class Matrix
00026 {
00027 
00028  public:
00029   Matrix();
00030   Matrix(const Matrix& _M);
00031   ~Matrix();
00032 
00033   Matrix multiply(Matrix M2);
00034   double * multiply(double *x);
00035   int multiply_internally(double *x);
00036   int multiply_rotation_internally(double *normal_copy);
00037 
00038   //Matrix get_inverse();
00039   double det() const;
00040 
00041   int set_identity();
00042   int set_zero();
00043 
00044   int set_translation(double *t);
00045   int set_translation(double tx,double ty,double tz);
00046   int add_translation(double *t);
00047   int add_translation(double tx,double ty,double tz);
00048 
00049   int set_euler_angle(double *r);
00050   int set_euler_angle(double theta_1,double theta_2,double theta_3);
00051 
00052   int set_rotation_matrix(double *axis,double angle);
00053   int set_rotation_matrix(double x_axis,double y_axis,double z_axis,double angle);
00054   Matrix multiply_rotation(double *axis,double angle);
00055   Matrix multiply_rotation(double x_axis,double y_axis,double z_axis,double angle);
00056 
00059 
00060   int build_rotation_matrix_to_vector(const V_3D v,const V_3D w);
00061 
00062 
00063   double value(int k_x,int k_y) const; 
00064   double& value(int k_x,int k_y); 
00065   double v(int k_x,int k_y) const; //shorthand for value
00066   double& v(int k_x,int k_y); 
00067 
00068   int set_value(double val,int k_x,int k_y);
00069   int set_value(double,double,double,double , double,double,double,double , double,double,double,double , double,double,double,double);
00070 
00071   int set_vector_rotation(double *v,double theta);//theta in radians
00072   int set_vector_rotation(double v_x,double v_y,double v_z,double theta);//theta in radians
00073   int multiply_vector_rotation(double *v,double theta);
00074 
00075   Matrix get_rotation_part();
00076   int set_rotation_part(Matrix R);
00077   int set_translation_part(Matrix T);
00078 
00079   friend ostream& operator << (ostream& flux, Matrix M);
00080   Matrix& operator=(const Matrix&);
00081   friend Matrix operator*(const Matrix&,const Matrix&);
00082   friend Matrix operator*(const Matrix&,const double&);
00083   friend Matrix operator*(const double&,const Matrix&);
00084   friend V_3D operator*(const Matrix&,const V_3D&);
00085   friend V_3D operator*(const V_3D& ,const Matrix&);
00086   friend Matrix operator+(const Matrix&,const Matrix&);
00087   friend Matrix operator-(const Matrix&,const Matrix&);
00088   friend int operator==(const Matrix&,const Matrix&);
00089   friend int operator!=(const Matrix&,const Matrix&);
00090   Matrix& operator+=(const Matrix&);
00091   Matrix& operator/=(const double&);
00092   double& operator [](int k_dim);
00093   double operator [](int k_dim) const;
00094 
00096   double operator ()(int k_1,int k_2) const;
00097   double& operator()(int k_1,int k_2);
00098 
00099   Matrix invert() const;
00100 
00101 
00102   int get_position(double *p);
00103   V_3D get_position();
00104 
00105   int scale(double *s);
00106 
00107  private:
00108 
00109   double M[16];
00110 
00111 
00112 
00113 };
00114 
00115 #endif      /* !MATRIX_H_ */

Generated on Mon Mar 30 16:55:54 2009 by  doxygen 1.5.6