Matrix4.h

Go to the documentation of this file.
00001 /***************************************************************************
00002  *cr                                                                       
00003  *cr            (C) Copyright 1995-2008 The Board of Trustees of the           
00004  *cr                        University of Illinois                       
00005  *cr                         All Rights Reserved                        
00006  *cr                                                                   
00007  ***************************************************************************/
00008 
00009 /***************************************************************************
00010  * RCS INFORMATION:
00011  *
00012  *      $RCSfile: Matrix4.h,v $
00013  *      $Author: jim $  $Locker:  $             $State: Exp $
00014  *      $Revision: 1.2 $        $Date: 2008/09/17 16:19:54 $
00015  *
00016  ***************************************************************************
00017  * DESCRIPTION:
00018  *
00019  * 4 x 4 Matrix, used for a transformation matrix.
00020  *
00021  ***************************************************************************/
00022 #ifndef MATRIX_FOUR_H
00023 #define MATRIX_FOUR_H
00024 
00026 class Matrix4 {
00027 public:
00028   Matrix4(void) { identity(); }                
00029   Matrix4(double f) { constant(f); }            
00030   Matrix4(const double *m);                     
00031   Matrix4(const Matrix4& m) { loadmatrix(m); } 
00032   ~Matrix4(void) {}                            
00033   double mat[16];                               
00034 
00036   void multpoint3d (const double[3], double[3]) const;
00037 
00039   void multnorm3d (const double[3], double[3]) const;
00040 
00042   void multpoint4d (const double[4], double[4]) const;
00043 
00045   void identity(void);
00046   
00048   void constant(double);
00049   
00054   int inverse(void);
00055   
00057   void transpose(void);
00058   
00060   void loadmatrix(const Matrix4 &m);
00061   Matrix4& operator=(const Matrix4& m) {loadmatrix(m); return *this;}
00062 
00064   void multmatrix(const Matrix4 &);
00065 
00067   void rot(double, char); // angle in degrees
00068 
00070   void rotate_axis(const double axis[3], double angle);
00071   
00073   void transvec(double x, double y, double z);
00074  
00076   void transvecinv(double x, double y, double z);
00077 
00079   void translate(double, double, double);
00080   void translate(double d[3]) { translate(d[0], d[1], d[2]); }
00081 
00083   void scale(double, double, double);
00084   void scale(double f) { scale(f, f, f); }
00085 
00087   void window(double, double, double, double, double, double);
00088 
00090   void ortho(double, double, double, double, double, double);
00091 
00093   void ortho2(double, double, double, double);
00094 
00101   void lookat(double, double, double, double, double, double, short);
00102 };
00103 
00105 void trans_from_rotate(const double mat3[9], Matrix4 *mat4);
00106 
00108 void print_Matrix4(const Matrix4 *mat4);
00109 
00110 #endif
00111 

Generated on Mon Nov 20 01:17:12 2017 for NAMD by  doxygen 1.4.7