00001 #ifndef __MATRIX3_H__
00002 #define __MATRIX3_H__
00003
00004 #include "Vector3.h"
00005
00006 class Matrix3
00007 {
00008 public:
00010 Matrix3();
00011
00013 Matrix3(float e11, float e12, float e13,
00014 float e21, float e22, float e23,
00015 float e31, float e32, float e33);
00016 Matrix3(const Matrix3& other);
00017
00018
00019 const float* operator[](int row) const;
00020 float* operator[](int row);
00021 float operator()(int row, int col) const;
00022 float& operator()(int row, int col);
00023
00025 const Matrix3& operator=(const Matrix3& other);
00026
00028 bool operator==(const Matrix3& other) const;
00029 bool operator!=(const Matrix3& other) const;
00030
00032 const Matrix3 operator+(const Matrix3& other) const;
00033 const Matrix3& operator+=(const Matrix3& other);
00034
00036 const Matrix3 operator-(const Matrix3& other) const;
00037 const Matrix3& operator-=(const Matrix3& other);
00038
00040 const Matrix3 operator*(float scalar) const;
00041 const Matrix3& operator*=(float scalar);
00042
00044 const Matrix3 operator*(const Matrix3& other) const;
00045
00047 Vector3 operator*(const Vector3& vector3d) const;
00048
00050 const Matrix3 operator/(float scalar) const;
00051 const Matrix3& operator/=(float scalar);
00052
00053
00055 Matrix3 Transposed(void) const;
00056 Matrix3 Inverse(void) const;
00057
00058 bool ToEulerAnglesXYZ(float& yaw, float& pitch, float& roll) const;
00059 bool ToEulerAnglesZYX(float& angleZ, float& angleY, float& angleX) const;
00060 bool ToEulerAnglesYXZ(float& angleY, float& angleX, float& angleZ) const;
00061
00062 void FromEulerAnglesYXZ (float yAngle, float xAngle, float zAngle);
00063
00065 void ToAxisAngle(Vector3& axis, float& angle) const;
00066 void FromAxisAngle(const Vector3& axis, float angle);
00067
00068 Vector3 GetLookVector(void) const;
00069 Vector3 GetUpVector(void) const;
00070 Vector3 GetRightVector(void) const;
00071
00072 void SetLookVector(const Vector3& vec);
00073 void SetUpVector(const Vector3& vec);
00074 void SetRightVector(const Vector3& vec);
00075
00076 Vector3 GetLookVectorInverse(void) const;
00077 Vector3 GetUpVectorInverse(void) const;
00078 Vector3 GetRightVectorInverse(void) const;
00079
00081 void BuildScale(float x, float y, float z);
00082
00083 void BuildRotationX(float angle);
00084 void BuildRotationY(float angle);
00085 void BuildRotationZ(float angle);
00086 void BuildRotation(float yaw, float pitch, float roll);
00087 void BuildRotation(const Vector3& axis, float angle);
00088
00090 static Matrix3 CreateScale(float x, float y, float z);
00091
00092 static Matrix3 CreateRotation(const Vector3& axis, float angle);
00093 static Matrix3 CreateRotation(float yaw, float pitch, float roll);
00094 static Matrix3 CreateRotationX(float angle);
00095 static Matrix3 CreateRotationY(float angle);
00096 static Matrix3 CreateRotationZ(float angle);
00097
00098 public:
00099 float entry[9];
00100
00101 static const Matrix3 ZERO;
00102 static const Matrix3 IDENTITY;
00103 };
00104
00105 #endif //__MATRIX3_H__