mirror of
https://gitee.com/mirrors_PX4/PX4-Autopilot.git
synced 2026-11-06 14:11:37 +08:00
Add support for Slice to Matrix, SquareMatrix, Vector
This commit is contained in:
+21
-1
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user