Support more of mathlib function for easier swap in px4.

This commit is contained in:
James Goppert
2016-08-16 19:03:54 -04:00
parent 558777f34c
commit 0eb8aa0c0b
10 changed files with 188 additions and 4 deletions
+17
View File
@@ -61,11 +61,24 @@ public:
return r;
}
inline Type operator*(const MatrixM1 & b) const {
const Vector &a(*this);
return a.dot(b);
}
inline Vector operator*(float b) const {
return Vector(MatrixM1::operator*(b));
}
Type norm() const {
const Vector &a(*this);
return Type(sqrt(a.dot(a)));
}
inline Type length() const {
return norm();
}
inline void normalize() {
(*this) /= norm();
}
@@ -74,6 +87,10 @@ public:
return (*this) / norm();
}
inline Vector normalized() const {
return unit();
}
Vector pow(Type v) const {
const Vector &a(*this);
Vector r;