Matrix3.h

00001 /****************************************************************************
00002  * Copyright 2005 Evan Drumwright
00003  * This library is distributed under the terms of the GNU General Public 
00004  * License (found in COPYING).
00005  ****************************************************************************/
00006 
00007 #ifndef _MATRIX3_H
00008 #define _MATRIX3_H
00009 
00010 #include <Physsim/Vector3.h>
00011 #include <Physsim/MatrixNN.h>
00012 
00013 namespace Physsim {
00014 
00015 class Quat;
00016 class AAngle;
00017 
00019 class Matrix3 : public MatrixNN
00020 {
00021         public:
00022                 Matrix3();
00023                 Matrix3(const boost::shared_array<Real> array);
00024                 Matrix3(Real m00, Real m01, Real m02, Real m10, Real m11, Real m12, Real m20, Real m21, Real m22);
00025                 Matrix3(const Quat* q);
00026                 Matrix3(const Matrix3& source);
00027                 Matrix3(const MatrixNN& source);
00028                 Matrix3(const MatrixN& source);
00029                 Matrix3(const AAngle* a);
00030                 bool epsilon_equals(const Matrix3& m, Real epsilon) const;
00031                 static bool epsilon_equals(const Matrix3& m1, const Matrix3& m2, Real epsilon);
00032                 Real det() const;
00033                 void invert();
00034                 static Matrix3 invert(const Matrix3& m);
00035                 void set_rot_X(Real angle);
00036                 static Matrix3 rot_X(Real angle);
00037                 void set_rot_Y(Real angle);
00038                 static Matrix3 rot_Y(Real angle);
00039                 void set_rot_Z(Real angle);
00040                 static Matrix3 rot_Z(Real angle);
00041                 void set(const AAngle* a);
00042                 void set(Real scale);
00043                 void set(const Quat* q);
00044                 static Matrix3 skew_symmetric(Real a, Real b, Real c);
00045                 static Matrix3 skew_symmetric(const Vector3& v);
00046                 static bool valid_rotation(const Matrix3& R);
00047                 void operator=(const Matrix3& source) { MatrixN::operator=(source); }
00048                 virtual void operator=(const MatrixN& source) { assert(source.rows() == 3 && source.columns() == 3); MatrixN::operator=(source); }
00049                 virtual void operator=(const MatrixNN& source) { assert(source.rows() == 3); MatrixN::operator=(source); }
00050                 Vector3 operator*(const Vector3& v) const;
00051 //              void operator+=(const Matrix3& m) { MatrixN::operator+=(m); }
00052 //              void operator-=(const Matrix3& m) { MatrixN::operator-=(m); }
00053                 Matrix3 operator*(const Matrix3& m) const { return Matrix3(MatrixN::operator*(m)); }
00054                 Matrix3 operator*(Real scalar) const { return Matrix3((MatrixN::operator*(scalar))); }
00055                 Matrix3 operator/(Real scalar) const { return Matrix3((MatrixN::operator/(scalar))); }          
00056 }; // end class
00057 } // end namespace
00058 
00059 #endif

Generated on Wed Oct 24 14:54:21 2007 for Physsim by  doxygen 1.5.1