Back to index

extremetuxracer  0.5beta
matrix.h
Go to the documentation of this file.
00001 /* 
00002  * Copyright (C) 2004-2005 Volker Stroebel <mmv1@planetpenguin.de>
00003  *
00004  * This program is free software; you can redistribute it and/or
00005  * modify it under the terms of the GNU General Public License
00006  * as published by the Free Software Foundation; either version 2
00007  * of the License, or (at your option) any later version.
00008  * 
00009  * This program is distributed in the hope that it will be useful,
00010  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00011  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00012  * GNU General Public License for more details.
00013  * 
00014  * You should have received a copy of the GNU General Public License
00015  * along with this program; if not, write to the Free Software
00016  * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
00017  */
00018  
00019 #ifndef _MATRIX_H
00020 #define _MATRIX_H
00021 
00022 
00023 #include "vec3d.h"
00024 #include "quat.h"
00025 
00026 namespace pp {
00027 
00029 class Quat;
00030 
00032 class Matrix
00033 {
00034 public:
00035        double data[4][4];
00036        Matrix(void){};
00037        Matrix(const Quat quat);    
00038 
00039        Matrix operator*(const Matrix matrix) const;
00040               
00041        void makeIdentity(void);
00042        void makeRotation(const double angle, const char axis);
00043        void makeTranslation(const double x, const double y, const double z);
00044        void makeScaling(const double x, const double y, const double z );
00045        void makeRotationAboutVector(const Vec3d u, const double angle );
00046 
00047        void transpose(const Matrix& mat);
00048               
00049        Vec3d  transformVector(const Vec3d v) const;
00050        Vec3d  transformPoint(const Vec3d p) const;
00051               
00052        static void makeChangeOfBasisMatrix(Matrix& mat,
00053                             Matrix& invMat,
00054                             const Vec3d w1,
00055                             const Vec3d w2,
00056                             const Vec3d w3);     
00057 };
00058 
00059 
00060 } //namespace pp
00061 
00062 #endif // MATRIX_H