Main Page | Class Hierarchy | Class List | File List | Class Members | File Members | Related Pages

matrix4x4.h

Go to the documentation of this file.
00001 /***************************************************************************
00002  *   Copyright (C) 2004 by Stephen Bridges                                 *
00003  *   widget@widget.dynu.com                                                *
00004  *                                                                         *
00005  *   This program is free software; you can redistribute it and/or modify  *
00006  *   it under the terms of the GNU General Public License as published by  *
00007  *   the Free Software Foundation; either version 2 of the License, or     *
00008  *   (at your option) any later version.                                   *
00009  *                                                                         *
00010  *   This program is distributed in the hope that it will be useful,       *
00011  *   but WITHOUT ANY WARRANTY; without even the implied warranty of        *
00012  *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the         *
00013  *   GNU General Public License for more details.                          *
00014  *                                                                         *
00015  *   You should have received a copy of the GNU General Public License     *
00016  *   along with this program; if not, write to the                         *
00017  *   Free Software Foundation, Inc.,                                       *
00018  *   59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.             *
00019  ***************************************************************************/
00020  
00021 // $Id$
00022 
00023 #ifndef MATRIX4X4_H
00024 #define MATRIX4X4_H
00025 
00026 #include "maths.h"
00027 #include "vec4.h"
00028 
00038 class Matrix4x4
00039 {
00040 public:
00042     float m[16];
00043     Matrix4x4();
00044 
00045     ~Matrix4x4();
00046     // Copy time
00047     Matrix4x4(const Matrix4x4& other);
00048     Matrix4x4& operator=(const Matrix4x4& other);
00049     // Add
00050     Matrix4x4 operator+(const Matrix4x4& other) const;
00051     Matrix4x4 &operator+=(const Matrix4x4& other);
00052     // Minus
00053     Matrix4x4 operator-(const Matrix4x4& other) const;
00054     Matrix4x4 &operator-=(const Matrix4x4& other);
00055     // Multiply by scalar
00056     Matrix4x4 operator*(const float other) const;
00057     Matrix4x4 &operator*=(const float other);
00058     // Multiply by Matrix
00059     Matrix4x4 operator*(const Matrix4x4 &o) const;
00060     Matrix4x4 &operator*=(const Matrix4x4 &o);
00061     // The accessing functions
00062     float &operator()(unsigned int i, unsigned int j);
00063     float operator()(unsigned int i, unsigned int j) const;
00064     // Comparisions
00065     bool operator==(Matrix4x4 &other);
00066     bool operator!=(Matrix4x4 &other);
00067     // Matrix functions
00068     bool isAffine(void);
00069     
00070     void scale(float xin, float yin, float zin);
00071     void trans(float xin, float yin, float zin);
00072     void rotate(float xin, float yin, float zin);
00073     void scale(Vec4 in);
00074     void trans(Vec4 in);
00075     void rotate(Vec4 in);
00076     void rotX(float in);
00077     void rotY(float in);
00078     void rotZ(float in);
00079     
00080     void makeScale(float xin, float yin, float zin);
00081     void makeTrans(float xin, float yin, float zin);
00082     void makeRotate(float xin, float yin, float zin);
00083     void makeScale(Vec4 in);
00084 //     void makeTrans(Vec4 in); NOT DEFINED YET
00085     void makeRotate(Vec4 in);
00086     void makeRotX(float in);
00087     void makeRotY(float in);
00088     void makeRotZ(float in);
00089     
00090     void invert(void);
00091     void transpose(void);
00092     // Default matrices
00093     void Identity(void);
00094     void Zero(void);
00095     void Print(void);
00096     void Clean(void);
00097 //     Matrix4x4 &onlyTrans(void);
00098 //     Matrix4x4 &onlyRot(void);
00099 //     Matrix4x4 &onlyScale(void);
00100 };
00101 
00102 Matrix4x4 makeInverse(const Matrix4x4 &in);
00103 
00112 inline float &Matrix4x4::operator()(unsigned int i, unsigned int j)
00113 {
00114     return m[i + 4*j];
00115 }
00116 
00125 inline float Matrix4x4::operator ()(unsigned int i, unsigned int j) const
00126 {
00127     return m[i + 4*j];
00128 }
00129 
00130 /*
00131  * $Log$
00132  */ 
00133 
00134 #endif
00135 
00136 // EOF

Generated on Mon Jan 3 15:14:19 2005 for Graviton by  doxygen 1.3.9.1