Matrix4.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 _MATRIX4_H
00008 #define _MATRIX4_H
00009 
00010 #include <boost/shared_ptr.hpp>
00011 #include <Inventor/SbLinear.h>
00012 #include <Physsim/Vector3.h>
00013 #include <Physsim/MatrixNN.h>
00014 
00015 namespace Physsim {
00016 
00017 class Quat;
00018 class AAngle;
00019 class Matrix3;
00020 
00022 
00028 class Matrix4 : public MatrixNN
00029 {
00030         public:
00031                 Matrix4();
00032                 Matrix4(const Matrix4& source);
00033                 Matrix4(const MatrixNN& source);
00034                 Matrix4(const MatrixN& source);
00035                 Matrix4(const boost::shared_array<Real> array);
00036                 Matrix4(const AAngle* a);
00037                 Matrix4(const Matrix3* m);
00038                 Matrix4(const Quat* q);
00039                 Matrix4(const AAngle* a, const Vector3* v);
00040                 Matrix4(const Matrix3* m, const Vector3* v);
00041                 Matrix4(const Quat* q, const Vector3* v);
00042                 Matrix4(const Vector3* v);
00043                 Matrix4(Real m00, Real m01, Real m02, Real m03, Real m10, Real m11, Real m12, Real m13, Real m20, Real m21, Real m22, Real m23, Real m30, Real m31, Real m32, Real m33);
00044                 bool epsilon_equals(const Matrix4& m, Real epsilon) const;
00045                 static bool epsilon_equals(const Matrix4& m1, const Matrix4& m2, Real epsilon);
00046                 static Matrix4 interpolate(const Matrix4& m1, const Matrix4& m2, Real t);
00047                 Matrix3 get_rotation() const;
00048                 void get_rotation(Matrix3* m) const;
00049                 Vector3 get_translation() const;
00050                 static void to_inventor_matrix(const Matrix4& src, SbMatrix& tgt);
00051                 static void from_inventor_matrix(const SbMatrix& src, Matrix4& tgt);
00052                 void invert_transform();
00053                 static Matrix4 invert_transform(const Matrix4& m);
00054                 void get_translation(boost::shared_array<Real> array) const;
00055                 void get_translation(Vector3& v) const;
00056                 void get_translation(Real& x, Real& y, Real& z) const;
00057                 void set(boost::shared_array<const Real>  array);
00058                 void set(const AAngle* a, const Vector3*  v);
00059                 void set(const Matrix3* m, const Vector3*  v);
00060                 void set(const Quat* q, const Vector3*  v);
00061                 void set_rotation(const AAngle* a);
00062                 void set_rotation(const Quat* q);
00063                 void set_rotation(const Matrix3* m);
00064                 void set_translation(Real x, Real y, Real z);
00065                 void set_translation(boost::shared_array<Real> array);
00066                 void set_translation(const Vector3& v);
00067                 void operator=(const Matrix4& source) { MatrixN::operator=(source); }
00068                 virtual void operator=(const MatrixN& source) { assert(source.rows() == 4 && source.columns() == 4); MatrixN::operator=(source); }
00069                 virtual void operator=(const MatrixNN& source) { assert(source.rows() == 4); MatrixN::operator=(source); }
00070                 Matrix4 operator*(const Matrix4& m) const { return MatrixN::operator*(m); }
00071                 Matrix4 operator*(Real scalar) const { return MatrixN::operator*(scalar); }
00072                 Matrix4 operator/(Real scalar) const { return (MatrixN::operator/(scalar)); }           
00073                 Vector3 operator*(const Vector3& v) const;
00074                 static bool valid_transform(const Matrix4& m);
00075 }; // end class
00076 } // end namespace
00077 
00078 #endif
00079 

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