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

matrix.h

00001 /* ************************************************************************* 00002 matrix.h - description 00003 ------------------- 00004 begin : Wed Oct 16 2002 00005 copyright : (C) 2002 by Micha Riser 00006 email : mriser@gmx.net 00007 00008 $Id: matrix_8h-source.html,v 1.1 2005/02/04 21:02:27 micha Exp $ 00009 00010 ************************************************************************* */ 00011 00012 /* ************************************************************************* 00013 * * 00014 * This program is free software; you can redistribute it and/or modify * 00015 * it under the terms of the GNU General Public License as published by * 00016 * the Free Software Foundation; either version 2 of the License, or * 00017 * (at your option) any later version. * 00018 * * 00019 ************************************************************************* */ 00020 00021 #ifndef MATRIX_H 00022 #define MATRIX_H 00023 00024 #include<cmath> 00025 #include<cstring> 00026 #include "types.h" 00027 00028 class Vector3; 00029 00034 class Matrix { 00035 00036 public: // Constructors and destructor 00037 00040 Matrix() {} 00041 00045 Matrix(DBL d[3][3]) {memcpy(&d,&a,sizeof(a));} 00046 00050 Matrix(int d) {memset(&a,d,sizeof(DBL)*3*3);} 00051 00052 public: // Public methods 00053 00056 DBL& operator() (int i, int j) {return a[i][j];} 00057 00060 const DBL& operator() (int i, int j) const {return a[i][j];} 00061 00064 void zero() {memset(&a,0,sizeof(DBL)*3*3);} 00065 00068 void transpose(); 00069 00073 bool invert(); 00074 00078 void applyFromLeft(const Matrix &m); 00079 00080 public: // Static methods 00084 static Matrix generateScaleMatrix(const Vector3& v); 00085 00090 static Matrix generateRotationMatrix(const Vector3& v); 00091 00092 private: // Private attributes 00093 static const DBL SMALL_DET; 00094 DBL a[3][3]; 00095 00096 }; 00097 00098 #endif

Generated on Thu Jan 27 12:16:05 2005 for raytracer.kdevelop by doxygen 1.3.8