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

Matrix33.h

00001 /*************************************************************************** 00002 * This file is part of OpenCAL: Open Computer Animation Library * 00003 * I created OpenCAL as my master's thesis Computer Science (multimedia) * 00004 * at the tUL university in Diepenbeek, Belgium * 00005 * * 00006 * Copyright (C) 2003-2004 by Jeroen Dierckx * 00007 * jeroen.dierckx@student.luc.ac.be * 00008 * * 00009 ***************************************************************************/ 00010 00011 #ifndef OPENCAL_UTILS_MATRIX33_H 00012 #define OPENCAL_UTILS_MATRIX33_H 00013 00014 // Includes 00015 #include <OpenCAL/global.h> 00016 00017 namespace OpenCAL 00018 { 00019 namespace Utils 00020 { 00021 // Forward declarations 00022 class Vector3; 00023 00031 class OPENCAL_API Matrix33 00032 { 00033 protected: 00034 // Member variables 00035 float m_values[9]; 00036 00037 public: 00038 // Static member variables 00039 static const Matrix33 zero; 00040 static const Matrix33 unity; 00041 00042 public: 00043 // Constructors and destructor 00044 Matrix33(); 00045 Matrix33( 00046 float m11, float m12, float m13, 00047 float m21, float m22, float m23, 00048 float m31, float m32, float m33); 00049 Matrix33(const Matrix33 &source); 00050 virtual ~Matrix33(); 00051 00052 // Get functions 00053 const float *get() const { return m_values; } 00054 float get(int index) const { return m_values[index]; } 00055 float get(int row, int col) const { return m_values[3 * row + col]; } 00056 00057 // Set functions 00058 void set(float *values); 00059 void set(int index, float value) { m_values[index] = value; } 00060 void set(int row, int col, float value) { m_values[3 * row + col] = value; } 00061 00062 // Operator functions 00063 void operator=(const Matrix33 &m); // Assignment 00064 Matrix33 operator*(const Matrix33 &m) const; // Matrix product 00065 Matrix33 operator*(float factor) const; // Scalar product 00066 Vector3 operator*(const Vector3 &v) const; // Vector product 00067 Matrix33 operator+(const Matrix33 &m) const; // Matrix addition 00068 Matrix33 operator-() const; // Negation 00069 00070 void operator*=(float factor); 00071 00072 bool operator==(const Matrix33 &m) const; // Equality 00073 bool operator!=(const Matrix33 &m) const // Not equality 00074 {return !(*this == m);} 00075 00076 // Transform functions 00077 void rotateX(float angle); 00078 void rotateY(float angle); 00079 void rotateZ(float angle); 00080 00081 // Other functions 00082 void identity(); // Creates the identity matrix 00083 void clear(); // Clears the matrix 00084 void transpose(); // Transposes the matrix 00085 Matrix33 transposed(); // Returns the transposed of this matrix 00086 void fill(float value); // Fills the matrix with a value 00087 00088 void print(); // Prints out the matrix 00089 00090 protected: 00091 // Friend functions 00092 friend Matrix33 operator*(float factor, const Matrix33 &m); // Scalar product 00093 friend Matrix33 operator/(float factor, const Matrix33 &m); 00094 }; 00095 } 00096 } 00097 00098 #endif // OPENCAL_UTILS_MATRIX33_H

Generated on Sun Aug 15 19:19:22 2004 for OpenCAL: Open Computer Animation Library by doxygen 1.3.8