diff options
author | Yann Herklotz <ymherklotz@gmail.com> | 2017-06-27 10:53:12 +0100 |
---|---|---|
committer | Yann Herklotz <ymherklotz@gmail.com> | 2017-06-27 10:53:12 +0100 |
commit | 3b2e4639de929e640fe672e0d77e0faef3acc027 (patch) | |
tree | aad08ed80aa9663a09614de065f3d40dd347b23f /include/YAGE/Math | |
parent | 205f2459063a123cabd83fb66b3880a72fb357bf (diff) | |
download | YAGE-3b2e4639de929e640fe672e0d77e0faef3acc027.tar.gz YAGE-3b2e4639de929e640fe672e0d77e0faef3acc027.zip |
Implementing Vector2d
Diffstat (limited to 'include/YAGE/Math')
-rw-r--r-- | include/YAGE/Math/matrix.hpp | 36 |
1 files changed, 36 insertions, 0 deletions
diff --git a/include/YAGE/Math/matrix.hpp b/include/YAGE/Math/matrix.hpp index d1c5fd74..238f7d09 100644 --- a/include/YAGE/Math/matrix.hpp +++ b/include/YAGE/Math/matrix.hpp @@ -236,6 +236,36 @@ Matrix<M, N, T> operator-(const T &lhs, Matrix<M, N, T> rhs) } template<int M, int N, class T> +Matrix<M, N, T> operator*(Matrix<M, N, T> lhs, const T &rhs) +{ + for(auto &data : lhs) + { + data*=rhs; + } + return lhs; +} + +template<int M, int N, class T> +Matrix<M, N, T> operator*(const T &lhs, Matrix<M, N, T> rhs) +{ + for(auto &data : rhs) + { + data*=lhs; + } + return rhs; +} + +template<int M, int N, class T> +Matrix<M, N, T> operator/(Matrix<M, N, T> lhs, const T &rhs) +{ + for(auto &data : lhs) + { + data/=rhs; + } + return lhs; +} + +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) @@ -280,6 +310,12 @@ 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() { |