From 57a2f2a543f7cfe53c93b707012b4596faa4079c Mon Sep 17 00:00:00 2001 From: Andreas Rauschert <andreas.rb.rauschert@bmw.de> Date: Mon, 22 Nov 2021 20:57:07 +0100 Subject: [PATCH] Add unary minus operator to vector Signed-off-by: Andreas Rauschert <andreas.rb.rauschert@bmw.de> --- MantleAPI/include/MantleAPI/Common/vector.h | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/MantleAPI/include/MantleAPI/Common/vector.h b/MantleAPI/include/MantleAPI/Common/vector.h index 73df1bf6..e8e5e4b7 100644 --- a/MantleAPI/include/MantleAPI/Common/vector.h +++ b/MantleAPI/include/MantleAPI/Common/vector.h @@ -29,6 +29,11 @@ struct Vec3 T z{0}; inline T Length() const { return units::math::sqrt((x * x) + (y * y) + (z * z)); } + + inline Vec3<T> operator-() const noexcept + { + return {-x, -y, -z}; + } }; template <typename T> -- GitLab