mirror of
https://gitee.com/mirrors_PX4/PX4-Autopilot.git
synced 2026-10-19 14:23:36 +08:00
Support more of mathlib function for easier swap in px4.
This commit is contained in:
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user