mirror of
https://gitee.com/mirrors_PX4/PX4-Autopilot.git
synced 2026-10-18 09:43:34 +08:00
Formatting and added Scalar.
This commit is contained in:
+26
-26
@@ -16,37 +16,37 @@ template<typename Type, size_t N>
|
||||
class Vector : public Matrix<Type, N, 1>
|
||||
{
|
||||
public:
|
||||
virtual ~Vector() {};
|
||||
virtual ~Vector() {};
|
||||
|
||||
Vector() : Matrix<Type, N, 1>()
|
||||
{
|
||||
}
|
||||
Vector() : Matrix<Type, N, 1>()
|
||||
{
|
||||
}
|
||||
|
||||
inline Type operator()(size_t i) const
|
||||
{
|
||||
const Matrix<Type, N, 1> &v = *this;
|
||||
return v(i, 0);
|
||||
}
|
||||
inline Type operator()(size_t i) const
|
||||
{
|
||||
const Matrix<Type, N, 1> &v = *this;
|
||||
return v(i, 0);
|
||||
}
|
||||
|
||||
inline Type &operator()(size_t i)
|
||||
{
|
||||
Matrix<Type, N, 1> &v = *this;
|
||||
return v(i, 0);
|
||||
}
|
||||
inline Type &operator()(size_t i)
|
||||
{
|
||||
Matrix<Type, N, 1> &v = *this;
|
||||
return v(i, 0);
|
||||
}
|
||||
|
||||
Type dot(const Vector & b) {
|
||||
Vector &a(*this);
|
||||
Type r = 0;
|
||||
for (int i = 0; i<3; i++) {
|
||||
r += a(i)*b(i);
|
||||
}
|
||||
return r;
|
||||
}
|
||||
Type dot(const Vector & b) {
|
||||
Vector &a(*this);
|
||||
Type r = 0;
|
||||
for (int i = 0; i<3; i++) {
|
||||
r += a(i)*b(i);
|
||||
}
|
||||
return r;
|
||||
}
|
||||
|
||||
Type norm() {
|
||||
Vector &a(*this);
|
||||
return sqrt(a.dot(a));
|
||||
}
|
||||
Type norm() {
|
||||
Vector &a(*this);
|
||||
return sqrt(a.dot(a));
|
||||
}
|
||||
};
|
||||
|
||||
}; // namespace matrix
|
||||
|
||||
Reference in New Issue
Block a user