Main Page   Namespace List   Class Hierarchy   Alphabetical List   Compound List   File List   Namespace Members   Compound Members   File Members   Related Pages  

Matrix4.h

Go to the documentation of this file.
00001 /***************************************************************************
00002  *cr                                                                       
00003  *cr            (C) Copyright 1995-2019 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: johns $        $Locker:  $             $State: Exp $
00014  *      $Revision: 1.42 $       $Date: 2019/01/17 21:21:00 $
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(float f) { constant(f); }            
00030   Matrix4(const float *m);                     
00031   Matrix4(const Matrix4& m) { loadmatrix(m); } 
00032   ~Matrix4(void) {}                            
00033   float mat[16];                               
00034 
00036   void multpoint3d(const float[3], float[3]) const;
00037 
00039   void multpointarray_3d(int numpts, const float *, float *) const;
00040 
00042   void multnorm3d(const float[3], float[3]) const;
00043 
00045   void multplaneeq3d(const float[3], float[3]) const;
00046 
00048   void multpoint4d(const float[4], float[4]) const;
00049 
00051   void identity(void);
00052   
00054   void constant(float);
00055   
00060   int inverse(void);
00061   
00063   void transpose(void);
00064   
00066   void loadmatrix(const Matrix4 &m);
00067   Matrix4& operator=(const Matrix4& m) {loadmatrix(m); return *this;}
00068 
00070   void multmatrix(const Matrix4 &);
00071 
00073   void rot(float, char); // angle in degrees
00074 
00076   void rotate_axis(const float axis[3], float angle);
00077   
00079   void transvec(float x, float y, float z);
00080  
00082   void transvecinv(float x, float y, float z);
00083 
00085   void translate(float, float, float);
00086   void translate(float d[3]) { translate(d[0], d[1], d[2]); }
00087 
00089   void scale(float, float, float);
00090   void scale(float f) { scale(f, f, f); }
00091 
00093   void window(float, float, float, float, float, float);
00094 
00096   void ortho(float, float, float, float, float, float);
00097 
00099   void ortho2(float, float, float, float);
00100 
00107   void lookat(float, float, float, float, float, float, short);
00108 };
00109 
00111 void trans_from_rotate(const float mat3[9], Matrix4 *mat4);
00112 
00114 void print_Matrix4(const Matrix4 *mat4);
00115 
00116 #endif
00117 

Generated on Fri Nov 8 02:44:44 2024 for VMD (current) by doxygen1.2.14 written by Dimitri van Heesch, © 1997-2002