matrix3.hpp
Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020 #ifndef _MATRIX3_HPP_
00021 #define _MATRIX3_HPP_
00022
00023 #include <iostream>
00024 #include <vector>
00025
00026 namespace cpe
00027 {
00028 class v3;
00029
00030 class matrix3
00031 {
00032
00033 public:
00034
00035
00036
00037
00038
00039
00040
00042 matrix3();
00044 matrix3(const double& x00,const double& x01,const double& x02,
00045 const double& x10,const double& x11,const double& x12,
00046 const double& x20,const double& x21,const double& x22);
00047
00048
00049
00050
00051
00052
00053
00055 static matrix3 identity();
00057 static matrix3 zeros();
00059 static matrix3 rotation(const v3& axis,const double& angle);
00061 static matrix3 scale(const double& s);
00063 static matrix3 scale(const double& s_x,const double& s_y,const double& s_z);
00064
00065
00066
00067
00068
00069
00070
00071
00073 const double& operator()(const size_t& k1,const size_t& k2) const;
00075 double& operator()(const size_t& k1,const size_t& k2);
00076
00079 const double* pointer() const;
00082 double* pointer_unprotected();
00083
00084
00085
00086
00087
00088
00089
00090
00091
00093 friend matrix3 operator+(const matrix3& m1,const matrix3& m2);
00095 friend matrix3 operator+(const double& s,const matrix3& m);
00097 friend matrix3 operator+(const matrix3& m,const double& s);
00098
00100 friend matrix3 operator-(const matrix3& m1,const matrix3& m2);
00102 friend matrix3 operator-(const double& s,const matrix3& m);
00104 friend matrix3 operator-(const matrix3& m,const double& s);
00105
00107 friend matrix3 operator*(const double& s,const matrix3& m);
00109 friend matrix3 operator*(const matrix3& m,const double& s);
00111 friend v3 operator*(const matrix3& m,const v3& v);
00113 friend matrix3 operator*(const matrix3& m1,const matrix3& m2);
00115 friend matrix3 operator/(const matrix3& m,const double& s);
00116
00117
00119 matrix3& operator+=(const matrix3& m);
00121 matrix3& operator+=(const double& s);
00123 matrix3& operator-=(const matrix3& m);
00125 matrix3& operator-=(const double& s);
00127 matrix3& operator*=(const double& s);
00129 matrix3& operator/=(const double& s);
00130
00132 matrix3 operator-() const;
00133
00137 matrix3 product_compontentwise(const matrix3& m) const;
00142 matrix3& product_compontentwise_internal(const matrix3& m);
00143
00144
00145
00146
00147
00148
00149
00150
00151
00152
00154 friend std::ostream& operator<<(std::ostream& stream,const matrix3& m);
00155
00156
00157
00158
00159
00160
00161
00162
00163
00164
00166 std::vector<double> to_4d() const;
00167
00168 private:
00169
00170
00171
00172
00173
00174
00175
00177 double m[9];
00178
00179
00180
00181
00182
00183
00184
00185
00187 void assert_size(const size_t& k1,const size_t& k2) const throw(std::exception);
00188
00189 };
00190 }
00191
00192 #endif