00001 /* 00002 * Part of rvglue source code, 00003 * Copyright (C) 2000 Alexander Kroeller (alilein@gmx.de) 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 Free Software 00017 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. 00018 */ 00019 00027 #ifndef __MATRIX3_H 00028 #define __MATRIX3_H 00029 00030 #include "rvbasetypes.h" 00031 #include "vector.h" 00032 00034 00043 class Matrix_3x3 00044 { 00045 public: 00046 Matrix_3x3(); 00047 Matrix_3x3(const Matrix_3x3 &); 00048 Matrix_3x3(Vector &, Vector &, Vector &); // vectors to columns! 00049 00050 rvfloat val(int col, int lin) const; 00051 void set(int col, int lin, rvfloat val); 00052 00053 00057 rvfloat det(void) const; 00058 00059 Vector operator * (Vector &); 00060 Matrix_3x3 operator * (Matrix_3x3 &); 00061 00062 bool is_invertable(void) const; 00063 00067 Vector solve(Vector &v) const; 00068 00069 Matrix_3x3 invert(void) const; 00070 00072 void dump(const char *pref); 00073 00074 rvfloat data[3][3]; /* [column][line] !!!! */ 00075 }; 00076 00077 00078 #define MATRIX_STORAGE_SIZE_OKAY (sizeof(Matrix_3x3) == 9*sizeof(rvfloat)) 00079 00080 00081 #endif