Add support for Slice to Matrix, SquareMatrix, Vector

This commit is contained in:
Julian Kent
2019-09-16 16:11:08 +02:00
parent af1378cc55
commit 82d565f4d9
8 changed files with 77 additions and 20 deletions
+21 -1
View File
@@ -20,6 +20,9 @@ class Matrix;
template <typename Type, size_t M>
class Vector;
template <typename Type, size_t P, size_t Q, size_t M, size_t N>
class Slice;
template<typename Type, size_t M>
class SquareMatrix : public Matrix<Type, M, M>
{
@@ -36,6 +39,24 @@ public:
{
}
template<size_t P, size_t Q>
SquareMatrix(const Slice<Type, M, M, P, Q>& in_slice) : Matrix<Type, M, M>(in_slice)
{
}
SquareMatrix<Type, M>& operator=(const Matrix<Type, M, M>& other)
{
Matrix<Type, M, M>::operator=(other);
return *this;
}
template <size_t P, size_t Q>
SquareMatrix<Type, M> & operator=(const Slice<Type, M, M, P, Q>& in_slice)
{
Matrix<Type, M, M>::operator=(in_slice);
return *this;
}
// inverse alias
inline SquareMatrix<Type, M> I() const
{
@@ -93,7 +114,6 @@ public:
}
return res;
}
};
typedef SquareMatrix<float, 3> SquareMatrix3f;