AP_Math: added more vector3f ops for lua

This commit is contained in:
Andrew Tridgell 2020-05-08 07:23:36 +10:00
parent 6c67ddacf4
commit a56a7f7da4
1 changed files with 15 additions and 0 deletions

View File

@ -143,6 +143,11 @@ public:
// dot product
T operator *(const Vector3<T> &v) const;
// dot product for Lua
T dot(const Vector3<T> &v) const {
return *this * v;
}
// multiply a row vector by a matrix, to give a row vector
Vector3<T> operator *(const Matrix3<T> &m) const;
@ -152,6 +157,16 @@ public:
// cross product
Vector3<T> operator %(const Vector3<T> &v) const;
// cross product for Lua
Vector3<T> cross(const Vector3<T> &v) const {
return *this % v;
}
// scale a vector3
Vector3<T> scale(const float v) const {
return *this * v;
}
// computes the angle between this vector and another vector
float angle(const Vector3<T> &v2) const;