diff options
author | Yann Herklotz <ymherklotz@gmail.com> | 2017-07-23 14:19:28 +0100 |
---|---|---|
committer | Yann Herklotz <ymherklotz@gmail.com> | 2017-07-23 14:19:28 +0100 |
commit | daa9dc84d7fb6e7c8f84b1ee3adfaacaad7de72f (patch) | |
tree | 60909899b320f03193896b277006fb01a506629f /include/YAGE/Math | |
parent | 85fe87aa7a52733dc80f61617bf65f22b2d98ccb (diff) | |
download | YAGE-daa9dc84d7fb6e7c8f84b1ee3adfaacaad7de72f.tar.gz YAGE-daa9dc84d7fb6e7c8f84b1ee3adfaacaad7de72f.zip |
Fixing gravity
Diffstat (limited to 'include/YAGE/Math')
-rw-r--r-- | include/YAGE/Math/matrix.hpp | 22 |
1 files changed, 14 insertions, 8 deletions
diff --git a/include/YAGE/Math/matrix.hpp b/include/YAGE/Math/matrix.hpp index 238f7d09..c7c40f00 100644 --- a/include/YAGE/Math/matrix.hpp +++ b/include/YAGE/Math/matrix.hpp @@ -269,15 +269,9 @@ template<int M, int N, class T> bool operator==(const Matrix<M, N, T> &lhs, const Matrix<M, N, T> &rhs) { for(int i=0; i<M; ++i) - { for(int j=0; j<N; ++j) - { if(lhs[i][j]!=rhs[i][j]) - { - return false; - } - } - } + return false; return true; } @@ -303,18 +297,30 @@ public: return this->data_[col]; } - + virtual std::string toString() const + { + std::stringstream ss; + ss<<"["; + for(std::size_t i=0; i<this->data_.size()-1; ++i) + { + ss<<this->data_[i]<<" "; + } + ss<<this->data_[this->data_.size()-1]<<"]"; + return ss.str(); + } }; template<class Type=double> class Vector2 : public Vector<2, Type> { public: Vector2<Type>() : Vector<2, Type>() {} + Vector2<Type>(Type x, Type y) { this->data_[0]=x; this->data_[1]=y; } + Vector2<Type>(const Matrix<2, 1, Type> &other) : Vector<2, Type>(other) {} Type& x() |