From a56a7f7da4d31a1275908824919bb8e8ef4acf85 Mon Sep 17 00:00:00 2001 From: Andrew Tridgell Date: Fri, 8 May 2020 07:23:36 +1000 Subject: [PATCH] AP_Math: added more vector3f ops for lua --- libraries/AP_Math/vector3.h | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/libraries/AP_Math/vector3.h b/libraries/AP_Math/vector3.h index dd4ca7908c..3813b40118 100644 --- a/libraries/AP_Math/vector3.h +++ b/libraries/AP_Math/vector3.h @@ -143,6 +143,11 @@ public: // dot product T operator *(const Vector3 &v) const; + // dot product for Lua + T dot(const Vector3 &v) const { + return *this * v; + } + // multiply a row vector by a matrix, to give a row vector Vector3 operator *(const Matrix3 &m) const; @@ -152,6 +157,16 @@ public: // cross product Vector3 operator %(const Vector3 &v) const; + // cross product for Lua + Vector3 cross(const Vector3 &v) const { + return *this % v; + } + + // scale a vector3 + Vector3 scale(const float v) const { + return *this * v; + } + // computes the angle between this vector and another vector float angle(const Vector3 &v2) const;