mirror of
https://gitee.com/mirrors_PX4/PX4-Autopilot.git
synced 2026-10-20 06:43:34 +08:00
Added set function.
This commit is contained in:
@@ -72,6 +72,13 @@ public:
|
||||
return _data[i][j];
|
||||
}
|
||||
|
||||
void operator=(const Matrix<Type, M, N> &other)
|
||||
{
|
||||
if (this != &other) {
|
||||
memcpy(_data, other._data, sizeof(_data));
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Matrix Operations
|
||||
*/
|
||||
@@ -324,6 +331,17 @@ public:
|
||||
return res;
|
||||
}
|
||||
|
||||
template<size_t P, size_t Q>
|
||||
void set(const Matrix<Type, P, Q> &m, size_t x0, size_t y0)
|
||||
{
|
||||
Matrix<Type, M, N> &self = *this;
|
||||
for (size_t i = 0; i < P; i++) {
|
||||
for (size_t j = 0; j < Q; j++) {
|
||||
self(i + x0, j + y0) = m(i, j);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void setZero()
|
||||
{
|
||||
memset(_data, 0, sizeof(_data));
|
||||
|
||||
Reference in New Issue
Block a user