mirror of
https://gitee.com/mirrors_PX4/PX4-Autopilot.git
synced 2026-10-19 03:33:34 +08:00
Work on testing.
This commit is contained in:
+14
-5
@@ -47,20 +47,24 @@ public:
|
||||
return v(i, 0);
|
||||
}
|
||||
|
||||
Type dot(const Vector & b) {
|
||||
Vector &a(*this);
|
||||
Type dot(const Vector & b) const {
|
||||
const Vector &a(*this);
|
||||
Type r = 0;
|
||||
for (int i = 0; i<3; i++) {
|
||||
for (int i = 0; i<M; i++) {
|
||||
r += a(i)*b(i);
|
||||
}
|
||||
return r;
|
||||
}
|
||||
|
||||
Type norm() {
|
||||
Vector &a(*this);
|
||||
Type norm() const {
|
||||
const Vector &a(*this);
|
||||
return sqrt(a.dot(a));
|
||||
}
|
||||
|
||||
inline void normalize() {
|
||||
(*this) /= norm();
|
||||
}
|
||||
|
||||
/**
|
||||
* Vector Operations
|
||||
*/
|
||||
@@ -131,6 +135,11 @@ public:
|
||||
return res;
|
||||
}
|
||||
|
||||
Vector<Type, M> operator/(Type scalar) const
|
||||
{
|
||||
return (*this)*(1.0/scalar);
|
||||
}
|
||||
|
||||
Vector<Type, M> operator+(Type scalar) const
|
||||
{
|
||||
Vector<Type, M> res;
|
||||
|
||||
Reference in New Issue
Block a user