Main Page | Namespace List | Class Hierarchy | Alphabetical List | Class List | Directories | File List | Namespace Members | Class Members | File Members | Related Pages

Matrix.h

Go to the documentation of this file.
00001 #ifndef _MATRIX_H_
00002 #define _MATRIX_H_
00003 
00004 #include "vuSimpleTypes.h"
00005 
00006 class Vector;
00007 
00008 //
00009 // The Matrix class is a 4x4 matrix that
00010 // works in conjunction with the Vector class
00011 // (a 3D homogeneous vector).  The elements of
00012 // the Matrix are all single precision
00013 // floating-point numbers, stored in column-major
00014 // order to be compatible with OpenGL.
00015 //
00016 class Matrix
00017 {
00018 friend class Vector;
00019 public:
00020     //
00021     // Constructors and destructor.
00022     //
00023     Matrix();
00024     Matrix(const Matrix& m);
00025     Matrix(const float v);
00026     Matrix(const float* v);
00027     ~Matrix();
00028 
00029     //
00030     // Generate various special matrices by
00031     // changing values in the current instance.
00032     // All transformation matrices are pre-
00033     // transforms, meaning they should be left
00034     // multiplied against a vector.
00035     //
00036     Matrix& MakeIdentity(void);
00037     Matrix& MakeRotate(Vector& axis, float a);
00038     Matrix& MakeRotateX(float a);
00039     Matrix& MakeRotateY(float a);
00040     Matrix& MakeRotateZ(float a);
00041     Matrix& MakeTranslate(float x, float y, float z);
00042     Matrix& MakeScale(float x, float y, float z);
00043     Matrix& MakeShearXY(float s);
00044     Matrix& MakeShearXZ(float s);
00045     Matrix& MakeShearYX(float s);
00046     Matrix& MakeShearYZ(float s);
00047     Matrix& MakeShearZX(float s);
00048     Matrix& MakeShearZY(float s);
00049     Matrix& MakeReflectX(void);
00050     Matrix& MakeReflectY(void);
00051     Matrix& MakeReflectZ(void);
00052     Matrix& MakePerspective(float d);
00053     Matrix& MakePerspectiveKeepZ(float d);
00054 
00055     //
00056     // Assignment and accessor operators.
00057     //
00058     Matrix& operator=(const Matrix& m);
00059     Matrix& operator=(const float& v);
00060     Matrix& operator=(const float* v);
00061     float* operator[](unsigned int index);
00062 
00063     //
00064     // Get the data pointer.
00065     // Same as calling operator[0].
00066     //
00067     float* GetData(void);
00068 
00069     //
00070     // Operators for matrix-matrix and matrix-vector
00071     // operations.
00072     //
00073     Matrix operator+(Matrix& m);
00074     Matrix operator-(Matrix& m);
00075     Matrix operator*(Matrix& m);
00076     Vector operator*(Vector& v);
00077     Matrix operator*(float s);
00078     friend Matrix operator*(float s, Matrix& m);
00079     Matrix& operator+=(Matrix& m);
00080     Matrix& operator-=(Matrix& m);
00081     Matrix& operator*=(const Matrix& m);
00082     Matrix& operator*=(float s);
00083 
00084     //
00085     // Equality and inequality operators.
00086     //
00087     bool operator==(const Matrix& m) const;
00088     bool operator!=(const Matrix& m) const;
00089 
00090 private:
00091     float val[16];
00092 };
00093 
00094 #endif
00095 

Generated on Wed Dec 15 21:20:29 2004 for vuVolume by  doxygen 1.3.9.1